Building and debugging offline on Linux with QtCreator IDE

This page provides step by step instructions how to create, build and debug MBED applications offline using

Main features

  • Mbed CLI is used as the backend engine and QtCreator IDE is the GUI making life easier.
  • No makefiles shall be edited.
  • Enables to build Mbed OS 2 (aka Mbed Classic) or Mbed OS 6 (aka Mbed OS) applications.
  • Supports custom targets.
  • Works on Linux. (MS Windows is not supported anymore.)
  • A common repository is shared rather than having a separate instance of Mbed OS and user libraries for each project.

How does it work

A bash script is run to parse and execute commands typed into the QtCreator's Make arguments edit box (located in the Build Steps Details). The commands are stored along with the project file. The bash script is stored in the ~/.local/bin/mbed.bat file of your linux machine and you are free to adapt it to your needs.
In comparison to mbed-cli compile it accepts a few additional options :

  • The -os option can be used to build for Mbed OS 2. For example:

-m LPC1768 -os 2
  • Libraries can be added with the -l option. For example:

-m LPC1768 -l TextLCD -l DS1820

See below the User libraries section for more details.

  • The -r or --release option can be used to build with release profile.

-m NUCLEO_F446RE -r
  • The -D or --macro option can be used to define macros. For example:

-m NUCLEO_F103RB -macro MY_MACRO -l DS1820

Once the compilation is complete it can also flash the selected target MCU/board. At the present it is using pyOCD, OpenOCD and lpc21isp for flashing. You can use any programmer supported by these tools (e.g. a serial port, DAP link or ST-link programmer/debugger).

Usage

Once installed and configured, creating a new Mbed project becomes as easy as

  • Launch the QtCreator and then click on the + New Project button. /media/uploads/hudakz/qtcreator_newproject.png
  • Choose the Mbed project template.
    /media/uploads/hudakz/qtcreator_projtemplate.png
  • Give it a name (for example Blinky-os ) and select a repository to create in.
    /media/uploads/hudakz/qtcreator_projlocation.png
  • Select the mbed kit https://os.mbed.com/media/uploads/hudakz/qtcreator_select_kit.png
  • Finish the new project
  • The main.cpp will be opened for editing /media/uploads/hudakz/qtcreator_main02.png
  • In the left-hand toolbar select Projects and for Build & Run select mbed
  • In Build Steps open Details and type -m followed by a space and the name of your target board into the Make arguments edit box. For example:

-m LPC1768

https://os.mbed.com/media/uploads/hudakz/qtcreator_proj_build.png

  • If you don't want your program to be automatically downloaded to the connected board's flash then deselect the all checkbox.
  • If you want a clean compilation (delete existing object files) then select the clean checkbox.
  • To launch compilation, in the left-hand toolbar select Edit and click on the Build Project button (Hammer) or press Ctrl+B /media/uploads/hudakz/qtcreator_compile.png
    Happy coding :)

Installation

Install the following software to your PC

GNU Arm Embedded Toolchain

  • Version 9-2019-q4-major for Mbed OS 6
  • If you'd like to build Mbed OS 2 programs install also version 6-2017-q2-update (see below Juan Pedro's comments for more details).

Mbed CLI

pyOCD

OpenOCD

QtCreator IDE (usually part of a Linux distribution)

Mbed OS

  • In your home directory, create a new src/arm/sys folder and open it in terminal
  • Issue the following commands

~/src/arm/sys >

mbed import mbed-os
cd mbed-os
mbed update master
mbed config -G toochain GCC_ARM

Mbed support for QtCreator

  • Import the Mbed support for QtCreator project into the online compiler. Type QtCreator_Support into the Import Name edit box and save the project.
  • Right-click on the mbed.bat file and select Export File ...
  • Save the file to the ~/.local/bin folder. (NOTE: In Linux ~ is a shortcut (alias name) for your home directory.)

