This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

C6678 EMIF16 boot summary

Here it is a tips for someone who wants to boot c66x from nor flash connected through emif16:

1. I’ve made my .out file with such strings in command file:

-stack 0x400
-heap 0x400

MEMORY
{
    BOOT (R):            o = 0x70000000 l = 0x00000100
    INTVEC (R):            o = 0x70000100 l = 0x00001000   /* 512kB LOCAL L2/SRAM */
    LOCAL_L2_SRAM:      o = 0x00800000 l = 0x00080000   /* 512kB LOCAL L2/SRAM */
    LOCAL_L1P_SRAM:     o = 0x00E00000 l = 0x00008000   /* 32kB LOCAL L1P/SRAM */
    LOCAL_L1D_SRAM:     o = 0x00F00000 l = 0x00008000   /* 32kB LOCAL L1D/SRAM */
    EMIF16_CS2 (R):        o = 0x70001100 l = 0x003FE000
    SHRAM (RWIX):       o = 0x0C000000 l = 0x00400000   /* 4MB Multicore shared Memory */
    
    EMIF16_CS3:     o = 0x74000000 l = 0x04000000   /* 64MB EMIF16 CS3 Data Memory */
    EMIF16_CS4:     o = 0x78000000 l = 0x04000000   /* 64MB EMIF16 CS4 Data Memory */
    EMIF16_CS5:     o = 0x7C000000 l = 0x04000000   /* 64MB EMIF16 CS5 Data Memory */
 
    DDR3:           o = 0x80000000 l = 0x80000000   /* 2GB CE0 and CE1 external DDR3 SDRAM */
}
 
SECTIONS
{
    .boot            > BOOT
    {
        -l rts6600_elf.lib <boot.obj> (.text)
    }
    .csl_vect        > INTVEC
    .intvecs        > INTVEC
    .text          >  EMIF16_CS2
    .stack         >  SHRAM
    .bss           >  SHRAM
    .cio           >  SHRAM
    .const         >  EMIF16_CS2
    .data          >  SHRAM
    .switch        >  EMIF16_CS2
    .sysmem        >  SHRAM
    .far           >  SHRAM
    .args          >  SHRAM
    .ppinfo        >  SHRAM
    .ppdata        >  SHRAM
 
    /* COFF sections */
    .pinit         >  EMIF16_CS2
    .cinit         >  EMIF16_CS2
 
    /* EABI sections */
    .binit         >  SHRAM
    .init_array    >  SHRAM
    .neardata      >  SHRAM
    .fardata       >  SHRAM
    .rodata        >  SHRAM
    .c6xabi.exidx  >  SHRAM
    .c6xabi.extab  >  SHRAM
}

The size of sections may differ. But main thing is a position of boot section. It points to the start of CS2 in emif16 address space. In SECTIONS one must fix an address of _c_int00 that is allocated at boot.obj. _c_int00 must be allocated at 0x70000000 address.

2. After compilation we have an .out file which contain our program in ELF format. Next step is to convert this file in raw binary to load it into the flash. To simplify a process I’ve made a .bat with such content:

hex6x.exe convert_hex_preloader.rmd

b2ccs.exe c6000_preloader.btbl c6000_preloader.dat

ccs2bin.exe c6000_preloader.dat c6000_preloader.bin

You can find utilities hex6x, b2ccs and ccs2bin  in ccs installation directory. Convert_hex_preloader.rmd file contain a commands for hex6x. In my case they are:

c6000_preloader.out

--ascii

--image

--map c6000_preloader.map

--entrypoint _c_int00

ROMS

{

            ROM1: org=0x70000000, len=0x10000, romwidth=32, memwidth=32

            files={c6000_preloader.btbl}

}  

For more info look hex6x –help.

3. After that you have .bin file which you can flash to the nor starting with 0x70000000.

p.s.: Don’t forget to set bootstrap pins correctly. In my case they are BOOTMODE[12:0] = 1100_0001_0000. I hope this will helps someone.

  • Dmitry,

    Thanks for summarizing your EMIF16 boot example for the community members.

    Regards,

    Rahul

  • Dmitry,

    Is your code which above project running in emif16 nor flash?I want to load the app.bin from emif16 nor to SHRAM,do you have the secondary bootload which in emif16 nor?
  • haipeng mu,

    the code, I've listed above is a *.cmd file that I aplly to my EMIF16 nor loader project. This loader runs quite in nor-flash and do a simple things:
    1. checks crc-code of firmware image stored in nor
    2. loads this image into the shared memory or DDR or somthing else.
    3. sets PC to _c_int00() location and makes "hands over".
  • can u please tell me about DDR and PLL confiuration done?
    from where it is done?
  • Hi, Noufal P.

    PLL  initializations i've made in preloader code. DDR initialization was made in main programm code.

    At this momemt further programm developing forcing me to allocate DDR initialization prior to the main programm start. While the code of main programm became a little bit huge for internal RAM allocation it's seems to place some part of it into DDR. Now I have simple preloader code which runs directly from NOR. There  PLL starts. Then starts Loader code (from internal SRAM). It's more complex, there starts DDR and Ethernet. Loader then download main programm into internal RAM and DDR and then start it.

  • Preloader means IBL or RBL?
    In my case, i have a NOR flash connected to DSP through EMIF16 and there is no i2c eeprom connected.
  • I use RBL only. It make a jump to address 0x70000000 where my own preloader is located.

    I also use emif16 only. On this bus I have NOR and NAND the same time.

  • thanks for ur reply.
    From preloader u will be jumping to loader code,right?. and that loader code is stored in flash and copied to SRAM for executing. please correct me if am wrong. one doubt, can i load my main program directly from the preloader code?
  • Yes, you are right. There is one rule I always follow. If code is big enough, I copy it in SRAM before execution.

    Certainly you can load your main programm directly from preloader. Insert in preloader code all initializations possibly needed for succeful allocation of your main programm code and write in PC _c_int00 address. It's a simpliest method I know.

  • thank u sir...!
    i will update once i check this boot flow.
  • Hi sir,
    One more doubt, can i use IBL as my preloader code? if not can u please provide me a sample code for reference?
  • I used IBL source code as a reference when Loader code was written. I think it's rather complicated for preloader. For the first time you can use some parts from c6678 GEL files were initializations performs.
    Preloader code is property of my employer company , sorry.