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.

SD Boot - Complete Example with SDRAM

Hi,

In addition to http://e2e.ti.com/support/dsp/tms320c5000_power-efficient_dsps/f/109/p/68376/359709.aspx#359709 I want to be more clearly.

I have a programm ready to work on the EVM5515.

I now want it to boot from SD Card. I have ereased the program on the SPI (coming with the EVM) and also erased Flash (nor and nand).

First Problem

I have the secureimageboot-utility and converted the out-File to a bin-File. I used "not bound to device" and some arbitrary values for keys.

I added SetupSystem() - Function  as follows and changed the linker file as below. The programmtool writes to the SD Card, but it doesn't boot.

Can you please provide a running bin file, to check wheather my SD Card might have a boot problem (I can use the ata_fs-Demos and read and write to the SD Card.

Additionally: Why is this not booting:

#define ESCR     0x1c33
#define SDTIMR1  0x1020
#define SDTIMR2  0x1021
#define SDCR1    0x1008
#define SDCR2    0x1009
#define SDSRETR  0x103C
#define SDRCR    0x100C
#define PRCR     0x1C05
#define PCGCR1   0x1c02
#define PCGCR2   0x1c03
#define PSRCR    0x1c04
#define CLKCFGL  0x1c1e
#define CCR2     0x1c1f
#define CGCR1    0x1c20
#define CGCR2    0x1c21
#define CGCR3    0x1c22
#define CGCR4    0x1c23
#define CCSSR    0x1c24
#define IVPD     0x0049

void SetupSystem(){

    int i=0;
    /* Disable interrupts */
    *(int*)0x0003 = *(int*)0x0003 | 0x0800; // Set INTM
    *(int*)0x0000 = 0;      // Clear IER0
    *(int*)0x0000 = 0;      // Clear IER1
    // Zürcksetzen der Peripherie
    *(ioport Uint16*)PSRCR = 0x0020;
    *(ioport Uint16*)PRCR  = 0x00BB;

    // Interrupt vector
    for(i=0;i<0xff;i++);
    *(ioport Uint16*)IVPD = 0x027F; // Load interrupt vector pointer

    /* Enable clocks to all peripherals */
    *(ioport Uint16*) PCGCR1 = 0x0;
    *(ioport Uint16*) PCGCR2 = 0x0;
    /* Bypass PLL */
    *(ioport Uint16*) CCR2 = 0x0;
    /* Set CLR_CNTL = 0 */
    *(ioport Uint16*)CGCR1 = *(ioport Uint16*)CGCR1 & 0x7FFF;
    *(ioport Uint16*)CGCR1 =  0x8BE8;
    *(ioport Uint16*)CGCR2 =  0x8000;
    *(ioport Uint16*)CGCR3 =  0x0806;
    *(ioport Uint16*)CGCR4 =  0x0000;
    /* Wait for PLL lock */
    for(i=0;i<0x7ff;i++);
    /* Switch to PLL clk */
    *(ioport Uint16*)CCR2 = 0x1;
    /* Enable clocks to all peripherals */
    SYS_PCGCR1 = 0x0000;
    SYS_PCGCR2 = 0x0000;

    // SDRAM
    /* reset EMIF */
    *(ioport Uint16*)PRCR = 0x0002;
    for(i=0;i<0xff;i++);

    //enable SDRAM clock
    *(ioport Uint16*)CLKCFGL=0x0001;

    /* enable word writes to EMIF regs */
    *(ioport Uint16*)ESCR = 0;

    /* step 1 */
    *(ioport Uint16*)SDTIMR1 = 0x4710;
    *(ioport Uint16*)SDTIMR2 = 0x3911;
    *(ioport Uint16*)SDSRETR = 0x0007;
    /* step 2 */
    *(ioport Uint16*)SDRCR = 0x04E3;  
    /* step 3 */
    *(ioport Uint16*)SDCR1 = 0x4720;
    *(ioport Uint16*)SDCR2 = 0x0001;
    /* step 4 */
    for(i=0;i<0xff;i++) asm("\tnop");
    /* step 5 */
    *(ioport Uint16*)SDRCR = 0x061A;

}

My linker file is:

-stack    0x2000      /* Primary stack size   */
-sysstack 0x1000      /* Secondary stack size */
-heap     0x2000      /* Heap area size       */

-c                    /* Use C linking conventions: auto-init vars at runtime */
-u _Reset             /* Force load of reset interrupt handler                */

/* SPECIFY THE SYSTEM MEMORY MAP */

MEMORY
{
 PAGE 0:  /* ---- Unified Program/Data Address Space ---- */

  MMR    (RWIX): origin = 0x000000, length = 0x0000c0  /* MMRs */
  DARAM0 (RWIX): origin = 0x0000c0, length = 0x00ff40  /*  64KB - MMRs */
  SARAM0 (RWIX): origin = 0x010000, length = 0x010000  /*  64KB */
  SARAM1 (RWIX): origin = 0x020000, length = 0x02A000  /* 128KB */
  BOOT   (RWIX): origin = 0x04E000, length = 0x001fff  /*  64KB */
  VECS   (RWIX): origin = 0x04A000, length = 0x000200  /*  512B */
  PDROM   (RIX): origin = 0xff8000, length = 0x008000  /*  32KB */

 PAGE 2:  /* -------- 64K-word I/O Address Space -------- */

  IOPORT (RWI) : origin = 0x000000, length = 0x020000
}
 
/* SPECIFY THE SECTIONS ALLOCATION INTO MEMORY */

SECTIONS
{
   .text     >> SARAM1|SARAM0  /* Code                        */

   /* Both stacks must be on same physical memory page               */
   .stack    >  DARAM0                /* Primary system stack        */
   .sysstack >  DARAM0                /* Secondary system stack      */

   .data     >> DARAM0|SARAM0|SARAM1  /* Initialized vars            */
   .bss      >> DARAM0|SARAM0|SARAM1  /* Global & static vars        */
   .const    >> DARAM0|SARAM0|SARAM1  /* Constant data               */
   .sysmem   >  DARAM0|SARAM0|SARAM1  /* Dynamic memory (malloc)     */
   .switch   >  SARAM1                /* Switch statement tables     */
   .cinit    >  SARAM1                /* Auto-initialization tables  */
   .pinit    >  SARAM1                /* Initialization fn tables    */
   .cio      >  SARAM1                /* C I/O buffers               */
   .args     >  SARAM1                /* Arguments to main()         */

    vectors  >  VECS                  /* Interrupt vectors           */

   .ioport   >  IOPORT PAGE 2         /* Global & static ioport vars */
}

Second Problem

I want to use the SDRAM. Can I use it to hold some time uncritical init-routines during startup? As I understand do I have to init the RAM, CCS does this for me, but if I boot from the SD Card, I would have to init it or is there a default mode running? Is this possible at all?

Thanks in advance.

Micky

  • How do you format your SD card? do you use window format utility or other tools.

    Also, if you format the SD card correct. And generate the encrypted boot image with TI provided tools, you just simple copy the image to the card. if should boot, you don't need to change the source code.

    do I understand you correctly?

    regards

    Wen

  • I format the Disk with the normal windows explorer as FAT32.

    To be clear: I did compile and made a *.out, the I used the secureimage-tool to make a bin file, then I used the programmer.out to place it on the SD Card. You can see my settings above, but tit doesn't boot. I'm not sure, if the SetupSystem()-Function is correct, it's just a copy of the GEL file in C-Syntax.

    Do you have a demo, how to setup the system  correctly, if not (meaning, enabling PLL, SDRAM etc.)?Is there an example available?

    regards

    Micky

  • Hi Micky,

    You should not have to use the programmer.out when placing the secure boot image on the SD Card. Instead copy the binary file onto the card with Windows, as it is plugged into a USB SD Card reader.

    The file name should be boot5505.bin in the root directory of the card.

    I'll try to find a binary file that works for me if this doesn't solve your problem.

    Hope this helps,
    Mark

  • Hi Mark,

    "Instead copy the binary file onto the card with Windows, as it is plugged into a USB SD Card reader.The file name should be boot5505.bin in the root directory of the card."

    I tried that, too, without sucess. I  might do something wrong in principle...

    Micky

  • Micky;

    Where did you get the SEED/Key value which you will use to create the file? you cannot enter "arbitrary value". maybe you can check this part.

    Wen

  • Hi Wen,

    "Where did you get the SEED/Key value"

    I just got an executable without further instructions. The key could be changed (and I did it, as far as I remember).

    EDIT: I've just sent a email to TI. I asked for a key/SEED pair

    EDIT2: I realized I can change the values, but next start, the orginally values are again re-loaded. So perhaps these values are ok (?)

    Micky

  • Micky;

    You have to enter the specific key come with the software, only this key can encrypt the bin file correct. I can not post the keys on this web site, before there is a license issue. Please let me know if you get the key from TI sale channel. Otherwise, we have to figure out the logistics for how to send you the keys.

     

    Regards

    Wen

  • Hi Wen,

    I contacted my TI sales. I hope they will send it to me very briefly to see, wheather this is my problem. I 'll keep you informed. I have no key file recieved with that software, definitely.

    EDIT: Do you have a solution for problem II? Is the setup of the processor correct?

    regards

    Micky

  • Hi Wen,

    I didnot recieve any feedback from my local sales nor from those who sent the tool directly to me.How can we proceed, then?

    BTW: Do you have a solution for problem II? Is the setup of the processor correct?

    Micky