EasyManuals Logo

Texas Instruments C2000 Workshop Guide And Lab Manual

Texas Instruments C2000
342 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #286 background imageLoading...
Page #286 background image
Lab 12: Programming the Flash
12 - 16 C2000 Microcontroller Workshop - System Design
Copying Interrupt Vectors from Flash to RAM
The interrupt vectors must be located in on-chip flash memory and at power-up needs to be
copied to the PIE RAM as part of the device initialization procedure. The code that performs this
copy is located in InitPieCtrl(). The C-compiler runtime support library contains a
memory copy function called memcpy() which will be used to perform the copy.
5. Open and inspect InitPieCtrl() in PieCtrl.c. Notice the memcpy() function used to
initialize (copy) the PIE vectors. At the end of the file a structure is used to enable the
PIE.
Initializing the Flash Control Registers
The initialization code for the flash control registers cannot execute from the flash memory (since
it is changing the flash configuration!). Therefore, the initialization function for the flash control
registers must be copied from flash (load address) to RAM (run address) at runtime. The memory
copy function memcpy() will again be used to perform the copy. The initialization code for the
flash control registers InitFlash() is located in the Flash.c file.
6. Add Flash.c to the project.
7. Open and inspect Flash.c. The C compiler CODE_SECTION pragma is used to place
the InitFlash() function into a linkable section named “secureRamFuncs”.
8. The secureRamFuncs” section will be linked using the user linker command file
Lab_12.cmd. Open and inspect Lab_12.cmd. The secureRamFuncswill load
to flash (load address) but will run from L4SARAM (run address). Also notice that the
linker has been asked to generate symbols for the load start, load size, 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
L4SARAM memory we are linking secureRamFuncsto, we are specifiying “PAGE
= 0” (which is program memory).
9. Open and inspect Main_12.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.
10. Add a line of code in 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, L1, L2, L3 and L4 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

Table of Contents

Other manuals for Texas Instruments C2000

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments C2000 and is the answer not in the manual?

Texas Instruments C2000 Specifications

General IconGeneral
BrandTexas Instruments
ModelC2000
CategoryMicrocontrollers
LanguageEnglish

Related product manuals