0

I use a makefile and linker to create a bootloader in hex format. I understand that the linker takes the code from the source o files and re-organizes to create the final hex. I understand how the linker positions the flash(.text) sections in the final hex, but i am little confused by what is happening with sections placed in data(.data). I see that people sometime Noload this section and copy from flash to data area. I understand this. What is confusing is how does this data section make it to the m4 i am programming. Is the .data section part of the final hex? If it is part of the hex what address would it be at? Where does this data end up in the board?

Thanks

-ren

  • See the documentation of [VMA and LMA](https://sourceware.org/binutils/docs/ld/Output-Section-LMA.html) and [Basic concepts](https://sourceware.org/binutils/docs/ld/Basic-Script-Concepts.html), for the Gnu Linker. Your data section is created as *init data* in the flash, which is copied by a boot loader to the final RAM location, so there is an *initial* copy in flash. Contrast this to BSS (all zero), which doesn't require the flash store, but just code to clear the run time section out. BSS and stack are typically `NOLOAD`, but maybe not data. – artless noise Jun 17 '14 at 20:05
  • Related: [Why is BSS required?](http://stackoverflow.com/questions/9535250/why-is-the-bss-segment-required) – artless noise Jun 17 '14 at 20:10
  • Maybe also useful: [Gnu linker map file and unexpected load address](http://stackoverflow.com/questions/14453996/gnu-linker-map-file-giving-unexpected-load-addresses); at least reading/understanding that question would give insight. – artless noise Jun 17 '14 at 20:17

0 Answers0