Lab 10: Programming the Flash
the linker has been asked to generate symbols for the load start, load end, and run start
addresses.
While not a requirement from a DSP hardware perspective (since the C28x DSP has a
unified memory architecture). Code Composer Studio generally prefers code to be linked
to program space (and data to be linked to data space). Therefore, notice that for the
L1SARAM memory we are linking “secureRamFuncs” to, we are specifiying
“PAGE = 0”(which is program space). The L1SARAM memory is currently defined in
data space in the Lab.cdb, but in the next step we will redefine it to exist in the
program space.
10. Using the DSP/BIOS configuration tool (Lab.cdb) modify the entry for L1SARAM so
that it is defined in the program space (code).
11. Open and inspect Main_10.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.
12. Add a line of code to main() to call the InitFlash() function. There are no passed
parameters or return values. You just type
InitFlash();
at the desired spot in main().
Code Security Module and Passwords
The CSM module provides protection against unwanted copying (i.e. pirating!) of your code from
flash, OTP memory, and the L0 and L1 RAM blocks. The CSM uses a 128-bit password made
up of 8 individual 16-bit words. They are located in flash at addresses 0x3F7FF8 to 0x3F7FFF.
During this lab, dummy passwords of 0xFFFF will be used – therefore only dummy reads of the
password locations are needed to unsecure the CSM. DO NOT PROGRAM ANY REAL
PASSWORDS INTO THE DEVICE. After development, real passwords are typically placed in
the password locations to protect your code. We will not be using real passwords in the
workshop.
The CSM module also requires programming values of 0x0000 into flash addresses 0x3F7F80
through 0x3F7FF5 in order to properly secure the CSM. Both tasks will be accomplished using a
simple assembly language program Passwords.asm.
13. Add Passwords.asm to your CCS project.
14. Open and inspect Passwords.asm. This file specifies the desired password values
(DO NOT CHANGE THE VALUES FROM 0xFFFF)
and places them in an initialized
section named “passwords”. It also creates an initialized section named
“csm_rsvd” which contains all 0x0000 values for locations 0x3F7F80 to 0x3F7FF5
(length of 0x76).
10 - 22 C28x - System Design