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.

Flash boot with instaSPIN project

Other Parts Discussed in Thread: MOTORWARE, CONTROLSUITE, TMS320F28062F

/*
// TI File $Revision: /main/3 $
// Checkin $Date: March 3, 2011   13:45:43 $
//###########################################################################
//
// FILE:    28069_RAM_lnk.cmd
//
// TITLE:   Linker Command File For F28069 examples that run out of RAM
//
//          This ONLY includes all SARAM blocks on the F28069 device.
//          This does not include flash or OTP.
//
//          Keep in mind that L0,L1,L2,L3 and L4 are protected by the code
//          security module.
//
//          What this means is in most cases you will want to move to
//          another memory map file which has more memory defined.
//
//###########################################################################
// $TI Release: 2806x C/C++ Header Files V1.10 $ 
// $Release Date: April 7, 2011 $ 
//###########################################################################
*/

/* ======================================================
// 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>\F2806x_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>\F2806x_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 :

   BEGIN       : origin = 0x000000, length = 0x000002    // BEGIN is used for the "boot to SARAM" bootloader mode
   RAMM0       : origin = 0x000050, length = 0x0003B0
   RAML0_L3    : origin = 0x008000, length = 0x002000	 // on-chip RAM block RAML0-L3
   L4SARAM     : origin = 0x00A000, length = 0x002000     /* L4 SARAM, CSM secure */

   RESET       : origin = 0x3FFFC0, length = 0x000002
   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

   BOOTROM    : origin = 0x3FF3B0, length = 0x000C10

   OTP            (R) : origin = 0x3D7800, length = 0x000400     // OTP

   FLASH_ABCDEFGH (R) : origin = 0x3D8000, length = 0x01FF80     // FLASH, All sectors combined
   CSM_RSVD       (R) : origin = 0x3F7F80, length = 0x000076     // Part of FLASH Sector A.  Reserved when CSM is in use.
   BEGIN_FLASH    (R) : origin = 0x3F7FF6, length = 0x000002     // Part of FLASH Sector A.  Used for "Jump to flash" bootloader mode.
   PASSWORDS      (R) : origin = 0x3F7FF8, length = 0x000008     // Part of FLASH Sector A.  CSM password locations.


PAGE 1 :

   BOOT_RSVD   : origin = 0x000002, length = 0x00004E    // Part of M0, BOOT rom will use this for stack
   RAMM1       : origin = 0x000400, length = 0x000400    // on-chip RAM block M1
   RAML4_5     : origin = 0x00A000, length = 0x004000    // on-chip RAM block L4 to L5

   ECANA       : origin = 0x006000, length = 0x000040     // eCAN-A Control and Status Registers
   ECANA_LAM   : origin = 0x006040, length = 0x000040     // eCAN-A Local Acceptance Masks
   ECANA_MOTS  : origin = 0x006080, length = 0x000040     // eCAN-A Message Object Time Stamps
   ECANA_MOTO  : origin = 0x0060C0, length = 0x000040     // eCAN-A Object Time-Out Registers
   ECANA_MBOX  : origin = 0x006100, length = 0x000100     // eCAN-A Milboxes

}


SECTIONS
{
   // Program memory (PAGE 0) sections
   .text            : > FLASH_ABCDEFGH,    PAGE = 0
   .cinit           : > FLASH_ABCDEFGH,    PAGE = 0
   .pinit           : > FLASH_ABCDEFGH,    PAGE = 0
   .switch          : > FLASH_ABCDEFGH,    PAGE = 0
   .reset           : > RESET,             PAGE = 0, TYPE = DSECT // not used,

   // Data Memory (PAGE 1) sections
   .stack           : > RAMM1,      PAGE = 1
   .ebss            : > RAML4_5,    PAGE = 1
   .econst          : > RAML4_5,    PAGE = 1
   .esysmem         : > RAML4_5,    PAGE = 1

   // User Defined Sections
   codestart          : > BEGIN_FLASH,           PAGE = 0                // Used by file CodeStartBranch.asm
   csm_rsvd           : > CSM_RSVD,              PAGE = 0                // Used by file Passwords.asm
   passwords          : > PASSWORDS,             PAGE = 0                // Used by file Passwords.asm
   ramfuncs           : > RAMM0,      PAGE = 0
   secureRamFuncs     :   LOAD = FLASH_ABCDEFGH, PAGE = 0                // Used by file Flash.c
                          RUN = L4SARAM,         PAGE = 0                // Load to flash, run from CSM secure RAM
                          LOAD_START(RamfuncsLoadStart),
                          LOAD_SIZE(RamfuncsLoadEnd),
                          RUN_START(RamfuncsRunStart)

   IQmath           : > RAML0_L3,   PAGE = 0
   IQmathTables     : > IQTABLES,   PAGE = 0, TYPE = NOLOAD
   
   // Allocate FPU math areas:
   FPUmathTables    : > FPUTABLES,  PAGE = 0, TYPE = NOLOAD
   
   // Peripheral Frame 1 Register Structures
   ECanaRegsFile     : > ECANA,       PAGE = 1
   ECanaLAMRegsFile  : > ECANA_LAM,   PAGE = 1
   ECanaMboxesFile   : > ECANA_MBOX,  PAGE = 1
   ECanaMOTSRegsFile : > ECANA_MOTS,  PAGE = 1
   ECanaMOTORegsFile : > ECANA_MOTO,  PAGE = 1

   // DMARAML4_6	        : > RAML4_6,      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)

   }
   */

}

