Download presentation
Presentation is loading. Please wait.
1
Creating A Stand-Alone System
Chapter 14 C6000 Integration Workshop T TO Technical Training Organization Copyright © 2005 Texas Instruments. All rights reserved.
2
Technical Training Organization
Outline Flow of events in the system Programming Flash Flash Programming Procedure Debugging ROM’d code Lab T TO Technical Training Organization
3
Creating a Stand-alone System
Flash RAM C6x CPU CCS Codec S D R A M S R A M . What is the flow of events from reset to main()? How do you create a stand-alone system? T TO Technical Training Organization
4
System Timeline Hardware Software Reset H/W Device Reset
5
Technical Training Organization
Reset Reset RESET h/w status actions taken When RESET goes high, the following occurs: Sample endian pin Sample boot pins Many registers are initialized to default values (always a good idea to initialize them anyway) Peripherals are reset Cache: L1 on, L2 off Interrupts off T TO Technical Training Organization
6
System Timeline Hardware Software Reset H/W EDMA Device Reset
Boot Loader
7
Technical Training Organization
What is a Boot Loader? C6000 Src Dest “Boot loader” (EDMA) “slow” “fast” Host P Ext memory Int mem Ext mem In most systems, information must be moved before CPU execution begins. For example: It could be from slow, flash ROM to fast RAM Or, from the host memory to the DSP C6000 uses the EDMA for Memory-to-Memory transfers After boot, CPU always starts executing at address 0 T TO Technical Training Organization
8
C671x Boot L2 L2 CE0 CE1 CE2 CE3 0000_0000 reset ‘C671x CPU EDMA
BOOT Pins RESET Boot Logic Host H P I CE0 CE1 1KBytes CE2 CE3 HD[4:3] Boot Modes Host Boot (HPI) bit ROM bit ROM bit ROM Mode 0: Host boots C671x via HPI Modes 1, 2, 3: Memory Copy EDMA copies from start of CE1 to 0x0 Uses default ROM timings After transfer, PC = 0x0 Bootloader copies 1K bytes Must always boot (No “no-boot” option)
9
C6713 DSK Boot Configuration
User DIP Switches DSP C6713 DSK Config Switch 1 2 3 4 Configuration Little endian Big endian 8-bit EMIF boot from Flash HPI Boot (& EMU boot) 32-bit EMIF boot 16-bit EMIF boot HPI enabled (HPI pins) McASP1 enabled (HPI pins) DSK6713 flash is located at top of CE1 See more details in DSK help files T TO Technical Training Organization
10
C64x Boot L2 L2 0000_0000 reset ‘C64x CPU EDMA BOOT Pins RESET Boot
Logic Host H P I C EMIFA CE0 CE1 CE2 CE3 EMIFB CE0 CE1 1KBytes CE2 CE3 BEA[19:18] Boot Modes 00 None 01 Host Boot (HPI/PCI) 10 EMIFB (8-bit) 11 Reserved Mode 0: No Boot bootmode; CPU starts at 0x0 Mode 1: Host boots C64x via HPI or PCI Mode 2: Memory Copy EDMA copies from start of EMIFB CE1 to 0x0 After transfer, PC = 0x0 Bootloader copies 1K bytes
11
C6416 DSK Boot Configuration
User DIP Switches DSP 1 2 3 4 5 6 7 8 Configuration x Little endian* Big endian EMIFB boot from 8-bit Flash* No Boot Reserved Host Boot 1GHz CPU, 125MHz EMIFA* 720MHz CPU, 125MHz EMIFA 850MHz CPU, 125MHz EMIFA 500MHz CPU, 100MHz EMIFA 600MHz CPU, 100MHz EMIFA DSK6416 flash is located at EMIFB CE1 *By default, all switches set to 0 See more details in DSK help files
12
System Timeline Hardware Software Reset H/W EDMA boot.asm Device Reset
Boot Loader 2nd Boot Loader No Boot or From EPROM or Via HPI Software begins running at address 0 (Reset Vector)
13
Technical Training Organization
User Boot Code boot.asm Your 2nd Boot Loader should perform the following tasks: (Optional) Self-Test routine Configure the EMIF Copy section(s) of code/data Call _c_int00() Code size is limited to 1K bytes 1K memory can be reused using overlay (we do this in an optional lab) BOOT.ASM written in assembly (because it’s called before the C-environment is initialized) ; Configure EMIF ... ; Copy Initialized Sections mvkl FLASH, A0 mvkh FLASH, A0 mvkl IRAM, A1 ; Start Program */ b _c_int00(); T TO Technical Training Organization
14
System Timeline Hardware Software Reset H/W EDMA boot.asm
Provided by TI Device Reset Boot Loader 2nd Boot Loader BIOS_init ( _c_int00 ) No Boot or From EPROM or Via HPI EMIF Self test Load remaining initialized sections Software begins running at address 0 (Reset Vector) When using “Boot Loader”, reset vector = address of boot.asm If “Boot Loader” is not used, then usually Reset Vector = BIOS_init().
15
Note: When using a .cdb file, reset vector defaults to _c_int00
BIOS_init (_c_int00) Initialize the C environment … Initialize C environment: Init global and static vars (copy .cinit .bss ) Setup stack pointer (SP) and global pointer (DP) Initialize BIOS Create DSP/BIOS objects Bind IOM device drivers Set NMIE = 1 Call main( ) Initialize BIOS … and then call main() Note: When using a .cdb file, reset vector defaults to _c_int00 T TO Technical Training Organization
16
Same stuff we’ve been doing in our lab exercises
System Timeline Hardware Software Reset H/W EDMA boot.asm Provided by TI main.c Device Reset Boot Loader 2nd Boot Loader BIOS_init ( _c_int00 ) System Init Code No Boot or From EPROM or Via HPI EMIF Self test Load remaining initialized sections Initialize: Stack Heap Globals Bind IOM devices Enable NMIE Initialize periph’s Enable indiv ints Return(); Same stuff we’ve been doing in our lab exercises Software begins running at address 0 (Reset Vector) When using “Boot Loader”, reset vector = boot.asm If “Boot Loader” is not used, then usually Reset Vector = BIOS_init().
17
System Timeline Hardware Software Reset H/W EDMA boot.asm
Provided by TI main.c Device Reset Boot Loader 2nd Boot Loader BIOS_init ( _c_int00 ) System Init Code BIOS_start No Boot or From EPROM or Via HPI EMIF Self test Load remaining initialized sections Initialize: Stack Heap Globals Bind IOM devices Enable NMIE Initialize periph’s Enable indiv ints Return(); GIE = 1 Software begins running at address 0 (Reset Vector) When using “Boot Loader”, reset vector = boot.asm If “Boot Loader” is not used, then usually Reset Vector = BIOS_init().
18
Technical Training Organization
System Timeline Hardware Software Reset H/W EDMA boot.asm Provided by TI main.c Device Reset Boot Loader 2nd Boot Loader BIOS_init ( _c_int00 ) System Init Code BIOS_start DSP/BIOS Scheduler Boot frm EPROM or Via HPI or No Boot EMIF Self test Load remaining initialized sections Initialize: Stack Heap Globals Bind IOM devices Enable NMIE Initialize periph’s Enable indiv ints Return(); GIE = 1 Runs IDL if no other threads are ready Software begins running at address 0 (Reset Vector) When using “Boot Loader”, reset vector = boot.asm If “Boot Loader” is not used, then usually Reset Vector = BIOS_init(). T TO Technical Training Organization
19
Technical Training Organization
Outline Flow of events in the system Programming Flash Flash Programming Procedure Debugging ROM’d code Lab T TO Technical Training Organization
20
Technical Training Organization
Non-Volatile Memory Non-volatile Options ROM EPROM FLASH Flash RAM C6000 CPU S D R A M R A M T TO Technical Training Organization How do you program a FLASH memory?
21
Flash Programming Options
Method Description Target? Data I/O Industry-standard programmer Any FlashBurn CCS plug-in that writes to flash via JTAG (DSK, EVM, XDS) Any BSL Board support library commands such as flash_write() “On the fly” programming DSK Custom Target Specific User writes their own flash alg T TO Technical Training Organization How does FlashBurn work?
22
Flashburn CCS EPROM image file DSK DSP FBTC file L2 RAM Flash
Flashburn plugin downloads and runs the FBTC file (FlashBurn Transfer Control) to establish continuous link between CCS & DSP. Choose “Erase Flash” to tell FBTC program running on DSP to erase the flash memory. Select “Program Flash” to stream the EPROM image file (.hex) down to the DSP. The FBTC program must be customized for whatever flash memory is on the target board (documentation is provided). Flash
23
Using FlashBurn Flashburn saves these settings to a .CDD file
Flash Burn Transfer Controller (FBTC) When FBTC has been downloaded to DSP and is running, FlashBurn is “connected” to DSP
24
Technical Training Organization
Outline Flow of events in the system Programming Flash Flash Programming Procedure Debugging ROM’d code Lab T TO Technical Training Organization
25
Technical Training Organization
Debug Flow CCS Build app.out FileLoad Program… DSK L2 C6x CPU Flash SDRAM T TO Technical Training Organization
26
Technical Training Organization
Flash Data Flow hex.cmd hex6x Build app.hex app.out app.cdd DSK RAM C6x CPU FlashBurn Flash T TO Technical Training Organization What is the procedure for creating a standalone system?
27
Flash/Boot Procedure 1 Plan out your system’s memory map – Before and After boot. Verify address for “top of Flash memory” in your system Plan for BOOT memory object 1KB in length Created for secondary boot-loader (boot.asm) Not absolutely required, but provides linker error if boot.asm becomes larger than 1KB Another big reason for BOOT MEM object is that if .hwi_vec is linked into a MEM object that contains address 0, it will be forced to zero. Since we don’t want this to be the case in this system, we must put .hwi_vec into anther MEM object, though, we still want it to be in fast, on-chip memory. All said and done, it’s easiest at this point to create an extra BOOT memory object.
28
Flash/Boot Procedure 1 Plan out your system’s memory map – Before and After boot. Verify address for “top of Flash memory” in your system Plan for BOOT memory object 1KB in length Created for secondary boot-loader (boot.asm) Not absolutely required, but provides linker error if boot.asm becomes larger than 1KB Note, when using the hardware boot, you do not have to relink your program with run/load addresses, HEX6x will take care of this for you (step #4) Another big reason for BOOT MEM object is that if .hwi_vec is linked into a MEM object that contains address 0, it will be forced to zero. Since we don’t want this to be the case in this system, we must put .hwi_vec into anther MEM object, though, we still want it to be in fast, on-chip memory. All said and done, it’s easiest at this point to create an extra BOOT memory object.
29
System Memory Map (load vs. run)
Load-time Run-time BOOT “boot.asm” 0000_0000 IRAM init + uninit 0000_0400 SDRAM 8000_0000 9000_0000 9000_0400 0001_0000 9002_0000 B O O T FLASH “init sections” 0000_0000 0001_0000 8000_0000 9000_0000 FLASH “boot.asm” FLASH “initialized sections” 9000_0400 Another big reason for BOOT MEM object is that if .hwi_vec is linked into a MEM object that contains address 0, it will be forced to zero. Since we don’t want this to be the case in this system, we must put .hwi_vec into anther MEM object, though, we still want it to be in fast, on-chip memory. All said and done, it’s easiest at this point to create an extra BOOT memory object. 9002_0000 Boot-loader copies code/data from FLASH to IRAM/SDRAM When using the hardware boot, you do not have to relink your program with run/load addresses, HEX6x will take care of it for you Some code/data can still reside in flash T TO Technical Training Organization
30
Flash/Boot Procedure Plan out your system’s memory map – Before and After boot. 1 Modify .cdb, memory manager and do the following: Create necessary memory areas (e.g. BOOT) Direct the BIOS & compiler sections to their proper locations (when using the boot loader, these should be the runtime locations we have been using for all of our lab exercises) 2 Another big reason for BOOT MEM object is that if .hwi_vec is linked into a MEM object that contains address 0, it will be forced to zero. Since we don’t want this to be the case in this system, we must put .hwi_vec into anther MEM object, though, we still want it to be in fast, on-chip memory. All said and done, it’s easiest at this point to create an extra BOOT memory object.
31
Create Memory Objects (as needed)
New Memories listed in our previous memory-maps Another big reason for BOOT MEM object is that if .hwi_vec is linked into a MEM object that contains address 0, it will be forced to zero. Since we don’t want this to be the case in this system, we must put .hwi_vec into anther MEM object, though, we still want it to be in fast, on-chip memory. All said and done, it’s easiest at this point to create an extra BOOT memory object. T TO Technical Training Organization
32
Flash/Boot Procedure Plan out your system’s memory map – Before and After boot. 1 Modify .cdb, memory manager and do the following: Create necessary memory areas (e.g. boot) Direct the BIOS & compiler sections to their proper locations 2 Create a user link.cmd file to specify boot.asm’s load/run addr 3
33
User Linker Command File (link.cmd)
SECTIONS { .boot_load :> BOOT } T TO Technical Training Organization
34
Flash/Boot Procedure Plan out your system’s memory map – Before and After boot. 1 Modify .cdb, memory manager and do the following: Create necessary memory areas (e.g. boot) Direct the BIOS & compiler sections to their proper locations 2 Create a user link.cmd file to specify boot.asm’s load/run addr 3 4 Modify hex.cmd w/proper options Run hex6x to create .hex file Convert app.out to app.hex for Flash programming:
35
Hex Conversion Utility (hex6x.exe)
hex.cmd app.hex ASCII-hex Tektronix Intel MCS-86 Motorola-S TI-tagged app.out hex6x Converts a “.out” file into one of several hex formats suitable for loading into an EPROM programmer. Use: hex6x filename.cmd Hex command file specifies options and filenames… T TO Technical Training Organization What does hex.cmd look like?
36
Hex Command File (lab14hex_6713.cmd)
c:\iw6000\labs\lab14a\debug\lab.out -a -image -zero -memwidth 8 -map .\Debug\lab14hex.map -boot -bootorg 0x -bootsection .boot_load 0x ROMS { FLASH: org = 0x , len = 0x , romwidth = 8, files = {.\Debug\lab14.hex} } Source File Create ASCII image Creates a memory image (filling all loc’s) Reset addr origin to 0 for each output file Width of ROM memory (flash) Create a map file with this name Convert all initialized sect’s to bootable form Specify address for the bootloader table Name of bootload section and where it should be placed Description of ROM memories Name and location of output file (.hex) T TO Technical Training Organization Looking more closely at the ROM...
37
Technical Training Organization
Hex6x - Boot Options If –e is not used to set the entry point, then it will default to the entry point indicated in the COFF object file. For more information on using Hex6x for building a boot image, please refer the the C6000 Assembly Language Tools Users Guide (SPRU186). T TO Technical Training Organization
38
Hex Command File (Flash ROM)
c:\iw6000\labs\lab14a\debug\lab.out -a -image -zero -memwidth 8 -map .\Debug\lab14hex.map -boot -bootorg 0x -bootsection .boot_load 0x ROMS { FLASH: org = 0x , len = 0x , romwidth = 8, files = {.\Debug\lab14.hex} } Flash ROM 0x .boot_load (boot.asm) 0x COPY_TABLE Remaining Inititalized Sections 0x -boot Tells Hex6x to create the boot Copy Table -bootorg 0x Specifies address where symbol COPY_TABLE should reside -bootsection .boot_load 0x Name of section containing secondary boot loader and where it should go T TO Technical Training Organization Click here to see the COPY_TABLE
39
HEX6x Created Copy_Table
.sect “.boot_load” mvkl mvkh COPY_TABLE, a3 ldw *a3++, entry copy_sect_top: *a3++, size *a3++, dest [!size] b copy_done copy_loop: ldb *a3++, data sub size,1,size [size] copy_loop copy_sect_top stb data,*dest++ copy_done: entry COPY_TABLE Entry Point Section 1 Size Section 1 Dest Section 1 Data Section 2 Size Section 2 Dest Section 2 Data Section N Size Section N Dest Section N Data 0x -bootorg 0x Specifies address where symbol COPY_TABLE should reside .text .cinit Above code is a pseudo representation of the boot.asm file. etc T TO Technical Training Organization In the map file this looks like...
40
Map file representation of COPY_TABLE
lab14hex.map CONTENTS: f .boot_load ff FILL = af13 BOOT TABLE .hwi_vec : btad= dest= size= .sysinit : btad= c dest= size= .trcdata : btad= dest=00002d68 size= c .gblinit : btad= dest=00002d74 size= .cinit : btad=640009c4 dest= size= .pinit : btad=64001e20 dest=00002da8 size= c .const : btad=64001e34 dest=00002db4 size=000000cf .text : btad=64001f0c dest=00004ce0 size= .bios : btad= dest= size=00003ee0 .stack : btad= c dest=0000c520 size= .trace : btad=64009b64 dest=0000c920 size= .rtdx_text : btad=64009d6c dest=0000cf60 size=00000ee0 .args : btad=6400ac54 dest=00002fc0 size= .log : btad=6400ac60 dest=00002fc4 size= .LOG_system$buf : btad=6400ac98 dest=0000e300 size= .logTrace$buf : btad=6400ada0 dest=0000e400 size= .sts : btad=6400aea8 dest=0000e2a0 size= 6400af ffff FILL = By default, the HEX6x utility adds all “initialized” sections to the bootloader table T TO Technical Training Organization
41
Flash/Boot Procedure Plan out your system’s memory map – Before and After boot. 1 Modify .cdb, memory manager and do the following: Create necessary memory areas (e.g. boot) Direct the BIOS & compiler sections to their proper locations 2 Create a user link.cmd file to specify boot.asm’s load/run addr 3 4 Modify hex.cmd w/proper options Run hex6x to create .hex file Convert app.out to app.hex for Flash programming: 5 Start Flashburn and fill-in the blanks: hex cmd file hex image file FBTC file Origin & length of Flash
42
Using FlashBurn Flashburn saves these settings to a .CDD file
Flash Burn Transfer Controller (FBTC) When FBTC has been downloaded to DSP and is running, FlashBurn is “connected” to DSP
43
Flash/Boot Procedure Plan out your system’s memory map – Before and After boot. 1 Modify .cdb, memory manager and do the following: Create necessary memory areas (e.g. boot) Direct the BIOS & compiler sections to their proper locations 2 Create a user link.cmd file to specify boot.asm’s load/run addr 3 4 Modify hex.cmd w/proper options Run hex6x to create .hex file Convert app.out to app.hex for Flash programming: 5 Start Flashburn and fill-in the blanks: hex cmd file hex image file FBTC file Origin & length of Flash Erase the FLASH 6 What if you want your image in the host's ROM? Program FLASH, run, and debug ROM code 7
44
Putting the DSP Image on the Host
ofd6x Build app.xml app.out perl script Flash Host CPU Target System C6x DSP RAM appimage.c Use Object File Description (OFD6x) to create an XML description of the .out file Perl script uses XML to convert initialized sections from .OUT file into a C description of the program’s image For more info refer to Using OFD Utility to Create a DSP Boot Image (SPRAA64.PDF) T TO Technical Training Organization
45
Technical Training Organization
Outline Flow of events in the system Programming Flash Flash Programming Procedure Debugging ROM’d code Lab T TO Technical Training Organization
46
Debugging Your Application
If your application has problems booting up or operating after boot, how do you debug it? Problem: Standard breakpoints (aka Software Breakpoints) cannot be used with program code residing in ROM-like memory. When using software breakpoints, CCS replaces the ‘marked’ instruction with an emulation-halt instruction. This cannot be done in ROM-like memory. Solutions: Use Hardware breakpoints to help locate the problem. To debug ROM program, it’s especially important to put a H/W breakpoint at the start of your program, otherwise you won’t be able to halt the code in time to see what executing. Create a “stop condition” (infinite loop) in your boot code. When the code stops, open CCS and load the symbol table. T TO Technical Training Organization
47
Some Helpful Hints (that caught us)
When you (try to) boot your application for the first time, your system may not work as expected. Here are a couple tips: A GEL file runs each time you invoke CCS. This routine performs a number of system initialization tasks (such as setting up the EMIF, etc.). These MUST now be done by your boot routine. Upon delivery, the DSK’s POST routine is located in its Flash memory and runs each time you power up the DSK. To perform its tests, it will initialize parts of the system (e.g. EMIF, codec, DMA, SP, etc). When you reprogram the Flash with your code (and boot routine), you will need to initialize any components that will be used. Bottom line, it’s easy to have your code working while in the “debug” mode we mentioned earlier, then have it stop working after Flashing the program. Often, this happens when some components don’t get initilized properly. T TO Technical Training Organization
48
Technical Training Organization
Outline Flow of events in the system Programming Flash Flash Programming Procedure Debugging ROM’d code Lab T TO Technical Training Organization
49
Technical Training Organization
LAB 14 ‘C6xxx DSK CCS FLASH C6x CPU Codec SDRAM RAM . Goal: Run application disconnected from CCS Requirements Convert application to hex format Burn FLASH with application/boot code Run from power-on RESET (debug if necessary) T TO Technical Training Organization
50
Technical Training Organization
TTO ti T TO Technical Training Organization
51
Technical Training Organization
System Timeline Loadtime Runtime Build CCS load program debug Hex6x Burn EPROM or make image for host Device Reset return(); to BIOS CPU reset main() my C init The bootloader is covered next asm init: (OPTIONAL) CPU self-test and possibly setup EMIF my C init: configure ints & system stuff using C code asm init The bootloader is covered next asm init: (OPTIONAL) CPU self-test and possibly setup EMIF compiler/BIOS init (boot.c) The bootloader is covered next Boot Loader T TO Technical Training Organization
52
2. CE1 CE0 P D Memory CE0 (16M) CE1 (4M) CE2 CE3 DMA 000_0000 reset
100_0000 CE1 (4M) D CPU 'C6x CE2 BOOTMODE[4:0] RESET CE3 BOOTMODE CE0 Memory Type n n SDRAM bit devices n n SDRAM bit devices n n bit asynchronous n n /2 rate SBSRAM n n x rate SBSRAM nn for EPROM width: 01=8bit,10=16bit,11=32bit T TO Technical Training Organization
53
DSPINT (HPI interrupt)
4. Boot Using HPI CE0 CE1 P D 0 (or 1) CE2 CE3 DMA HPI uP P D CPU 'C6x BOOTMODE[4:0] RESET BOOTMODE Memory Map Map 0 Map 1 How does ‘C6000 know to start? DSPINT (HPI interrupt) T TO Technical Training Organization
54
‘C6211 and ‘C6711 Bootmodes Always bootloads to internal RAM (L2)
No “No Boot” bootmode (not needed for production)
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.