Monthly Archives: February 2017


Really rough notes on compiling source code on Fedora 25 for STM32F767 Nucleo-144 (Nucleo-F767ZI)

#eclipse with support for C/C++
sudo dnf install -y eclipse-cdt;
#cross-compiler for arm
sudo dnf install -y arm-none-eabi-gcc arm-none-eabi-gdb arm-none-eabi-binutils arm-none-eabi-newlib arm-none-eabi-gcc-cs-c++;
#manually installing openocd from the repository as the version in the repositories does not support our board (STM32F767 Nucleo-144 (Nucleo-F767ZI))
git clone http://openocd.zylin.com/openocd;
cd openocd/;
./bootstrap;
./configure;
make;
sudo make install;

#download eclipse plugin from https://my.st.com/content/my_st_com/en/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-configurators-and-code-generators/stsw-stm32095.license%3d1491636351998.html
#install using from menu “Help” > “Install New Software…” > “Add…” > “Archive…”. Find “en.stsw-stm32095.zip” and press OK. Tick new repo and click next.

#add http://gnuarmeclipse.sourceforge.net/updates as a repository in eclipse.  menu “Help” > “Install New Software…” > “Add…”. Type name “GNU arm eclipse” and type address “http://gnuarmeclipse.sourceforge.net/updates”. Press ok. Tick new repo and click next.

# st_nucleo_f7.cfg copy it with the rest of the configuration files e.g. /usr/local/share/openocd/scripts/board/
sudo cp st_nucleo_f7.cfg /usr/local/share/openocd/scripts/board/

Create a new st 7x project and add 2048 of memory

create a C/C++ run application run

create new openosd run to run the elf created by above run and add parameter

-f /usr/local/share/openocd/scripts/board/st_nucleo_f7.cfg

to config options in debugger tab

sudo usermod -a -G root george;
#if you get error on opening the usb device (really ugly hack)

 

Needed packages:

  • sudo dnf install -y arm-none-eabi-gcc arm-none-eabi-gdb arm-none-eabi-binutils arm-none-eabi-newlib
  • Do not install openocd from the repositories, clone the git server as it has a later version which supports our board.
    git clone http://openocd.zylin.com/openocd
    then build it

[download id=”2731″] copy it where you have the rest of the target files
e.g. /usr/share/openocd/scripts/board/st_nucleo_f7.cfg

[download id=”2732″]  copy it with the rest of the configuration files
e.g. /usr/share/openocd/scripts/target/stm32f7x.cfg

The locations for the above files depend on your configuration

You need to download the STM32CubeF7 (https://my.st.com/content/my_st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-embedded-software/stm32cubef7.license%3d1487716364634.html) ~634MB
Extract it.

Navigate to a ready project like the GPIO_IOToggle in STM32Cube_FW_F7_V1.6.0/Projects/STM32F767ZI-Nucleo/Examples/GPIO/GPIO_IOToggle

Compile each .c file using the following command, but fix the paths !!! You also might need ton include the Inc directory of the project
e.g.
arm-none-eabi-gcc -Wall -mcpu=cortex-m7 -mlittle-endian -mthumb -ISTM32Cube_FW_F7_V1.6.0/Drivers/CMSIS/Device/ST/STM32F7xx/Include -ISTM32Cube_FW_F7_V1.6.0/Drivers/CMSIS/Include -ISTM32Cube_FW_F7_V1.6.0/Drivers/STM32F7xx_HAL_Driver/Inc -I. -ISTM32Cube_FW_F7_V1.6.0/Drivers/BSP/STM32F7xx_Nucleo_144 -DSTM32F767xx -Os -c system_stm32f7xx.c -o system_stm32f7xx.o

Merge all .o files into an .elf file

arm-none-eabi-gcc -mcpu=cortex-m7 -mlittle-endian -mthumb -DSTM32F767xx -TSTM32Cube_FW_F7_V1.6.0/Projects/STM32F767ZI-Nucleo/Templates/SW4STM32/STM32F767ZI_Nucleo_AXIM_FLASH/STM32F767ZITx_FLASH.ld -Wl,–gc-sections system_stm32f7xx.o main.o stm32f7xx_it.o -o main.elf

Convert the .elf file to a .hex

arm-none-eabi-objcopy -Oihex main.elf main.hex
Start openocd to attach to the board

sudo ../src/openocd -f /usr/share/openocd/scripts/board/st_nucleo_f7.cfg

Use telnet to control the board

telnet localhost 4444

Flash the board

reset halt
flash write_image erase /home/xeirwn/Downloads/ST/GPIO_IOToggle/Src/main.hex
reset run

 

DONE

 

 

sudo dnf install eclipse-cdt-sdk;

download plugin from here https://my.st.com/content/my_st_com/en/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-configurators-and-code-generators/stsw-stm32095.license%3d1491636351998.html

 

add http://gnuarmeclipse.sourceforge.net/updates as a repository in eclipse

sudo dnf install -y arm-none-eabi-gcc-cs-c++;

create new openosd run and add parameter

-f /usr/share/openocd/scripts/board/st_nucleo_f7.cfg

to config options in debugger tab

add   RCC_OscInitStruct.PLL.PLLR = 7; to _initialize_hardware.c

 

I hope I did not forget anything

Anyhow, this post will be updated soon