Hi,
In the function _c_int00, I need to work with the value of a global defined variable in a different .C file.
My idea is to store it's value into one CPU register and then restore it to it's original location after the global variables initialisation.
I know that there is a linker option to avoid the initialisation of the global variables, but I can not use it for the moment (--zero_init=off).
For that I'm doing the following implementation that works as expected but generates a warning message:
Texas Instruments TMS470 Code Generation Tools Version 4.9.0
----------------------------------------------------------------------------------------------------------------------------
asm (" .global TestVar00"); /*External global variable defined in a different C file*/
#pragma INTERRUPT(_c_int00, RESET)
void _c_int00 (void)
{
/*Operations using AddressTestVar00 and working with CPU registers in assembly */
... store the TestVar00 value into a cpu register
...
/*Initialisation of copy tables and global variables*/
...
...
...
/*Operations using AddressTestVar00 and working with CPU registers in assembly */
... restore the TestVar00 value from a cpu register
...
/* call the application */
main();
asm ("AddressTestVar00 .word TestVar00"); /*WARNING #1119-D*/
}
----------------------------------------------------------------------------------------------------------------------------
From the map file:
local AddressTestVar00 (.text:retain)
And I get the following warning:
warning #1119-D: this assembly directive potentially unsafe inside a function
So I tried to move the line that produces the warning outside from the C function but it does not work, as seems that "AddressTestVar00" is created in a different section:
From the map file:
local AddressTestVar00 (.text)
And I get the following ERRORS(the compilation fails):
[E0001] Address must be defined in the current section
ldr r10, AddressTestVar00
[E0004] Illegal operand
ldr r10, AddressTestVar00
Could you please help me to clarify the following items:
1. Why is that assembly directive potentially unsafe inside a function??
2. How could I fix my implementation to avoid that potentially unsafe situation?? (I do not want to suppress the warning message)
Thanks