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/TMS320F28335: CMD file modification of application project in IAP application

Part Number: TMS320F28335

Tool/software: Code Composer Studio

Hi sir,

I asked question about vector table before. URL : e2e.ti.com/.../2509689

And there is no problem about vector table. Thanks.

But currently I have a question about cmd file modification.

Current status:
secondary_boot area : flash_H + flash_G (0x30 0000H to 0x30 FFFFH)
application area :flash_F + flash_D (0x31 0000H to 0x32 7FFFH)

My thought and my testing step was :
1. flash_A address : 0x33 FFF6H store the entry point address of secondary_boot , because it will run secondary_boot after power on.
application should not use flash_A , otherwise it will be conflict with secondary_boot. Right?

2. Enter debug mode to see the data of entry point by using application, because the most modification should be on application project:
1) Did no modification of original cmd file.
Enter debug mode of application and see the address of 0x33 FFF6H, record the data of this address, it should be the entry point of application, named DATA_1.
2) Did modiication of cmd file, delete flash_A , assign area flash_F to flash_D.
Enter debug mode of applicatoin and see the address of 0x32 7FFEH, record the data of this address ,it should be the entry point of application, named DATA_2.

I thought DATA_1 and DATA_2 should be the same ,right?

But currently I met a load failed when did the step 2.->2), the error message is : .out load failed.
C28xx : Flash programmer : Error encountered when writing to flash memory.
C28xx : GEL : File: ..\.out load failed.

3) I tried to change BEGIN address :
BEGIN : origin = 0x327FFE, length = 0x000002
But it also failed : error #10264: BEGIN memory range overlaps

So my question is :
How to modify my cmd file correctly?


Below is my current cmd file of application:
//=================================================================================================//
MEMORY
{
PAGE 0: /* Program Memory */
/* Memory (RAM/FLASH/OTP) blocks can be moved to PAGE1 for data allocation */

ZONE0 : origin = 0x004000,          length = 0x001000 /* XINTF zone 0 */
RAMM0 : origin = 0x000050,         length = 0x0003B0 /* on-chip RAM block M0 */
/* RAML0 : origin = 0x008000,       length = 0x001000*/ /* on-chip RAM block L0 */
/* RAML1 : origin = 0x009000,       length = 0x001000*/ /* on-chip RAM block L1 */
/* RAML2 : origin = 0x00A000,       length = 0x001000*/ /* on-chip RAM block L2 */
/* RAML3 : origin = 0x00B000,       length = 0x001000*/ /* on-chip RAM block L3 */
ZONE6 : origin = 0x0100000,         length = 0x100000 /* XINTF zone 6 */
/* ZONE7A : origin = 0x0200000,   length = 0x00FC00*/ /* XINTF zone 7 - program space */
FLASHF_D : origin = 0x310000,    length = 0x018000 /* on-chip FLASH */
// FLASHH : origin = 0x300000,     length = 0x008000 /* on-chip FLASH */
// FLASHG : origin = 0x308000,     length = 0x008000 /* on-chip FLASH */
// FLASHF : origin = 0x310000,      length = 0x008000 /* on-chip FLASH */
// FLASHE : origin = 0x318000,      length = 0x008000 /* on-chip FLASH */
// FLASHD : origin = 0x320000,      length = 0x008000 /* on-chip FLASH */
FLASHC : origin = 0x328000,         length = 0x008000 /* on-chip FLASH */
// FLASHA : origin = 0x338000,      length = 0x007F80 /* on-chip FLASH */
CSM_RSVD : origin = 0x33FF80,   length = 0x000076 /* Part of FLASHA. Program with all 0x0000 when CSM is in use. */
BEGIN : origin = 0x33FFF6,            length = 0x000002 /* Part of FLASHA. Used for "boot to Flash" bootloader mode. */
CSM_PWL : origin = 0x33FFF8,     length = 0x000008 /* Part of FLASHA. CSM password locations in FLASHA */
OTP : origin = 0x380400,                length = 0x000400 /* on-chip OTP */
ADC_CAL : origin = 0x380080,       length = 0x000009 /* ADC_cal function in Reserved memory */

IQTABLES : origin = 0x3FE000,       length = 0x000b50 /* IQ Math Tables in Boot ROM */
IQTABLES2 : origin = 0x3FEB50,     length = 0x00008c /* IQ Math Tables in Boot ROM */
FPUTABLES : origin = 0x3FEBDC,  length = 0x0006A0 /* FPU 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 */

/* 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 */
RAML0_7 : origin = 0x008000,                  length = 0x008000 /* on-chip RAM block L1 */
/* RAML4 : origin = 0x00C000,                  length = 0x001000*/ /* on-chip RAM block L1 */
/* RAML5 : origin = 0x00D000,                  length = 0x001000*/ /* on-chip RAM block L1 */
/* RAML6 : origin = 0x00E000,                  length = 0x001000*/ /* on-chip RAM block L1 */
/* RAML7 : origin = 0x00F000,                  length = 0x001000*/ /* on-chip RAM block L1 */
/* ZONE7B : origin = 0x20FC00,               length = 0x000400*/ /* XINTF zone 7 - data space */
ZONE7 : origin = 0x200000,                     length = 0x010000 /* XINTF zone 7 - data space */
FLASHB : origin = 0x330000,                   length = 0x008000 /* on-chip FLASH */

}

