Difference between revisions of "STM32"
(Which TCs should be used with with s/w package) |
|||
Line 19: | Line 19: | ||
</gallery> | </gallery> | ||
− | = Toolchain = | + | = Toolchains = |
− | == | + | |
− | + | You will need 2 separate toolchains, one for building the Kernel and Bootloader and the other for building userspace. | |
+ | |||
+ | == Kernel/Bootloader Toolchain == | ||
+ | === Baremetal Toolchain === | ||
Version known to work [https://launchpad.net/gcc-arm-embedded/4.9/4.9-2014-q4-major here]. | Version known to work [https://launchpad.net/gcc-arm-embedded/4.9/4.9-2014-q4-major here]. | ||
− | == uClibc Toolchain == | + | === Userspace uClibc Toolchain === |
=== OSELAS Toolchain === | === OSELAS Toolchain === | ||
Pengutronix provides [http://www.pengutronix.de/oselas/toolchain/ OSELAS] (arm-cortexm3-uclinuxeabi-gcc-4.7.2) toolchain for Cortex-M MCUs. | Pengutronix provides [http://www.pengutronix.de/oselas/toolchain/ OSELAS] (arm-cortexm3-uclinuxeabi-gcc-4.7.2) toolchain for Cortex-M MCUs. | ||
− | === Buildroot | + | |
− | Buildroot fork | + | == Alternative Toolchains == |
+ | === Buildroot === | ||
+ | |||
+ | Alternatively you can use Kamil Lulko's Buildroot fork which generates a uClibc toolchain. | ||
+ | |||
+ | The fork also builds a Kernel and U-boot for you, but since many STM32 boards are low on resources some prefer to use the AFBoot-STM32 (see below) to save space. In which case it's better to build Kernel, Bootloader and Buildroot as separate entities. | ||
= Bootloaders = | = Bootloaders = |
Revision as of 03:55, 12 February 2016
Contents
Introduction
This is starting page for Linux on STMicroelectronics STM32 microcontrollers family. These pages are not meant to replace official STMicroelectronics support.
Supported Boards
STM32F429i-Discovery
The STM32F429 Discovery kit has the following features:
- STM32F429 MCU (ARM Cortex-M4 up to 180MHz, 2MB internal flash, 256KB internal RAM)
- 8MB SDRAM
- USB OTG Full-Speed
- 2.4" LCD
- MEMS motion sensor
- STLink/V2 (debugging)
- Extension headers
Toolchains
You will need 2 separate toolchains, one for building the Kernel and Bootloader and the other for building userspace.
Kernel/Bootloader Toolchain
Baremetal Toolchain
Version known to work here.
Userspace uClibc Toolchain
OSELAS Toolchain
Pengutronix provides OSELAS (arm-cortexm3-uclinuxeabi-gcc-4.7.2) toolchain for Cortex-M MCUs.
Alternative Toolchains
Buildroot
Alternatively you can use Kamil Lulko's Buildroot fork which generates a uClibc toolchain.
The fork also builds a Kernel and U-boot for you, but since many STM32 boards are low on resources some prefer to use the AFBoot-STM32 (see below) to save space. In which case it's better to build Kernel, Bootloader and Buildroot as separate entities.
Bootloaders
AFBoot-STM32
AFBoot-STM32 has been developed by Andreas Färber and is available on his GitHub page.
The main advantage of this bootloader is its size (less than 2KB). Indeed, the STM32F429 only has 2MB internal flash for Bootloader, Kernel, Rootfs and DTB.
A fork compatible with mainline Kernel (from v4.2-rc1) is available here.
The following commands cover the later version.
git clone https://github.com/mcoquelin-stm32/afboot-stm32.git cd afboot-stm32 make stm32f429i-disco make flash_stm32f429i-disco
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 that mainline Kernel requires some patches on top to work with U-Boot port, these patches are available on Kamil GitHub.
Linux Kernel
Mainline 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-
Produced files are xipImage to be written at address 0x08008000, and arch/arm/boot/dts/stm32f429-disco.dtb DTB file to be written at address 0x08004000.
stm32_defconfig file generates binaries compatible with afboot-stm32 fork.
Emcraft Kernel
Emcraft shares its kernel based on uClinux Kernel v2.6.33 on his GitHub page.
Andreas Färber's Kernel
For ARM TechSymposium Europe 2014 Andreas Färber presented a 3.19-rcX based kernel for the STM32F429I-DISCO at the openSUSE booth. Most of this work was superseded by Maxime; some drivers remain to be forward-ported.
User Space
Busybox
Below link is a prebuilt minimal Busybox to be used as a Ramdisk:
File:Stm32 mini rootfs.cpio.bz2
Buildroot
A fork of Buildroot has been done by Kamil Lulko to add STM32 support.
The git repo is available here.
It builds Kernel, U-Boot and RootFS (busybox).
Debug
OpenOCD in combination with GDB can be used to debug through the STLink interface.
Flash Tools
OpenOCD
OpenOCD can be used to write binaries to internal flash.
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.
Usage example
st-flash --reset write arch/arm/boot/dts/stm32f429-disco.dtb 0x08004000 st-flash --reset write arch/arm/boot/xipImage 0x08008000