Suppose I have a 128 KB memory area. In my linker directives, I have broken this area into three sections:
- .section_text
- .section_data li>
- .section_bss
The size of each section is unknown precompilation, but I limited .section_bss to use all the remaining space in the memory area after allocating .section_text and .section_data.
Is there a way to declare a C array that uses all the free space in .region_bss? Suppose this is the only one that uses .region_bss so that it can safely use the entire region. For example, goals, but clearly wrong:
char entire_bss[sizeof(.region_bss)];
Here are my preliminary answers to some of the expected answers. Firstly, I know that sizeof () does not work like that. I just use it to get an idea. Secondly, suppose you need to do this with an array, not with pointers (a solution using pointers is possible and quite simple). Thirdly, I know that I can get the start and end addresses of .region_bss, but I don’t know how to use them for my array. At least it doesn't work in C.
It very well cannot be this, but I hope that some genius has figured it out. Extra credit if you can get it working with the Green Hills toolkit.
source
share