/* 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 : > FLASHF_D          PAGE = 0
.pinit : > FLASHF_D,         PAGE = 0
.text : > FLASHF_D           PAGE = 0
codestart : > BEGIN          PAGE = 0

ramdelay : LOAD = FLASHC,
                 RUN = RAMM0,
                 LOAD_START(_RamdelayLoadStart),
                 LOAD_END(_RamdelayLoadEnd),
                 RUN_START(_RamdelayRunStart),
                 PAGE = 0

ramfuncs : LOAD = FLASHC,
                  RUN = RAMM0,
                  LOAD_START(_RamfuncsLoadStart),
                  LOAD_END(_RamfuncsLoadEnd),
                  RUN_START(_RamfuncsRunStart),
                  PAGE = 0

csmpasswds : > CSM_PWL PAGE = 0
csm_rsvd : > CSM_RSVD PAGE = 0

/* Allocate uninitalized data sections: */
.stack : > RAMM1               PAGE = 1
.ebss : > RAML0_7             PAGE = 1
data : > RAML0_7               PAGE = 1
.esysmem : > RAMM1         PAGE = 1

/* Initalized sections go in Flash */
/* For SDFlash to program these, they must be allocated to page 0 */
.econst : > FLASHF_D        PAGE = 0
.switch : > FLASHF_D         PAGE = 0

// .sysmem : > RAML0_7      PAGE = 1
// .cio : > RAML0_7               PAGE = 1

/* Allocate IQ math areas: */
IQmath : > FLASHC                       PAGE = 0 /* Math Code */
IQmathTables : > IQTABLES,        PAGE = 0, TYPE = NOLOAD
IQmathTables2 : > IQTABLES2,    PAGE = 0, TYPE = NOLOAD
FPUmathTables : > FPUTABLES, PAGE = 0, TYPE = NOLOAD

/* Allocate DMA-accessible RAM sections: */
DMARAML4 : > RAML0_7, PAGE = 1
DMARAML5 : > RAML0_7, PAGE = 1
DMARAML6 : > RAML0_7, PAGE = 1
DMARAML7 : > RAML0_7, PAGE = 1

/* Allocate 0x400 of XINTF Zone 7 to storing data */
/* ZONE7DATA : > ZONE7B, PAGE = 1*/

/* .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

/* Allocate ADC_cal function (pre-programmed by factory into TI reserved memory) */
.adc_cal : load = ADC_CAL, PAGE = 0, TYPE = NOLOAD
}


//=================================================================================================//

Hope your response.

Thanks.

Best Regards,

