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/TMS320F28035: Running code from Flash (Standalone)

Part Number: TMS320F28035
Other Parts Discussed in Thread: C2000WARE

Tool/software: Code Composer Studio

Hi, I've been trying to port a project (digital controller) from running from RAM to Flash I have modified the linker file to put initialised and non-initialised data in the correct sections.  This all compiles and links / loads onto the device successfully but when I run it I get the following screen.  I have not done this before so any pointers of where I should look would be appreciated. 

  • Hi Richard,

    First thing I can think of checking is if you have the 'DSP2803x_CodeStartBranch.asm' file in your project. This is needed when running from flash (more info on what it does here: https://e2e.ti.com/support/microcontrollers/c2000/f/171/t/396203).

    Can be found in C2000ware:

    C:\ti\c2000\C2000Ware_2_00_00_02\device_support\f2803x\common\source

    Best,

    Kevin

  • Thanks Kevin, that's helpful.  I think also there is a requirement to add some code to copy some data from Flash to RAM (PIE vectors).  I'll have a bit of a further play with it over the next few weeks and post here what I had to do to get it working (assuming I succeed).

    Rgds, Rich

  • Hi Rich,

    This application report will be a good reference for you (which you may have already found):

    http://www.ti.com/lit/spra958

    Yes, you will need to copy portions to RAM. If you review some of the examples in C2000ware it copies the "Ramfuncs" section from the linker command file to RAM with the function below:

        //
        // Copy time critical code and Flash setup code to RAM (such as ISRs)
        // The  RamfuncsLoadStart, RamfuncsLoadEnd, and RamfuncsRunStart
        // symbols are created by the linker.
        //
        memcpy((uint16_t *)&RamfuncsRunStart,(uint16_t *)&RamfuncsLoadStart, 
                (unsigned long)&RamfuncsLoadSize);

    Best,

    Kevin

  • Hi Kevin

    Yes, I have a copy of SPRA958L which I'm working through.  I haven't done the Flash to RAM copying yet, as you say the ISRs should be copied as well as the CLA locations.  I see that the dissembler "ESTOP0" is referenced as something the compiler puts in to force emulation to halt (software breakpoint),

    Thanks again for your help,

    Rich

  • Hi Rich,

    OK, just let me know if you run into any issues or have any questions. Yes an ESTOP0 is a SW breakpoint used to assist in debug.

    Best,

    Kevin

  • Hi Kevin

    Thanks.  I have now got it running albeit in debug mode but it all seems to be running nicely, code is in the right places.  Next I'll make a release version and see it it will run by itself.  I recall there is a switch setting on the controlCard,

    Best Regards

    Rich

  • Hi Rich,

    Sorry for the delay. Yes switch SW2 is used to alter the boot mode pins. See the device datasheet (section 6.1.9) for the different selections.

    Best,

    Kevin

  • Hi Kevin

    Thanks again for your reply.  I found that the runtime initialisation of the PIE RAM isn't happening.  Having tried to rectify my code there are names in the const struct PIE_VECT_TABLE which the compiler linker can't find reference to:

    /**********************************************************************
    * The PIE vector initialization table for the F2803x
    **********************************************************************/
    const struct PIE_VECT_TABLE PieVectTableInit = {
    
    //--- Base vectors
        rsvd_ISR,                       // 0x000D00  reserved
        rsvd_ISR,                       // 0x000D02  reserved
        rsvd_ISR,                       // 0x000D04  reserved
        rsvd_ISR,                       // 0x000D06  reserved
        rsvd_ISR,                       // 0x000D08  reserved
        rsvd_ISR,                       // 0x000D0A  reserved
        rsvd_ISR,                       // 0x000D0C  reserved
        rsvd_ISR,                       // 0x000D0E  reserved
        rsvd_ISR,                       // 0x000D10  reserved
        rsvd_ISR,                       // 0x000D12  reserved
        rsvd_ISR,                       // 0x000D14  reserved
        rsvd_ISR,                       // 0x000D16  reserved
        rsvd_ISR,                       // 0x000D18  reserved
        INT13_ISR,                      // 0x000D1A  INT13 - CPU Timer1
        INT14_ISR,                      // 0x000D1C  INT14 - CPU Timer2
        DATALOG_ISR,                    // 0x000D1E  DATALOG - CPU data logging interrupt
        RTOSINT_ISR,                    // 0x000D20  RTOSINT - CPU RTOS interrupt
        EMUINT_ISR,                     // 0x000D22  EMUINT - CPU emulation interrupt


    The attached file build log is what I get. I have #include all the header files I could think of. I presume I am doing something more subtle wrongly.

  • Hi Rich,

    Are you receiving compilation errors after building for this? If so can you share a screenshot of the errors?

    Make sure you have all necessary files and includes in your project. See the C2000ware example below to compare your project to, it will have all the necessary files and configurations:

    C:\ti\c2000\C2000Ware_2_00_00_02\device_support\f2803x\examples\c28\flash_f28035

    Best,

    Kevin

  • Hi Kevin

    Thanks for the pointer to that example.  Here is a sample of the console when it fails:

    The function InitSysCtrl(); is also not recognised so that's probably a strong clue as to what is missing.  I'll let you know how I get on,

    Thanks again, Rich

  • Hi Rich,

    Were you able to get any further in fixing the compilation errors? Looks like you're probably missing source or include files in your project.

    Comparing your project to some C2000ware examples should help you in figuring out what's missing.

    Best,

    Kevin

  • Hi Kevin

    That's exactly what I intend to do, this week I haven't been working on it but next week I will be,

    Best Regards

    Rich