Skip to content

Commit 37ace18

Browse files
Some fixes for NUMAKER_PFM_M487 (#457)
* Fix some warnings, add COMPONENT_SPIF, add upload method instructions * Improve comments a bit * Add note about example
1 parent d53849f commit 37ace18

File tree

7 files changed

+56
-15
lines changed

7 files changed

+56
-15
lines changed

connectivity/drivers/emac/sources/CompositeEMAC.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ namespace mbed {
8282
return;
8383
}
8484

85+
#if MBED_TRACE_MAX_LEVEL >= TRACE_LEVEL_INFO
8586
char const * speedStr;
8687
if(speed == LinkSpeed::LINK_10MBIT) {
8788
speedStr = "10Mbps";
@@ -94,6 +95,7 @@ namespace mbed {
9495
}
9596

9697
tr_info("Link up at %s %s duplex", speedStr, duplex == Duplex::FULL ? "full" : "half");
98+
#endif
9799

98100
linkState = LinkState::UP;
99101
if(mac.enable(speed, duplex) != ErrCode::SUCCESS) {

storage/blockdevice/COMPONENT_SPIF/mbed_lib.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@
7070
},
7171
"ARDUINO_NICLA_SENSE_ME": {
7272
"SPI_CS": "CS_FLASH"
73-
}
73+
},
74+
"NUMAKER_PFM_M487": {
75+
"SPI_MOSI": "PC_0",
76+
"SPI_MISO": "PC_1",
77+
"SPI_CLK": "PC_2",
78+
"SPI_CS": "PC_3"
79+
}
7480
}
7581
}

storage/blockdevice/tests/TESTS/blockdevice/general_block_device/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ void test_contiguous_erase_write_read()
738738
}
739739
}
740740

741-
free(write_read_buf);
741+
delete[] write_read_buf;
742742
}
743743

744744
void test_program_read_small_data_sizes()
@@ -867,7 +867,7 @@ void test_write_deinit_init()
867867

