Skip to content

timmy-quinn/UART_driver_STM32

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UART Driver

This project was largely an excersise in stubborness. If you're like me and want to forgo the immense convenience of IDE's and SDK's you're in the right place. Hopefully this project can serve as a helpful example, in addition to the resources linked below, all of which were immensely helpful throughout the course of the project, especially in writing the linker scripts and startup code. This project implements a simple USART driver for an STM32f466RE.

Despite the amount of time it took compared to doing the same thing with an SDK, I found writing code for an MCU completely from scratch to be incredibly educational. It taught me things I would never have otherwise learned about the fundamentals of processor and peripheral hardware and I recommend all embedded engineers try this at least once.

The only thing I didn't write are the file in the src/CMSIS_core folder, which I just used for the addresses of relevant UART registers, and bit masks for configuring those registers. If you want to avoid using even that, you can just find the relevant registers in the datasheet. But at that point it becomes even too tedious for me, so I would recommend getting the files in the CMSIS_core from the STM32 Standard Peripheral Libraries.

Requirements

Build Process

make all
st-flash ./main.bin

Debugging

make all 
st-util

You should see st-util open a debugging port on localhost:4242. Following this, open (in a separate terminal) a gdb instance like this.

arm-none-eabi-gdb build/main.elf  
(gdb) target extended-remote :4242  
(gdb) load  

From here you can simply debug using gdb.

Resources

https://vivonomicon.com/2018/04/02/bare-metal-stm32-programming-part-1-hello-arm/

https://community.silabs.com/s/article/understand-the-gnu-assembler-startup-file-of-cortex-m4?language=en_US

https://allthingsembedded.com/post/2019-01-03-arm-cortex-m-startup-code-for-c-and-c/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages