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.

TMS320F28027F: Where is the code stored? Erases on power cycle.

Part Number: TMS320F28027F
Other Parts Discussed in Thread: TMS320F28027

Hello,

I know there is likely a simple answer, but I have been unable to find it.  I've gone through most of the TMS320F2802x  datasheet (sprs523), as well as searched for forums.

I have a LauchXL-F28027F, and it came with a default little demo program.

I wrote a simple little example, loaded it, and it ran.  When I power cycle the board, it goes back to the original demo.  Hmmm...  ?

I then imported a sample from the resource explorer, and built and ran it.  Now it erased the built in demo program.  But it does run.  Only now when I power cycle the board, it's dead (well, unprogrammed). I have to reprogram it with CCS every time.

I looked at the map file, and it shows all the code in flash sectors D and C, as I would expect.  And it shows the reset vector where it should be (3FFFC0-C2), but says it's unused. I would expect that on power up, it would load the program counter from the reset vector, which should point to the entry point in Flash, section D (or where ever) and the board would run WITHOUT having to reload the code every time.

My questions:

What setting during loading, debug process from inside CCS 6.2 which caused it to erase the demo program?

Where was the demo program anyway?  Obviously is should have been in Flash memory to be persistent.  But I wonder why did my first test program NOT erase the demo program.

The MAP file shows the reset vector as "unused"  (actually, length =2, used = 0. unused = 2).  Do I have to manually set that?  How do I set it, and how do I figure out where the compile set the entry point of the program?

Why doesn't any program I write simply replace the code in Flash and run when the board is first powered up?

I don't see a need to post my code, because it is essentially "task 28" from the Piccolo Experimenters kit in the resource explorer.

Thanks in advance.