~/.local/bin/mbed.bat
  • To make the script (text file) executable open a terminal in the ~/.local/bin directory and execute:chmod +x mbed.bat

ubuntu:~/.local/bin$  chmod +x mbed.bat
  • Click on the mbed_wizard_linux_zip folder
  • Right-click on the mbed_wizard_linux.zip file and select Export File...
  • Save the file to the ~/.config/QtProject/qtcreator/templates/wizards folder and unzip. The result should be as below:

~/.config/QtProject
          └── qtcreator
		      └── templates
		          └── wizards
		              └── mbed
		                  ├── ARMmbedLogo.png
		                  ├── main.cpp
		                  ├── mbed_app.json
		                  ├── project.config
		                  ├── project.creator
		                  ├── project.files
		                  ├── project.includes
		                  └── wizard.json
  • Right-click on the custom_targets folder and select Export Folder ...
  • Save the file to the ~/src/arm/sys folder and unzip:

~/src/arm/sys
          ├── custom_targets
          └── mbed-os
  • In your home directory create a new ~/src/arm/app folder:

~/src/arm
      ├── app
      └── sys
  • In your home directory create a new ~/src/arm/lib folder and copy & paste (collect) the folders with your library sources there:

~/src/arm
      ├── app
      ├── lib
      └── sys

Optional: For building Mbed OS 2 programs

~/src/arm/sys
          ├── custom_targets
          ├── mbed
          └── mbed-os
  • Copy & paste the tools folder from the mbed-os to the mbed folder.

Configuration

When the installation is complete launch the Qt Creator and in the Help menu select About Plugins ...
Make sure that the BareMetal (experimental) plugin is checked.
/media/uploads/hudakz/qtcreator_plugins.png


  • Close the dialog box and restart the QtCreator.
  • In Tools menu select Options ...
  • Proceed to Build & Run and add new mbedCustom C and mbed Custom C++ compilers. Provide the actual paths according to your system.
    https://os.mbed.com/media/uploads/hudakz/qtcreator_compiler_c.png https://os.mbed.com/media/uploads/hudakz/qtcreator_compiler_cpp.png


For the new mbed Custom C and Custom C++ compilers change the Custom Parser Settings ...:

  • Copy & paste the following text into the Error message capture pattern edit box:

^.*[Ee][Rr][Rr][Oo][Rr][^.c][ \]]*([^@:,]*)[@:,]([0-9]*)(.*)

/media/uploads/hudakz/qtcreator_compilers_error_parsing.png

  • Copy & paste the following text into the Warning message capture pattern edit box:

^.*[Ww][Aa][Rr][Nn][Ii][Nn][Gg][ \]]*([^@:,]*)[@:,]([0-9]*)(.*)

/media/uploads/hudakz/qtcreator_compilers_warning_parsing.png


