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.

CCS/LAUNCHXL-F28069M: Running from FLASH

Part Number: LAUNCHXL-F28069M
Other Parts Discussed in Thread: C2000WARE, CONTROLSUITE

Tool/software: Code Composer Studio

Hey, This is Mike

I have some problems trying to run my software from the FLASH, What are the steps to run in standalone mode in the LAUNCHXL-F28069M ?

Thanks for all your answers

  • Hi Mike,

    What kind of problems you are facing? If you want to debug your code in Flash, you can step through using CCS Debugger.

    Regards,
    Nirav
  • Hi Nirav

    This is the code I have, but I cannot put it on the flash. I mean, when I disconnect the LaunchXL-F28069M I have to re-programm it in order tu put it to work.

    #include "F2806x_Device.h"   // Aquí se encuentran las definiciones de los módulos internos del DSP F28069M, siempre hace referencia a este archivo, al menos una vez
    #include "F2806x_Examples.h" // Aquí se encuentra el ejemplo de ajuste de parametros del WD, CPUCLK, modelo del DSP y la definición de la función "DELAY_US()"
    #include <string.h>          // Aquí se encuentra el prototipo de la función "memcpy(&a,&b,(size_t)$b)" la cual permite escribir sobre la RAM
    
    /*
     * La declaración de variables tipo "extern" hace referencia a que estas variables están en la tabla de simbolos de otro archivo, en este caso, del archivo enlazador "F28069M.cmd".
     * El compilador no interpreta estas variables, el archivo enlazador se encarga de ello.
     *  extern Uint16 RamfuncsLoadStart;
     *  extern Uint16 RamfuncsLoadEnd;
     *  extern Uint16 RamfuncsRunStart;
     */
    
    extern Uint16 RamfuncsLoadStart;
    extern Uint16 RamfuncsLoadEnd;
    extern Uint16 RamfuncsRunStart;
    
    void main(void)
    { // Inicio función principal
    
        #ifdef FLASH
        memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadEnd);   // Manipulación de bloque de memoria: El contenido de RamfuncsLoadStart
        #endif                                                                     // se copia en RamfuncsRunStart, la cantidad de bytes copiados lo define
                                                                                   // el tamaño de RamfuncsLoadEnd. Estas acciones las realiza el enlazador (F28069M.cmd)
        InitFlash();// Inicializa las funciones para copiar el programa a la memoria Flash
        EALLOW; //Emulación de registros
        GpioCtrlRegs.GPBDIR.bit.GPIO39 = 1; //GPIO39 como salida
        GpioCtrlRegs.GPBMUX1.bit.GPIO39 = 0; //GPIO39 como GPIO, ninguna función especial
        EDIS;
        for(;;)
        {
                EALLOW;
                GpioDataRegs.GPBSET.bit.GPIO39 = 1;
                DELAY_US(500000);
                GpioDataRegs.GPBCLEAR.bit.GPIO39 = 1;
                DELAY_US(500000);
                EDIS;
        }
    
    } // Fin de función principal
    

  • I know about the switches, When I programm the LaunchXL-F28069M I disconnect it and then I move the switches (UP-UP-DOWN) But it seems it doesn't work to me
  • Mike,

    Did you build your application with Flash linker command file?
    Checkout the C2000Ware examples with Flash build configuration (Right click on imported example -> Build Configurations -> Set Active -> FLASH).

    Thanks and regards,
    Vamsi
  •  I did the code by myself, and I was trying tu put it onto the flash. I don't have this option here

  • I use this but it doesn't work e2e.ti.com/.../633836
  • Mike,

    Can you share your linker command file?

    Thanks and regards,
    Vamsi
  • Sure, Here it is

    /*
    //###########################################################################
    //
    // FILE:    F28069M.cmd
    //
    // TITLE:   Linker Command File For F28069M Device
    //
    //###########################################################################
    // $TI Release: F2806x Support Library v2.04.00.00 $ 
    // $Release Date: Tue Jun 26 03:13:59 CDT 2018 $ 
    // $Copyright:
    // Copyright (C) 2009-2018 Texas Instruments Incorporated - http://www.ti.com/
    //
    // Redistribution and use in source and binary forms, with or without 
    // modification, are permitted provided that the following conditions 
    // are met:
    // 
    //   Redistributions of source code must retain the above copyright 
    //   notice, this list of conditions and the following disclaimer.
    // 
    //   Redistributions in binary form must reproduce the above copyright
    //   notice, this list of conditions and the following disclaimer in the 
    //   documentation and/or other materials provided with the   
    //   distribution.
    // 
    //   Neither the name of Texas Instruments Incorporated nor the names of
    //   its contributors may be used to endorse or promote products derived
    //   from this software without specific prior written permission.
    // 
    // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
    // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
    // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
    // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
    // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
    // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
    // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
    // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    // $
    //###########################################################################
    */
    
    /* ======================================================
    // For Code Composer Studio V2.2 and later
    // ---------------------------------------
    // In addition to this memory linker command file,
    // add the header linker command file directly to the project.
    // The header linker command file is required to link the
    // peripheral structures to the proper locations within
    // the memory map.
    //
    // The header linker files are found in <base>\headers\cmd
    //
    // For BIOS applications add:      F2806x_Headers_BIOS.cmd
    // For nonBIOS applications add:   F2806x_Headers_nonBIOS.cmd
    ========================================================= */
    
    /* ======================================================
    // For Code Composer Studio prior to V2.2
    // --------------------------------------
    // 1) Use one of the following -l statements to include the
    // header linker command file in the project. The header linker
    // file is required to link the peripheral structures to the proper
    // locations within the memory map                                    */
    
    /* Uncomment this line to include file only for non-BIOS applications */
    /* -l F2806x_Headers_nonBIOS.cmd */
    
    /* Uncomment this line to include file only for BIOS applications */
    /* -l F2806x_Headers_BIOS.cmd */
    
    /* 2) In your project add the path to <base>\headers\cmd to the
       library search path under project->build options, linker tab,
       library search path (-i).
    /*========================================================= */
    
    /* Define the memory block start/length for the F2806x
       PAGE 0 will be used to organize program sections
       PAGE 1 will be used to organize data sections
    
       Notes:
             Memory blocks on F28069 are uniform (ie same
             physical memory) in both PAGE 0 and PAGE 1.
             That is the same memory region should not be
             defined for both PAGE 0 and PAGE 1.
             Doing so will result in corruption of program
             and/or data.
    
             Contiguous SARAM memory blocks can be combined
             if required to create a larger memory block.
    */
    
    MEMORY
    {
    PAGE 0 :   /* Program Memory */
               /* Memory (RAM/FLASH/OTP) blocks can be moved to PAGE1 for data allocation */
       RAML0       : origin = 0x008000, length = 0x000800     /* on-chip RAM block L0 */
       RAML1       : origin = 0x008800, length = 0x000400     /* on-chip RAM block L1 */
       OTP         : origin = 0x3D7800, length = 0x000400     /* on-chip OTP */
    
       FLASHH      : origin = 0x3D8000, length = 0x004000     /* on-chip FLASH */
       FLASHG      : origin = 0x3DC000, length = 0x004000     /* on-chip FLASH */
       FLASHF      : origin = 0x3E0000, length = 0x004000     /* on-chip FLASH */
       FLASHE      : origin = 0x3E4000, length = 0x004000     /* on-chip FLASH */   
       FLASHD      : origin = 0x3E8000, length = 0x004000     /* on-chip FLASH */
       FLASHC      : origin = 0x3EC000, length = 0x004000     /* on-chip FLASH */
       FLASHA_B    : origin = 0x3F0000, length = 0x007F80     /* on-chip FLASH */
       CSM_RSVD    : origin = 0x3F7F80, length = 0x000076     /* Part of FLASHA.  Program with all 0x0000 when CSM is in use. */
       BEGIN       : origin = 0x3F7FF6, length = 0x000002     /* Part of FLASHA.  Used for "boot to Flash" bootloader mode. */
       CSM_PWL_P0  : origin = 0x3F7FF8, length = 0x000008     /* Part of FLASHA.  CSM password locations in FLASHA */
    
       FPUTABLES   : origin = 0x3FD590, length = 0x0006A0	 /* FPU Tables in Boot ROM */
       IQTABLES    : origin = 0x3FDC30, length = 0x000B50    /* IQ Math Tables in Boot ROM */
       IQTABLES2   : origin = 0x3FE780, length = 0x00008C    /* IQ Math Tables in Boot ROM */
       IQTABLES3   : origin = 0x3FE80C, length = 0x0000AA	 /* IQ Math Tables in Boot ROM */
    
       ROM         : origin = 0x3FF3B0, length = 0x000C10     /* Boot ROM */
       RESET       : origin = 0x3FFFC0, length = 0x000002     /* part of boot ROM  */
       VECTORS     : origin = 0x3FFFC2, length = 0x00003E     /* part of boot ROM  */
    
    PAGE 1 :   /* Data Memory */
               /* Memory (RAM/FLASH/OTP) blocks can be moved to PAGE0 for program allocation */
               /* Registers remain on PAGE1                                                  */
    
       BOOT_RSVD   : origin = 0x000000, length = 0x000050     /* Part of M0, BOOT rom will use this for stack */
       RAMM0       : origin = 0x000050, length = 0x0003B0     /* on-chip RAM block M0 */
       RAMM1       : origin = 0x000400, length = 0x000400     /* on-chip RAM block M1 */
       RAML2_3     : origin = 0x008C00, length = 0x001400     /* on-chip RAM block L2 */
       RAML4       : origin = 0x00A000, length = 0x002000     /* on-chip RAM block L4 */
       RAML5       : origin = 0x00C000, length = 0x002000     /* on-chip RAM block L5 */
       RAML6       : origin = 0x00E000, length = 0x002000     /* on-chip RAM block L6 */
       RAML7       : origin = 0x010000, length = 0x002000     /* on-chip RAM block L7 */
       RAML8       : origin = 0x012000, length = 0x001800     /* on-chip RAM block L8 */
       USB_RAM     : origin = 0x040000, length = 0x000800     /* USB RAM		  */   
    }
    
    /* Allocate sections to memory blocks.
       Note:
             codestart user defined section in DSP28_CodeStartBranch.asm used to redirect code
                       execution when booting to flash
             ramfuncs  user defined section to store functions that will be copied from Flash into RAM
    */
    
    
    SECTIONS
    {
    
       /* Allocate program areas: */
       .cinit              : > FLASHA_B,   PAGE = 0
       .pinit              : > FLASHA_B,   PAGE = 0
       .text               : > FLASHA_B,   PAGE = 0
       codestart           : > BEGIN,      PAGE = 0
       ramfuncs            : LOAD = FLASHD,
                             RUN = RAML0,
                             LOAD_START(_ramfuncsLoadStart),
                             LOAD_END(_ramfuncsLoadEnd),
                             RUN_START(_ramfuncsRunStart),
                             PAGE = 0
    
       csmpasswds          : > CSM_PWL_P0, PAGE = 0
       csm_rsvd            : > CSM_RSVD,   PAGE = 0
    
       /* Allocate uninitalized data sections: */
       .stack              : > RAMM0,      PAGE = 1
       .ebss               : > RAML2_3,    PAGE = 1
       .esysmem            : > RAML2_3,    PAGE = 1
    
       /* Initalized sections to go in Flash */
       /* For SDFlash to program these, they must be allocated to page 0 */
       .econst             : > FLASHA_B,   PAGE = 0
       .switch             : > FLASHA_B,   PAGE = 0
    
    
       
       /* Allocate IQ math areas: */
       IQmath              : > FLASHA_B,   PAGE = 0            /* Math Code */
       IQmathTables        : > IQTABLES,   PAGE = 0, TYPE = NOLOAD
       
       /* Allocate FPU math areas: */
       FPUmathTables       : > FPUTABLES,  PAGE = 0, TYPE = NOLOAD
       
       DMARAML5	           : > RAML5,      PAGE = 1
       DMARAML6	           : > RAML6,      PAGE = 1
       DMARAML7	           : > RAML7,      PAGE = 1
       DMARAML8	           : > RAML8,      PAGE = 1   
    
      /* Uncomment the section below if calling the IQNexp() or IQexp()
          functions from the IQMath.lib library in order to utilize the
          relevant IQ Math table in Boot ROM (This saves space and Boot ROM
          is 1 wait-state). If this section is not uncommented, IQmathTables2
          will be loaded into other memory (SARAM, Flash, etc.) and will take
          up space, but 0 wait-state is possible.
       */
       /*
       IQmathTables2    : > IQTABLES2, PAGE = 0, TYPE = NOLOAD
       {
    
                  IQmath.lib<IQNexpTable.obj> (IQmathTablesRam)
    
       }
       */
       /* Uncomment the section below if calling the IQNasin() or IQasin()
          functions from the IQMath.lib library in order to utilize the
          relevant IQ Math table in Boot ROM (This saves space and Boot ROM
          is 1 wait-state). If this section is not uncommented, IQmathTables2
          will be loaded into other memory (SARAM, Flash, etc.) and will take
          up space, but 0 wait-state is possible.
       */
       /*
       IQmathTables3    : > IQTABLES3, PAGE = 0, TYPE = NOLOAD
       {
    
                  IQmath.lib<IQNasinTable.obj> (IQmathTablesRam)
    
       }
       */
    
       /* .reset is a standard section used by the compiler.  It contains the */
       /* the address of the start of _c_int00 for C Code.   /*
       /* When using the boot ROM this section and the CPU vector */
       /* table is not needed.  Thus the default type is set here to  */
       /* DSECT  */
       .reset              : > RESET,      PAGE = 0, TYPE = DSECT
       vectors             : > VECTORS,    PAGE = 0, TYPE = DSECT
    
    }
    
    /*
    //===========================================================================
    // End of file.
    //===========================================================================
    */

  • Mike,

    Your linker command file looks fine.

    Do you know if your application started executing from Flash or not? May be you can toggle a GPIO to indicate the start of the application for this debug.

    Did you initialize the Flash wait states etc (using InitFlash()) as per the operating frequency?
    Please check whether it is mapped to ramfuncs (.TI.ramfunc) or not.

    Thanks and regards,
    Vamsi
  • Hi, This is the main code

    #include <lib.h>
    #pragma CODE_SECTION(InitFlash, "ramfuncs")
        Uint32 GPIO_count = 0;
    
    void InitFlash(void)
    {
        EALLOW;
    
        //
        // Enable Flash Pipeline mode to improve performance of code executed from
        // Flash.
        //
        FlashRegs.FOPT.bit.ENPIPE = 1;
    
        //                CAUTION
        // Minimum waitstates required for the flash operating
        // at a given CPU rate must be characterized by TI.
        // Refer to the datasheet for the latest information.
        //
    
        //
        // Set the Paged Waitstate for the Flash
        //
        FlashRegs.FBANKWAIT.bit.PAGEWAIT = 3;
    
        //
        // Set the Random Waitstate for the Flash
        //
        FlashRegs.FBANKWAIT.bit.RANDWAIT = 3;
    
        //
        // Set the Waitstate for the OTP
        //
        FlashRegs.FOTPWAIT.bit.OTPWAIT = 5;
    
        //
        // CAUTION -  ONLY THE DEFAULT VALUE FOR THESE 2 REGISTERS SHOULD BE USED
        //
        FlashRegs.FSTDBYWAIT.bit.STDBYWAIT = 0x01FF;
        FlashRegs.FACTIVEWAIT.bit.ACTIVEWAIT = 0x01FF;
        EDIS;
    
        //
        // Force a pipeline flush to ensure that the write to the last register
        // configured occurs before returning.
        //
        __asm(" RPT #7 || NOP");
    }
    
    void main(void)
    { // Inicio función principal
        memcpy(&ramfuncsRunStart, &ramfuncsLoadStart, (size_t)&ramfuncsLoadEnd); // Manipulación de bloque de memoria: El contenido de RamfuncsLoadStart
                                                                                    // se copia en RamfuncsRunStart, la cantidad de bytes copiados lo define
                                                                                    // el tamaño de RamfuncsLoadEnd. Estas acciones las realiza el enlazador (F28069M.cmd)
    
        InitFlash();// Inicializa las funciones para copiar el programa a la memoria Flash
        EALLOW; //Emulación de registros
        GpioCtrlRegs.GPBMUX1.bit.GPIO39 = 0; //GPIO39 como GPIO, ninguna función especial
        GpioDataRegs.GPBCLEAR.bit.GPIO39 = 1;
        GpioCtrlRegs.GPBDIR.bit.GPIO39 = 1; //GPIO39 como salida
    
        GpioCtrlRegs.GPBMUX1.bit.GPIO34 = 0;     // GPIO34 como GPIO
        GpioDataRegs.GPBCLEAR.bit.GPIO34 = 1;    // Salida en estado bajo antes de configurar el pin como Salida, Modo Drenador (Sink). Consultar spruh18g.pdf (pág 120)
        GpioCtrlRegs.GPBDIR.bit.GPIO34 = 1;      // GPIO34 como salida
        GpioDataRegs.GPBSET.bit.GPIO39 = 1;
        EDIS;
    
        for(;;)
        {
    
    
    
                    if(GPIO_count++>1000000)
                    {
                    EALLOW;
                    GpioDataRegs.GPBTOGGLE.bit.GPIO39 = 1;
                    GpioDataRegs.GPBTOGGLE.bit.GPIO34 = 1;
                    GPIO_count=0;}
                    EDIS;
    
    
    
    
    
        }
    
    } // Fin de función principal
    

  • Some help, I got stucked UU
  • Hi Mike,

    I am still not completely clear on the issue, can you please clarify what is the problem:

    1. Are you able to build and compile your project without any errors?
    2. If so, are you having issues loading the code into Flash?
    3. If you loaded into the Flash, are you having issues running the code from the Flash?

    Regards,
    Nirav
  • Hi Nirav

    I'm able to build and compile my program with any error
    The problem is when I disconnect my launchpad, I have to reprogramm it in order to put it to work.
    I already did the change of the switches ON-ON-OFF but the code doesn´t run from flash
  • Hi Mike,

    Ok, now I understand. Is it possible for you to take a picture of switch configuration on launchpad and send? I want to make sure it is in the correct boot mode.

    Thanks,
    Nirav
  • Sure, here it is

    Boot Mode

    And Get Mode

  • Hi Mike,

    Switch configuration looks correct. Can you check couple of things at your end?

    1. Dump OTP_KEY (0x3D7BFB) and OTP_BMODE (0x3D7BFE), you can connect the Launchpad to the debugger and dump these otp values.
    2. Build & reload the LAUNCHXL-F28069M demo software from controlSUITE

    Regards,
    Nirav
  • Where do I have tu dump OTP ?
    Thanks
  •  I can´t use the DEMO program here it is the screen shoot

  • I have resolved the issue of .ebss, it was because of the size of the block memory. but I have not solved the problem of the FLASH
  • Anybody out there?
  • I'm using the Example as a guide to implement my code, but the example has some code about cpu registers and thinks like that, I think my code doesn´t need those registers, Just I think is a matter of the linker file, the codestart branch, the memcpy and the init flash ... some help would be good, I have 36 hours with this thing...

  • Mike,

    I see Nirav asked you to tell the values at OTP_KEY (0x3D7BFB) and OTP_BMODE (0x3D7BFE). Please open CCS memory window and enter these addresses. Please look at Table 2-6. OTP Values for GetMode in www.ti.com/.../spruh18g.pdf to know why these locations are important. If you program OTP_KEY as 0x005A, then value at OTP_BMODE location will decide the boot mode. You need to make sure it is configured for flash boot if you program OTP_KEY as 0x005A. If OTP_KEY is not 0x005A (and since you confirmed the boot pins), we know flash boot is properly configured. Hence, please confirm the values at above locations.

    Quick questions to help your debug:
    1) Did you disable watchdog in your application? If not, is it getting serviced as needed?
    2) Do you see XRSn toggling? If yes, please check if your application is getting a reset due to watchdog expiration.
    3) Were you able to execute your application correctly from Flash when debugger is connected?
    4) Did you connect a scope to the GPIOs and observe the toggles when debugger is connected?
    5) How are you powering your board?

    Note that we may not respond in weekend.

    Thanks and best regards,
    Vamsi
  • Hi Vamsi, Hi Nirav

    I have resolved this issue, The thing was about disabling the WD, this is found at InitSysCtrl.c, but, also this disabling is found in InitPLL(...); Because if the PLL is not initialized, the functions, after the code run from flash, are slow, So first I initialize the internal oscillators, then I initialize the PLL, then the memcpy and finally the initflash(). After debugging I have to move the switches int this position

    1 - ON

    2 - ON

    3 - OFF

    This works for me

    Thanks both of you for the hints, also , thank to this issue, I learned more about the LAUNCHXL-F28069M

    This is the main code If somebody need it






    Uint32 GPIO_count = 0;
    void main(void)
    { // Inicio función principal
    
    
        IntOsc1Sel();
        InitPll(DSP28_PLLCR,DSP28_DIVSEL);
        memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadEnd); // Manipulación de bloque de memoria: El contenido de RamfuncsLoadStart
                                                                                 // se copia en RamfuncsRunStart, la cantidad de bytes copiados lo define
                                                                                  // el tamaño de RamfuncsLoadEnd. Estas acciones las realiza el enlazador (F28069M.cmd)z
        InitFlash();// Inicializa las funciones para copiar el programa a la memoria Flash
        EALLOW; //Emulación de registros
        GpioCtrlRegs.GPBMUX1.bit.GPIO39 = 0; //GPIO39 como GPIO, ninguna función especial
        GpioDataRegs.GPBCLEAR.bit.GPIO39 = 1;
        GpioCtrlRegs.GPBDIR.bit.GPIO39 = 1; //GPIO39 como salida
        GpioDataRegs.GPBSET.bit.GPIO39=1;
    
        GpioCtrlRegs.GPBMUX1.bit.GPIO34 = 0;     // GPIO34 como GPIO
        GpioDataRegs.GPBCLEAR.bit.GPIO34 = 1;    // Salida en estado bajo antes de configurar el pin como Salida, Modo Drenador (Sink). Consultar spruh18g.pdf (pág 120)
        GpioCtrlRegs.GPBDIR.bit.GPIO34 = 1;      // GPIO34 como salida
    
        EDIS;
    
        for(;;)
        {
    
    
    
                    if(GPIO_count++>50000)
                    {
                    EALLOW;
                    GpioDataRegs.GPBTOGGLE.bit.GPIO39 = 1;
                    GpioDataRegs.GPBTOGGLE.bit.GPIO34 = 1;
                    GPIO_count=0;}
                    EDIS;
    
    
    
    
    
        }
    
    } // Fin de función principal
    
    
    
    

  • Mike,

    Glad that WD disable hint worked for you. I am closing this thread.

    Thanks and regards,
    Vamsi