-CSW

  • Hi,

    The MAP file shows the reset vector as "unused"  (actually, length =2, used = 0. unused = 2).  Do I have to manually set that?

    Reset vector address is in ROM which user can not update hence. This specific section in linker cmd file has attribute DESCT hence it's showing unused. This is of BOOTROM code which is provided by TI.

    Why doesn't any program I write simply replace the code in Flash and run when the board is first powered up?

    In standalone mode PC does not get written with reset vector but the execution jump to predefined location (0x3F7FF6). User need to make sure the entry point of their code is this predefined location. If entry point is any other address then code will not run as expected. You may want to try the linker cmd file of example code for your project and see if that helps.

    Regards,

    Vivek Singh 

  • Thanks for your reply, but I'm still not clear. First, your statement "You may want to try the linker cmd file of example code for your project and see if that helps."
    I am using the original linker cmd file from the example project completely untouched, and it doesn't do it. Which is why I am asking. I see the same thing in the map file for that address as I saw for the reset entry: "BEGIN" Length=2, used = 0, unused = 2

    I can find no clues on how to manipulate the file.

    So, the data sheet says on reset "The program counter points to the address contained at the location 0x3F FFC0 " (page 12). So you are saying that the contents of this address is something that the user cannot update? Therefore, that would imply that the user cannot set ANY of the 32 interrupt vectors in this table? Then where are they pointing?
    If 0x3F FFC0 hardcoded to point to address 0x3F 7FF6 which contains yet another vector address, or contains a jump to where ever we need to go?

    The data sheet does, however, tell me that there are 32 vectors at 0x3f ffc0 if VMAP=1, or there are M0 vectors at address 0x0000 if VMAP=0. It does not, however, tell me what "VMAP" is, how to set it, or anything about those vectors, aside from the aformentioned reset vector.

    Is there yet another document or resource I need to read? I'm into about 5 so far...
  • Which linker cmd file you are using (please tell the name).

    Also refer the BOOTROM reference guide of this device.

    Regards,

    Vivek Singh

  • The sample is "task28_ExperimentersKit_PiccoloF28027"

    The built in (came with the example package) linker file is "TMS320F28027.cmd".   I can see that .cinit apparently is supposed to be the entry  point, but it just says "> FLASH"

    I am pasting the contents here:

    /*

    * Copyright (c) 2015-2016, Texas Instruments Incorporated

    * ...  clipped... .

    */

    /*

    *  ======== TMS320F28027.cmd ========

    *  Define the memory block start/length for the F28027

    */

    /*

    *  PAGE 0 will be used to organize program sections

    *  PAGE 1 will be used to organize data sections

    *

    *  Notes:

    *        Memory blocks on F2802x 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.

    *

    *        L0 memory blocks are mirrored - that is

    *        they can be accessed in high memory or low memory.

    *        For simplicity only one instance is used in this

    *        linker file.

    */

    MEMORY

    {

    PAGE 0:    /* Program Memory */

       OTP         : origin = 0x3D7800, length = 0x000400     /* on-chip OTP */

       FLASH       : origin = 0x3F0000, length = 0x007F80     /* on-chip FLASH */

       CSM_RSVD    : origin = 0x3F7F80, length = 0x000076     /* Program with all 0x0000 when CSM is in use. */

       BEGIN       : origin = 0x3F7FF6, length = 0x000002     /* Used for "boot to Flash" bootloader mode. */

       CSM_PWL     : origin = 0x3F7FF8, length = 0x000008     /* CSM password locations in FLASH */

       IQTABLES    : origin = 0x3FE000, length = 0x000B50     /* IQ Math Tables in Boot ROM */

       IQTABLES2   : origin = 0x3FEB50, length = 0x00008C     /* IQ Math Tables in Boot ROM */

       IQTABLES3   : origin = 0x3FEBDC, length = 0x0000AA   /* IQ Math Tables in Boot ROM */

       ROM         : origin = 0x3FF27C, length = 0x000D44     /* Boot ROM */

       RESET       : origin = 0x3FFFC0, length = 0x000002     /* part of boot ROM  */

       VECTORS     : origin = 0x3FFFC2, length = 0x00003E     /* part of boot ROM  */

    PAGE 1 :   /* Data Memory */

       M01SARAM    : origin = 0x000000, length = 0x000800     /* on-chip RAM block M0, M1 */

       PIEVECT     : origin = 0xD00,    length = 0x100

       L0SARAM     : origin = 0x008000, length = 0x001000     /* on-chip RAM block L0 */

    }

    /*

    *  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              : > FLASH       PAGE = 0

       .pinit              : > FLASH       PAGE = 0

       .text               : > FLASH       PAGE = 0

       codestart           : > BEGIN       PAGE = 0

       ramfuncs            : LOAD = FLASH      PAGE = 0,

                             RUN  = L0SARAM    PAGE = 1,

                             LOAD_START(_RamfuncsLoadStart),

                             LOAD_SIZE(_RamfuncsLoadSize),

                             LOAD_END(_RamfuncsLoadEnd),

                             RUN_START(_RamfuncsRunStart)

       csmpasswds          : > CSM_PWL     PAGE = 0

       csm_rsvd            : > CSM_RSVD    PAGE = 0

       /* Allocate uninitalized data sections: */

       .stack              : > M01SARAM | L0SARAM      PAGE = 1

       .ebss               : > M01SARAM | L0SARAM      PAGE = 1

       .esysmem            : > L0SARAM | M01SARAM      PAGE = 1

       .cio                : > L0SARAM | M01SARAM      PAGE = 1

       /* Initalized sections go in Flash */

       /* For SDFlash to program these, they must be allocated to page 0 */

       .econst             : > FLASH       PAGE = 0

       .switch             : > FLASH       PAGE = 0

       .args               : > FLASH       PAGE = 0

    #ifdef __TI_COMPILER_VERSION__

    #if __TI_COMPILER_VERSION__ >= 15009000

       .TI.ramfunc         : {} LOAD = FLASH    PAGE = 0,

                                RUN  = L0SARAM  PAGE = 1,

                                table(BINIT)

    #endif

    #endif

       /* Allocate IQ math areas: */

       IQmath              : > FLASH       PAGE = 0            /* Math Code */

       IQmathTables        : > IQTABLES    PAGE = 0, TYPE = NOLOAD

       /*

        *  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)

       }

       */

    }

  • Entry point would be codestart and it's placed in BEGIN section which is correct. I don't see any issue in linker cmd file.

    When you connect CCS and load your program, it loads correctly. Right? Can you check that?

    Regards,

    Vivek Singh 

  • You know, I can't even get TI's web site to work... When I press "POST" I little SOLID RED box pops up.
    And it's not the first defective thing I've found dealing with TI... It's actually more like the 3rd or 4th. Not very reassuring, I can tell you...

    Spent 20 minute writing and attaching files... And all it gives me is a RED BOX.
  • Oh look. That COMPLETELY EMPTY RED BOX apparently means I can't attach a map file.
  • Getting back on subject...

    Yes, it does work when I load it, tethered to my PC.  The Launchpad XL is an XDS100 device, so I can load it, debug it, everything like that.  Exactly like the training materials say.  I have learned that much so far.

    But I still have that fundamental question:  How do I set it to run on power up?  I want to be able to unplug it from the PC, and attach it to a circuit (relays, inputs, uarts... whatevever) at a different location.  *Without* being tethered to a PC.  That's all part of this development/evaluation process.

    It is behaving like the memory is completely volatile.  That is, when I apply power, nothing of what I downloaded before is still in memory.  

    I examined the TMS320x2802x Piccolo Boot ROM ("sprufn6a" ... where do they get these non-intuitive names??).  And it explains the boot process that is in ROM better.  Thanks for pointing me to it,  it's too bad the data sheet doesn't more clearly tell you direct you toward it.

    But the question is still there, just shifted to a new entry point:  How do I get the entry point set properly, so It runs at powerup?  That's assuming the program I am loading is actually going into FLASH. I assume it is, the MAP file addresses seem to tell me so, which I will attach.

    I have yet to even figure out how to use CCS to debug an existing, loaded, program.  CCS downloads the code every time... I can't find any menu option  that says anything like "start executing the code that's already in it, I don't want to reload the code, especially since it hasn't changed..."

    Map file attached.task28_ExperimentersKit_PiccoloF28027.IM_NOT_A_MAP_FILE.txt

  • Hi,

    Sorry, look like this post was not answered. Not sure if you were able to resolve the issue.

    I have yet to even figure out how to use CCS to debug an existing, loaded, program.  CCS downloads the code every time... I can't find any menu option  that says anything like "start executing the code that's already in it, I don't want to reload the code, especially since it hasn't changed..."

    You need to click on "reset" and then on "restart" that would take the code to it's entry point without re-loading the program and then you can run the code.

    Vivek Singh

  • Thanks. That answered one of the questions.

    But I still can't figure out how it works to set it to boot cold.

    By default, the project has the entry point specified to "_c_int00"  under Project Properties | C2000 Linker | Advanced Options | Symbol Management.

    But the compiler *completely ignores* that, and put nothing at the entry point address (which I learned is 3F7FF6 after much digging)

    Nor can I get it to do that by defining "_c_int00   : > BEGIN       PAGE = 0" in my cmd file...

    ( where "BEGIN" is defined as "BEGIN       : origin = 0x3F7FF6, length = 0x000002"  )

    On the other hand, add the "boot.asm" file, make sure the CMD file has "codestart           : > BEGIN       PAGE = 0"  and it does work.

    However, I have another project that looks to be configured the exact same way, but it DOESN'T WORK THAT WAY.  The "Example_F2802xLaunchPadDemo" doesn't even have a boot.asm, but it does properly program the device...?  What is going on???

    And, of course, the compiler or CCS doesn't tell me that it's not configuring my device the way I think I'm specifying.  It just fails to do so, leaving me scratching my head as to what is wrong.

    And don't even get me started on "codestart" versus "code_start"...

  • Hi,

    By default, the project has the entry point specified to "_c_int00"  under Project Properties | C2000 Linker | Advanced Options | Symbol Management.

    But the compiler *completely ignores* that, and put nothing at the entry point address (which I learned is 3F7FF6 after much digging)

    Setting in the CCS project is for CCS and that has nothing to do with compiler. Project setting only tells CCS tools about entry point so that CCS can write that value into PC after code is loaded. Compiler uses the linker cmd file to place the code at required memory location hence you have to place the codestart section at BEGIN in cmd file.

    And don't even get me started on "codestart" versus "code_start"...

    codestart is name of section where as code_start is function name. It's done that way to avoid confusion.

    Regards,

    Vivek Singh

  • Vivek Singh said:

    codestart is name of section where as code_start is function name. It's done that way to avoid confusion.

    Regards,

    Vivek Singh

    To avoid confusion??  Really?

    Where is any of this documented?  I haven't found it in my 10+ PDFs and training material I've been able to uncover so far.

    Neither "codestart" nor "code_start" are function names, section names, nor anything else I can find inside anything in my project.  Except the linker CMD file has an entry that is basically saying "when you find it, put it here...".  But I can't find it.

    Vivek Singh said:

    Setting in the CCS project is for CCS and that has nothing to do with compiler. Project setting only tells CCS tools about entry point so that CCS can write that value into PC after code is loaded. Compiler uses the linker cmd file to place the code at required memory location hence you have to place the codestart section at BEGIN in cmd file.

    If the Project setting has nothing to do with the compiler, why, after changing it to "_c_int00", does my lauchpad NOT work after power cycling it once the code is loaded into flash?  That "codestart" is entry is still sitting in my cmd file.  I can tell you why it's not working, it's because the loading process is NOT placing the correct vector at the FLASH BOOT entry location. I can see that in the map file, for reasons that are completely unexplained.  

    So setting that value in the CCS project most certainly has something to do with the compile, linker, and load process, but I have no clue what.  I only know that if I change it, it doesn't work.  I can give you a gazillion examples of settings that don't work.  And only trial and error, tripping accidentally over that single setting that does work...  Sometimes... Maybe...  Depending on something else in your project that can't be defined...  Because I have two projects, both for this launchpad, which should be identical, and behave differently.

    Is there anything that documents this in a coherent and consistent manner?

    -Scott (Christopher)