( 日本語版はこちら )
This section summarizes how to set up an environment of mbed project with any version of the mbed-os library (can be developed with both mbed-cli and SW4STM32).
1. mbed-cli environment setup
Create an appropriate working directory and work in that directory.
mkdir sample cd sample
Start git with
git init and create sample programs of
main.cpp in the working directory.
mbed project configuration
mbed new creates
.mbed file. You can create only
.mbed file with
mbed new . --create-only
toolchain. In this case, NUCLEO_L476RG and GCC_ARM are specified here.
mbed target NUCLEO_L476RG mbed toolchain GCC_ARM
Import an arbitrary version of mbed-os with
mbed add. Here, we import mbed-os 5.13.1 as an example.
mbed add https://github.com/ARMmbed/mbed-os#mbed-os-5.13.1
profile.json as needed. If you want to create
profile.json, add the line
PROFILE=profile.json in the
At this time, the
.mbed file is as follows.
ROOT=. TARGET=NUCLEO_L476RG TOOLCHAIN=GCC_ARM PROFILE=profile.json
mbed compile and check that the compilation goes through.
2. SW4STM32 environment setup
Set up a project just before
mbed compile as described above.
Make the project ready for edditing with SW4STM32 by
mbed export -i sw4stm32.
mbed export -i sw4stm32
Configuration on SW4STM32
Open SW4STM32 and import the project for SW4STM32 that you created above. (In the above example, specify the
sample directory as the import destination.)
sample directory is not in the Workspace of SW4STM32, then select File -> Import -> General -> Existing Projects into Workspace. (Check "Copy projects into workspace" in the option box).
Build the imported project and make sure that it is successful.
However, if you find the following error, you should modify
asm volatile in line 190 of
~/SW4workspace/sample/mbed-os/platform/mbed_toolchain.h:190:37: error: expected ';' before 'volatile' #define MBED_COMPILER_BARRIER() asm volatile("" : : : "memory")
If you do not see Commit or Push to Upstream etc. when you right click the imported project, select Team and do the following.
Right click on the imported project and select Team -> Share project. Select Git and click Next and click Finish.