Declaring a constant structure in flash memory without initialization

Hello everyone!

I am using Keil uVision 5.28 with Compiler V6.12.

How to declare a constant structure in flash memory so that it is not initialized by programmer / debugger and functions from scatterloader?

I'm looking at document https://static.docs.arm.com/100748/0609/compiler_user_guide_100748_0609_00_en.pdf.

There is an example on page 120 for peripheral registers, but it does not quite suit me, since there can be many such structures, and I do not want to make many files for each structure.

Now I have limited the size of the flash memory in the scatter file and refer to the structure at an absolute address.
Maybe there is some other, more correct solution?

Parents
  • The linker can collect all of the structures from different files for you. As the manual says, use __attribute((section(".bss.noinit"))) to name them, and use ANY (.bss.noinit) in the scatter file to pull them into a section marked with UNINIT. ANY is more useful that using *, and avoids needing to specify the files individually.

Reply
  • The linker can collect all of the structures from different files for you. As the manual says, use __attribute((section(".bss.noinit"))) to name them, and use ANY (.bss.noinit) in the scatter file to pull them into a section marked with UNINIT. ANY is more useful that using *, and avoids needing to specify the files individually.

Children
More questions in this forum