EasyManuals Logo

Texas Instruments TMS320F2837 D Series Workshop Guide And Lab Manual

Texas Instruments TMS320F2837 D Series
324 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 #266 background imageLoading...
Page #266 background image
Lab 10: Programming the Flash
10 - 18 TMS320F2837xD Microcontroller Workshop - System Design
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.
5. Add (copy) Flash.c to the project from C:\C28x\Labs\Lab10\source.
6. Open and inspect Flash.c. The C compiler CODE_SECTION pragma is used to place
the InitFlash() function into a linkable section named “secureRamFuncs”.
7. The “secureRamFuncs” section will be linked using the user linker command file
Lab_10.cmd. In Lab_10.cmd the “secureRamFuncs” will load to flash (load address)
but will run from RAMLS5 (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
RAMLS5 memory we are linking “secureRamFuncs” to, we are specifiying “PAGE = 0”
(which is program memory).
8. 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.
9. 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().
Dual Code Security Module and Passwords
The DCSM module provides protection against unwanted copying (i.e. pirating!) of your code
from flash, OTP, LS0-5 RAM blocks, D0-1 RAM blocks, and CLA memory blocks. The DCSM
uses a 128-bit password made up of 4 individual 32-bit words. They are located in the OTP.
During this lab exercise, dummy passwords of 0xFFFFFFFF will be used – therefore only dummy
reads of the password locations are needed to unsecure the DCSM. 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. Again, DO NOT CHANGE THE VALUES FROM 0xFFFFFFFF.
Executing from Flash after Reset
The F28379D device contains a ROM bootloader that will transfer code execution to the flash
after reset. When the boot mode selection is set for “Jump to Flash” mode, the bootloader will
branch to the instruction located at address 0x080000 in the flash. An instruction that branches
to the beginning of your program needs to be placed at this address. Note that BEGIN_FLASH
begins at address 0x080000. There are exactly two words available to hold this branch
instruction, and not coincidentally, a long branch instruction “LB” in assembly code occupies
exactly two words. Generally, the branch instruction will branch to the start of the C-environment
initialization routine located in the C-compiler runtime support library. The entry symbol for this
routine is _c_int00. Recall that C code cannot be executed until this setup routine is run.

Table of Contents

Other manuals for Texas Instruments TMS320F2837 D Series

Questions and Answers:

Question and Answer IconNeed help?

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

Texas Instruments TMS320F2837 D Series Specifications

General IconGeneral
BrandTexas Instruments
ModelTMS320F2837 D Series
CategoryMicrocontrollers
LanguageEnglish

Related product manuals