ataradov / mcu-starter-projects

Simple starter projects for bare-metal MCU development
307 stars 41 forks source link

Added RP2040 support #3

Closed majbthrd closed 3 years ago

majbthrd commented 3 years ago

The datasheet is here:

https://datasheets.raspberrypi.org/rp2040/rp2040-datasheet.pdf

It is mostly 'just yet another microcontroller', although the dual Cortex-M0+ cores is interesting.

The secret sauce for boot images is a specially crafted 256 byte header that must pass a CRC-32 check and contains executable code to initialize the peripheral that memory maps the QSPI flash for subsequent execution.

The boot ROM can provide USB MSC that will accept a .uf2 image, and the conversion tool is part of the build process.

ataradov commented 3 years ago

I won't merge this. I hate their crazy header files and want nothing to do with them.

I'll generate my own header files based on the SVD. I just did not have time to look at that.

Plus for this project I want to write the code myself so I know it well, since I do use those starter projects for my own needs.

ataradov commented 3 years ago

Also, the main.c does not follow the same structure as other projects. They are the way they are for a very specific reason. Not just the minimal running stuff. Timer using interrupt, UART, clock configuration is the minimal useful set of things that provides a good template. Just using systick does not show common patterns of enabling the clocks for the peripherals.

majbthrd commented 3 years ago

OK, no problem. My only goal was to offer a head start.

I completely agree that their provided include files are awful, but I found parsing the SVD too daunting. Can you recommend a SVD parsing library?

Thanks.

ataradov commented 3 years ago

I'm working on my own SVD parser as I need it for another project anyway. And yes, it is going slow and miserable, since SVD is very poorly defined and practical SVD files violate the spec all the time. So I'm mostly just doing trial and error and ignoring the parts of the spec that are not used by any current SVD files.

majbthrd commented 3 years ago

Cool. Good luck!