The TI E2E™ design support forums will undergo maintenance from July 11 to July 13. If you need design support during this time, open a new support request with our customer support center.

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.

LP-MSPM0G3507: exception when initialize the .init_array

Part Number: LP-MSPM0G3507

Tool/software:

Ran into the same issue as this poster:

https://e2e.ti.com/support/tools/code-composer-studio-group/ccs/f/code-composer-studio-forum/349603/exception-when-initialize-the-init_array

A close look at the build output shows that the linker couldn't find a location for the .init_array section. This is the array of constructor function calls for c++ objects that need to be created at launch time. By default, the linker.cmd file doesn't include that section in any of the lists, so it gets placed in RAM by the linker as a fall back. Unfortunately, since it was just defaulted to RAM and not loaded into a flash area that's copied to RAM, it never gets initialized. Thus, the caller of the constructors ends up calling a random address from RAM.

The fix is to add an entry for .init_array to one of the flash sections. It's constant anyway, pointing to functions in flash, so flash is a fine spot for it.

Example:


    GROUP {
        .reserved:                   { . += 0x101C; } (NOLOAD)
        .padding : fill = 0xFFFFFFFF { . += 0x00E4; }
        .resetVecs:   {} palign(4)   /* This is where code resides */
        .cram:        {} palign(4)
        .text:   {} palign(4)   /* This is where code resides */
        .rodata: {} palign(4)   /* This is where const's go */
        .cinit:  {} palign(4)
        .init_array {} palign(4)
    } > FLASH_NON_SECURE

This will fix the crash and allow use of C++ objects that are created at system startup.

  • Hi, 

    It seems that you are using a C++ in MSPM0, right?

    Is this code or demo you are using from MSPM0 SDK or created by yourself?

        GROUP {
            .reserved:                   { . += 0x101C; } (NOLOAD)
            .padding : fill = 0xFFFFFFFF { . += 0x00E4; }
            .resetVecs:   {} palign(4)   /* This is where code resides */
            .cram:        {} palign(4)
            .text:   {} palign(4)   /* This is where code resides */
            .rodata: {} palign(4)   /* This is where const's go */
            .cinit:  {} palign(4)
            .init_array {} palign(4)
        } > FLASH_NON_SECURE

    It seems that both CCS nor syscfg won't generate this kind of .cmd file.

    Regards,

    Helic