rust-embedded / cortex-m-quickstart

Template to develop bare metal applications for Cortex-M microcontrollers
809 stars 167 forks source link

Add example moving .bss data into custom memory #53

Closed birkenfeld closed 6 years ago

birkenfeld commented 6 years ago

We're using a STM32F429 and wanted to move stuff around in memory, notably put stack+data into CPU coupled memory, and put framebuffers for the integrated LCD controller into the normal SRAM.

Getting this right while not completely overriding the default link.x was quite tricky (especially finding the INSERT AFTER life-saver...) so I thought an example would not hurt here.

It should probably also be mentioned in other places (book/...)?

birkenfeld commented 6 years ago

Indeed! Thanks.

adamgreig commented 6 years ago

Aah, INSERT AFTER is great. I really want to see this included somewhere, either here or in the cortex-m-rt docs (or both!). My only reservation atm is the way they will be uninitialised - probably wants a little more exposition on the consequences. Hopefully sometime soon c-m-rt will support initialising multiple sections anyway.

birkenfeld commented 6 years ago

I agree, and I saw that there is some related functionality in r0 but didn't investigate as I'm initializing the framebuffers anyway, using DMA.

adamgreig commented 6 years ago

I'm happy to merge this as-is and we can add information about cortex-m-rt support once it has it. This is the third time in a few weeks someone's asked about doing this and it would be great to have this to point them at.

I'll leave merging up to @thejpster if they're happy, though.