/*
//===========================================================================
// End of file.
//===========================================================================
*/

Hello,

When I want to do a flash boot with my project, I'm having building errors.

I don't know how to sort them out (it's the first time i'm using a C2000).

Below, you will find what I have already done :

1) In the properties of CCS, I had the predifined symbol "FLASH"

2) I had "CodeStartBranch.asm" in my project

3) I modified the original linker command file (please see it attached .txt instead of .cmd)

4) GPIO34 (boot PIN) and GPIO37 (TDO) are both high to boot on FLASH

 

Your help would be very appreciated.

 

Best Regards,

  • Hi!

    1 Check please that you defined the following in your main.c file:

    #ifdef FLASH
    // Used for running BackGround in flash, and ISR in RAM
    extern uint16_t *RamfuncsLoadStart, *RamfuncsLoadEnd, *RamfuncsRunStart;
    #endif

    2 Also try to edit your cmd-file thus:

    ramfuncs : LOAD = FLASH_ABCDEFGH,
    RUN = RAMM0,
    LOAD_START(RamfuncsLoadStart),
    LOAD_SIZE(RamfuncsLoadEnd),
    RUN_START(RamfuncsRunStart),
    PAGE = 0

    3 I would recommend you to download motorware package. This will help you.

    Regards,

    Igor

  • Hi,

    Thanks Igor for your answer.

    1 yes, this part of code is in my project.

    2 OK, I will try.

    3. I downloaded motorware, my project is based on an example of it. I may missed something.

    I also downloaded ControlSuite and read the application note "Running an application from internal flash memory on the TMS320F28xxx DSP" (SPRA958L). Unfortunately not really helpful in this case.

    Best Regards,

     

  • Hi Sebastien!

    BTW regarding unresolved symbol "memCopy". This function (in two versions) is defined here

    ti\MotorWare\MotorWare_1_01_00_09\sw\modules\memCopy\src\.

    Perhaps one should include to project .h & .c files where this function is defined.

    Regards,

    Igor

  • Hello,

    Maybe you should put too another .cmd file that you can find in C:\ti\motorware\MotorWare_1_01_00_09\sw\ide\ccs\cmd (in my case I use Headers_nonBIOS.cmd).

    So it will be 2 cmds in your project.

    In my case for motorware project:

    1. I added memCopy.c (Igor has told you where it can be found)

    2. I added F28069F.cmd and F2806x_Headers_nonBIOS.cmd

    3. I removed F28069F_ram_lnk.cmd

    4. I defined FLASH in project properties

    5. I added CodeStartBranch.asm

    6. I checked whether flash has been setup (initialize) in the code or not

    7. I set the boot switch in my controlcard to be flash boot mode

    That's all. Hope it works for you.

    Best regards,

    Maria

  • Hello,

    Thanks Maria and Igor.

    I'm one step further...

    I had to add memCopy.c in my project and I had to add the "_" at the beginning of RamfuncsLoadStart, RamfuncsLoadEnd and RamfuncsRunStart.

    secureRamFuncs     :  

    LOAD = FLASH_ABCDEFGH, PAGE = 0                // Used by file Flash.c                        

    RUN = RAML0_L3,        PAGE = 0                // Load to flash, run from CSM secure RAM

    LOAD_START(_RamfuncsLoadStart),

    LOAD_SIZE(_RamfuncsLoadEnd),

    RUN_START(_RamfuncsRunStart)

    As a result, 0 error and 0 warning.

    When I pressed on debug button, I saw erasing flash process and I think loading flash (I was very fast).

    After that I pressed on "Enable silicon real time mode" button and finally I pressed on "Resume" button and the MCU is blocked like the picture below :

    What's wrong?

    How can I insert a second command file? I tried to insert a new command file as a new file but It appeared in light grey. I seemed to be not active.

    Best Regards,

  • Hi Sebastien!

    Sebastien Dassy said:

    How can I insert a second command file? I tried to insert a new command file as a new file but It appeared in light grey. I seemed to be not active.

    Right click on not active .CMD ->left click "Exclude from build" ->clean both check box (Debug & Release)->OK.

    If you wish deactivate some .CMD then:

    Right click on active .CMD ->left click "Exclude from build" ->fill both check box (Debug & Release)->OK.

    Regards,

    Igor

  • Hello Sebastien,

    Sebastien Dassy said:
    How can I insert a second command file? I tried to insert a new command file as a new file but It appeared in light grey. I seemed to be not active.

    I am not sure what you mean about the second command file, but if you mean to add the .cmd file (the header cmd file), what I did was right click on my project in CCS --> click Add files --> and located the .cmd file that I wanted to add.

    Best regards,

    Maria

  • Hello Maria and Igor,

    Thanks, I was able to add a new cmd file.

    Do you have an idea about the fact that the MCU is blocked at the address 0x3ff4fa?

    Best Regards,

  • Hi Sebastian,

     

    You have already received some great advice.  In addition to this feedback, please consider exploring the FLASH example that is delivered with the MotorWare download.  One of the main purposes of these examples (or labs) are to give you a reference to follow for your project.  The labs have a User's Guide to walk you through the steps in CCS and many of your questions will be answered by trying out this example.

     

    In the figure below you can see from the MotorWare.exe GUI that the example projects are located within the development board that you are using.

     

     

     

    The InstaSPIN Projects and Labs User's Guide is available within the Resources folder.  This is a critical document to make life easier using InstaSPIN.

     

    You will find many different labs to choose from, including a lab on running InstaSPIN from FLASH (see Lab02b).

     

    Give this a try and let us know how it goes.

     

    Thanks, Jeff

     

  • Sebastien,

    what is your target device (DSP) which you apply?

    Regards,

    Igor

  • Hello,

    Thanks for your answer Jeff.

    I read these labs and the labs 2b explain how to use speed and current controller in RAM and FLASH instead of ROM but not how to boot the application from FLASH for a stand alone device.

     

    Igor, I'm using TMS320F28062F and as you saw, I modified F28062F_ram_lnk.cmd and I added F2806x_Headers_nonBIOS.cmd.

    It seems that the MCU is blocked (address 0x3FF4FA) in "Bootloader function" (address 0x3FF3B0 to 0x3FF7D2).

    Best Regards,

     

  • Hello Sebastien,

    I am not sure what you call in your code.

    In your cmd file that you attached, they were 2 ramfuncs.

          ramfuncs : > RAMM0, PAGE = 0

          secureRamFuncs :

                        LOAD = FLASH_ABCDEFGH, PAGE = 0 // Used by file Flash.c

                        RUN = L4SARAM, PAGE = 0 // Load to flash, run from CSM secure RAM

                        LOAD_START(RamfuncsLoadStart),

                        LOAD_SIZE(RamfuncsLoadEnd),

                        RUN_START(RamfuncsRunStart)

    In your case, in the beginning you should define like this (for example: for mainISR):

    #ifdef FLASH

    #pragma CODE_SECTION(mainISR,"secureRamfuncs"); // make sure you call secureRamfuncs instead of ramfuncs

    #endif

    Then you should make sure that you call memCopy() like this.

    memCopy((uint16_t *) &RamfuncsLoadStart, (uint16_t *) &RamfuncsLoadEnd, (uint16_t *) &RamfuncsRunStart);

    And in your cmd file, your should define like this:

    secureRamfuncs :

                       LOAD = FLASH_ABCDEFGH,

                       RUN = RAML0_L3,

                       LOAD_START(_RamfuncsLoadStart),

                       LOAD_END(_RamfuncsLoadEnd),

                       RUN_START(_RamfuncsRunStart),

                       LOAD_SIZE(_RamfuncsLoadSize),

                       PAGE = 0

    Please notice that LOAD_SIZE and LOAD_END are different.

    And memCopy calls LOAD_END (not LOAD_SIZE).

    If you have checked this and still have the same error, maybe you should check your Debug setting. I am not sure what the correct settings are. In my case I just used the default setting.

    And indeed, it is better you try the example from TI first before going to your own code.

    Hope you can solve your problem soon.

    Best regards,

    Maria

  • Sebastien,

    I see. Nonetheless I suspect the problem is into your modified file .cmd. Maybe the best way is take for base F28069F.cmd from motorware package and to modify one according memory map of F28062. Or migt take F28062.cmd from ti\controlSUITE\device_support\f2806x\v136\F2806x_common\cmd\ and to modify it in part of ramfuncs section.

    Regards,

    Igor

  • Igor, Maria,

    It works now :-)

    You were right Igor, I had a problem in my cmd file. The address and size of the flash memory were for F28069 instead of F28062. My project is better now, with a F28062F.cmd + F2806x_Headers_nonBIOS.cmd.

    Thanks a lot for your help.

    Best Regards,

  • Sebastien,

    I'm glad to hear these good news!

    Good luck,

    Igor

  • thanks for bringing to our attention. We need to make this easier and it should be updated in MotorWare _10 that releases on Thursday.