Offline Nucleo development with EmBlocks

/media/uploads/dreschpe/codeblocks1.png The Em::Blocks IDE come with STM32 support out of the box. You simply have to download and install the install-file at http://www.emblocks.org/web/downloads-main. After installing EmBlocks you have to load my flashing led sample project from :

for nucleo L152 : /media/uploads/dreschpe/stm32l152-mbed.zip

for nucleo F401: /media/uploads/dreschpe/stm32f401-mbed1.zip

Unpack the project and load it. After a build target (F7) you can plugin your nucleo board and press F8. A dos-box is popping up , the flash is loaded via the st-link. The code is stopped on the Reset_Handler. If you want to run until main() you have to activate "Run to main()" in the Debug-Interface-Target settings dialog. /media/uploads/dreschpe/debug1.png Set a breakpoint in main and press the run symbol. The code will stop and you can inspect the variables. /media/uploads/dreschpe/codeblocks5.png

To see the peripheral registers of the cpu we have to stop the debugger and load the description file. Start Debug-Plugins-SVD repository and enter vendor and Device :

/media/uploads/dreschpe/debug2.png

If you restart the debugger you can inspect and edit the Registers via .Debug- Debugging windows - System registers.

In a next step you can save this project as template. File-save project as template. After this step you can start with File-new from template to setup a new mbed project for the nucleo.

To transfer a project with additional libraries to EmBlock, export the project from the online compiler. The Keil export is supported. at the moment for the nucleo . This is ok - we need only the c and h files.If you open the zip file you see a folder for every additional lib. Copy this folder into your project..Next add the source files into your project with "Add files recursively". In a last step we have to add the search path to this directories. Build options - Search directories - includes


Report

21 comments on Offline Nucleo development with EmBlocks:

21 Mar 2014

Hello Peter,

thanks for this introduction. What if we add exporters for emblock? I will install it to look at project files and how many targets are supported. Do they have own implementation of gdb? pyocd or openocd can be used? Just to know if CMSIS-DAP is supported there.

Regards,
0xc0170

04 Apr 2014

Hello Peter, Thanks for posting this information. I normally do not run windows but started up a VM (Virtualbox with Windows-7) for this experiment and it works. It is however very strange that the project EmBlocks is not releasing any code, since they are using GPL code to start with. Keep on posting to the mbed site, Greetings, Edwin van den Oetelaar

07 Apr 2014

Edwin Oetelaar, van den wrote:

It is however very strange that the project EmBlocks is not releasing any code, since they are using GPL code to start with.

It's not so very strange that you can't find any code if you never looked for it to start with. Your Ip xxx.ftth.onsbrabantnet.nl did go straight to the downloads and never visited the licensing page or SVN server.

27 Apr 2014

E B wrote:

It's not so very strange that you can't find any code if you never looked for it to start with. Your Ip xxx.ftth.onsbrabantnet.nl did go straight to the downloads and never visited the licensing page or SVN server.

Your detailed inspection of the web-logging is remarkable :-)

Well that would my my bad then, I looked arround and could not see any reference to the code, I did not look under the licensing, but now I finally found it here.

http://www.emblocks.org/svn/listing.php?repname=EmBlocks thanks to your hint. I like the project :-)

Maybe that helps someone else to find it too.

01 May 2014

Peter

Awesome work....can you update your example ( /media/uploads/dreschpe/stm32f401-mbed1.zip) to use the new mbed verison 83...because it includes an automatic clock config (84mhz)...thank you

10 May 2014

Is it possible to use semihosting for printf with nucleo in emblocks?

03 Jun 2014

Pat P wrote:

Is it possible to use semihosting for printf with nucleo in emblocks?

Sure, this is not something Nucleo but Arm related. EmBlocks supports semihost printing with output in the GDB window of EmBlocks. There is an example with the F4 and semihosting, just enable semihosting in the linker library options and you are ready.

You can use the FormFeed character to clear the terminal window (to start at the top of the window when you start printing).

Edit: The 2.0 is just released with FreeRTOS and ChibiOS/RT OS viewer.

24 Jun 2014

The EmBlocks examples from above work fine, but unfortunately I have to get it run on the Landtiger-Board /LPC1768.

What changes are to be made to run this example on other ARM-Controllers e.g. the LPC1768 - Board? Where can I get the necessary HAL /CMSIS - Files?

I would appreciate your help very much, so I can use EmBlocks with my students.

29 Jul 2014

> Edit (Sept 05th) :

mbed lib has been updated and I2CSlave is now supported in V0.88 ! just be careful with the READADDRESSED case because the STM32 needs exact timing to send back a msg. And even a pc.printf("blahblah") is enough to make it work (or not!) Rico

Hi Peter, nice work ! thank you :-)

i'm looking for a way to enable the I2CSlave feature for the STM32L1xx and F401 yet I don't see where to start. the device.h says #define DEVICE_I2CSLAVE 0 Not supported yet and I suppose that it enables the I2CSlave related fuctions inside the cmsis /mbed API. apparently they are already implemented in stm32f4xx_hal_i2c.h so I'm missing something yet i don't see it :-/

