diff --git a/connectivity/drivers/emac/sources/CompositeEMAC.cpp b/connectivity/drivers/emac/sources/CompositeEMAC.cpp index ac723d04660..776e662bab1 100644 --- a/connectivity/drivers/emac/sources/CompositeEMAC.cpp +++ b/connectivity/drivers/emac/sources/CompositeEMAC.cpp @@ -82,6 +82,7 @@ namespace mbed { return; } +#if MBED_TRACE_MAX_LEVEL >= TRACE_LEVEL_INFO char const * speedStr; if(speed == LinkSpeed::LINK_10MBIT) { speedStr = "10Mbps"; @@ -94,6 +95,7 @@ namespace mbed { } tr_info("Link up at %s %s duplex", speedStr, duplex == Duplex::FULL ? "full" : "half"); +#endif linkState = LinkState::UP; if(mac.enable(speed, duplex) != ErrCode::SUCCESS) { diff --git a/storage/blockdevice/COMPONENT_SPIF/mbed_lib.json b/storage/blockdevice/COMPONENT_SPIF/mbed_lib.json index a5093d85a1c..cf37017b7df 100644 --- a/storage/blockdevice/COMPONENT_SPIF/mbed_lib.json +++ b/storage/blockdevice/COMPONENT_SPIF/mbed_lib.json @@ -70,6 +70,12 @@ }, "ARDUINO_NICLA_SENSE_ME": { "SPI_CS": "CS_FLASH" - } + }, + "NUMAKER_PFM_M487": { + "SPI_MOSI": "PC_0", + "SPI_MISO": "PC_1", + "SPI_CLK": "PC_2", + "SPI_CS": "PC_3" + } } } diff --git a/storage/blockdevice/tests/TESTS/blockdevice/general_block_device/main.cpp b/storage/blockdevice/tests/TESTS/blockdevice/general_block_device/main.cpp index abcfba9a31c..c68d6836b9a 100644 --- a/storage/blockdevice/tests/TESTS/blockdevice/general_block_device/main.cpp +++ b/storage/blockdevice/tests/TESTS/blockdevice/general_block_device/main.cpp @@ -738,7 +738,7 @@ void test_contiguous_erase_write_read() } } - free(write_read_buf); + delete[] write_read_buf; } void test_program_read_small_data_sizes() @@ -867,7 +867,7 @@ void test_write_deinit_init() for (int i = 0; i < 3; i++) { // Generate test pattern - for (int j = 0; j < prog_size; j++) { + for (bd_size_t j = 0; j < prog_size; j++) { prog[j] = (uint8_t)'0' + i + j; } diff --git a/targets/TARGET_NUVOTON/nu_miscutil.c b/targets/TARGET_NUVOTON/nu_miscutil.c index 2ea9b0ca4df..7ec43a07973 100644 --- a/targets/TARGET_NUVOTON/nu_miscutil.c +++ b/targets/TARGET_NUVOTON/nu_miscutil.c @@ -40,22 +40,31 @@ void nu_nop(uint32_t n) switch (rmn) { case 9: __NOP(); + // fall through case 8: __NOP(); + // fall through case 7: __NOP(); + // fall through case 6: __NOP(); + // fall through case 5: __NOP(); + // fall through case 4: __NOP(); + // fall through case 3: __NOP(); + // fall through case 2: __NOP(); + // fall through case 1: __NOP(); + // fall through default: break; } diff --git a/targets/targets.json5 b/targets/targets.json5 index fd6997f3979..453c1ce7650 100644 --- a/targets/targets.json5 +++ b/targets/targets.json5 @@ -8230,6 +8230,12 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "detect_code": [ "1304" ], + "components_add": [ + "SPIF" // 4MiB SPI flash. + + // Note that this board also has a MicroSD slot, but it is not hooked up to the right pins for SPI + // operation, so Mbed currently cannot use it. + ], "overrides": { "hxt-present": false, "lxt-present": true, diff --git a/targets/upload_method_cfg/NUMAKER_IOT_M487.cmake b/targets/upload_method_cfg/NUMAKER_IOT_M487.cmake index e22ae6c968a..fa5bd7b185d 100644 --- a/targets/upload_method_cfg/NUMAKER_IOT_M487.cmake +++ b/targets/upload_method_cfg/NUMAKER_IOT_M487.cmake @@ -2,6 +2,19 @@ # 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. +# Notes: +# 1. The Nuvoton fork of OpenOCD is required: https://github.com/OpenNuvoton/OpenOCD-Nuvoton/releases . +# Point CMake to it via setting the OpenOCD option: +# -DOpenOCD="C:/Program Files (x86)/OpenOCD-nuvoton/bin/openocd.exe" +# 2. Take note of the "MSG" DIP switch on the Nu-Link section of the board. If set to ON, the Nu-Link will run in +# mass storage mode and can only work with the "MBED" upload method. If set to OFF, the Nu-Link will run in +# Nu-Link mode and only works with Nuvoton OpenOCD. +# 3. On Windows you will need to install the Nu-Link Keil USB driver, which can be found near the bottom here: +# https://www.nuvoton.com/tool-and-software/ide-and-compiler/ +# 4. The onboard nu-link does not have a unique USB serial number configured, so the MBED_UPLOAD_SERIAL_NUMBER +# option will not work (and it doesn't seem to work with OpenOCD 0.10.x anyway). This means, sadly, it's impossible +# to work with more than one Nuvoton board at a time on a given machine. + # General config parameters # ------------------------------------------------------------- set(UPLOAD_METHOD_DEFAULT MBED) @@ -11,12 +24,6 @@ set(UPLOAD_METHOD_DEFAULT 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) diff --git a/targets/upload_method_cfg/NUMAKER_PFM_M487.cmake b/targets/upload_method_cfg/NUMAKER_PFM_M487.cmake index c3ff2f11a8d..e1a0c242943 100644 --- a/targets/upload_method_cfg/NUMAKER_PFM_M487.cmake +++ b/targets/upload_method_cfg/NUMAKER_PFM_M487.cmake @@ -2,6 +2,23 @@ # 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. +# Notes: +# 1. The Nuvoton fork of OpenOCD is required: https://github.com/OpenNuvoton/OpenOCD-Nuvoton/releases . +# Point CMake to it via setting the OpenOCD option. For example: +# -DOpenOCD="C:/Program Files (x86)/OpenOCD-nuvoton/bin/openocd.exe" +# 2. Take note of the "MSG" DIP switch on the Nu-Link section of the board. If set to ON, the Nu-Link will run in +# mass storage mode and can only work with the "MBED" upload method. If set to OFF, the Nu-Link will run in +# Nu-Link mode and only works with Nuvoton OpenOCD. +# 3. On Windows you will need to install the Nu-Link Keil USB driver, which can be found near the bottom here: +# https://www.nuvoton.com/tool-and-software/ide-and-compiler/ +# 4. The onboard nu-link does not have a unique USB serial number configured, so the MBED_UPLOAD_SERIAL_NUMBER +# option will not work (and it doesn't seem to work with OpenOCD 0.10.x anyway). This means, sadly, it's impossible +# to work with more than one Nuvoton board at a time on a given machine. +# 5. To upgrade the Nu-Link firmware, the official instructions didn't work for me at first -- I had to use +# the ICP Programming Tool to get to a newer version. Then I could use the method of holding down the +# DAP button to get into bootloader mod, and flash the binary from here: +# https://github.com/OpenNuvoton/Nuvoton_Tools/blob/master/Latest_NuLink_Firmware/NuLink1FW.bin + # General config parameters # ------------------------------------------------------------- set(UPLOAD_METHOD_DEFAULT MBED) @@ -11,12 +28,6 @@ set(UPLOAD_METHOD_DEFAULT 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)