868868
for (int i = 0; i < 3; i++) {
869869
// Generate test pattern
870-
for (int j = 0; j < prog_size; j++) {
870+
for (bd_size_t j = 0; j < prog_size; j++) {
871871
prog[j] = (uint8_t)'0' + i + j;
872872
}
873873

targets/TARGET_NUVOTON/nu_miscutil.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,31 @@ void nu_nop(uint32_t n)
4040
switch (rmn) {
4141
case 9:
4242
__NOP();
43+
// fall through
4344
case 8:
4445
__NOP();
46+
// fall through
4547
case 7:
4648
__NOP();
49+
// fall through
4750
case 6:
4851
__NOP();
52+
// fall through
4953
case 5:
5054
__NOP();
55+
// fall through
5156
case 4:
5257
__NOP();
58+
// fall through
5359
case 3:
5460
__NOP();
61+
// fall through
5562
case 2:
5663
__NOP();
64+
// fall through
5765
case 1:
5866
__NOP();
67+
// fall through
5968
default:
6069
break;
6170
}

targets/targets.json5

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8230,6 +8230,12 @@ mode is recommended for target MCUs with small amounts of flash and RAM.",
82308230
"detect_code": [
82318231
"1304"
82328232
],
8233+
"components_add": [
8234+
"SPIF" // 4MiB SPI flash.
8235+
8236+
// Note that this board also has a MicroSD slot, but it is not hooked up to the right pins for SPI
8237+
// operation, so Mbed currently cannot use it.
8238+
],
82338239
"overrides": {
82348240
"hxt-present": false,
82358241
"lxt-present": true,

targets/upload_method_cfg/NUMAKER_IOT_M487.cmake

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22
# To change any of these parameters from their default values, set them in your build script between where you
33
# include app.cmake and where you add mbed os as a subdirectory.
44

5+
# Notes:
6+
# 1. The Nuvoton fork of OpenOCD is required: https://github.com/OpenNuvoton/OpenOCD-Nuvoton/releases .
7+
# Point CMake to it via setting the OpenOCD option:
8+
# -DOpenOCD="C:/Program Files (x86)/OpenOCD-nuvoton/bin/openocd.exe"
9+
# 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
10+
# mass storage mode and can only work with the "MBED" upload method. If set to OFF, the Nu-Link will run in
11+
# Nu-Link mode and only works with Nuvoton OpenOCD.
12+
# 3. On Windows you will need to install the Nu-Link Keil USB driver, which can be found near the bottom here:
13+
# https://www.nuvoton.com/tool-and-software/ide-and-compiler/
14+
# 4. The onboard nu-link does not have a unique USB serial number configured, so the MBED_UPLOAD_SERIAL_NUMBER
15+
# option will not work (and it doesn't seem to work with OpenOCD 0.10.x anyway). This means, sadly, it's impossible
16+
# to work with more than one Nuvoton board at a time on a given machine.
17+
518
# General config parameters
619
# -------------------------------------------------------------
720
set(UPLOAD_METHOD_DEFAULT MBED)
@@ -11,12 +24,6 @@ set(UPLOAD_METHOD_DEFAULT MBED)
1124
set(MBED_UPLOAD_ENABLED TRUE)
1225
set(MBED_RESET_BAUDRATE 115200)
1326

14-
# Config options for PYOCD
15-
# -------------------------------------------------------------
16-
set(PYOCD_UPLOAD_ENABLED TRUE)
17-
set(PYOCD_TARGET_NAME m487jidae)
18-
set(PYOCD_CLOCK_SPEED 4000k)
19-
2027
# Config options for OPENOCD
2128
# -------------------------------------------------------------
2229
set(OPENOCD_UPLOAD_ENABLED TRUE)

targets/upload_method_cfg/NUMAKER_PFM_M487.cmake

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,23 @@
22
# To change any of these parameters from their default values, set them in your build script between where you
33
# include app.cmake and where you add mbed os as a subdirectory.
44

5+
# Notes:
6+
# 1. The Nuvoton fork of OpenOCD is required: https://github.com/OpenNuvoton/OpenOCD-Nuvoton/releases .
7+
# Point CMake to it via setting the OpenOCD option. For example:
8+
# -DOpenOCD="C:/Program Files (x86)/OpenOCD-nuvoton/bin/openocd.exe"
9+
# 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
10+
# mass storage mode and can only work with the "MBED" upload method. If set to OFF, the Nu-Link will run in
11+
# Nu-Link mode and only works with Nuvoton OpenOCD.
12+
# 3. On Windows you will need to install the Nu-Link Keil USB driver, which can be found near the bottom here:
13+
# https://www.nuvoton.com/tool-and-software/ide-and-compiler/
14+
# 4. The onboard nu-link does not have a unique USB serial number configured, so the MBED_UPLOAD_SERIAL_NUMBER
15+
# option will not work (and it doesn't seem to work with OpenOCD 0.10.x anyway). This means, sadly, it's impossible
16+
# to work with more than one Nuvoton board at a time on a given machine.
17+
# 5. To upgrade the Nu-Link firmware, the official instructions didn't work for me at first -- I had to use
18+
# the ICP Programming Tool to get to a newer version. Then I could use the method of holding down the
19+
# DAP button to get into bootloader mod, and flash the binary from here:
20+
# https://github.com/OpenNuvoton/Nuvoton_Tools/blob/master/Latest_NuLink_Firmware/NuLink1FW.bin
21+
522
# General config parameters
623
# -------------------------------------------------------------
724
set(UPLOAD_METHOD_DEFAULT MBED)
@@ -11,12 +28,6 @@ set(UPLOAD_METHOD_DEFAULT MBED)
1128
set(MBED_UPLOAD_ENABLED TRUE)
1229
set(MBED_RESET_BAUDRATE 115200)
1330

14-
# Config options for PYOCD
15-
# -------------------------------------------------------------
16-
set(PYOCD_UPLOAD_ENABLED TRUE)
17-
set(PYOCD_TARGET_NAME m487jidae)
18-
set(PYOCD_CLOCK_SPEED 4000k)
19-
2031
# Config options for OPENOCD
2132
# -------------------------------------------------------------
2233
set(OPENOCD_UPLOAD_ENABLED TRUE)

0 commit comments

Comments
 (0)