Skip to content
Discussion options

You must be logged in to vote

Hi Matheus, good question! If I understand your post correctly, your problem stems mostly from trying to manage global variables using external tools, right?

In that case, as an aside, you can specify an ELF section of your choosing when declaring globals: uint32_t global_var __section(".data.myconfig");. This is really useful for dividing globals into categories. It'll also result in more predictable behaviour compared to relying on .bss, since the compiler typically puts any zero-initialized variable there, including static vars with local scope.

Now, if you specify a default value for a global in your C code (uint32_t global_var = 42), it'll suddenly appear in .data instead of .bss, br…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mscastanho
Comment options

Answer selected by mscastanho
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants