Skip to content

Commit f4b6b30

Browse files
committed
Update mbed-to-arduino script with nRF52 NO_SD target
1 parent 6812af6 commit f4b6b30

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

mbed-os-to-arduino

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash -ex
22

33
MBED_CORE_LOCATION=$1
4-
BOARDNAMES=(ENVIE_M4 MBED_CONNECT_ODIN NRF52840_DK)
4+
BOARDNAMES=(ENVIE_M4 MBED_CONNECT_ODIN NRF52840_DK NRF52840_DK)
55

66
#always work in /tmp
77
cd /tmp/
@@ -28,12 +28,20 @@ mbed toolchain GCC_ARM
2828
echo -e "#include \"mbed.h\"\nint main() {Thread thd;}" > main.cpp
2929
echo -e "{\n\"macros\": [\n\"MBED_HEAP_STATS_ENABLED=1\",\n\"MBED_STACK_STATS_ENABLED=1\",\n\"MBED_MEM_TRACING_ENABLED=1\"\n],\n\"target_overrides\": {\n \"*\": {\n\"platform.stdio-buffered-serial\": true,\n\"platform.stdio-baud-rate\": 115200,\n\"platform.default-serial-baud-rate\": 115200\n}\n}\n}\n" > mbed_app.json
3030

31+
if [ $BOARDNAME == NRF52840_DK ]; then
32+
if [ x$NO_SD_TARGET == x"" ]; then
33+
NO_SD_TARGET=true
34+
else
35+
echo -e "{\n\"macros\": [\n\"MBED_HEAP_STATS_ENABLED=1\",\n\"MBED_STACK_STATS_ENABLED=1\",\n\"MBED_MEM_TRACING_ENABLED=1\"\n],\n\"target_overrides\": {\n \"*\": {\n\"platform.stdio-buffered-serial\": true,\n\"platform.stdio-baud-rate\": 115200,\n\"platform.default-serial-baud-rate\": 115200,\n\"target.features_add\": [\"BLE\"],\"target.extra_labels_add\": [\"CORDIO\", \"CORDIO_LL\", \"SOFTDEVICE_NONE\", \"NORDIC_CORDIO\"],\"target.extra_labels_remove\": [\"SOFTDEVICE_COMMON\", \"SOFTDEVICE_S140_FULL\", \"NORDIC_SOFTDEVICE\"]}\n}\n}\n" > mbed_app.json
36+
ARDUINOCORE=$MBED_CORE_LOCATION/variants/NRF52840_DK_NOSD
37+
fi
38+
fi
39+
3140
mbed compile -v | grep "Macros:" > $BOARDNAME.macros.txt
3241
cat $BOARDNAME.macros.txt | cut -f2 -d":" > $ARDUINOCORE/defines.txt
3342
echo " -DMBED_NO_GLOBAL_USING_DIRECTIVE=1" >> $ARDUINOCORE/defines.txt
3443
xargs -n 1 < ./BUILD/$BOARDNAME/GCC_ARM/.include* | sed -e 's#-I./mbed-os#-iwithprefixbefore/mbed#g' | sed '/^-I./ d' | tac > $ARDUINOCORE/includes.txt
3544

36-
#TODO: remove -I{build.core.path}/mbed/drivers from includes.txt (name clashing with libraries)
3745
#TODO: remove -MDD from flags
3846

3947
./gron ./BUILD/$BOARDNAME/GCC_ARM/.profile-c | grep json.flags | cut -f2 -d"\"" > $ARDUINOCORE/cflags.txt
@@ -53,6 +61,7 @@ rm -rf $ARDUINOCORE/../../cores/arduino/mbed/*
5361
cd mbed-os && find . | grep "\.h" | xargs -I % cp --parents % $ARDUINOCORE/../../cores/arduino/mbed && cd ..
5462

5563
#TODO: add #include "mbed_config.h" in "mbed.h"
64+
#TODO: rename drivers/SPI.h in drivers/SPIMaster.h and modify include in mbed.h
5665

5766
exit 0
5867

0 commit comments

Comments
 (0)