Other Parts Discussed in Thread: LAUNCHXL-F2800137
Tool/software:
Hello,
I have an issue with my code.
The code based on universal_motor_control_lab.
At the begining of the code, in the main, some data RAM are cleared using for example:
HAL_clearDataRAM((void *)loadStart_est_data, (uint16_t)loadSize_est_data);
loadStart_est_data and loadSize_est_data are defined by the linker with the following in cmd file:
est_data : > RAMLS0F, LOAD_START(loadStart_est_data), LOAD_END(loadEnd_est_data), LOAD_SIZE(loadSize_est_data)
And in hal.h, the following is declared.
extern uint32_t loadStart_est_data; extern uint32_t loadEnd_est_data; extern uint32_t loadSize_est_data;
I try to reproduce it for another RAM location but it doesn't work, the following clear a data section which is not the expected one (it clears from adress 0x00000000 so it clears some usefull information written by the boot rom code).
The issue is coming from :
HAL_clearDataRAM((void *)loadStart_sta_data, (uint16_t)loadSize_sta_data);
loadStart_sta_data and loadSize_sta_data are declared identically in hal.h.
And in the command file, it is a little bit different :
.sectionRAM_DATA_safety : {sta_tests.obj(.data), stl_sp.obj(.data), ref_crc.obj(.data), sta_tests.obj(.bss), sta_user.obj(.bss), //sta_util.obj(.data,.bss), sta_motor_application.obj(.data,.bss)} > BASE_RAMLS0D_SAFETY_DATA, LOAD_START(loadStart_sta_data), LOAD_END(loadEnd_sta_data), LOAD_SIZE(loadSize_sta_data)
Using the debugger, I can see that the value of loadStart_sta_data and loadSize_sta_data is correct (using a breakpoint, when the cursor is above the data name) but once the code execution is in HAL_clearDataRAM((void *)loadStart_sta_data, (uint16_t)loadSize_sta_data);
void HAL_clearDataRAM(void *pMemory, uint16_t lengthMemory)
{
uint16_t *pMemoryStart;
uint16_t loopCount, loopLength;
pMemoryStart = pMemory;
loopLength = lengthMemory;
for(loopCount = 0; loopCount < loopLength; loopCount++)
{
*(pMemoryStart + loopCount) = 0x0000;
}
} //end of HAL_clearDataRAM() function
The start adress switch to zero which cause the issue.
I can not find the issue, can I have some help?
Regards.