Summary - How the code into the DSP28335 of Flash in the CCS5.5.0

This article is reproduced connection:  https://blog.csdn.net/GSH_Hello_World/article/details/52187882

The program was originally programmed into a DSP chip RAM is modified to be programmed into the FLASH program of the DSP chip, you require the following steps:

1. Add DSP2833x_CodeStartBranch.asm file
to add D: \ tidcs \ c28 \ DSP2833x \ v131 \ DSP2833x_common \ source \ DSP2833x_CodeStartBranch.asm file, which is responsible for program execution sequence jumps after power-on;

2. Add DSP281x_Headers_nonBIOS.cmd file
Add D: \ tidcs \ c28 \ DSP2833x \ v131 \ DSP2833x_headers \ cmd \ DSP2833x_Headers_nonBIOS.cmd files, header files for DSP28 peripheral structure memory address correspondence;

3. Delete 28335_RAM_lnk.cmd file
to 28335_RAM_lnk.cmd removed from the project file, right-choice 28335_RAM_lnk.cmd then choose delete;

4. Add F28335.cmd file
right click project name, then select add file to project, and then browse box appears, in D: \ tidcs \ c28 \ DSP2833x \ v131 \ \ cmd subfolders under DSP2833x_common this folder, select F28335.cmd, point OK, now you can see the list of files in a project of F28335.cmd be added to the project;

5. Add two lines
() function to add the following statement in main:
 

MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);
     InitFlash();

Add the above two sentences in InitPieVectTable (); sentence following line, add the statement of the time, be careful not to add wrong, every letter must be correct, brackets have to use English in brackets;
6. Add DSP2833x_MemCopy.c file
Right select the project name, then select add file to project, and then browse box appears, locate the D: \ tidcs \ c28 \ DSP2833x \ v131 \ DSP2833x_common \ DSP2833x_MemCopy.c file source folder, then OK;

7. MODE select the Boot
the DSP development board DIP switches are toggle ON, meaning essentially of: F28335 the GPIO84, GPIO85, GPIO86, GPIO87 with four pins 1k to 10k is pulled between 3.3V resistor, this put boot mode selected DSP mode inside the boot program from the FLASH;

8. Debug compilation after
compilation Debug can be carried out after no errors, then the code into the FLASH, instead of the RAM, as shown below:

9. Notes
(1) downloaded from the emulator if you want to re-power operation, must be cut off and JTAG emulator board connection, or run the program will go wrong, before I only put USB on the computer and disconnect emulator while the JTAG interface is not open, so the operation is not a normal phenomenon, which is very important!
(2) is not the correct program RAM to run, it must also run in the FLASH correctly.

This is because the same program in the DSP RAM to run the time spent is much shorter than the time run in FLASH. If, there is an interrupt function cpu_timer_isr10ms (), the function generates an interrupt every 10ms timer is triggered by the CPU 1, automatically jump into the execution time. This cpu_timer_isr1ms () comprises three internal sub-functions is sequentially adc_sanple (), pwm_update (), gpio_toggle ():

cpu_timer_isr1ms()
{
adc_sanple();
pwm_update();
gpio_toggle();
}
 

Assuming adc_sanple () subroutine performed this time in the RAM is 1ms, pwm_update () subroutine performed this time in the RAM is 2ms, gpio_toggle () subroutine performed this time in the RAM is 3ms, so 1+ 2 + 3 = 6 <10, so there is no problem in the above RAM these programs can run well.
However, if you run the programs listed above into the FLASH likely adc_sanple () subroutine execution time in this FLASH is 3ms, pwm_update () subroutine execution time in this FLASH is 7ms, this is because the same program in the DSP RAM to run the time spent is much shorter than the time run in FLASH. The first two such functions took 10ms are used up, there is Lunbu Shang gpio_toggle () This subroutine is executed, he was forced to terminate the DSP, so do not see the phenomenon gpio_toggle (); and
(3) Load program to be out of RAM file and can be cured (programmed) to FLASH out content files are different;

