Version 4 (modified by Jmfriedt, on Aug 17, 2014 at 9:19:04 PM) (diff)


The STM32F105, produced by ST Microelectronics, is part of the STM32F1 series of the lower end CPUs with 64 to 256 kB FLASH and are thus best suited for real time control in industrial applications.

The STM32F105 BSP, based on the STM32F4 BSP, is compiled according to

Having compiled the toolchain, RTEMS is compiled for the STM32F105 BSP following

We run the example on Qemu supporting the STM32 architecture as described at:

The trick is that, as indicated at, the console is connected to UART3. Qemu as found on the previous GIT site only implements UART2: the two options are either to add support for UART3 to Qemu, or to move the console to another serial port. The former solution is easiest, the latter most useful for practical applications on real board which might use other UARTs than UART3. For modifying Qemu, edit hw/arm/stm32_p103.c in the Qemu source tree downloaded from the github cite and add both UART1 and UART3 by including

DeviceState? *uart1 = DEVICE(object_resolve_path("/machine/stm32/uart[1]", NULL)); DeviceState? *uart3 = DEVICE(object_resolve_path("/machine/stm32/uart[3]", NULL)); assert(uart1); assert(uart3); stm32_uart_connect((Stm32Uart *)uart1,serial_hds[0],STM32_USART1_NO_REMAP); stm32_uart_connect((Stm32Uart *)uart3,serial_hds[2],STM32_USART3_NO_REMAP);

having compiled Qemu with these updates, and RTEMS for the STM32F105 BSP, the example is loaded using

qemu-system-arm -M stm32-p103 -serial stdio -serial stdio -serial stdio -kernel hello.bin

(three times -serial stdio to indicate that all three UARTs outputs are displayed on stdout). The result is

VNC server running on `::1:5900' LED Off * BEGIN OF TEST HELLO WORLD * Hello World * END OF TEST HELLO WORLD *

For modifying the default UART used by the console, either edit in the RTEMS BSP the rtems/c/src/lib/libbsp/arm/stm32f4/ file and modify RTEMS_BSPOPTS_SET([STM32F4_ENABLE_USART_3],[*],[1]) by disabling UART3 (remove [1] and replace with []) and activating UART1 (replace [] with [1]). Alternatively, before the configuration step, export variables STM32F4_ENABLE_USART_3="" and STM32F4_ENABLE_USART_1="1" for the same effect.