Skip to content

Latest commit

 

History

History
24 lines (13 loc) · 1.4 KB

Readme.md

File metadata and controls

24 lines (13 loc) · 1.4 KB

Bare Metal STM32F103

This repo contains code example that shows how to use UART and timer peripherals without any libraries and headers on stm32f103c8t6.

Initially based on This stackoverflow answer, slightly modified for stm32f103 MCU using UART2 and TIM2. nvic_enable function code is taken from this github repo with project examples.

How to set up and run openocd on linux.

UART2 (PA2:TX, PA3:RX) is configured with speed 115200, TIM2 is configured to trigger the interrupt every second on 8 MHz clock frequency.

Tools

arm-none-eabi-gcc and arm-none-eabi-gdb from Arch linux repo were used.

Notes

GCC Assembler using caveat

You probably should not use any assembler code since you are using gcc assembler. A good and short explanation from the NASM documetation for v2.09.04 (pdf):

gas is free, and ports over to DOS and Unix, but it’s not very good, since it’s designed to be a back end to gcc, which always feeds it correct code. So its error checking is minimal.

I am going to get rid of any assembly code I can do in future, but now it is here, sorry.