Access bootloader variable

Hey guys,

I have a variable on my arduino zero bootloader that I would like to access from my application.
The variable is constant, and will not change.
This is how I initialize it in the bootloader

unsigned const int __attribute__((section(".version"))) MAGIC_NUMBER=15;

Now I have problem reading it from my application

I tried

uint16_t MAGIC_NUMBER;
void load_versions_consts(){
uint16_t p=0x7FFA;  // the .section(".version") places these constants at the end of FLASH

MAGIC_NUMBER= pgm_read_word_near(&p);
}

However its not returning the stored value, any suggestions? thanks.

arduino zero

uint16_t p=0x7FFA;  // the .section(".version") places these constants at the end of FLASH

The "end of flash" is surely NOT 0x7FFA on an Arduino Zero.
The memory layout of bootloader vs main program is completely different than on an AVR.
AFAIK, the zero bootloader does not have a ".version" section

Thanks for the reply,
What would be the ".version" equivalent for the zero bootloader?
Also pgm_read_word_near(&p) only gives the memory value content of the variable p, which is the address, so it prints the value of the variable p instead of the value of that memory location, I tried using pgm_read_word_near(p) without the "&" but I get compiler error.