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.

MSP432E401Y: Linker command file for TI-RTOS application with flash bootloader

Part Number: MSP432E401Y
Other Parts Discussed in Thread: UNIFLASH, SYSBIOS

Hello TI Experts,

I'm implementing a flash bootloader on an MSP432E401Y, which is running an app using TI-RTOS.

Everything works as expected, but I'm not sure the vectors are at the right place.

When I flash the blank device via UniFlash with the bootloader + the application at the same time, I get this message : 

In my application, the vectors are not where they usually are, is that what UniFlash calls an "illegal address" ?

Here's my cmd file :

/*
 * Copyright (c) 2017-2020, Texas Instruments Incorporated
 * All rights reserved.
 *
 * 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.
 */
/*
 *  ======== MSP_EXP432E401Y_TIRTOS.cmd ========
 *  Define the memory block start/length for the MSP_EXP432E401Y M4F
 */
--stack_size=1024   /* C stack is also used for ISR stack */

HEAPSIZE = 0x20000;  /* Size of heap buffer used by HeapMem */


MEMORY
{
    FLASH (RX) : origin = 0x00004000, length = 0x000FC000
    SRAM (RWX) : origin = 0x20000000, length = 0x00040000
}

/* Section allocation in memory */

SECTIONS
{
    .text   :   > FLASH
    .const  :   > FLASH
    .rodata :   > FLASH
    .cinit  :   > FLASH
    .pinit  :   > FLASH
    .init_array : > FLASH

    .TI.ramfunc : {} load=FLASH, run=SRAM, table(BINIT)
    .data   :   > SRAM
    .bss    :   > SRAM
    .sysmem :   > SRAM

    /* Heap buffer used by HeapMem */
    .priheap   : {
        __primary_heap_start__ = .;
        . += HEAPSIZE;
        __primary_heap_end__ = .;
    } > SRAM align 8

    .stack  :   > SRAM (HIGH)
}

Should I add ".intvecs:    > 0x00004000" or anything else in "SECTIONS" ?

Thanks for your help.

Regards,

