wiki:TBR/BSP/STM32_F4

STM32 F4

The STM32F4 BSP of RTEMS was tested on a custom board (http://jmfriedt.free.fr/network_analyzer.pdf [in French]) fitted with a STM32F410RBT6 CPU whose serial port number 1 is connected to a RS232 to USB converter: this version of the STM32F4 series only provides 32 KB flash and 128 KB RAM, emphasizing the moderate requirements of RTEMS. The microcontroller is clocked with a 20 MHz resonator.

In order to get RTEMS running :

  1. compile the toolchain from source as described at https://ftp.rtems.org/pub/rtems/people/chrisj/source-builder/source-builder.html, which requires about 10 GB of free space for the target 5/rtems-arm
  2. having compiled the toolchain, export the PATH to include arm-rtems5-gcc
  3. git clone the latest release of RTEMS
  4. export TARGET="arm-rtems5"
    1. if using a non-8 MHz quartz resonator (as I am doing), edit

rtems/c/src/lib/libbsp/arm/stm32f4/configure.ac and replace 8000000 with 20000000 as well as 16000000 with 40000000 (which might overclock the processor, which seems to remain functional)

  1. if using a serial port other than USART3 (as I am doing), edit

rtems/c/src/lib/libbsp/arm/stm32f4/configure.ac and replace
RTEMS_BSPOPTS_SET([STM32F4_ENABLE_USART_3],[*],[1])
RTEMS_BSPOPTS_HELP([STM32F4_ENABLE_USART_3],[enable USART 3])
with
RTEMS_BSPOPTS_SET([STM32F4_ENABLE_USART_1],[*],[1])
RTEMS_BSPOPTS_HELP([STM32F4_ENABLE_USART_1],[enable USART 1])
...
RTEMS_BSPOPTS_SET([STM32F4_ENABLE_USART_3],[*],[])
RTEMS_BSPOPTS_HELP([STM32F4_ENABLE_USART_3],[enable USART 3])
to send console on USART1

  1. in the rtems clone, ./bootstrap
  2. in a build directory next to the rtems clone, ../rtems/configure --target=${TARGET} --enable-rtemsbsp=stm32f4 --enable-tests=samples --prefix=$HOME/my/directory/rtems/5
    1. in $HOME/my/build/directory/arm-rtems5/c/stm32f4/testsuites/samples I had to remove pppd, fileio, iostream, loopback and related applications whose size exceeded the available 32 KB flash
  3. make
  4. make install
  5. in the $HOME/my/build/directory/arm-rtems5/c/stm32f4/testsuites/samples/hello:

sudo stm32flash -w hello.bin /dev/ttyUSB0

  1. if all goes well, while monitoring at 115200 bauds the virtual serial port output
    *** BEGIN OF TEST HELLO WORLD ***                           
    Hello World                                                 
    *** END OF TEST HELLO WORLD ***                             
    

{{Infobox BSP |BSP_name = STM32 F4 |Manufacturer = STMicroelectronics |image = STM32 F4 Discovery.jpg |caption = STM32 F4 Discovery |Board_URL = STM32 F4 Discovery Board |Architecture = ARM Cortex-M4F |CPU_model = 168 MHz Cortex-M4 CPU |Monitor = uBoot, uMon |Simulator = Yes. [OpenOCD simualator] |Aliases = STM32 F4 |RAM = Up to 192-KByte SRAM |NVMEM = Up to 1-Mbyte flash |Serial = 2 serial ports |Video = }}

Overview

This is the ST evaluation board with the CPU of the new STM32 F4 CPU family.

Features

  • STM32F407VGT6 microcontroller featuring 32-bit ARM Cortex-M4F core, 1 MB Flash, 192 KB RAM in an LQFP100 package
  • On-board ST-LINK/V2 with selection mode switch to use the kit as a standalone STLINK/V2 (with SWD connector for programming and debugging)
  • Board power supply: through USB bus or from an external 5 V supply voltage
  • External application power supply: 3 V and 5 V
  • LIS302DL or LIS3DSH ST MEMS 3-axis accelerometer
  • MP45DT02, ST MEMS audio sensor, omni-directional digital microphone
  • CS43L22, audio DAC with integrated class D speaker driver
  • Eight LEDs: LD1 (red/green) for USB communication, LD2 (red) for 3.3 V power on, Four user LEDs, LD3 (orange), LD4 (green), LD5 (red) and LD6 (blue), 2 USB OTG LEDs LD7 (green) VBus and LD8 (red) over-current
  • Two push buttons (user and reset)
  • USB OTG FS with micro-AB connector
  • Extension header for all LQFP100 I/Os for quick connection to prototyping board and easy probing

For the set of board manuals please see ST page dedicated to this board: http://www.st.com/stm32f4-discovery

RTEMS does not support Ethernet with the stm32f4 BSP

Board Setup

The STM32F4 will switch to bootloader mode, using the st-link protocol, when BOOT0 is low during the reset sequence.

Downloading and Executing

sudo stm32flash -w hello.bin /dev/ttyUSB0

Debugging

At the moment the only validation procedure was to display the message expected from a properly running RTEMS application.

Test Reports

{{Test Report |Version = CVS head |Date = DATE |User = User:WhoTestedThis? |Report = reports that something happened. }}

Last modified on Nov 9, 2017 at 6:57:50 AM Last modified on Nov 9, 2017, 6:57:50 AM