Bootloader

AFBoot-STM32

$ git clone https://github.com/mcoquelin-stm32/afboot-stm32.git
$ cd afboot-stm32
$ make stm32f429i-disco
$ make flash_stm32f429i-disco

Note: The last command uses OpenOCD to flash the bootloader onto the board

U-Boot

U-Boot STM32 port to mainline has been done by Kamil Lulko. The port is based on U-Boot fork from Emcraft, distributed on their GitHub page.

$ git clone git://git.denx.de/u-boot.git
$ cd u-boot
$ make ARCH=arm CROSS_COMPILE=arm-none-eabi- stm32f429-discovery_defconfig
$ make ARCH=arm CROSS_COMPILE=arm-none-eabi-

Note: The mainline Kernel requires some patches on top to work with U-Boot port, these patches are available on Kamil GitHub

Linux Kernel

Main Kernel

STM32F429 Discovery board basic support has been merged in Kernel v4.2-rc1.

STM32 maintainer git repository is hosted on kernel.org.

Steps to build mainline kernel for STM32f429i-Discovery board:

$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
$ cd linux
$ make ARCH=arm CROSS_COMPILE=arm-none-eabi- stm32_defconfig
$ make ARCH=arm CROSS_COMPILE=arm-none-eabi-

Emcraft Kernel

Emcraft shares its kernel based on uClinux Kernel v2.6.33 on his GitHub page.

Flash Tools

OpenOCD

OpenOCD can be used to write binaries to internal flash.

Be aware that OpenOCD needs to be installed (not just built in a src directory) for this to work.

$ git clone git://git.code.sf.net/p/openocd/code openocd
$ cd openocd
$ git submodule init && git submodule update && ./bootstrap && ./configure --enable-stlink  && make && sudo make install

Usage example

$ openocd -f  board/stm32f429discovery.cfg \
  -c "init" \ 
  -c "reset init" \
  -c "flash probe 0" \
  -c "flash info 0" \
  -c "flash write_image erase arch/arm/boot/dts/stm32f429-disco.dtb 0x08004000" \
  -c "flash write_image erase arch/arm/boot/xipImage 0x08008000" \
  -c "reset run" \
  -c "shutdown"

Texane

STlink tool from Texane can be found here.

Once built, you’ll need to copy the udev rule for your STLink device to /etc and reload udev

$ cp 49-stlinkv*.rules /etc/udev/rules.d
$ udevadm control --reload-rules
$ udevadm trigger

Usage example

$ st-flash --reset write arch/arm/boot/dts/stm32f429-disco.dtb 0x08004000
$ st-flash --reset write arch/arm/boot/xipImage 0x08008000

Resource

Reference

  • http://elinux.org/STM32
  • http://www.emcu.it/index.html#STM32