bastelhalde.de


Ben,

Setting up EmBitz for an STM32F7 HAL project

I really like to use the EmBitz IDE for STM32 projects. Unfortunately the current version (1.11) does not yet support STM32F7 devices. So I decided to write this guide how to get the "blink" example running for the STM32F767 Nucleo 144 Board.

Required software

The first thing I did was to install the SEGGER J-Link software package. After that I plugged in the nucleo board and reflashed the STLinkv2 to a SEGGER J-Link using the ST-Link Reflash Utility (more infos).

The next step was to unpack the STM32CubeF7 package somewhere you like.
Now open up EmBitz and create an empty project. Mine will be called "nucleo". Make sure to select the packaged ARM-GCC-compiler for the project.

Copying code

Now it's time to collect all the source files we need for the blink example. The syntax of this code copying guide is like the following:
Subfolder of the STM32 CubeF7 package --> Destination Folder in the EmBitz project root

  1. /Drivers/STM32F7xx_HAL_Driver/Inc and /Src to a new directory /HAL/Inc and /HAL/Src
  2. Contents of /Drivers/BSP/STM32F7xx_Nucleo_144 to a new /BSP/ directory
  3. Contents of /Drivers/CMSIS/Device/ST/STM32F7xx/Include to a new /CMSIS/STM32F7xx directory
  4. Contents of /Drivers/CMSIS/Include to a new /CMSIS/Include directory
  5. /Projects/STM32F767ZI-Nucleo/Examples/GPIO/GPIO_IOToggle/Inc and /Src to a new /Inc and /Src directory
  6. startup_stm32f767xx.s and STM32F767ZITx_FLASH.ld (see subfolder) from /Projects/STM32F767ZI-Nucleo/Examples/GPIO/GPIO_IOToggle/SW4STM32 to the root dir /

Now that all files are collected we will now add them to EmBitz. Right click on your project and select "Add files recursively" and select the root directory of your project. A lot of files should come up for adding. Make sure the linker script (file extension .ld) is also added.

Unfortunately we need to remove some of the files right away. In the EmBitz project view select all files in the /Source/HAL/ directory which contain _ll or _template. Right click an remove form project. The same has to be done for the _ll or _template files in /Headers/HAL folder.

The following image shows the folder structure for my example project. The folders with a lot of files are not expanded.

Configuring the project

Now we will set up the project. Right click on your project and select build options. Make sure your project name (nucleo in my case) is selected from the list in the far left and fill in the values as seen from the screenshot below.

Next select Compiler Settings -> #defines and define the following constants:

USE_HAL_DRIVER
STM32F767xx
USE_STM32F7XX_NUCLEO_144


From the Linker Settings -> Linker Flags -> All categories section check the following options:

  • INCLUDE library start files
  • Newlib nano branch

Now select "Debug" from the list in the far left, go to Assembler settings and check "Generate debugging information". Make sure the option --gdwarf-2 from the assemblers "other options" field is removed.

Click OK to save everything.
Now you should be set up for compiling. Select Build->Build Target to compile the project.

Configuring the debugger

Now we need to configure the EmBitz end of the debugging bridge. So in EmBitz select Debug->Interfaces go to GDB server and select JLink in the top combo box. Select the ST device family and click on settings. In the window that just opened fill in "STM32F767ZI" (although it might not get auto completed) into the device field and select swd for the interface. Click OK to close the window.
My settings are shown in the following screenshot.

Go back to the target settings tab and select Run to main() if you want. Now everything should be ready.
Press F8 to start a debugging session. The JLink server should pop up and the chip will be programmed and you can start debugging.

Please notify me if something in this guide is wrong or impractical.


Leave Comment: