I'm compiling using CW10.6 eclipse plugin. I tried to retreive linker defined symbols referencing to memory segments. I used macros taken from MCU_Build_Tools_Utilities, Revised: June 10, 2014, page 100. They are:
#define __SEG_START_REF(a) __SEG_START_ ## a
#define __SEG_END_REF(a) __SEG_END_ ## a
#define __SEG_SIZE_REF(a) __SEG_SIZE_ ## a
#define __SEG_START_DEF(a) extern char __SEG_START_REF(a) []
#define __SEG_END_DEF(a) extern char __SEG_END_REF( a) []
#define __SEG_SIZE_DEF(a) extern char __SEG_SIZE_REF( a) []
I have defined the symbol SHADOW_ROM_S in prm file covering a memory area from 0xFFEE00 to 0xFFEFFF. In my code I define a variable ptTest and I tried the following assigment
char* const ptTest = __SEG_START_REF(SHADOW_ROM_S);
By the way, before previous assigment i used macro __SEG_START_DEF(SHADOW_ROM_S) to declare a variable __SEG_START_SHADOW_ROM_S.
I expected to have ptTest egual to 0xFFEE00 but i got a pointer to 0 instead.
What should I do to get the correct value?
Thanks,
Alessandro
Hi Alessandro,
I don't have a S12Z device so I can not test it.
I've created an example for S12Z and tried it on S12 simulator.
It seems to be running so I think it should work on S12Z too.
I think the problem is may be linked to the initialization of your variable pTest which should be defined as far.
Please have a look to the example attached.
It should work.
Have a great day,
Pascal Irrle
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thanks so much for help.
Regards,
Alessandro
2014-11-27 10:59 GMT+01:00 Pascal Irrle <admin@community.freescale.com>:
<https://community.freescale.com/>
Access linker symbols in S12Z tool chain (eclipse)
reply from Pascal Irrle
<https://community.freescale.com/people/trytohelp?et=watches.email.thread>
in CodeWarrior Development Tools - View the full discussion
<https://community.freescale.com/message/457770?et=watches.email.thread#457770>