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.

Flashed code does not run on USBSTK5505

I used to flash my code..on to the USBSTK5505 board using the programmer_USBKey.out. There were no issue.

My lastest code flashes but does not run. But the same code runs on the debugger.

If I flash the older code it tuns from flash.

Would you folks let me know how I can proceed.

We are going to production next week. Please respond soon.

  • Microt,

    What changes have you made from code that boots to code that does not boot?  You have provided no details. 

    Since code runs from debugger, but not flash I would check initialization that is done in Gel file that is run by CCS.  It happens often that a GEL file does some critical initialization for an application so it works when the debugger is active.  When code is run from flash, CCS is not active, so critical initialization is not performed.  This would be my best advise based on information available.

    Regards.

     

  •  

    Hi Tommy G

    We changed this in c5505.cmd to support more memory.  have the gel file also below that

    Thanks

    ---c5505.cmd---

    MEMORY

    {

        MMR     (RW) : origin = 0000000h length = 0000c0h /* MMRs */

    /*    DARAM (RW)    : origin = 00000c0h length = 00ff40h  /  * on-chip DARAM */

    /*    SARAM   (RW)  : origin = 0030000h length = 01e000h  /  * on-chip SARAM */

          SARAM   (RW)  : origin = 0010000h length = 03e000h

     

        /* FOR I2S1 CHANGES FEB 23 */

     /*    DARAM (RW)    : origin = 00000c0h length = 00f540h  / * on-chip DARAM */  

      /*  DARAM_1 (RW)  : origin = 00f600h length = 000A00h / * on-chip DARAM */  

       DARAM (RW)    : origin = 00000c0h length = 00f040h  /* on-chip DARAM  */  

      DARAM_1 (RW)  : origin = 00f100h length = 000f00h /* on-chip DARAM */  

     

     

     

        SAROM_0 (RX)  : origin = 0fe0000h length = 008000h /* on-chip ROM 0 */

        SAROM_1 (RX)  : origin = 0fe8000h length = 008000h /* on-chip ROM 1 */

        SAROM_2 (RX)  : origin = 0ff0000h length = 008000h /* on-chip ROM 2 */

        SAROM_3 (RX)  : origin = 0ff8000h length = 008000h /* on-chip ROM 3 */

     

        EMIF_CS0 (RW)  : origin = 0050000h  length = 07B0000h   /* mSDR */ 

    EMIF_CS2 (RW)  : origin = 0800000h  length = 0400000h   /* ASYNC1 : NAND */ 

    EMIF_CS3 (RW)  : origin = 0C00000h  length = 0200000h   /* ASYNC2 : NAND  */

    EMIF_CS4 (RW)  : origin = 0E00000h  length = 0100000h   /* ASYNC3 : NOR */

    EMIF_CS5 (RW)  : origin = 0F00000h  length = 00E0000h   /* ASYNC4 : SRAM */

     

    }

     

     

    SECTIONS

    {

        vectors (NOLOAD)

        .bss        : > DARAM /*, fill = 0 */

        vector      : > DARAM      ALIGN = 256 

        .stack      : > DARAM  

        .sysstack   : > DARAM  

    .sysmem : > DARAM 

        .text       : > SARAM    /* SARAM */

        .data       : > DARAM

    .cinit : > DARAM

    .const : > DARAM

    /* speex */

    /*.myheap : > DARAM */ 

     .myheap : > SARAM  /* we changed this*/

    /* speexEnd */  

    .cio : > DARAM

    .usect   : > DARAM

    .switch     : > DARAM 

    .emif_cs0   : > EMIF_CS0

    .emif_cs2   : > EMIF_CS2

    .emif_cs3   : > EMIF_CS3

    .emif_cs4   : > EMIF_CS4

    .emif_cs5   : > EMIF_CS5

     

    .decodedata : > DARAM_1

    .uart_data : > SARAM

    .inputdata : > SARAM     /* we added this*/

     

    }

     

    /********************************************************************/

    /* usbstk5505.gel                                                   */

    /* Version 1.02                                                     */

    /*                                                                  */

    /* This GEL file is to be used with the TMS320C25505 DSP USB STICK. */

    /* Changes may be required to support specific hardware designs.    */

    /*                                                                  */

    /* Code Composer Studio supports six reserved GEL functions that    */

    /* automatically get executed if they are defined. They are:        */

    /*                                                                  */

    /* StartUp()              - Executed whenever CCS is invoked        */

    /* OnReset()              - Executed after Debug->Reset CPU         */

    /* OnRestart()            - Executed after Debug->Restart           */

    /* OnPreFileLoaded()      - Executed before File->Load Program      */

    /* OnFileLoaded()         - Executed after File->Load Program       */

    /* OnTargetConnect()      - Executed after Debug->Connect           */

    /*                                                                  */

    /*   Version History                                                */

    /*     v1.01        Added peripheral reset                          */

    /*     v1.02        Added Interrupt Vector Pointer                  */

    /********************************************************************/

    StartUp()

    {

        C5505_MapInit();

    }

     

    /*--------------------------------------------------------------*/

    /* OnTargetConnect() -- this function is called after a target  */

    /* connect.                                                     */

    /*--------------------------------------------------------------*/

    OnTargetConnect()

    {

        GEL_Reset();

        Peripheral_Reset();

        ProgramPLL_100MHz();

        GEL_TextOut("Target Connection Complete.\n"); 

    }

     

    /*--------------------------------------------------------------*/

    /* OnPreFileLoaded()                                            */

    /* This function is called automatically when the 'Load Program'*/

    /* Menu item is selected.                                       */

    /*--------------------------------------------------------------*/

    OnPreFileLoaded()

    {

        /* Reset the CPU to clean up state */

        //GEL_Reset();

    }

     

    /*--------------------------------------------------------------*/

    /* OnRestart()                                                  */

    /* This function is executed before a file is restarted. Disable*/

    /* interrupts and DMA from the current program so pending       */

    /* events and transfers don't interfere with the new program.   */

    /*--------------------------------------------------------------*/

    OnRestart()

    {

        /* Disable interrupts */

        *(int*)0x0003 = *(int*)0x0003 | 0x0800; // Set INTM

        *(int*)0x0000 = 0;      // Clear IER0

        *(int*)0x0000 = 0;      // Clear IER1

    }

     

    /*--------------------------------------------------------------*/

    /* OnReset()                                                    */

    /* This function is called by CCS when you do Debug->Resest.    */

    /* The goal is to put the C55xx into a known good state with    */

    /* respect to cache, dma and interrupts.                        */

    /*--------------------------------------------------------------*/

    OnReset( int nErrorCode )

    {

    }

     

    /*--------------------------------------------------------------*/

    /* OnFileLoaded()                                               */

    /* This function is called by CCS when you do File->Load Program*/

    /* The goal is to do in post file loaded configuration that may */

    /* be needed.                                                   */

    /*--------------------------------------------------------------*/

    OnFileLoaded()

    {

    }

     

    #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 CCR2     0x1c1f

    #define CGCR1    0x1c20

    #define CGCR2    0x1c21

    #define CGCR3    0x1c22

    #define CGCR4    0x1c23

    #define CCSSR    0x1c24

    #define IVPD     0x0049

     

     

    // ***************************************************************************

     

    /* Memory map based on MP/MC value (assume MP/MC = 0).    */

    C5505_MapInit() {

        GEL_MapOn();

        GEL_MapReset();

     

        /*Program Space*/

     

        /* DARAM */

        GEL_MapAdd(0x0000C0,0,0x001F40,1,1);    /* DARAM0 */

        GEL_MapAdd(0x002000,0,0x002000,1,1);    /* DARAM1 */

        GEL_MapAdd(0x004000,0,0x002000,1,1);    /* DARAM2 */

        GEL_MapAdd(0x006000,0,0x002000,1,1);    /* DARAM3 */

        GEL_MapAdd(0x008000,0,0x002000,1,1);    /* DARAM4 */

        GEL_MapAdd(0x00A000,0,0x002000,1,1);    /* DARAM5 */

        GEL_MapAdd(0x00C000,0,0x002000,1,1);    /* DARAM6 */

        GEL_MapAdd(0x00E000,0,0x002000,1,1);    /* DARAM7 */

     

        /* SARAM */

        GEL_MapAdd(0x010000,0,0x002000,1,1);    /* SARAM0 */

        GEL_MapAdd(0x012000,0,0x002000,1,1);    /* SARAM1 */

        GEL_MapAdd(0x014000,0,0x002000,1,1);    /* SARAM2 */

        GEL_MapAdd(0x016000,0,0x002000,1,1);    /* SARAM3 */

        GEL_MapAdd(0x018000,0,0x002000,1,1);    /* SARAM4 */

        GEL_MapAdd(0x01A000,0,0x002000,1,1);    /* SARAM5 */

        GEL_MapAdd(0x01C000,0,0x002000,1,1);    /* SARAM6 */

        GEL_MapAdd(0x01E000,0,0x002000,1,1);    /* SARAM7 */

        GEL_MapAdd(0x020000,0,0x002000,1,1);    /* SARAM8 */

        GEL_MapAdd(0x022000,0,0x002000,1,1);    /* SARAM9 */

        GEL_MapAdd(0x024000,0,0x002000,1,1);    /* SARAM10 */

        GEL_MapAdd(0x026000,0,0x002000,1,1);    /* SARAM11 */

        GEL_MapAdd(0x028000,0,0x002000,1,1);    /* SARAM12 */

        GEL_MapAdd(0x02A000,0,0x002000,1,1);    /* SARAM13 */

        GEL_MapAdd(0x02C000,0,0x002000,1,1);    /* SARAM14 */

        GEL_MapAdd(0x02E000,0,0x002000,1,1);    /* SARAM15 */

        GEL_MapAdd(0x030000,0,0x002000,1,1);    /* SARAM16 */

        GEL_MapAdd(0x032000,0,0x002000,1,1);    /* SARAM17 */

        GEL_MapAdd(0x034000,0,0x002000,1,1);    /* SARAM18 */

        GEL_MapAdd(0x036000,0,0x002000,1,1);    /* SARAM19 */

        GEL_MapAdd(0x038000,0,0x002000,1,1);    /* SARAM20 */

        GEL_MapAdd(0x03A000,0,0x002000,1,1);    /* SARAM21 */

        GEL_MapAdd(0x03C000,0,0x002000,1,1);    /* SARAM22 */

        GEL_MapAdd(0x03E000,0,0x002000,1,1);    /* SARAM23 */

        GEL_MapAdd(0x040000,0,0x002000,1,1);    /* SARAM24 */

        GEL_MapAdd(0x042000,0,0x002000,1,1);    /* SARAM25 */

        GEL_MapAdd(0x044000,0,0x002000,1,1);    /* SARAM26 */

        GEL_MapAdd(0x046000,0,0x002000,1,1);    /* SARAM27 */

        GEL_MapAdd(0x048000,0,0x002000,1,1);    /* SARAM28 */

        GEL_MapAdd(0x04A000,0,0x002000,1,1);    /* SARAM29 */

        GEL_MapAdd(0x04C000,0,0x002000,1,1);    /* SARAM30 */

        GEL_MapAdd(0x04E000,0,0x002000,1,1);    /* SARAM31 */

     

        /* External-Memory */

        GEL_MapAdd(0x050000,0,0x7B0000,1,1);    /* External-SDRAM */

        GEL_MapAdd(0x800000,0,0x400000,1,1);    /* External-Async */

        GEL_MapAdd(0xC00000,0,0x200000,1,1);    /* External-Async */

        GEL_MapAdd(0xE00000,0,0x100000,1,1);    /* External-Async */

        GEL_MapAdd(0xF00000,0,0x0E0000,1,1);    /* External-Async */

     

        /* ROM */

        GEL_MapAdd(0xFE0000,0,0x008000,1,0);    /* SAROM0 */

        GEL_MapAdd(0xFE8000,0,0x008000,1,0);    /* SAROM1 */

        GEL_MapAdd(0xFF0000,0,0x008000,1,0);    /* SAROM2 */

        GEL_MapAdd(0xFF8000,0,0x008000,1,0);    /* SAROM3 */

     

        /* Data Space */

     

        /* DARAM */

        GEL_MapAdd(0x000000,1,0x000060,1,1);    /* MMRs */

        GEL_MapAdd(0x000060,1,0x000FA0,1,1);    /* DARAM0 */

        GEL_MapAdd(0x001000,1,0x001000,1,1);    /* DARAM1 */

        GEL_MapAdd(0x002000,1,0x001000,1,1);    /* DARAM2 */

        GEL_MapAdd(0x003000,1,0x001000,1,1);    /* DARAM3 */

        GEL_MapAdd(0x004000,1,0x001000,1,1);    /* DARAM4 */

        GEL_MapAdd(0x005000,1,0x001000,1,1);    /* DARAM5 */

        GEL_MapAdd(0x006000,1,0x001000,1,1);    /* DARAM6 */

        GEL_MapAdd(0x007000,1,0x001000,1,1);    /* DARAM7 */

     

        /* SARAM */

        GEL_MapAdd(0x008000,1,0x001000,1,1);    /* SARAM0 */

        GEL_MapAdd(0x009000,1,0x001000,1,1);    /* SARAM1 */

        GEL_MapAdd(0x00A000,1,0x001000,1,1);    /* SARAM2 */

        GEL_MapAdd(0x00B000,1,0x001000,1,1);    /* SARAM3 */

        GEL_MapAdd(0x00C000,1,0x001000,1,1);    /* SARAM4 */

        GEL_MapAdd(0x00D000,1,0x001000,1,1);    /* SARAM5 */

        GEL_MapAdd(0x00E000,1,0x001000,1,1);    /* SARAM6 */

        GEL_MapAdd(0x00F000,1,0x001000,1,1);    /* SARAM7 */

        GEL_MapAdd(0x010000,1,0x001000,1,1);    /* SARAM8 */

        GEL_MapAdd(0x011000,1,0x001000,1,1);    /* SARAM9 */

        GEL_MapAdd(0x012000,1,0x001000,1,1);    /* SARAM10 */

        GEL_MapAdd(0x013000,1,0x001000,1,1);    /* SARAM11 */

        GEL_MapAdd(0x014000,1,0x001000,1,1);    /* SARAM12 */

        GEL_MapAdd(0x015000,1,0x001000,1,1);    /* SARAM13 */

        GEL_MapAdd(0x016000,1,0x001000,1,1);    /* SARAM14 */

        GEL_MapAdd(0x017000,1,0x001000,1,1);    /* SARAM15 */

        GEL_MapAdd(0x018000,1,0x001000,1,1);    /* SARAM16 */

        GEL_MapAdd(0x019000,1,0x001000,1,1);    /* SARAM17 */

        GEL_MapAdd(0x01A000,1,0x001000,1,1);    /* SARAM18 */

        GEL_MapAdd(0x01B000,1,0x001000,1,1);    /* SARAM19 */

        GEL_MapAdd(0x01C000,1,0x001000,1,1);    /* SARAM20 */

        GEL_MapAdd(0x01D000,1,0x001000,1,1);    /* SARAM21 */

        GEL_MapAdd(0x01E000,1,0x001000,1,1);    /* SARAM22 */

        GEL_MapAdd(0x01F000,1,0x001000,1,1);    /* SARAM23 */

        GEL_MapAdd(0x020000,1,0x001000,1,1);    /* SARAM24 */

        GEL_MapAdd(0x021000,1,0x001000,1,1);    /* SARAM25 */

        GEL_MapAdd(0x022000,1,0x001000,1,1);    /* SARAM26 */

        GEL_MapAdd(0x023000,1,0x001000,1,1);    /* SARAM27 */

        GEL_MapAdd(0x024000,1,0x001000,1,1);    /* SARAM28 */

        GEL_MapAdd(0x025000,1,0x001000,1,1);    /* SARAM29 */

        GEL_MapAdd(0x026000,1,0x001000,1,1);    /* SARAM30 */

        GEL_MapAdd(0x027000,1,0x001000,1,1);    /* SARAM31 */

     

        /* External-Memory */

        GEL_MapAdd(0x028000,1,0x3D8000,1,1);    /* External-SDRAM */

        GEL_MapAdd(0x400000,1,0x200000,1,1);    /* External-Async */

        GEL_MapAdd(0x600000,1,0x100000,1,1);    /* External-Async */

        GEL_MapAdd(0x700000,1,0x080000,1,1);    /* External-Async */

        GEL_MapAdd(0x780000,1,0x070000,1,1);    /* External-Async */

     

        /* ROM */

        GEL_MapAdd(0x7F0000,1,0x004000,1,0);    /* SAROM0 */

        GEL_MapAdd(0x7F4000,1,0x004000,1,0);    /* SAROM1 */

        GEL_MapAdd(0x7F8000,1,0x004000,1,0);    /* SAROM2 */

        GEL_MapAdd(0x7FC000,1,0x004000,1,0);    /* SAROM3 */

     

        /* IO Space */

        GEL_MapAdd(0x0000,2,0xFFFF,1,1);        /* XPORT */

    }

     

    Peripheral_Reset()

    {

        int i;

     

        *(short *)PSRCR@IO = 0x0020;

        *(short *)PRCR@IO  = 0x00BB;

     

        for(i=0;i<0xff;i++);

        *(short *)IVPD@data = 0x027F; // Load interrupt vector pointer

        GEL_TextOut("Reset Peripherals is complete.\n");

    }

     

    ProgramPLL_100MHz() {

        int i;

     

        GEL_TextOut("Configuring PLL (100.00 MHz).\n");

        /* Enable clocks to all peripherals */

        *(short *)PCGCR1@IO = 0x0;

        *(short *)PCGCR2@IO = 0x0;

     

        /* Bypass PLL */

        *(short *)CCR2@IO = 0x0;

     

        /* Set CLR_CNTL = 0 */

        *(short *)CGCR1@IO = *(short *)CGCR1@IO & 0x7FFF;

     

        *(short *)CGCR2@IO = 0x8000;

        *(short *)CGCR4@IO = 0x0000;

        *(short *)CGCR3@IO = 0x0806;

        *(short *)CGCR1@IO = 0x82fa; 

     

        /* Wait for PLL lock */

        for(i=0;i<0x7fff;i++);

     

        /* Switch to PLL clk */ 

        *(short *)CCR2@IO = 0x1;

     

        GEL_TextOut("PLL Init Done.");

     

    }

     

  • If your code compiles correctly, then memory changes are probably not the problem. 

    You said original program works correctly from flash.  Is this correct?  And only change you made was to memory allocation.  Is this correct?  If both are yes, then something else is going on. 

    Typically like I mentioned previously initialization is done with Gel file that does not get integrated to customer code.  In your Gel file the functions called Startup() and OnTargetConnect() would be the ones to examine.  It looks like PeripheralReset() and PLL setup are the only ones that need to be considered.

    It would be good to know how far in the boot process your target gets to help with debug.  If you startup your target, then open CCS without any gel file.  The Program Counter will show you where the code execution is currently.  You can compare this to the .map file to figure out which code module is being executed.  From there next steps can be determined.

    Just to double check, you are using the eZdsp for this project?  And the Memory section in the Linker .cmd file accurately defines your target memory?

    Regards,

  • Hi TommyG

    It works the other way. The code runs from the debugger but not after flashing.

    It could be the way you suggested earlier. The debugger may be initilizing the right stuff..But we may not have the necessary things in the gel file.

    I have attached the gel file etc..in my earlier post.

    We have run out of ideas. Do you see anything in the gel and cmd file I have posted

    I will run it to see as per you sugestion to see how far it ran.

    Yes we are using eZdsp.

    Thanks

  • We just realized thw latest code is just over 64K.

    The EEPROM ATMEL 95512=>64 is on the USBSTK board.

    If we change it to a 128K EEPROM does the programmer code support it

     

  • Microt,

    I'm not sure if the flash utility will support larger chip.  I've never seen the source code for it.  Someone else will have to comment on that point.

    One way to catch code overflows is to exactly match the linker command file Memory Section definitions to the physical memory in your system.  If you do this, then the Linker will flag if the code is too big for the memory.

    Regards.

  • Microt,

    Do you mean that both the original and new code would not boot from Flash?  If so, then that points to CCS initialization missing from your code.  The functions to look at are:

    Peripheral_Reset()
    {
        int i;

        *(short *)PSRCR@IO = 0x0020;
        *(short *)PRCR@IO  = 0x00BB;

         for(i=0;i<0xff;i++);
        
         *(short *)IVPD@data = 0x027F; // Load interrupt vector pointer

        GEL_TextOut("Reset Peripherals is complete.\n");
    }

     

    ProgramPLL_100MHz()
    {
        int i;

         GEL_TextOut("Configuring PLL (100.00 MHz).\n");

        /* Enable clocks to all peripherals */
        *(short *)PCGCR1@IO = 0x0;
        *(short *)PCGCR2@IO = 0x0;

        /* Bypass PLL */
        *(short *)CCR2@IO = 0x0;

         /* Set CLR_CNTL = 0 */
        *(short *)CGCR1@IO = *(short *)CGCR1@IO & 0x7FFF;
        *(short *)CGCR2@IO = 0x8000;
        *(short *)CGCR4@IO = 0x0000;
        *(short *)CGCR3@IO = 0x0806;
        *(short *)CGCR1@IO = 0x82fa; 

        /* Wait for PLL lock */
          for(i=0;i<0x7fff;i++);

        /* Switch to PLL clk */ 
         *(short *)CCR2@IO = 0x1;

        GEL_TextOut("PLL Init Done.");
    }

    Regards.

  • question:

     

    In our Project (Using VC5505_FFT_Filter_Demo), we have the following in a file called "flash_routines.h", called in "main.c"

     

    void Peripheral_Reset()
    {
        int i;

        *(short *)PSRCR = 0x0020;
        *(short *)PRCR  = 0x00BB;

        for(i=0;i<0xff;i++);
        *(short *)IVPD = 0x027F; // Load interrupt vector pointer
    }

    void ProgramPLL_100MHz() {
        int i;

        /* Enable clocks to all peripherals */
        *(short *)PCGCR1 = 0x0;
        *(short *)PCGCR2 = 0x0;

        /* Bypass PLL */
        *(short *)CCR2 = 0x0;

        /* Set CLR_CNTL = 0 */
        *(short *)CGCR1 = *(short *)CGCR1 & 0x7FFF;

        *(short *)CGCR2 = 0x8000;
        *(short *)CGCR4 = 0x0000;
        *(short *)CGCR3 = 0x0806;
        *(short *)CGCR1 = 0x82fa;

        /* Wait for PLL lock */
        for(i=0;i<0x7fff;i++);

        /* Switch to PLL clk */
        *(short *)CCR2 = 0x1;
    }

     

    And in main.c, there are InitSystem(), ConfigPort() called.

     

    Our project flash output either sounds laggy (without Interrupt pointer part) or nothing (with interrupt pointer). Is that above GEL-to-C conversion correct?

    Need answers ASAP

     

    thanks

  • Hi,

    probably you already solved your problem. Otherwise, did you check if your issue is maybe the same as described in this post?

    http://e2e.ti.com/support/dsp/tms320c5000_power-efficient_dsps/f/110/t/33709.aspx

    In short, when you are using DMA in a program that you run from flash, you have to start the corresponding DSP periphery "manually". When using CCS for loading the program, that is not necessary. I did not read the code you posted, it just sounds similar to me.

    Hope this helps,

    Regards

    Raphael