Victor Tolosana

  • Hi Victor,

    I would try some of the suggestions listed in this thread [link] where they are trying to change the application start address from 0x0000 to 0x4000 on MSP432E401Y.

    Thanks,

    Urica Wang

  • Hi,

    I have been trying the same sort of thing - to jump to a TI RTOS app, from the demo Flash bootloader example supplied in the SDK. Clearly the entire project needs to be moved (to 0x4000) so that it lives after the Flash Bootloader. I believe that the example in the link above is a non-RTOS app, so it is quite simple to change the APP_START to 0x4000.

    If I try to move the http server demo - httpserver_MSP_EXP432E401Y_tirtos_ccs, the linker complains that the reset vectors are not in the correct address range, and these are defined by the imported TI RTOS project - tirtos_builds_MSP_EXP432E401Y_release_ccs.

    It is possible to manually edit the RTOS project by changing tirtos_builds_MSP_EXP432E401Y_release_ccs/Debug/configPkg/linker.cmd - change the line
    .resetVecs: load > 0x0
    to 0x4000
    This now links, and seems to work - I can load the http server demo via BSLScripter, and it runs and serves the web page Slight smile

    Unfortunately, the linker.cmd file is auto generated and, as it says at the top, my change gets overwritten if I rebuild the RTOS project.

    The TI-RTOS Kernel user guide SPRUEX3V.pdf (June 2020) p151 gives 3 examples of how to correctly change the .resetVecs value. Unfortunately, it refers to 3 items of online help that no longer seem to exist:
    http://rtsc.eclipseprojects.io/cdoc-tip/xdc/cfg/Program.html%23sections.Exclude
    http://rtsc.eclipseprojects.io/cdoc-tip/xdc/cfg/Program.html%23sections.Template
    http://rtsc.eclipseprojects.io/cdoc-tip/xdc/cfg/Program.html%23link.Template

    In fact, none of the rtsc.eclipseprojects.io seems to respond!

    Is there a new link for that documentation? And am I going in the right direction with this?

    Thanks

  • Hi Jim,

    I think you are on the right track with this. I can't find any working online links, but these files are zipped with XDCTools. I've attached the zipped documentation that's included with XDCTools 3.62. You can find this zip in the XDCTools install location or on the software product page.

    docs.zip

    Thanks,

    Urica Wang

  • Hi Urica,
    Thanks for the docs, that was helpful but I still can't find an explanation of how the whole thing works so there has been some guesswork!

    It looks like I might need need something like:

    var Program = xdc.useModule('xdc.cfg.Program');
    Program.sectionsExclude = "^\.resetVecs$";

    to remove the existing .resetVecs from the generated linker.cmd.
    I assume these new lines go in the tirtos_builds_MSP_EXP432E401Y_release_ccs\release.cfg, but where?

    If I add just the single "var Program..." line in the /* ================ Program configuration ================ */ section, or later, I get a build error:

    ...
    configuring release.xem4f from package/cfg/release_pem4f.cfg ...
    subdir_rules.mk:12: recipe for target 'build-90018911-inproc' failed
    js: "C:/Users/whitehousej/workspace_v10/tirtos_builds_MSP_EXP432E401Y_release_ccs/release.cfg", line 294: TypeError: Cannot read property "global" from undefined (C:/Users/whitehousej/workspace_v10/tirtos_builds_MSP_EXP432E401Y_release_ccs/release.cfg#294)
    "./package/cfg/release_pem4f.cfg", line 189
    xdctools_3_62_01_15_core\gmake.exe: *** [package.mak:202: package/cfg/release_pem4f.xdl] Error 1
    xdctools_3_62_01_15_core\gmake.exe: *** [package/cfg/release_pem4f.xdl] Deleting file 'package/cfg/release_pem4f.h'
    xdctools_3_62_01_15_core\gmake.exe: *** [package/cfg/release_pem4f.xdl] Deleting file 'package/cfg/release_pem4f.c'

    Adding:

    var Program = xdc.useModule('xdc.cfg.Program');
    Program.sectionsExclude = "^\.resetVecs$";

    at the top of release.cfg, it builds without errors and I see that the .resetVecs entry is now gone from SECTIONS in linker.cmd - minor success Slight smile

    From the docs for Program.sectionsTemplate, it looks like I should be able to add a filename for a custom template file to do "something" to the SECTIONS bit. If I now add:

    var Program = xdc.useModule('xdc.cfg.Program');
    Program.sectionsExclude = "^\.resetVecs$";
    Program.sectionsTemplate = './test.xdt';

    to the top of release.cfg, and put test.xdt in tirtos_builds_MSP_EXP432E401Y_release_ccs\Debug\configPkg, I always seem to get an error:

    ...
    configuring release.xem4f from package/cfg/release_pem4f.cfg ...
    generating custom ti.sysbios library makefile ...
    subdir_rules.mk:12: recipe for target 'build-90018911-inproc' failed
    js: "C:/ti/simplelink_msp432e4_sdk_4_20_00_12/kernel/tirtos/packages/ti/platforms/msp432/linkcmd.xdt", line 125: The choice of Java method java.lang.String.replace matching JavaScript argument types (function,string) is ambiguous; candidate methods are:
    class java.lang.String replace(char,char)
    class java.lang.String replace(java.lang.CharSequence,java.lang.CharSequence)
    "C:/ti/simplelink_msp432e4_sdk_4_20_00_12/kernel/tirtos/packages/ti/platforms/msp432/linkcmd.xdt", line 125
    "C:/ti/simplelink_msp432e4_sdk_4_20_00_12/kernel/tirtos/packages/ti/platforms/msp432/linkcmd.xdt", line 134
    xdctools_3_62_01_15_core\gmake.exe: *** [package.mak:202: package/cfg/release_pem4f.xdl] Error 1

    I have tried using an empty file for test.xdt, and tried various versions of the example in the Program.sectionsTemplate docs, but no luck!

    Any further advice would be appreciated!
    Thanks

  • Hi Jim,

    Can you try using double-quotations around the path to the custom template file ("./test.xdt")? There is a comment in linkcmd.xdt at line 62 that double-quotations should be used to enclose paths otherwise the linked will incorrectly parse the path.

    Thanks,

    Urica Wang

  • Hi,

    That doesn't seem to make any difference. If it can't find the file, it does give a clear message!

    I suspect my problem is what is actually in my file. I've tried leaving it empty, and tried a few attempts based on the example, but it doesn't seem to like anything I do.

    Thanks

    Jim

  • Unfortunately, the linker.cmd file is auto generated and, as it says at the top, my change gets overwritten if I rebuild the RTOS project.

    In the .cfg file try setting m3Hwi.resetVectorAddress

    E.g. the example attached to TM4C1294NCPDT: RTOS: BIOS not working used the following in the .cfg file:

    var m3Hwi = xdc.useModule('ti.sysbios.family.arm.m3.Hwi');
    
    /* Set a non-zero reset vector address for this application, since is started by a bootloader placed at address zero.
       The FLASH memory region in the linker command file is set to start at this address, to avoid using any flash
       reserved for the bootloader. */
    m3Hwi.resetVectorAddress = 0x8100;
    

    Which resulted in the following in the automatically generated linker.cmd file:

    SECTIONS
    {
        .bootVecs:  type = DSECT
        .vecs: load > 0x20000000
        .resetVecs: load > 0x8100
    
    
    
        xdc.meta: type = COPY
    }
    

  • Is there a new link for that documentation?

    In a CCS 10.4 installation, using Help -> Help Contents and entering "ti.sysbios.family.arm.m3.Hwi" in the search finds multiple hits - from the different products installed with SYS/BIOS support, E.g. from the SimpleLink MSP432E SDK.

    Documentation is also available under https://software-dl.ti.com. E.g. metaonly config Hwi.resetVectorAddress

  • Thanks, that's great.

    In fact, it is even simpler - the TI RTOS project's release.cfg file already has a section:

    /* ================ Hwi configuration ================ */
    var halHwi = xdc.useModule('ti.sysbios.hal.Hwi');
    var m3Hwi = xdc.useModule('ti.sysbios.family.arm.m3.Hwi');

    ...

    so all I needed to do was was, somewhere after, add:

    m3Hwi.resetVectorAddress = 0x4000;

    And it gets even easier!

    The Hwi configuration section in the text view of the file corresponds to the Hwi (ti.sysbios.family.arm.m3) section in the XGCONF GUI editor. Hiding in plain sight there is Vector Tables, Reset Vector Table Address - if I simply enter 0x4000 in the box there, the line

    m3Hwi.resetVectorAddress = 0x4000;

    is added to the end of the file, and it now builds suitable offset to be loaded via the flash bootloader example Slight smile