do you have any idea on where to look at ? thank you for your support

26 Aug 2014

Hi Peter, how can I update mbed library?

21 Sep 2014

To update the mbed lib export a program with the actual mbed lib and the Nucleo target. You can use Keil toolchain. Unpack the project and put all .h and .cpp files from the mbed folder into the corresponding folder in the emblocks project. After that you have to update the EmBlocks project. Use "add files recursively.." to reload all files in the mbed folder.

25 Sep 2014

I had contact with Mbed how to include EmBlocks support. I have downloaded the mbed_master project and are busy with the implementation of the python part of the EB exporter. There are some questions open for the Mbed professionals but it is moving the right direction.

If there is a positive reaction on the open questions then the EB Mbed importer would look like as follows:

  • The Mbed exporter for EmBlocks will generate an EIX xml file (<name>.eix) which stands for Emblocks Intermediate Exchange file. This EIX file is very simple, has all the information available from Mbed, like: files, target, symbols, libraries etc but no EB specific switches or options. Only bare project information.
  • The EIX plugin of EmBlocks will parse the XML file and is looking for a target XML description in the plugin. If it finds one it will use that XML file as project template inside EB with all the switches and build targets etc.
  • If there is no target XML file, a wizard will be launched which will guide the user to a buildable project.

Normally all the project files with all the IDE specific options are generated on Mbed side. The problem is that if you change the EB project file format, you have to modify all external generators as well. If someone will add a target it can do this locally and use this right away (and share this with other EB users). The maintainability is much easier now because we keep all the EB specific parts right where it belongs, at EB.

The EIX file format will have a very simple structure and can also be used by other tools to export to EB.

27 Sep 2014

Great tool Peter!!

I am new into mbed and Nucleo boards (I do have experience in MCUs from other vendors).

I have run some programs downloading the bin file from the online compiler, but I would like to use emblocks for debugging with the stlink debugger. However I have a NUCLEO-F302R8 board, which does not match the two sample projects that you provided.

Could you build one project for that board?

Thank you

15 Nov 2014

in compiling your samples nucleo L152, i get this error /media/uploads/hbendali/capture2.png

23 Nov 2014

same here @edit: Got it to work. in stm32l152rd_flash.ld there is an extra closing bracket on line 44. I removed it and it works fine now.

02 Feb 2015

Hi. Just received my first Nucleo board, installed EmBlocks and built your project. Thank you for this project as a soft intro to EmBlocks and for me STM32 development. I'm having a problem when I start a debug session after performing the successful build (with one warning "Warning: ignoring changed section attributes for .data"). The problem is the debugger terminates without the break point, mentioned above, being reached.

Window "Debug error" "Debug Server is closed/terminated, debug session will stop."

The "Logs & others" window has "Debugger finished with status 1".

There are no other warnings or errors indicated.

Also using Em::Blocks 2.30.

I've installed the 64bit ST-Link driver without issue and upgraded the firmware for the Nucleo board as recommended by this site.

STM32L152 Nucleo Windows 8.1 64bit pc

The USB link is currently powering the default program the board came with which is the variable user led flashing program.

I was wondering about correct jumper positioning? I've left them in the position as they arrived.

Also ST-Link driver compatibility with Windows 8.1 64 bit?

Any help would be appreciated.

PS: I've now tried ST-Link driver and EmBlocks install and project run on STM32L152 Nucleo in a Windows 8 32bit VM with the same result.

Thanks.

03 Feb 2015

Murray King wrote:

Hi. Just received my first Nucleo board, installed EmBlocks and built your project. Thank you for this project as a soft intro to EmBlocks and for me STM32 development. I'm having a problem when I start a debug session after performing the successful build (with one warning "Warning: ignoring changed section attributes for .data"). The problem is the debugger terminates without the break point, mentioned above, being reached.

Window "Debug error" "Debug Server is closed/terminated, debug session will stop."

The "Logs & others" window has "Debugger finished with status 1".

There are no other warnings or errors indicated.

Also using Em::Blocks 2.30.

I've installed the 64bit ST-Link driver without issue and upgraded the firmware for the Nucleo board as recommended by this site.

STM32L152 Nucleo Windows 8.1 64bit pc

The USB link is currently powering the default program the board came with which is the variable user led flashing program.

I was wondering about correct jumper positioning? I've left them in the position as they arrived.

Also ST-Link driver compatibility with Windows 8.1 64 bit?

Any help would be appreciated.

PS: I've now tried ST-Link driver and EmBlocks install and project run on STM32L152 Nucleo in a Windows 8 32bit VM with the same result.

Thanks.

Just swapped it out with an identical kit and this one worked so am attempting to return and/or get a replacement for the kit.

01 Jul 2015

Can I make this work with F411RE?

03 Mar 2016

Hi ALL after compile,where could I find program bin file?

06 Mar 2016

awesome

26 Aug 2016

Hi, I use this for STM32F446, but for STM32F091 don't work . Because I need a file .svd for STM32F091 ? Tnx.

Please log in to post comments.