+ 5

How can I compile a C++ program that uses Mbed OS?

I've started learning Mbed on the online compiler. Since I don't have that much internet access, I downloaded the GitHub repository for offline use. I have built the library using: $ python tools/build.py -m K64F -t GCC_ARM It created a directory called BUILD/mbed which has a structure like: drivers hal mbed.h platform TARGET_K64F/TOOLCHAIN_GCC_ARM drivers, hal, platform and TARGET_K64F had header files. TOOLCHAIN_GCC_ARM had header and object files and the library. I tried compiling the program as: $(CXX -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fmessage-length=0 -W -Wall -Os -mcpu=cortex-m4 -DCPU_MK64FN1M0VLL12 -c -o blinky.o blinky.cpp -I{includes to mbed dirs} I linked it like arm-none-eabi-gcc -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fmessage-length=0 -W -Wall -Os -T <script> -o blink.elf *.o <TOOLCHAIN_GCC_ARM> -lmbed -lstdc++ -lc -lg -lm -lgcc I keep getting errors of undefined vars. What should I do?

9th Feb 2019, 11:01 AM
Edwin Pratt
Edwin Pratt - avatar
3 odpowiedzi
+ 1
I use Mbed completely offline, but with MCUXpresso... on Linux and Windows: 1. Export one project from online IDE and... 2. ...import it into MCUXpresso 3. Copy & paste the imported project 4. Delete the .bin and .map from DEBUG folder Then you can code and build offfline. In the DEBUG folder you will find the .bin file And if you want to debug (with breakpoints, etc.) you can download and install into MCUXpresso the FRDM-K64 SDK...
10th Feb 2019, 5:01 PM
unChabon
unChabon - avatar
+ 4
Hi diego Code Most of the time, I don't have an online connection. I've cloned Mbed from GitHub and used the tools/build.py to generate object files and libmbed. Currently, I'm struggling to link the files together because I keep getting "undefined variable" errors. For example, Reset_Handler is undefined. It is included in the startup file and if I include that, I get more undefined errors... I've also tried linking all of the object files due to frustration, and still I get undefined errors.
10th Feb 2019, 6:13 AM
Edwin Pratt
Edwin Pratt - avatar
+ 2
Hi! Dou you need to use command line? You can export the online project to a number of formats. With keil and mcuxpresso frdm-k64 works good.
10th Feb 2019, 4:10 AM
unChabon
unChabon - avatar