Some experience on DSP parallel FLASH booting
[Copy link]
A few days ago, my homemade DSP board was successfully booted, and I have been planning to write about this for a long time. The DSP I used is 5416, and with it as the core, I made a relatively independent subsystem (hardware, software, algorithm), which has been basically completed. Now I will report to you the work done on FLASH booting, hoping it will be helpful to you. My experience and writing skills are limited, so please forgive me if my writing is not good. Hardware environment:
DSP: TMS320VC5416PGE160
FLASH: SST39VF400A-70-4C-EK are all SMD, FLASH is mapped to 0x8000-0xFFFF in DSP data space
Software environment: CCS v2.12.01
Main program (program to be burned into FLASH): DEBUG version, the program occupies space 0x28000-0x2FFFF (on-chip SARAM), the interrupt vector table is at 0x0080-0x00FF (on-chip DARAM), and the data space uses 0x0100-0x7FFF (on-chip DARAM). Because FLASH is SMD, you need to write a data moving program to move the main program to FLASH. When writing FLASH data, you should also write the format data of the boot table. Finally, write the starting address of the boot table at 0xFFFF in the data space (here is 0x8000).
Migration program: DEBUG version, program space 0x38000-0x3FFFF (on-chip SARAM), interrupt vector table at 0x7800-0x78FF (on-chip DARAM), data space 0x5000-0x77FF (on-chip DARAM). Migration program cannot use the physical space that overlaps with the main program's program space and interrupt vector table to avoid overwriting. When burning, open the projects of the main program and the moving program at the same time, load the main program first, then load the moving program, and then execute the moving program, and the burning is OK! Appendix: Moving program (for reference only)
volatile unsigned int *pTemp=(unsigned int *)0x7e00; unsigned int iFlashAddr;
int iLoop; /* Store parallel boot keywords in the boot header*/
iFlashAddr=0x8000;
WriteFlash(iFlashAddr,0x10aa);
iFlashAddr++; /* Initialize SWWSR value*/
WriteFlash(iFlashAddr,0x7e00);
iFlashAddr++; /* Initialize BSCR value*/
WriteFlash(iFlashAddr,0x8006);
iFlashAddr++; /* Entry address for program execution*/
WriteFlash(iFlashAddr,0x0002);
iFlashAddr++;
WriteFlash(iFlashAddr,0x8085);
iFlashAddr++; /* Program length*/
WriteFlash(iFlashAddr,0x7f00);
iFlashAddr++; /* Address where the program is to be loaded*/
WriteFlash(iFlashAddr,0x0002);
iFlashAddr++;
WriteFlash(iFlashAddr,0x8000);
iFlashAddr++;
for (iLoop=0;iLoop<0x7f00;iLoop++)
{ /* Read data from program space and put it in temporary storage unit*/
asm(" pshm al");
asm(" pshm ah");
asm(" rsbx cpl");
asm(" ld #00fch,dp");
asm(" stm #0000h, ah");
asm(" MVDM _iLoop, al");
asm(" add #2800h,4,a");
asm(" reada 0h");
asm(" popm ah");
asm(" popm al");
asm(" ssbx cpl"); /* Write the temporary storage unit content to FLASH */
WriteFlash(iFlashAddr,*pTemp);
iFlashAddr++; } /* Interrupt vector table length*/
WriteFlash(iFlashAddr,0x0080);
iFlashAddr++; /* Interrupt vector table loading address*/
WriteFlash(iFlashAddr,0x0000);
iFlashAddr++;
WriteFlash(iFlashAddr,0x0080);
iFlashAddr++;
for (iLoop=0;iLoop<0x0080;iLoop++) { /* Read data from program space and put it in temporary storage unit*/
asm(" pshm al");
asm(" pshm ah");
asm(" rsbx cpl");
asm(" ld #00fch,dp");
asm(" stm #0000h, ah");
asm(" MVDM _iLoop, al");
asm(" add #0080h,0,a");
asm(" reada 0h");
asm(" popm ah");
asm(" popm al");
asm(" ssbx cpl"); /* Write the temporary storage unit content to FLASH */
WriteFlash(iFlashAddr,*pTemp);
iFlashAddr++;
} /* Write the end mark of the boot table*/
WriteFlash(iFlashAddr,0x0000);
iFlashAddr++;
WriteFlash(iFlashAddr,0x0000); /* Write the start address of the boot table in the data space 0xFFFF*/
iFlashAddr=0xffff;
WriteFlash(iFlashAddr,0x8000);
|