This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

__attribute__((section("name"))) variable attribute

Hi,

I'm trying to have a certain variable lets say "const uint8_t Version[4] = {0x01,0x02,0x03,0x04}" at a specific place memory region.
For doing so i've used the section attribute of "__attribute__((section("name"))) variable attribute".
Here is the definition:
const uint8_t Version[4] __attribute__((section("VER_SECTION"))) = {0x01,0x02,0x03,0x04};

I've also added another execution region in the corresponding scatter file like below:
ER_VER __VER_BASE __VER_SIZE
 {
        opcodes.o (VER_SECTION)
 }

However during link stage i got the below error:
" Warning: L6329W: Pattern opcodes.o(VER_SECTION) only matches removed unused sections"

I though that using the "--keep" linker flag will help to solve the problem so i tried:
--keep="opcodes.o (VER_SECTION)"
but it didn't help.

Your help will be appreciated.

BTW, regarding "section attribute" usage i understood that "The section attribute specifies that a variable must be placed in a particular data section". While my variable is of const uint8_t which means it goes into RO/CODE area - maybe this is the problem root cause?

Thanks,
Ronen