-
Notifications
You must be signed in to change notification settings - Fork 0
[T TOOL 0] Environment installation for cross compilation
A cross compiler is a compiler capable of creating executable code for a platform other than the one on which the compiler is running. The main reason we need a cross compiler is that it is necessary to compile the code on our PC first because direct compilation on the target platform might be infeasible, for example on a microcontroller of an embedded system(the STM32 in our case).
sudo apt-get update
sudo apt install git
- You need to install mbed-cli try
pip install mbed-cli
(you may need to addsudo -H
before) Check if it worked by typingmbed -h
if not then you need to install it manually by cloninggit clone https://github.com/ARMmbed/mbed-cli
and then you need to go inside the mbed-cli folder that you just cloned and run the script by typingpython setup.py install
you may will need to first install python - Create an new program for mbed OS5
mbed new folder_name
this will create your working folder(it may take a few minutes)more info here - Download the GCC_ARM embedded toolchain download here unzip it
- Go into the working folder that you created and the link the GCC_ARM embedded toolchain
mbed config -G GCC_ARM_PATH "<your path to the bin folder of GCC_ARM>"
- To compile your cpp code you use
mbed compile -m auto -t GCC_ARM
more info here the board has to be connected to your computer
Now, to check if it is correctly installed : plug in your STM32 and type mbed detect
on a terminal and try to compile a simple code.
You can find a file named flash.sh and it is simply a bash script file that is compiling the source code with this line of code:mbed compile -m auto -t GCC_ARM
. Here, the target is in auto and the toolchain is GCC_ARM. You can find more informations about the commands and options with mbed --help
.
Then the .bin file is flashed in the STM32.
- Home
- [History]
- [Tutorials]
- [TOOL]
- [MECA]
- [CODE]
- [ELEC]
- [MAKE]
- 3D Modeling
- Laser cutting
- 3D Printing
- CNC Extrusion
- [Tools 101]
- [Articles]
- [Type of motors]
- [Type of sensors]
- [Choice of microcontroller]
- [Eurobot 2019 Strategy]
- [Ressources]
- [Cloud]
- [Other Repositories]
- [Youtube Channels]
- [Miscellaneous]