Message Edited by IronTek on 05-12-200609:33 AM
Message Edited by IronTek on 05-12-200610:10 AM
Message Edited by IronTek on 05-12-200610:10 AM
Solved! Go to Solution.
Hello
I assume you have defined your own application entry point (implemented in your assembly source file) and at the end you are jumping to _Startup.
Am I right?
Within the _Startup function, we are initializing all global variable with 0.
That means when you reach the main function, the variable post_Status is initialized with 0 again (and you will not see 0xBEEF there).
In order to make sure the startup code does not initialize variables with 0, you need to define them in a memory area defined as NO_INIT (rather than READ_WRITE).
So basically:
1- Define the¨variable in a user defined segment using
#pragma DATA_SEG myTestData
uint16 post_status;
#pragma DATA_SEG myTestData
2- In the PRM file allocate the segment MyTestData in a NO_INIT memory area:
SEGMENTS
RAM = READ_WRITE 0x1000 TO 0x3FFD;
RAM_2 = NO_INIT 0x3FFE TO 0x3FFF;
...
END
PLACEMENT
myTestData INTO RAM_2;
...
END
This should do it.
Alternatively instead of defining a user define segment, you can specify your variable is allocated at absolute address 0x3FFE in the following way:
uint16 post_status @0x3FFE;
and modify the definition of RAM memory area in the PRM file as follows:
RAM = READ_WRITE 0x1000 TO 0x3FFD;
This also works.
I hope this helps.
CrasyCat
Hello
I assume you have defined your own application entry point (implemented in your assembly source file) and at the end you are jumping to _Startup.
Am I right?
Within the _Startup function, we are initializing all global variable with 0.
That means when you reach the main function, the variable post_Status is initialized with 0 again (and you will not see 0xBEEF there).
In order to make sure the startup code does not initialize variables with 0, you need to define them in a memory area defined as NO_INIT (rather than READ_WRITE).
So basically:
1- Define the¨variable in a user defined segment using
#pragma DATA_SEG myTestData
uint16 post_status;
#pragma DATA_SEG myTestData
2- In the PRM file allocate the segment MyTestData in a NO_INIT memory area:
SEGMENTS
RAM = READ_WRITE 0x1000 TO 0x3FFD;
RAM_2 = NO_INIT 0x3FFE TO 0x3FFF;
...
END
PLACEMENT
myTestData INTO RAM_2;
...
END
This should do it.
Alternatively instead of defining a user define segment, you can specify your variable is allocated at absolute address 0x3FFE in the following way:
uint16 post_status @0x3FFE;
and modify the definition of RAM memory area in the PRM file as follows:
RAM = READ_WRITE 0x1000 TO 0x3FFD;
This also works.
I hope this helps.
CrasyCat