I make a project in codewarrior, there is a error report like below:
Error : illegal 16-bit relocation for symbol __MBAR init_bsp.c line 64 }
the error code as follow:
#define MCF_SYSTEM_PLL_CONTROL (*(volatile uint_32*)(void*)(&__MBAR[0x008A0C]))
void _bsp_pll_control_init(void)
{
MCF_SYSTEM_PLL_CONTROL = 0x80004235;
}
Could you tell me what wrong in the code?
Thank you very much.
hi jason,
you do one thing.......
change your code like this and then compile.
Some times our compiler can't able to understand &__ so this is also give you the same meaning.
so do this and check once again.hope this will do..
#define MCF_SYSTEM_PLL_CONTROL (*(volatile uint_32*)(void*)(MBAR+0x008A0C))
All the best
Hi, Thank you very much,
But is it same mean? and I change the define, but still another error
Error : undefined identifier 'MBAR'
init_bsp.c line 64 *(volatile uint_32*)(void*)(MBAR+0x008A0C)) = 0x80004235;
should I redefine the MBAR in a headfile?
I replant some code to MCF5482, there are so many &__MBAR, is it can be compiler in codewarrior6.2?
Thank you again.
Hai,
Of course it's a same meaning.don't worry it will work.
In that condition only that .c file have all these MBAR problem i hope.SO change all MBAR on the way you changed last time([mabar+0x0000..])
and in that file above all these things add
#define MBAR 0x10000000
Hope definatly this will solve your problem.
Bye
~manju
Hi manju:
Thank you, it is ok follow your opinion.
I have another question, I define the symbol in link file like below:
SECTIONS
{
___INTERNAL_SRAM_BASE = 0x20000000;
…………
.kernel_data : AT(ADDR(.main_application_data) + SIZEOF(.main_application_data))
{
. = ALIGN(0x10);
___EXTERNAL_SRAM_DATA_START = .;
}
…………
}
but the CW report a link error like below:
Link Error : Illegal 16-bit small data area relative reference to symbol '___EXTERNAL_SRAM_DATA_START'
from address 0x01F07DCC in section '.text' of file 'm548xbsp_d.a raminit.o '.
Do you know where is the problem? Iused the CW7.1.
Thank you again.
Jason
Hi Jason,
I think this is the error not because of your coding.
it should be because of your sram config settings...
be sure the access path which you set and all the settings which is in settings are correct.
Only because of your setting mistakes you will get these linker errors...
give a try....
All the best
This is an old thread but it comes up on a google search so I thought I'd update it.
The root cause of the probelms with illegal 16-bit relocations seems to be that the variables defined by the linker are stored in the small data area. To resovle this I changed the project setting so that no data is stored in the small data area.
Perhaps there is a way to specify that data below a certain size goes into the SDA without including the symbols defined in the linker command file but that is beyond my current level of expertise.