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.

RTOS/MSP432P401R: MSP432 OAD: How to generate custom bootloader to be placed @ 0x0000 (Memory organization is same as existing OAD example code )

Part Number: MSP432P401R

Tool/software: TI-RTOS

I am performing Firmware update for MSP432 via CC2650MODA on a custom board. I get OAD image from CC2650 and store same on EEPROM present on my custom board (Image is more than 128KB, so it doesnt fit in internal flash of MSP432). I wrote custom bootloader (in same lines of "OAD Example Bootloader" shared by TI) to be loaded @ 0x0000 & application will start @0x2000 (Following same memory organization as OAD example of TI). I tried loading binary image of my custom bootloader to 0x2000 but when i try to flash the same i get -

"Reset on Target Occured"

The OAD example documentation (

http://dev.ti.com/tirex/content/simplelink_msp432_sdk_bluetooth_plugin_1_20_00_42/examples/rtos/MSP_EXP432P401R/bluetooth/oad_firmware_update/README.html

)  has below line -

"A compiled binary bootloader is included in this code example (and placed into a special memory location) within the oad_bootloader.c file. The source code for this bootloader can be found in the examples/nortos/MSP_EXP432P401R/oad_bootloader_source directory"

I compiled example oad_bootloader.c source code and compared the BINARY with binary bootloader DATA array present in oad_bootloader.c (const unsigned char oad_bootloader[]). They are not same and on careful inspection of data array , I see a section of 256 bytes added to top of that data array and after these 256 bytes, the compiled bootloader is placed. However even the next section is also not bit-exact but i feel its same with minor changes.

Can anyone let me know -

1) Why DATA ARRAY is not matching with BINARY generated through the code shared by TI?

2) How to correctly generate & place my custom bootloader code as DATA ARRAY for OAD?

Thanks in advance.

  • Hello,

    Kavan Acharya said:
    I compiled example oad_bootloader.c source code and compared the BINARY with binary bootloader DATA array present in oad_bootloader.c (const unsigned char oad_bootloader[]). 

    Please be aware that when you import the project the startup_msp432p401r_ccs. and system_msp432p401r.c are missing (Just copy and paste the startup/system files from any stock example). This will get fixed in the next version of the plugin. This might be part of the reason why you are seeing differences, but also this could be related to the compiler tools that you are using.

    With CCS 7.2.0 - TI Code Generation Tools ARM version 16.9.3.LTS, This is my oad_bootloader.c file.

    Kavan Acharya said:
    2) How to correctly generate & place my custom bootloader code as DATA ARRAY for OAD?

    The easiest way to create this is using the srec_cat from srecord.sourceforge.net/

    1. In your bootloader project (oad_bootloader_source_MSP_EXP432P 401R_nortos_ccs), enable the Hex Utility (project properties) and for output format, select Output TI-TXT

    2. Using the srec_cat tool, run the following command: C:\ccs_msp432_ccsv7_2_msp432p401r_oad\oad_bootloader_source_MSP_EXP432P 401R_nortos_ccs\Debug>srec_cat oad_bootloader_source_MSP_EXP432P401R_nortos_ccs.txt -ti_txt -o oad_bootloader.c -ca oad_bootloader -c_comp

    3. You can merge or copy this generated file into the one that you have in the your oad_firmware_update_MSP_EXP432P401R_tirtos_ccs project, please make sure to keep the #pragma DATA_SECTION at the beginning of the file.

    #if defined(__TI_COMPILER_VERSION__)
    #pragma DATA_SECTION(oad_bootloader, "OAD_BSL")
    #endif

    Hopefully this helps.

       David

  • Thanks a lot David. This Resolved My issue.
  • Hi David,

    We are facing One more issue.

    In order to implement OAD in MSP432 we did following

    1. Add following lines in .cfg

    /* ================ Reset configuration ================ */
    var Reset = xdc.useModule("xdc.runtime.Reset");
    /*
     * This function is used when a boot loader is used
     */
    Reset.fxns[Reset.fxns.length++] = "&myReset";
    
    /* ================ Vector Table re-location ================ */
    var m3Hwi = xdc.useModule('ti.sysbios.family.arm.m3.Hwi');
    m3Hwi.resetVectorAddress = 0x2000; /* App base */

    2. .cmd file is changed to 

    --stack_size=768   /* C stack is also used for ISR stack */
    --retain oad_bootloader
    
    MEMORY
    {
        OAD_BSL      (RX) : origin = 0x00000000, length = 0x00002000
        MAIN         (RX) : origin = 0x00002000, length = 0x0001D000
        OADIMAGEINFO (RX) : origin = 0x0001F000, length = 0x00001000
        OADIMAGE     (RX) : origin = 0x00020000, length = 0x00020000
        INFO         (RX) : origin = 0x00200000, length = 0x00004000
        SRAM_CODE    (RWX): origin = 0x01000000, length = 0x00010000
        SRAM_DATA    (RW) : origin = 0x20000000, length = 0x00010000
    }
    
    /* Section allocation in memory */
    
    SECTIONS
    {
        .text   :   > MAIN
        .const  :   > MAIN
        .cinit  :   > MAIN
        .pinit  :   > MAIN
    
    #ifdef __TI_COMPILER_VERSION__
    #if __TI_COMPILER_VERSION__ >= 15009000
        .TI.ramfunc : {} load=MAIN, run=SRAM_CODE, table(BINIT)
    #endif
    #endif
    
        GROUP {
            .data
            .bss
            .sysmem
            empty: {
                /* the UNUSED symbols define reusable heap memory */
                __primary_heap_start__ = .;
                __primary_heap_end__ = __stack;
            }
        } > SRAM_DATA
    
        .stack  :   > SRAM_DATA (HIGH)
    }
    
    /* Symbolic definition of the WDTCTL register for RTS */
    WDTCTL_SYM = 0x4000480C;

    3. Add the following files to the project

        oad_bootloader.c , oad_firmware_update_status.c , oad_firmware_update_status.h , oad_firmware_update.h

    After Doing all these if I flash a code with a LED BLINK CODE in DEBUG mode , LED Blinks. But if I run in free running mode LED will not BLINK. That is it works only in Debug Mode. Plugout and Plugin is also not working.

    Kindly let us know how this can be resolved

  • Hello,

     Did you also update the new vector table address (main_tirtos.c)??

    #if defined(__TI_COMPILER_VERSION__)
    extern uint32_t ti_sysbios_family_arm_m3_Hwi_resetVectors;
    int myReset(void)
    #endif
    {
        /* Use Application the interrupt vector */
    #if defined(__TI_COMPILER_VERSION__)
        SCB->VTOR = (uint32_t) &ti_sysbios_family_arm_m3_Hwi_resetVectors;
    #endif
        return 1;
    }

     Hopefully this helps.

       David

  • Yes I have updated that too.
  • Could you please send me your project??
  • Hello,

    If you do not want to share your project with the community, please get in touch with me offline, you can click on my profile and send me a private message that way.

    Thanks,

    David

**Attention** This is a public forum