I want to place a function void loadableSW (void)
at a specific location:0x3FF802
. In another function residentMain()
I will jump to this location using pointer to function. How to declare function
loadableSW
to accomplish this. I have attached the skeleton of residentMain
for clarity.
Update: Target hardware is TMS320C620xDSP. Since this is an aerospace project, deterministic
behaviour is a desirable design objective. Ideally, they would like to know what portion of memory contains what at a particular time. The solution as I just got to know is to define a section in memory in the linker file. The section shall start at 0x3FF802
(Location where to place the function). Since the size of the loadableSW
function is known, the size of the memory section can also be determined. And then the directive #pragma CODESECTION ("function_name", "section_name")
can place that function in the specified section.
Since pragma
directives are not permissible in test scripts, I am wondering if there is any other way to do this without using any linker directives.
Besides I am curious. Is there any placement syntax for functions in C++? I know there is one for objects, but functions?
void residentMain (void)
{
void (*loadable_p) (void) = (void (*) (void)) 0x3FF802;
int hardwareOK = 0;
/*Code to check hardware integrity. hardwareOK = 1 if success*/
if (hardwareOK)
{
loadable_p (); /*Jump to Loadable Software*/
}
else
{
dspHalt ();
}
}