Vincent

  • Vincent,

    You cannot change BEGIN address. Reason: Once the boot rom realizes it has to boot to flash it automatically jumps to 0x33FFF6.

    On a boot to flash mode, If you store entry point address of secondary boot, you would automatically jump to secondary boot code on each power up. But, storing entry point address of secondary boot doesn't have restriction on you storing application in section A. Memory locations 0x338000 - 0x33FF7F can still be used to store code / data sections of application code.

    Here is my understanding of your requirement: When you boot to flash, you enter secondary boot code and check whether you want to update your application code based on external stimulus (like say based on GPIO state (or) reading a specific word to change application code).

    • If external stimulus doesn't demand application code change, you just jump to application code.
    • If external stimulus demands application code change, you want to erase the application code (either partially (or) fully) and re-program with new application code.

    Am i correct?

    If so, please threads should be helpful

    inquiry about boot loader of tms320F28335. - C2000 microcontrollers forum - C2000™︎ microcontrollers...

    e2e.ti.com
    Other Parts Discussed in Thread: TMS320F28335 HI I want to boot tms320f28335 from flash boot. and i am refering to SPRU963A which is tms320x2833x boot rom reference

    http://www.ti.com/lit/an/spraaq3/spraaq3.pdf

    custom flash bootloader - C2000 microcontrollers forum - C2000™︎ microcontrollers - TI E2E support f...

    e2e.ti.com
    hello i am new to TI MCUs, and relatively new to MCUs in general i am working with the TMS320F228335 and have an application in flash sectors A and B, is it possible

    Regards,

    Manoj

  • Hi Manoj,

    Sorry for reply later.

    Yes, your understanding of my requirements is correct.

    But I am not very clearly how to change the cmd file of application , on the other words, which points should be modified in cmd file of application project.

    Here is my understanding for application cmd file  modification :(application area = Flash_F to Flash_D , secondary_boot area = Flash_H to Flash_G)

    1. BEGIN  :0x33FFF6 --- you said this address should be not changed.  Here is where i tried to change to 0x327FFE(application entry point) before.

    2. .cinit / .pinit / .text            : > FLASHF_D             ---  place application code into Flash_F to Flash_D.

    3.  ramfuncs            : LOAD = FLASHC,                 ---  place ramfuncs code into Flash_C,  including flash_api code

    4. .econst / .switch   : > FLASHF_D      PAGE = 0  --- place const code into Flash_F to Flash_D

    5. IQmath              : > FLASHC      PAGE = 0         --- place math code into Flash_C

    About these content in cmd file of secondary_boot , i think it just need modify .cinit/.pinit/.text/.econst/.switch  area to Flash_H to Flash_G only, right?

    I also add a sentence which jump from secondary_boot to application:

    =========================================================

    for(;;)
    {
    //
    // This loop will be interrupted, so the overall
    // delay between pin toggles will be longer.
    //
    //DELAY_US(DELAY);
    LoopCount++;
    //GpioDataRegs.GPBTOGGLE.bit.GPIO32 = 1;
    LedLoop();

    if(LoopCount == 10)
    {
    asm ("LB 0x327FFE");                         // jump to application
    }
    }

    ==========================================

    I think after executed asm ("LB 0x327FFE"); , it will enter application project to execute application.And the BEGIN address i tried to modify is application BEGIN address,not secondary_boot. I think how to modify BEGIN address of application project is my key point.

    I tried as above and program app and secondary_boot into flash via debug tool XDS100.

    1)  Program app first , then program secondary_boot,  power off then power on again, it will run secondary_boot automatically.

    2)  My expect is after program app and secondary_boot,  address 0x33FFF6 = entry point of secondary_boot, and address 0x327FFE = entry point of app.

         But currently address 0x327FFE = 0xffff, so i think cmd file modification of application is wrong.

    That's why i thought if i should modify BEGIN value of application.

    My purpose is:

    a. Program application code into flash(app code area) via debug tool XDS100 first, because currently there is no related PC upgrade tool yet to send hex file.

       So use debug tool to program application code into flash is a method.

    b. Then debug secondary_boot project into flash via debug tool XDS100, run it to jump to application.

    c. Run continue, it will start run application code.

    I thought this method could be executed to verify secondary_boot jump to application correctly or not.

    I do not know if i describe my question clearly or not.  

    Hope your response.

    Thanks.

    Best Regards,

    Vincent

  • Vincent,

    If you want to execute Secondary boot of device power up, place the entry point address of secondary boot in 0x33FFF6. In your Secondary boot code, when you decide to jump to application project, just jump to the start address of your application project (Note: This should have a valid opcode). You don't need to enter the entry point address of application code in cmd file.

    Regards,
    Manoj
  • Hi Manoj,

    I am doubted what you said "just jump to the start address of my application project".

    As this URL reference : https://e2e.ti.com/support/microcontrollers/c2000/f/171/t/273790    I thought secondary_boot should jump to the entry point of application.

    And about this entry point, as my understanding , it should be the last two address of the whole application area.

    For example of my application, the flash area = Flash_F to Flash_D, so secondary_boot should jump to address 0x327FFE.

    So let me summarize my problem.

    1. When secondary_boot jump to application , does it only use asm (" LB 0x327FFE "); ?  

    2. Since application area = Flash_F to Flash_D, jump address is 0x327FFE, right ? (i did test to jump to 0x310000H, the start address of application, but failed, it enter abort. of exit.c)

    3. If 1. and 2. are right, how to change cmd file of application project ? 

       1) BEGIN address = 0x33FFF6, it should not be changed, right?

       2) other area you can see above information in the cmd file content at the begging of this topic I showed.

             .init / .pinit / .text   :  >   FLASHF_D , PAGE = 0       // here should be the application flash area, and the begging of application should be the start of FlashF:0x310000H, 

    Today I did test both jump to 0x327FFEH and 0x310000H, both failed.

    1)  when jump to 0x310000H (this address has valid data,not 0xFFFF) , it enter abort() of exit.c.

    2)  When jump to 0x327FFEH (this address data : FFFF FFFF 1901 56C3 FFFF 0006) , it enter ILLEGAL_ISR(), not run application code never.

    BTW, before jump to application in secondary_boot,  i disable CPU interrupts and clear all CPU interrupt flags:

    IER = 0x0000;
    IFR = 0x0000;

    So hope your response ASAP.

    Thanks.

    Best Regards,

    Vincent

         

  • Vincent,

    When I mean start address of your application, I mean the entry point address of application project. This entry address should contain the first op-code which you would like to get executed in application code. It may not necessarily be first / last address of application flash sector.

    What is entry point address really depends upon the first opcode (of application code) you want to get executed when you jump from secondary bootloader.

    Regards,
    Manoj
  • Hi Manoj,

    Thanks for your response.

    Would you mind give me an example , such as my application which described in above information.

    BTW: would you mind answer my questions I asked in May.3rd ? 

    It's urgent for me to do test on this jumpping from secondar_boot to application.  Otherwise I have to consider another design.

    Thanks for your understanding.

    Best Regards,

    Vincent

  • Vincent,

    Please highlight me the question which you didn't get clarification. I felt I addressed your question in general.

    I will see whether I have any example code. But, I'm not positive.

    Regards,
    Manoj
  • Hi Manoj,

    Please see below highlight in red.

    1. When secondary_boot jump to application , does it only use asm (" LB 0x327FFE "); ?

    2. Since application area = Flash_F to Flash_D, jump address is 0x327FFE, right ? (i did test to jump to 0x310000H, the start address of application, but failed, it enter abort. of exit.c)

    3. If 1. and 2. are right, how to change cmd file of application project ?

    1) BEGIN address = 0x33FFF6, it should not be changed, right?

    2) other area you can see above information in the cmd file content at the begging of this topic I showed.

    .init / .pinit / .text : > FLASHF_D , PAGE = 0 // here should be the application flash area, and the begging of application should be the start of FlashF:0x310000H,

    Today I did test both jump to 0x327FFEH and 0x310000H, both failed.

    1) when jump to 0x310000H (this address has valid data,not 0xFFFF) , it enter abort() of exit.c.

    2) When jump to 0x327FFEH (this address data : FFFF FFFF 1901 56C3 FFFF 0006) , it enter ILLEGAL_ISR(), not run application code never.

    BTW, before jump to application in secondary_boot, i disable CPU interrupts and clear all CPU interrupt flags:

    IER = 0x0000;
    IFR = 0x0000;

    So hope your response ASAP.

    Thanks.

    Best Regards,

    Vincent

  • Vincent,

    Unfortunately, I don't have an example code which I could share it.

    1) This depends upon how you have written your application code. That is reason why in my previous message I said this jump address should be first opcode you want to execute in application code. So, I can't say that asm("LB 0x327FFE") is what you need to use.

    2) Same answer as above

    3) You don't need to change application project cmd file. When you load the application project independently without secondary bootloader code. What is the first op-code that get executed. The op-code of the first address is address you need to jump to from your secondary bootloader program.

    4) According to your application code, addresses 0x327FFEH and 0x310000H might not be have the first op-code in your application that needs to be executed.

    Can you send me your application project ? You either privately message me if you need to.
  • Hi Manoj,

    Thanks.  Ok, we continue to discuss in this topic.

    I can send my project to you without key C files, hope you could understand it.  And i think maybe you do not need my c files, only need project setting related files, right ?

    Or whether you only need cmd files?  

    Could you give me your mail box?

    Thanks.

    Best Regards,

    Vincent

  • Please send me a private message. I shall reply my email address on that private mesage. I can't post my email address here.

    I definetely need your CMD file. Its okay if you don't send me your key C files.
  • Vincent,

    Please resend to my email. But don't send it as .rar file.

    Regards,
    Manoj
  • Vincent,

    I received 3 files shown below:-

    F28335_Boot.txt
    F28335_FLASH.txt
    DSP2833x_Headers_nonBIOS.txt

    After reviewing F28335_FLASH.txt (which looks like application code .cmd), it looks like you are assigning codestart section to BEGIN (0x33FFF6 - 0x33FFFF). You can't do that because this addresses are already programmed by F28335_Boot.txt. I would recommend you to make the following changes.

    Memory section:
    FLASHC : origin = 0x328000, length = 0x007FFD

    FLASHC_BEGIN : origin = 0x32FFFE, length = 0x2

    Sections section:

    codestart :>  FLASHC_BEGIN

    In your boot code, you have to use below statement to jump to your application code.

    asm(" LB 0x32FFFE");

    Regards,

    Manoj

  • Can I close this thread? Is this issue resolved?
  • Haven't heard back from customer for while. Closing this thread.