wiki:TBR/BSP/STM32F105

Version 3 (modified by Jmfriedt, on 08/17/14 at 21:18:29) (diff)

STM32F105

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 http://alanstechnotes.blogspot.fr/2013/03/setting-up-rtems-development.html.

Having compiled the toolchain, RTEMS is compiled for the STM32F105 BSP following http://s937484.blogspot.fr/2013/10/rtems-stm32f407-discovery-board-posted.html

We run the example on Qemu supporting the STM32 architecture as described at: https://github.com/beckus/qemu_stm32

The trick is that, as indicated at ftp://ftp.rtems.eu/pub/rrr/RRR_Quick_Start_Guide_en.pdf, 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/configure.ac 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.