1.What is the starting address after DSP reset?
0x3FFFC0
2. What are the steps to burn a program into the emulator?
Burn the program to the specified location according to the cmd file and then execute it.
3.What is the Flash boot process of DSP?
First, the hardware configuration GPIO84~87 is pulled up to 1, which means it is in the Flash boot process. When the DSP is reset, it will get the reset vector from the reset vector 0x3FFFC0 and jump to InitBoot to start execution. InitBoot will read the values of GPIO84~87 and find that they are all 1, judging it as Flash boot mode. Then it will jump to 0x33FFF6 to execute. In the cmd file of the CCS5.2 project, there is the following code:
MEMORY
{
PAGE 0 :
BEGIN : origin = 0x33FFF6, length = 0x000002 /* Boot to M0 will go here */
...
}
SECTIONS
{...
codestart : > BEGIN PAGE = 0
...}
That means putting the codestart segment at 0x33FFF6. The file "DSP2833x_CodeStartBranch.asm" has the definition of the codestart segment. In fact, the codestart segment only contains a jump instruction, which jumps the program to _c_int00. _c_int00 is defined in boot.asm in RTS library. The code of _c_int00 will eventually call the main function of c, and then the main function will be executed.
4. How to burn code into flash and run it on F28335?
First, add C:\ti\controlSUITE\device_support\f2833x\v133\DSP2833x_common\cmd\F28335.cmd. This file is the TI official configuration file for configuring the code to flash.
Then refer to C:\ti\controlSUITE\device_support\f2833x\v133\DSP2833x_examples_ccsv4\flash_f28335. Add the following code:
MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);Copies some code that runs in memory from flash to memory, and then the program can run normally.
5. The written code can run normally in RAM, but after being burned into flash, the function DSP28x_usDelay() cannot run normally. Why?
Because there is .sect "ramfuncs" in DSP2833x_usDelay.asm, that is, the function is defined in the segment "ramfuncs", and this segment needs to be run in memory, so the function needs to be used
MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart); copies the ramfuncs segment to the memory and then runs it. This design is because the function DSP28x_usDelay() requires a high running speed for accurate operation, so it must be placed in the segment "ramfuncs".
6.How to interpret the following code in cmd?
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 the RAML0 of PAGE0.
LOAD_ START (_RamfuncsLoadStart) causes the compiler to create a variable RamfuncsLoadStart, which points to the first address of the loading address of the segment ramfuncs (LOAD_ START is a compilation pseudo-instruction, please see the help document of CCS);
LOAD_ START (_RamfuncsLoadEnd) causes the compiler to create a variable RamfuncsLoadEnd, which points to the last address of the loading address of the segment ramfuncs (LOAD_ END is a compilation pseudo-instruction, please see the help document of CCS);
LOAD_ START (_RamfuncsRunStart) causes the compiler to create a variable RamfuncsRunStart, which points to the first address of the running address of the segment ramfuncs (LOAD_ START is a compilation pseudo instruction, please refer to the CCS help document);
From the 1st and 2nd lines, it can be seen that the loading address and running address of the function DSP28x_usDelay() in the segment ramfuncs are different. In this program, it is loaded into the Flash block FLASHD and runs 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 made the following declarations in the file DSP2833x_GlobalPrototypes.h:
extern Uint16 RamfuncsLoadStart;
extern Uint16 RamfuncsLoadEnd;
extern Uint16 RamfuncsRunStart;
Then it can be used. In Main.c, use the MemCopy() function to copy the code of the function DSP28x_usDelay() in the ramfuncs segment from the loading 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.
7. How to put a function into RAM to run?
Refer to the InitFlash function in the TI header file. These functions will be declared in CODE_SECTION. For example: #pragma CODE_SECTION(InitFlash, "ramfuncs");
|