Skip to content

Commit

Permalink
Add instructions on how to use Arduino as mbed library
Browse files Browse the repository at this point in the history
  • Loading branch information
facchinm committed Jan 9, 2019
1 parent bf6e647 commit 4f0dc1b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions mbed-os-to-arduino
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,18 @@ xargs -n 1 < ./BUILD/$BOARDNAME/GCC_ARM/.include* | sed -e 's#./mbed-os#{build.c
arm-none-eabi-ar rcs BUILD/mbed-core-$BOARDNAME.a `xargs -n 1 < ./BUILD/$BOARDNAME/GCC_ARM/.link_options.txt | grep "\.o" | grep -v "main.o"`
cp BUILD/mbed-core-$BOARDNAME.a $ARDUINOCORE/libs/libmbed.a
cd mbed-os && find . | grep "\.h" | xargs -I % cp --parents % $ARDUINOCORE/../../cores/arduino/mbed
#cd BUILD && find . | grep "\.h" | xargs -I % cp % $ARDUINOCORE/../../cores/arduino/mbed
cp ./BUILD/$BOARDNAME/GCC_ARM/.link_script.ld $ARDUINOCORE/linker_script.ld
cp ./BUILD/$BOARDNAME/GCC_ARM/mbed_config.h $ARDUINOCORE/

# add #include "mbed_config.h" in "mbed.h"

# TODO: mbed_config? should be part of the variant?
openocd -f interface/stlink-v2.cfg -f target/stm32f4x_stlink.cfg -c "init" -c "reset init" -c "halt" -c "flash write_image erase ./BUILD/$BOARDNAME/GCC_ARM/mbed-os-program.elf" -c "verify_image ./BUILD/$BOARDNAME/GCC_ARM/mbed-os-program.elf" -c "reset run" -c shutdown

openocd -f interface/stlink-v2.cfg -f target/stm32f4x_stlink.cfg -c "init" -c "reset init" -c "halt" -c "flash write_image erase ./BUILD/$BOARDNAME/GCC_ARM/mbed-os-program.elf" -c "verify_image ./BUILD/$BOARDNAME/GCC_ARM/mbed-os-program.elf" -c "reset run" -c shutdown

##################

Using Arduino as an mbed library

echo -e "arduino/cores/arduino/main.cpp\n arduino/cores/arduino/mbed/\narduino/libraries/" > .mbedignore
#add ARDUINO_AS_MBED_LIBRARY=1 to macros section in mbed_app.json
echo "https://github.com/arduino/ArduinoCore-mbed#bf6e64771ebe20285b0364756dff856ebbc679dc" > arduino.lib

0 comments on commit 4f0dc1b

Please sign in to comment.