(4) When the general use of CCS simulator, we burn the program into RAM to run, so fast speed, easy development and debugging actual project, this time with a 28335_RAM_lnk.cmd file; when the project is completed, we will choose Flash burned into the program in order to get rid of dependence on imitation really is when we use f28335.cmd connection file, the program will burn into the interior of 28335 Flash, in which case, you can run out of the simulator, and from Flash start up.

What Flash boot process (5) DSP is?
First, the hardware configuration of an pull GPIO84 ~ 87, i.e. in the Flash boot process. When the DSP is reset, it will obtain from the reset vector 0x3FFFC0 reset vector, and begins execution jumps to InitBoot, InitBoot GPIO84 ~ 87 will read the value of 1 is determined to find the full Flash starts. Then it will jump 0x33FFF6 Branch. Cmd following code files in the project CCS5.2:
the MEMORY
{
PAGE 0:
   the BEGIN: Origin = 0x33FFF6, length = 0x000002    
...
}
a SECTIONS
{...
the codestart:> = 0 the BEGIN PAGE
...}
means that the placed at the para position codestart 0x33FFF6, the file "DSP2833x_CodeStartBranch.asm" are defined in codestart segment actually contains only a segment codestart jump instruction, is a jump to the program at _c_int00, in boot.asm in RTS _c_int00 Library there are defined, _c_int00 c code eventually calls the main function is executed after the main function.

(6) cmd in the following code how to interpret?
   ramfuncs: the LOAD = FLASHD, 
                         the RUN = RAML0, 
                         LOAD_START (_RamfuncsLoadStart),
                         LOAD_END (_RamfuncsLoadEnd),
                         RUN_START (_RamfuncsRunStart),
                         PAGE = 0
line 1 represents loaded PAGA0 the segment FLASHD in
row 2 indicates the segment operating address in PAGE0 of RAML0 in
LOAD_ START (_RamfuncsLoadStart) so that the compiler creates a variable RamfuncsLoadStart, the variable points of the segment ramfuncs load address of the first address (LOAD_ START compiler directives, see the help document CCS);
LOAD_ the START (_RamfuncsLoadEnd ) order compiler creates a variable RamfuncsLoadEnd, the variable pointing to the end of the address segment load address ramfuncs (LOAD_ eND compiler directive, see the help documentation CCS);
RUN_ the START (_RamfuncsRunStart) order compiler creates a variable RamfuncsRunStart this variable points to the first address segment ramfuncs run address (LOAD_ START compiler directives, see the help documentation CCS);
As can be seen from lines 1 and 2, the function of ramfuncs DSP28x_usDelay segment () load and run addresses are different, this program is loaded in block FLASHD Flash, it operates in SARAM L0, which is only a target, DSP actual operation will not be automatically copied to the Flash code SARAM and therefore need to add code to complete manually.
In the C function, in order to use variable RamfuncsLoadStart, RamfuncsLoadEnd and RamfuncsRunStart, you must first declare that this project made the following statement in the file DSP2833x_GlobalPrototypes.h:
extern Uint16 RamfuncsLoadStart;
extern Uint16 RamfuncsLoadEnd;
extern Uint16 RamfuncsRunStart;
then you can use. In Main.c using MEMCOPY () function is a function of ramfuncs DSP28x_usDelay segment () copy of the code from the load address space RamfuncsLoadStart-RamfuncsLoadEnd RamfuncsRunStart to start the SARAM. After the run time, just call DSP28x_usDelay () function are automatically directed SARAM corresponding function entry address, and this is done automatically. MemCopy () function prototype in MemCopy.c in, DSP2833x_GlobalPrototypes.h statement.

Released six original articles · won praise 189 · views 280 000 +

Guess you like

Origin blog.csdn.net/newbie_xymt/article/details/103862242