This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi
My application is F28335 based with ccs3.3 and bios. Previoulsy my applicatoin runs fine from RAM . I have followed SPRA958I to Run my code from flash using on chip flash programmar in ccs 3.3 and black hawk usb 2000. I have changed the linker file using bios configuration memory sectoin manager according to Table 3.2 in SPRA958i. I can download my code in flash, and i see my main() to be on 0x00300100. But when i try to Copy the .hwi_vec Section from load address in flash to run address in RAM as described in section 4.2 of SPRA958i using memcpy functoin i get follwing compilation error
" argument of type "unsigned int *" is incompatible with parameter of type "unsigned long. "
The code i have added in my main is as follwing
extern unsigned int hwi_vec_loadstart; // declared as gloabl to file
extern unsigned int hwi_vec_loadsize; // declared as gloabl to file
extern unsigned int hwi_vec_runstart; // declared as global to file
asm(" EALLOW"); /* Enable EALLOW protected register access */ // These 3 lines are added inside the main() fucntion
memcpy(&hwi_vec_runstart, &hwi_vec_loadstart, &hwi_vec_loadsize);
asm(" EDIS"); /* Disable EALLOW protected register access */
Please help me in this regard
Ahmed Shakeel
Looking at the code briefly, and not knowing the memcpy function off by heart I think your problem is as follows:
Change: &hwi_vec_loadsize to hwi_vec_loadsize
The reason I say this as this fits the error (you are giving it a pointer when it just wants a number). You may also have to cast it since hwi_vec_loadsize is just an unsigned int not an unsigned long. Thus the new line of code would be:
memcpy(&hwi_vec_runstart, &hwi_vec_loadstart, (unsigned long)hwi_vec_loadsize);
Hope that sorts the issue out,
Tim
Dear Tim
Thank you very much for the answer i will try it , i hope this works
Ahmed shakeel
Ahmed,
The standard memcpy does not work here because the type incompatibility. Those symbols are defined in the linkder command file and all of them are references. In some TI examples, you will see there is a vanilla memory copy defined as following:
void MemCopy(Uint16 *SourceAddr, Uint16* SourceEndAddr, Uint16* DestAddr)
{
while(SourceAddr < SourceEndAddr)
{
*DestAddr++ = *SourceAddr++;
}
return;
}
Use this funciton instead of the standard C function in the string.h.
Leong
p.s. this api requires the definition of Load_End instead of Load_Size. for example, In the linker command file define a section to run from RAM.
ramfuncs: LOAD = FLASH,
RUN = RAML4L7,
LOAD_START(_RamfuncsLoadStart),
LOAD_END(_RamfuncsLoadEnd),
RUN_START(_RamfuncsRunStart),
PAGE = 0
In the main call:
MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);
Hi Leong
Thanks for the post, I have tried what is suggested by Tim King when i compile my program i see that the error that i was getting is gone. also since i am using bios , i can already see the follwoing lines means i dont need to define them explicitly in my linker file as suggested by you, i used memcpy for copying interrupt vectors and trcdata .
.hwi_vec: START(_hwi_vec_loadstart), END(_hwi_vec_loadend), SIZE(_hwi_vec_loadsize), RUN_START(_hwi_vec_runstart) {
/* no HWI stubs are necessary */
} load > FLASH PAGE 0, run > PIEVECT PAGE 1
.trcdata: START(_trcdata_loadstart), END(_trcdata_loadend), SIZE(_trcdata_loadsize), RUN_START(_trcdata_runstart) {
} load > FLASH PAGE 0, run > H0SARAM PAGE 0
But i dont know how to validate that memcpy has actually copied these section from their load address in flash to Run address in Ram. I get following message after flashing code
Erase/Program/Verify Operation in progress...
Erase operation in progress...
Erase operation was successful.
Program operation in progress...
Program operation was successful.
Verify operation in progress...
Verify operation successful.
Load RAM operation in progress...
Load RAM operation was successful.
Warning: This program contains initialized RAM data.
It may run successfully under Code Composer Studio
but not as a standalone system because of this. If
your Flash program requires initialized data in RAM,
you will need to write Flash code to initialize RAM memory.
Erase/Program/Verify Operation succeeded
**** End Erase/Program/Verify Operation. ***
Regards
Ahmed Shakeel