5. Open and inspect Flash.c. The C compiler CODE_SECTION pragma is used to place
the InitFlash() function into a linkable section named “secureRamFuncs”.
6. The “secureRamFuncs” section will be linked using the user linker command file
Lab_4.cmd. Open and inspect Lab_4.cmd. The “secureRamFuncs” will load to
flash (load address) but will run from L0SARAM (run address). Also notice that the
linker has been asked to generate symbols for the load start, load end, and run start
addresses.
While not a requirement from a MCU hardware or development tools perspective (since
the C28x MCU has a unified memory architecture), historical convention is to link code
to program memory space and data to data memory space. Therefore, notice that for the
L0SARAM memory we are linking “secureRamFuncs” to, we are specifiying “PAGE
= 0” (which is program memory).
7. Open and inspect Main_4.c. Notice that the memory copy function memcpy() is being
used to copy the section “secureRamFuncs, which contains the initialization function
for the flash control registers.
8. The following line of code in main() is used call the InitFlash() function. Since
there are no passed parameters or return values the code is just:
InitFlash();
at the desired spot in main().