Discarding/Overriding cortex-m-rt exception table

I'm working on a XMC1100 Cortex-M0 device which stores some clock initialization information for the startup software inside the unused values of the exception table.

Going through the cortex-m-rt source code, The reserved values in __EXCEPTIONS do not look like they can be overridden in any way. I tried duplicating the exception table with the required values and added a /DISCARD/ section to my memory.x, but I cannot seem to get the match correct.

Current memory.x

MEMORY
{
    FLASH   (RX)    : ORIGIN = 0x10001000, LENGTH = 64K
    RAM     (!RX)   : ORIGIN = 0x20000000, LENGTH = 16K
}

_stack_start = ORIGIN(RAM) + LENGTH(RAM);


SECTIONS
{
    /DISCARD/ :
    {
        *cortex_m_rt* (__EXCEPTIONS)
    }
}

Is it possible to override or discard just the exception table from the cortex-m-rt? Or should I just create a new link.x?

I'd suggest you contact the author of the crate.
Or you can fork it and make the changes on your own.

I would not suggest doing these linker shenanigans, since unless very specific configurations are made for symbols (such as #[link_name="..."]), the output symbol names are not stable.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.