BrianSidebotham / arm-tutorial-rpi

Raspberry-Pi Bare Metal Programming in C Tutorial
https://www.valvers.com/open-software/raspberry-pi/bare-metal-programming-in-c-part-1/
MIT License
585 stars 177 forks source link

Setting MAXPAGESIZE instead of changing linker script (BMC Part 2 - The C Runtime) #18

Closed eyalabraham closed 3 years ago

eyalabraham commented 4 years ago

First off, absolutely love this tutorial!

Not sure this is a huge deal, but in part 2 you adjust the linked script to get rid of an odd page-alignment behavior. This behavior is governed by the PAGESIZE linker constant that can be controlled by a linked '-z max-page-size=' CLI option, which is also described here. I tried this and the page size was reduced accordingly, yielding a smaller image once the .data section is aligned to the new size. Perhaps a note in the README would be appropriate?

I compile with a '-c' on arm-none-eabi-gcc and then use the '-z' with arm-none-eabi-ld

BrianSidebotham commented 4 years ago

@eyalabraham Looks like great info. Haven't seen that option. I'll introduce it at the end of Part-2. I think we remove the customer linker script at the end of part 2 anyway.

Thanks for the heads up.