Skip to content

Commit

Permalink
Upload: Support Nuvoton targets (#334)
Browse files Browse the repository at this point in the history
* NUVOTON: Support upload methods

Support targets include:
- NUMAKER_PFM_NANO130
- NUMAKER_PFM_NUC472
- NUMAKER_PFM_M453
- NUMAKER_PFM_M487
- NUMAKER_IOT_M487
- NUMAKER_IOT_M467
- NUMAKER_IOT_M252
- NUMAKER_IOT_M263A
- NU_M2354

* NUVOTON: Add openocd upload method document

This adds document to enable openocd upload method for Nuvoton
NuMicro Cortex-M series.
  • Loading branch information
ccli8 authored Sep 9, 2024
1 parent 428b56e commit b352953
Show file tree
Hide file tree
Showing 13 changed files with 270 additions and 0 deletions.
15 changes: 15 additions & 0 deletions targets/TARGET_NUVOTON/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Nuvoton NuMicro Cortex-M series

## Nuvoton fork of OpenOCD

Nuvoton NuMicro Cortex-M support for openocd is forked
[here](https://github.com/OpenNuvoton/OpenOCD-Nuvoton),
but has not yet upstreamed.
To enable openocd upload method for the series,
install [NuEclipse IDE](https://github.com/OpenNuvoton/Nuvoton_Tools)
which will also install the necessary openocd.

> **ℹ️ Information**
>
> On Windows, openocd will usually install at:
`C:\Program Files (x86)\Nuvoton Tools\OpenOCD\bin\openocd.exe`.
28 changes: 28 additions & 0 deletions targets/upload_method_cfg/NUMAKER_IOT_M252.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Mbed OS upload method configuration file for target NUMAKER_IOT_M252.
# To change any of these parameters from their default values, set them in your build script between where you
# include app.cmake and where you add mbed os as a subdirectory.

# General config parameters
# -------------------------------------------------------------
set(UPLOAD_METHOD_DEFAULT MBED)

# Config options for MBED
# -------------------------------------------------------------
set(MBED_UPLOAD_ENABLED TRUE)
set(MBED_RESET_BAUDRATE 115200)

# Config options for PYOCD
# -------------------------------------------------------------
set(PYOCD_UPLOAD_ENABLED TRUE)
set(PYOCD_TARGET_NAME m252kg6ae)
set(PYOCD_CLOCK_SPEED 4000k)

# Config options for OPENOCD
# -------------------------------------------------------------
set(OPENOCD_UPLOAD_ENABLED TRUE)
set(OPENOCD_CHIP_CONFIG_COMMANDS
-f ${CMAKE_CURRENT_LIST_DIR}/openocd_cfgs/numicro_m23.cfg)

# Nuvoton NuMicro Cortex-M support for OpenOCD is forked, but has
# not yet upstreamed. Its version number is fixed to 0.10.022.
set(OPENOCD_VERSION_RANGE 0.10.022...0.10.22)
28 changes: 28 additions & 0 deletions targets/upload_method_cfg/NUMAKER_IOT_M263A.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Mbed OS upload method configuration file for target NUMAKER_IOT_M263A.
# To change any of these parameters from their default values, set them in your build script between where you
# include app.cmake and where you add mbed os as a subdirectory.

# General config parameters
# -------------------------------------------------------------
set(UPLOAD_METHOD_DEFAULT MBED)

# Config options for MBED
# -------------------------------------------------------------
set(MBED_UPLOAD_ENABLED TRUE)
set(MBED_RESET_BAUDRATE 115200)

# Config options for PYOCD
# -------------------------------------------------------------
set(PYOCD_UPLOAD_ENABLED TRUE)
set(PYOCD_TARGET_NAME m263kiaae)
set(PYOCD_CLOCK_SPEED 4000k)

# Config options for OPENOCD
# -------------------------------------------------------------
set(OPENOCD_UPLOAD_ENABLED TRUE)
set(OPENOCD_CHIP_CONFIG_COMMANDS
-f ${CMAKE_CURRENT_LIST_DIR}/openocd_cfgs/numicro_m23.cfg)

# Nuvoton NuMicro Cortex-M support for OpenOCD is forked, but has
# not yet upstreamed. Its version number is fixed to 0.10.022.
set(OPENOCD_VERSION_RANGE 0.10.022...0.10.22)
28 changes: 28 additions & 0 deletions targets/upload_method_cfg/NUMAKER_IOT_M467.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Mbed OS upload method configuration file for target NUMAKER_IOT_M467.
# To change any of these parameters from their default values, set them in your build script between where you
# include app.cmake and where you add mbed os as a subdirectory.

# General config parameters
# -------------------------------------------------------------
set(UPLOAD_METHOD_DEFAULT MBED)

# Config options for MBED
# -------------------------------------------------------------
set(MBED_UPLOAD_ENABLED TRUE)
set(MBED_RESET_BAUDRATE 115200)

# Config options for PYOCD
# -------------------------------------------------------------
set(PYOCD_UPLOAD_ENABLED TRUE)
set(PYOCD_TARGET_NAME m467hjhae)
set(PYOCD_CLOCK_SPEED 4000k)

# Config options for OPENOCD
# -------------------------------------------------------------
set(OPENOCD_UPLOAD_ENABLED TRUE)
set(OPENOCD_CHIP_CONFIG_COMMANDS
-f ${CMAKE_CURRENT_LIST_DIR}/openocd_cfgs/numicro_m4.cfg)

# Nuvoton NuMicro Cortex-M support for OpenOCD is forked, but has
# not yet upstreamed. Its version number is fixed to 0.10.022.
set(OPENOCD_VERSION_RANGE 0.10.022...0.10.22)
28 changes: 28 additions & 0 deletions targets/upload_method_cfg/NUMAKER_IOT_M487.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Mbed OS upload method configuration file for target NUMAKER_IOT_M487.
# To change any of these parameters from their default values, set them in your build script between where you
# include app.cmake and where you add mbed os as a subdirectory.

# General config parameters
# -------------------------------------------------------------
set(UPLOAD_METHOD_DEFAULT MBED)

# Config options for MBED
# -------------------------------------------------------------
set(MBED_UPLOAD_ENABLED TRUE)
set(MBED_RESET_BAUDRATE 115200)

# Config options for PYOCD
# -------------------------------------------------------------
set(PYOCD_UPLOAD_ENABLED TRUE)
set(PYOCD_TARGET_NAME m487jidae)
set(PYOCD_CLOCK_SPEED 4000k)

# Config options for OPENOCD
# -------------------------------------------------------------
set(OPENOCD_UPLOAD_ENABLED TRUE)
set(OPENOCD_CHIP_CONFIG_COMMANDS
-f ${CMAKE_CURRENT_LIST_DIR}/openocd_cfgs/numicro_m4.cfg)

# Nuvoton NuMicro Cortex-M support for OpenOCD is forked, but has
# not yet upstreamed. Its version number is fixed to 0.10.022.
set(OPENOCD_VERSION_RANGE 0.10.022...0.10.22)
22 changes: 22 additions & 0 deletions targets/upload_method_cfg/NUMAKER_PFM_M453.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Mbed OS upload method configuration file for target NUMAKER_PFM_M453.
# To change any of these parameters from their default values, set them in your build script between where you
# include app.cmake and where you add mbed os as a subdirectory.

# General config parameters
# -------------------------------------------------------------
set(UPLOAD_METHOD_DEFAULT MBED)

# Config options for MBED
# -------------------------------------------------------------
set(MBED_UPLOAD_ENABLED TRUE)
set(MBED_RESET_BAUDRATE 115200)

# Config options for OPENOCD
# -------------------------------------------------------------
set(OPENOCD_UPLOAD_ENABLED TRUE)
set(OPENOCD_CHIP_CONFIG_COMMANDS
-f ${CMAKE_CURRENT_LIST_DIR}/openocd_cfgs/numicro_m4.cfg)

# Nuvoton NuMicro Cortex-M support for OpenOCD is forked, but has
# not yet upstreamed. Its version number is fixed to 0.10.022.
set(OPENOCD_VERSION_RANGE 0.10.022...0.10.22)
28 changes: 28 additions & 0 deletions targets/upload_method_cfg/NUMAKER_PFM_M487.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Mbed OS upload method configuration file for target NUMAKER_PFM_M487.
# To change any of these parameters from their default values, set them in your build script between where you
# include app.cmake and where you add mbed os as a subdirectory.

# General config parameters
# -------------------------------------------------------------
set(UPLOAD_METHOD_DEFAULT MBED)

# Config options for MBED
# -------------------------------------------------------------
set(MBED_UPLOAD_ENABLED TRUE)
set(MBED_RESET_BAUDRATE 115200)

# Config options for PYOCD
# -------------------------------------------------------------
set(PYOCD_UPLOAD_ENABLED TRUE)
set(PYOCD_TARGET_NAME m487jidae)
set(PYOCD_CLOCK_SPEED 4000k)

# Config options for OPENOCD
# -------------------------------------------------------------
set(OPENOCD_UPLOAD_ENABLED TRUE)
set(OPENOCD_CHIP_CONFIG_COMMANDS
-f ${CMAKE_CURRENT_LIST_DIR}/openocd_cfgs/numicro_m4.cfg)

# Nuvoton NuMicro Cortex-M support for OpenOCD is forked, but has
# not yet upstreamed. Its version number is fixed to 0.10.022.
set(OPENOCD_VERSION_RANGE 0.10.022...0.10.22)
22 changes: 22 additions & 0 deletions targets/upload_method_cfg/NUMAKER_PFM_NANO130.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Mbed OS upload method configuration file for target NUMAKER_PFM_NANO130.
# To change any of these parameters from their default values, set them in your build script between where you
# include app.cmake and where you add mbed os as a subdirectory.

# General config parameters
# -------------------------------------------------------------
set(UPLOAD_METHOD_DEFAULT MBED)

# Config options for MBED
# -------------------------------------------------------------
set(MBED_UPLOAD_ENABLED TRUE)
set(MBED_RESET_BAUDRATE 115200)

# Config options for OPENOCD
# -------------------------------------------------------------
set(OPENOCD_UPLOAD_ENABLED TRUE)
set(OPENOCD_CHIP_CONFIG_COMMANDS
-f ${CMAKE_CURRENT_LIST_DIR}/openocd_cfgs/numicro_m0.cfg)

# Nuvoton NuMicro Cortex-M support for OpenOCD is forked, but has
# not yet upstreamed. Its version number is fixed to 0.10.022.
set(OPENOCD_VERSION_RANGE 0.10.022...0.10.22)
22 changes: 22 additions & 0 deletions targets/upload_method_cfg/NUMAKER_PFM_NUC472.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Mbed OS upload method configuration file for target NUMAKER_PFM_NUC472.
# To change any of these parameters from their default values, set them in your build script between where you
# include app.cmake and where you add mbed os as a subdirectory.

# General config parameters
# -------------------------------------------------------------
set(UPLOAD_METHOD_DEFAULT MBED)

# Config options for MBED
# -------------------------------------------------------------
set(MBED_UPLOAD_ENABLED TRUE)
set(MBED_RESET_BAUDRATE 115200)

# Config options for OPENOCD
# -------------------------------------------------------------
set(OPENOCD_UPLOAD_ENABLED TRUE)
set(OPENOCD_CHIP_CONFIG_COMMANDS
-f ${CMAKE_CURRENT_LIST_DIR}/openocd_cfgs/numicro_m4.cfg)

# Nuvoton NuMicro Cortex-M support for OpenOCD is forked, but has
# not yet upstreamed. Its version number is fixed to 0.10.022.
set(OPENOCD_VERSION_RANGE 0.10.022...0.10.22)
28 changes: 28 additions & 0 deletions targets/upload_method_cfg/NU_M2354.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Mbed OS upload method configuration file for target NU_M2354.
# To change any of these parameters from their default values, set them in your build script between where you
# include app.cmake and where you add mbed os as a subdirectory.

# General config parameters
# -------------------------------------------------------------
set(UPLOAD_METHOD_DEFAULT MBED)

# Config options for MBED
# -------------------------------------------------------------
set(MBED_UPLOAD_ENABLED TRUE)
set(MBED_RESET_BAUDRATE 115200)

# Config options for PYOCD
# -------------------------------------------------------------
set(PYOCD_UPLOAD_ENABLED TRUE)
set(PYOCD_TARGET_NAME m2354kjfae)
set(PYOCD_CLOCK_SPEED 4000k)

# Config options for OPENOCD
# -------------------------------------------------------------
set(OPENOCD_UPLOAD_ENABLED TRUE)
set(OPENOCD_CHIP_CONFIG_COMMANDS
-f ${CMAKE_CURRENT_LIST_DIR}/openocd_cfgs/numicro_m23.cfg)

# Nuvoton NuMicro Cortex-M support for OpenOCD is forked, but has
# not yet upstreamed. Its version number is fixed to 0.10.022.
set(OPENOCD_VERSION_RANGE 0.10.022...0.10.22)
4 changes: 4 additions & 0 deletions targets/upload_method_cfg/openocd_cfgs/numicro_m0.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# OpenOCD config file for Nuvoton NuMicro M0 series

source [find interface/nulink.cfg]
source [find target/numicroM0.cfg]
13 changes: 13 additions & 0 deletions targets/upload_method_cfg/openocd_cfgs/numicro_m23.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# OpenOCD config file for Nuvoton NuMicro M4 series

# Meet the following warning and flash programming gets to take too long
# to finish. Fix it by enlarging work area size. This fix will also get into
# numicroM23.cfg in upcoming NuEclipse OpenOCD release.
#
# Warn : not enough working area available(requested 4096)
# Warn : No large enough working area available, can't do block memory writes
# Warn : couldn't use block writes, falling back to single memory accesses
set WORKAREASIZE 0x8000

source [find interface/nulink.cfg]
source [find target/numicroM23.cfg]
4 changes: 4 additions & 0 deletions targets/upload_method_cfg/openocd_cfgs/numicro_m4.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# OpenOCD config file for Nuvoton NuMicro M4 series

source [find interface/nulink.cfg]
source [find target/numicroM4.cfg]

0 comments on commit b352953

Please sign in to comment.