How to interpret the following code in F28335cmd?[Copy link]
ramfuncs : LOAD = FLASHD, RUN = RAML0, LOAD_START(_RamfuncsLoadStart), LOAD_END(_RamfuncsLoadEnd), RUN_START(_RamfuncsRunStart), PAGE = 0 The first line indicates that the segment is loaded in the FLASHD of PAGA0 The second line indicates that the running address of the segment is in RAML0 of PAGE0 LOAD_ START(_RamfuncsLoadStart) causes the compiler to create a variable RamfuncsLoadStart, which points to the first address of the load address of the segment ramfuncs (LOAD_ START is a compilation pseudo-instruction, please see the help document of CCS); LOAD_ START(_RamfuncsLoadEnd) instructs the compiler to create a variable RamfuncsLoadEnd, which points to the end address of the load address of the segment ramfuncs (LOAD_ END is a compilation pseudo-instruction, please see the help document of CCS); LOAD_ START(_RamfuncsRunStart) instructs the compiler to create a variable RamfuncsRunStart, which points to the first address of the run address of the segment ramfuncs (LOAD_ START is a compilation pseudo-instruction, please see the help document of CCS); From the first and second lines, it can be seen that the load address and run address of the function DSP28x_usDelay() in the segment ramfuncs are different. In this program, it is loaded into the Flash block FLASHD and run in SARAM L0. This is just a goal. During actual operation, DSP will not automatically copy the code in Flash to SARAM, so it is necessary to manually add code to complete it. In the C function, in order to use the variables RamfuncsLoadStart, RamfuncsLoadEnd and RamfuncsRunStart, they must be declared first. This project makes the following declarations in the file DSP2833x_GlobalPrototypes.h: extern Uint16 RamfuncsLoadStart; extern Uint16 RamfuncsLoadEnd; extern Uint16 RamfuncsRunStart; Then you can use them. In Main.c, use the MemCopy() function to copy the code of the function DSP28x_usDelay() in the segment ramfuncs from the load address RamfuncsLoadStart-RamfuncsLoadEnd to the SARAM space starting from RamfuncsRunStart. After that, when the program is running, as long as the DSP28x_usDelay() function is called, it will automatically point to the corresponding function entry address in SARAM. This is done automatically. The prototype of the MemCopy() function is in MemCopy.c and declared in DSP2833x_GlobalPrototypes.h.