2021-06-28 09:37 PM
I had created single task with normal priority. The task has three functions. In one function ,I am writing the 2 byte data into internal SRAM (starting address for e.g. 0x20010204) .The 2 byte data is written on memory addresses 0x20010204 and 0x20010205 respectively. But after completion of one function execution data becomes zero when program control goes into another function call.
The Function I'm using to write sram data as:
uint32_t DummyIP1;
DummyIP1 = 500;
Write_SRAM_Data(ANALOG_INPUT_1,DummyIP1); //ANALOG_INPUT_1 = 0x20010204 ;
//Function defination
void Write_SRAM_Data(uint32_t *ldMemoryAdd,uint32_t lwData)
{
*ldMemoryAdd = lwData;
}
Please suggest that this method is correct or not. If not then suggest correct method for data writing into internal SRAM address and Bit banding addresses.
Thanks!
Anagha
Solved! Go to Solution.
2021-07-02 02:21 AM
Hello @ADank.2 ,
Are you sure that the memory addresses you have chosen are allocated and the linker knows about it?
Otherwise, take a look at this reference to get an idea of how to define variables to an absolute address with gcc :
https://mcuoneclipse.com/2012/11/01/defining-variables-at-absolute-addresses-with-gcc/
BeST Regards,
Walid
2021-07-02 02:21 AM
Hello @ADank.2 ,
Are you sure that the memory addresses you have chosen are allocated and the linker knows about it?
Otherwise, take a look at this reference to get an idea of how to define variables to an absolute address with gcc :
https://mcuoneclipse.com/2012/11/01/defining-variables-at-absolute-addresses-with-gcc/
BeST Regards,
Walid
2021-07-05 09:53 PM
Thanks Walid. It is really helpful for me.
2021-07-06 01:51 AM
Glad to help you :smiling_face_with_smiling_eyes:.