This will assure capturing error and warning messages during compilation and quick navigation to the related line. /media/uploads/hudakz/qtcreator_compile_issues.png


  • Add a new arm-gdb debugger. Make sure you select the arm-none-eabi-gdb-py (arm-none-eabi-gdb won't work)
    /media/uploads/hudakz/qtcreator_debugger.png


  • Proceed to the Devices and click on the Add ... button.
    /media/uploads/hudakz/qtcreator_devices.png


  • Select the Bare Metal Device and click on the Start Wizard button.
    /media/uploads/hudakz/qtcreator_devices_new_baremetal.png


  • In Devices proceed to the Bare Metal tab. Click on the Add button and select OpenOCD.
    /media/uploads/hudakz/qtcreator_devices_baremetal.png


  • Go back to the Devices tab and select OpenOCD as the GDB server provider.
    /media/uploads/hudakz/qtcreator_devices.png


  • Select Build & Run and proceed to the Kits tab. Click on the Add button and add the following new kit.
    https://os.mbed.com/media/uploads/hudakz/qtcreator_mbed_kit.png


User libraries

User libraries can be shared among all the projects. Such approach requres less disk space and makes sure all programs use the same version of a library. If you keep your libraries in the recommended repository ( ~/src/arm/lib) then just add the directory name of your library (the relative path inside the library repository) into the Make arguments edit box prepended with -l . For example if you have a TextLCD and DS1820 library stored in the ~/src/arm/lib repository as below:

~/src/arm/lib
          └── Display
		      └── TextLCD
          └── TempSensor
		      └── DS1820

Then you can add them to your project as:

-m LPC1768 -l Display/TextLCD -l TempSensor/DS1820  

Another option is to copy & paste a folder containing library files to the project folder using your favorite file manager utility. However, in this case the library is not shared with other projects. Any modification to the library will affect only the given project.
Notice that when you then open the project in QtCreator you won't see the library folder yet. /media/uploads/hudakz/qtcreator_lib_copy.png

You have to launch the compilation to get the folder added to the Projects pane.


/media/uploads/hudakz/qtcreator_lib_copy_build.png

As an alternative you can import a library into your local project from its URL repository

  • In the Projects pane right-click on the main.cpp file and select Open terminal here (on Linux) or Open command prompt here (on Windows)
  • Use the mbed add command followed by the library's URL repository to import the library. For example: /media/uploads/hudakz/qtcreator_lib_add.png
  • Close the terminal (command prompt) window and return to the QtCreator.
  • Launch compilation and the new library will appear in the Projects pane.
Creating a new library
  • Launch the Qt Creator and open your project (or create a new one).
  • In the Projects pane right click on your project name and select Add new ....
  • Choose the C++ template and C++ Class then click on the Choose... button.
  • In the Class Name edit box provide a name for your new class (for example MyLcdDriver).
  • Click on the Browse button and create a new folder (e.g. MyLcdDriver) in your Project folder and then click on the Next button. /media/uploads/hudakz/qtcreator_lib_class.png


  • Choose <None> for Add to version control and click on the Finish button. /media/uploads/hudakz/qtcreator_lib_versionctrl.png


  • Edit your library files as needed and then compile the project. /media/uploads/hudakz/qtcreator_lib_edit.png
  • Once you are happy with it move the library folder to your library repository so you can easily share it with other projects.

Importing projects from online repository

One way is to export the program from the online compiler for the QtCreator toolchain
  • Right-click on the project in the online compiler and export for the QtCreator toolchain.
  • Once saved to the local drive, unzip the file and open the project's folder in a file manager.
  • Delete all files and folders (mbed and mbed-os included) except user library folders, the .creator project file, source and header files (like main.cpp) and .json files.
  • Open the .creator project file in QtCreator.
  • Select the target system and board and compile.
Another method is to use Mbed CLI for import
  • Open a terminal (on Linux) or command prompt (on Windows) in your mbed projects repository.
  • Use the mbed import command followed by the programs's URL repository to import the program.
    For example:

mbed import https://github.com/ARMmbed/mbed-os-example-blinky
  • When finished, open the folder and delete all files and folders (mbed and mbed-os included) except user library folders, source and header files (like main.cpp) and .json files.
  • In the project's folder create an empty PROJECT_NAME.creator file (substitute PROJECT_NAME with your project name).
  • Open the .creator project file in QtCreator.
  • Select the target system and board and compile.

Custom targets

It is possible to build projects also for custom targets. Read Adding and configuring targets and have a look at the provided custom targets. I'm sure you'll be able to extend them by your favorite ones.

Once a custom target is added you compile for it by simply using its name. For example, to build for the BLUEPILL target type

-m BLUEPILL

into the Make arguments edit box in the Build Steps Details.

Debugging

Setting up debug tools
  • In the Menu select Tools > Options ... > Debugger and proceed to the GDB tab.
  • Copy & Paste the following text into the Additional Attach Commands edit pane:

monitor reset halt
load
monitor reset halt

/media/uploads/hudakz/qtcreator_debugger_gdb_general.png

  • Click on the OK button to save the changes.

  • In the Tools menu select External > Configure ...
    /media/uploads/hudakz/debug02.png

  • Click on the Add button and select Add Category.
    /media/uploads/hudakz/debug03.png

  • Name it MBED.
  • Select MBED, click on the Add button and select Add Tool.
  • Change its name to pyOCD and provide Description, Executable, Arguments and Working directory according to the path selected when you installed pyOCD to your system.
    /media/uploads/hudakz/debug04.png

  • In ~/.local/bin create a new text file for each group of boards you'd like to debug. For example PyOCD, NUCLEO-F103, NUCLEO-F4XX, NUCLEO-F7XX
  • Type or paste the following text into the PyOCD file:

#!/bin/bash
~/.local/bin/pyocd-gdbserver
  • Type or paste the following text into the NUCLEO-F103 file:

!/bin/bash
openocd -s /usr/local/share/openocd/scripts -f /usr/local/share/openocd/scripts/board/st_nucleo_f103rb.cfg
  • Type or paste the following text into the NUCLEO-F4XX.bat file:

#/bin/bash
openocd -s /usr/local/share/openocd/scripts -f /usr/local/share/openocd/scripts/board/st_nucleo_f4.cfg
  • Type or paste the following text into the NUCLEO-F7XX.bat file:

#!/bin/bash
openocd -s /usr/local/share/openocd/scripts -f /usr/local/share/openocd/scripts/board/st_nucleo_f7.cfg
  • NOTE: Modify the path to the OpenOCD folder in the scripts above according to the actual path on your system.
  • Finally save and close all files and make them executable with the following commnad:

chmod +x file_name


Enter gnome-terminal as Executable and the path to the associated batch file prepended with -- as Arguments.
For example:

-- ~/.local/bin/OpenOCD_F103
Debugging on boards equipped with CMSIS-DAP interface

We'll use pyOCD GDB server to debug on boards equqipped with CMSIS-DAP interface (e.g. mbed LPC1768).

  • Launch the Qt Creator.
  • Open for example the Blinky-os project for the LPC1768 target (or create a new one) and open main.cpp for editing.
  • Connect your mbed LPC1768 board over a USB cable to the PC.
  • In the Tools menu select External > MBED > pyOCD.
    /media/uploads/hudakz/debug06.png

  • That will launch a pyOCD GDB server.
    /media/uploads/hudakz/debug07.png

  • Return to the Qt Creator and in the left-hand toolbar select Projects and for Build & Run select Mbed > Build.

For some unknown reason when local file system and semihosting is enabled debugging for LPC1768 boards fails. A workaround is to compile for a custom (dummy) LPC1768 target board with local file system and semihosting disabled. That's why a custom target LPC1768DBG is provided. Have a look at the ~/src/arm/sys/custom_targets/mbed-os/custom_targets.json configuration file.

  • Build the project for the dummy LPC1768DBG custom target board:
    • Type -m LPC1768DBG to the Make aguments edit box and click on the 'Hammer' button.
  • Setup a break point by clicking in front of a source line.
  • In Menu select Debug > Start Debugging > Attach to Running Debug Server.
  • For Local executable click on the Browse ... button and select the Blinky-os/BUILD/LPC1768DBG/GCC_ARM-DEBUG/Blinky-os.elf file. /media/uploads/hudakz/qtcreator_debugger_startdebugger.png

Debugging on boards equipped with ST-Link or J-Link interface

We'll use OpenOCD GDB server to debug on boards equqipped with ST-Link or J-Link interface (e.g. STM NUCLEO boards).

  • Launch the Qt Creator.
  • Open for example the Blinky-os project for a target board e.g. NUCLEO-F446RE or create a new one and open main.cpp for editing and build the project
  • Connect your MBED board NUCLEO-F446RE over a USB cable to the PC.
  • In the Tools menu select External > MBED > OpenOCD NUCLEO-F4XX.
    /media/uploads/hudakz/debug17.png

  • That will launch an OpenOCD GDB server for the selected group of boards.
    /media/uploads/hudakz/debug18.png

  • Return to the Qt Creator and in the left-hand toolbar select Projects and for Build & Run select Mbed > Build
  • Build the project for the NUCLEO-F446RE target:
    • Type -m NUCLEO_FF446RE to the Make aguments edit box and click on the 'Hammer' button.
  • Setup a break point by clicking in front of a source line.
  • In the Menu select Debug > Start Debugging > Attach to Running Debug Server.
  • For Local executable click on the Browse ... button and select the Blinky-os/BUILD/NUCLEO_F446RE/GCC_ARM-DEBUG/Blinky-os.elf file. /media/uploads/hudakz/qtcreator_debugger_nucleo-f446_blinky-os.png


23 comments on Building and debugging offline on Linux with QtCreator IDE:

09 May 2018

Very detailed and amazing article! But I have a question. Is there a similar option to make a wizard for qt creator on mac os? Thanks.

09 May 2018

I found a solution. According to the documentation(http://doc.qt.io/qtcreator/creator-project-wizards.html) the paths in mac os are somewhat different (Qt Creator.app/Contents/Resources/templates / wizards). And also it's need to correct all references in all *.qbs files. After editing it all started. Thank you very much for your article!

07 Jun 2018

Innokentiy Zoobarkin wrote:

I found a solution. According to the documentation(http://doc.qt.io/qtcreator/creator-project-wizards.html) the paths in mac os are somewhat different (Qt Creator.app/Contents/Resources/templates / wizards). And also it's need to correct all references in all *.qbs files. After editing it all started. Thank you very much for your article!

Did you use it successfully for mac? Thank you

15 Nov 2018

Yes, it's works!

11 Dec 2018

Great write-up! This helped me a lot after struggling with MCUXpresso for a four days and finally moving over to QtCreator. I wanted to explain a few things that diverged from your walk-thru (I am on CentOS7 with Python3 and a FRDM-K66F board, btw):

1. You're link for the application wizard did not work for me, but I didn't seem to need it anywhere. I started with an export for QtCreator from ide.mbed.com which seems to have everything I need in its "mbed" directory.

2. I added a custom executable after building which is simply "cp" with the arguments including my binary file and the MCU's drive, that way I don't have to manually copy it every time.

With debugging, I ended up with a completely different solution (I'm not sure how pushing the green debug arrow works for you without specifying an executable):

3. I required root privileges for pyOCD to find my board, so I had to change my default terminal to "/usr/bin/gnome-terminal -x sudo" and then I added it as my run executable (pyocd-gdbserver) to make it easier to start.

4. Then to connect to the server, I clicked debug -> attach to running debug server. With the kit setup as you described, the executable is set to my .elf file, and "override server channel" is set to localhost:3333.

5. The last thing is that the makefile that is exported by ide.mbed.com is not made correctly to include debug info. I changed C_FLAGS += -g3 and CXX_FLAGS += -g3, both from -g1, in order to analyse local variables & expressions.

15 Dec 2018

Hello Zoltan,

thank you for this great job.

I hang on tuto at "qbs_mbed_5.10.4.zip" the link doesn't works : https://os.mbed.com/media/uploads/hudakz/qbs_mbed_5.10.4.png

Installing the MBED Application wizard Download the qbs_mbed_5.10.4.zip file into the C:\Qt\Qt5.10.0\Tools\QtCreator\share\qtcreator\templates\wizards folder and unzip.

Kind regards

23 Dec 2018

Thanks for reporting the broken link. I use Internet Explorer and it seems to work fine. When using Chrome:

  • Right click on the link and select Save link as...
  • Save the file to your local hard drive (since MBED pages did not allow me to upload files with zip extension I decided to use png).
  • Change the extension from png to zip and then unzip the file.
29 Jan 2019

Hello,

I have installed Qt 5.12 with the online installer.

In "Installing the MBED Application wizard" step there is a missing step.

You need to change the "C:/Qt/Qt5.10.0/Tools/QtCreator/share/qtcreator/templates/wizards/qbs_mbed" paths in the MbedApplication.qbs and Project.qbs to the correct path where you have copied qbs_mbed

If you install Qt using the online installer, QtCreator usually gets installed to C:\Qt\Tools\QtCreator so the correct path would be "C:\Qt\Tools\QtCreator\share\qtcreator\templates\wizards\qbs_mbed"

29 Jan 2019

GCC compiler version needs to be >= 6.0.0 and < 7.0.0

As explained in https://os.mbed.com/questions/84008/Errors-barm-none-eabi-objcopy-applicatio/ , officially Mbed supports gcc v6.

The v6 2017 Q2 update of GNU Arm Embedded Toolchain compiles fine the example of "Creating a new MBED project offline" section of the tutorial, but newer versions produce the following error:

"... 64-bit address 0x.... out of range for Intel Hex File"

It seems that mBed requires the compiler version to be >= 6.0.0 and < 7.0.0

29 Jan 2019

Thanks for all comments and suggestions. I'll try to update the tutorial accordingly.

11 Apr 2019

Is this works for free version of QT? Since i cant see the mbed project in project creation step ?

11 Apr 2019

Ok..Compilers were moved to kits tab in Tools->options

06 Jun 2019

Hi, thanks for the great tutorial.

19 Sep 2019

I'm having the same problem as Kamil M. there is no MBED project template after selecting New Project in qtcreator. mbed-cli is installed.

20 Sep 2019

Make sure the QtCreator MBED Application Wizard is installed as described in Download and installation:

On MS Windows

Since MBED pages do not allow to upload files with zip extension, png is used instead. To download the MBED Application Wizard right-click on the link and select Save link as.... Once saved to your local drive, change the extension from png to zip and unzip to the C:\Qt\Tools\QtCreator\share\qtcreator\templates\wizards folder. Make sure that an mbed folder is then located in that folder.

On Linux (Ubuntu)

Since MBED pages do not allow to upload files with zip extension, png is used instead. To download the MBED Application Wizard right-click on the link and select Save link as.... Once saved to your local drive, change the extension from png to zip and unzip to the ~/.config/QtProject/qtcreator/templates/wizards folder. Make sure that an mbed folder is then located in that folder.

02 Jan 2020

Hi, thank you for this article! Can you describe how to adjust debug options on linux? I don't know what paths i should use and what files i should create instead of bat-files on windows.

05 Jan 2020

Additional info about Linux (Ubuntu) debug batch files was added.

08 Jan 2020

Thank you!

31 Jul 2020

Hello,

It would be interesting to update the scripts to support mbed os 6 and python3. https://os.mbed.com/docs/mbed-os/v6.2/build-tools/install-and-set-up.html

The supported compiles have also been updated according to https://os.mbed.com/docs/mbed-os/v6.2/build-tools/index.html#compiler-versions

Best Regards, Juan Pedro

31 Jul 2020

Hello,

https://os.mbed.com/media/uploads/hudakz/mbed_scripts_linux_2020_01.png link is broken, it contains twice the https://os.mbed.com part

BR, Juan Pedro

25 Aug 2020

Compilation problems for Linux users:

You may have problems running the mbed.bat file ... because of ^M end of line. In QtCreator compile output the symptoms are like:

  • 20:47:39: Running steps for project ...
  • 20:47:39: Could not start process "/.local/bin/mbed.bat" -m NUCLEO_L476RG -j8
  • Error while building/deploying project ..._os (kit: mbed)
  • When executing step "Make"
  • 20:47:39: Elapsed time: 00:00.

If you try to run the bat file in a linux terminal and have something like:

  • bash: /.local/bin/mbed.bat: /bin/bash^M: bad interpreter: No such file or directory

You can fix it with:

  • dos2unix /.local/bin/mbed.bat
15 Sep 2020

Custom Output Parsers: They are used to parse the output of the compiler to detect errors and warnings. In QtCreator 4.13.0 they are defined in Tools/Options/Build & Run/Custom Output Parsers

Note: The following applies for gcc-arm-none-eabi-9-2019-q4-major tool chain; I do not know if previous versions of the toolchain produce the same type of output.

1.- I suggest to use for error message capture pattern:

^.*[Ee][Rr][Rr][Oo][Rr][ \]]*([^@:,]*)[@:,]([0-9]*),([0-9]*)\:(.*)

Filename is at capture position 1, line number at position 2 and message at position 4

https://os.mbed.com/media/uploads/jprodrigueznieto/qt-custom-output-parser-gcc-arm-errors.png

2.- I suggest to use for warning message capture pattern:

^.*[Ww][Aa][Rr][Nn][Ii][Nn][Gg][ \]]*([^@:,]*)[@:,]([0-9]*),([0-9]*)\:(.*)

Filename is at capture position 1, line number at position 2 and message at position 4

https://os.mbed.com/media/uploads/jprodrigueznieto/qt-custom-output-parser-gcc-arm-warnings.png

With this capture patterns you have the following benefits:

  • At "compile output" tab, filenames in error and warning outputs are converted to links to the source code
  • At "issues" tab, errors are clickable and linked to source code
15 Sep 2020

Hello,

I have made some changes to mbed.bat that may be interesting for other people.

You can download it with:

wget https://os.mbed.com/media/uploads/jprodrigueznieto/mbed.bat.png no-check-certificate

mv mbed.bat.png mbed.bat

Changes made:

  • Explain arguments parsing to easy error detection
  • Handle the -j8 argument added by QtCreator
  • Fix additional args parsing
  • Use gcc-arm-none-eabi-9-2019-q4-major for OS-2 (I have tested it with STM32L476 and it is working)
  • Echo commands so they can be read in the compile tab in QtCreator
  • Remove compile_commands.json because it is generated and it grows to a large file
  • Add mbed_app.json, *.cfg and mbed.bat files to the generated ${PROJ_NAME}.files so they appear in the files list in QtCreator
  • Added a flash option for NUCLEO_L476RG. For this case I am using a custom gw485.cfg file I have made for my board. The default st_nucleo_l476rg.cfg board config file can be used removing the comments
  • Added (commented) pyocd flash command, that can be used as alternative to openocd

Note: Update the path to openocd scripts according to your system. I am using /usr/share/openocd/scripts but you may have openocd in /usr/local/share/openocd

Example: You have to set the correct parameters in the project build settings. The following is an example of use where I have cloned some libraries and the use them in the project:

Libraries clone (this example clones three libraries in /src/arm/lib, so they can be used in different projects without duplicating the source code of the libraries in each project):

Build settings using the libraries and specifying OS-2, the mcu and the libraries used in the project

  • Build make arguments: -os 2 -m NUCLEO_L476RG -l X_NUCLEO_IKS01A2 -l ST_INTERFACES -l X_NUCLEO_COMMON
  • Clean make arguments: -os 2 -m NUCLEO_L476RG -l X_NUCLEO_IKS01A2 -l ST_INTERFACES -l X_NUCLEO_COMMON

These build settings will be used by mbed.bat in the "mbed export -i qtcreator" step, generating the ${PROJ_NAME}.files and ${PROJ_NAME}.include files and in the "mbed compile" step to compile your source code.

https://os.mbed.com/media/uploads/jprodrigueznieto/qtcreator-mbed-build-settings.png

Please log in to post comments.