Cortex-M Vector Table and Address Remap

Hi guys,

Does the M0 always default to 0x0 when an interrupt triggers? I understand VTOR is not available in M0 for relocation of the tables.

Can I copy the application vector table just the vector table to beginning of SRAM and remap the SRAM to 0x0 so that during interrupts it will always go to the SRAM to fetch the vectors? Is that the right way to relocate the vector?

If I understand it correctly the REMAP is mainly used for 

1. Power up fetch of first MSP and Reset Vector

2. After powerup --- allows interrupt vectors (assume M0 always goes to 0x0 to fetch vectors) to be fetched from the REMAPed addresses.

3. It masks out accesses to the actual memory located on physical 0x0 on the bus.

It is not really useful for actual application program because the PC can be explicitly controlled with branching/jump instructions.

Hypothetically, if I do not place any memory blocks on 0x0 and then use REMAP to switch some other blocks at say 0x1 or 0x2 into 0x0 as needed, would this be a good way to switch the location of the vector table?

For example

SRAM at 0x1  

FLASH at 0x2  ((Bootloader (at beginning)+ application Prog))

At power up Remap FLASH to 0x0 -- Run bootloader Vectortable + code; copy AppProgram Vector table to SRAM.

REMAP SRAM to 0x0 (application vector table active), jump to Application at FLASH (now mapped to 0x2)

and so on.

It would seem possible to run the MCU and use the REMAP in this way, but would appreciate any feedback from more experienced designers.

Initial thoughts were obtained from this thread regarding relocating vector tables

https://community.arm.com/developer/ip-products/processors/f/cortex-m-forum/13533/relocating-the-vector-table-in-cortex---m0/36527#36527

Parents
  • Yes, the M0 always default fetch to vector table at address 0x0 when an interrupt triggers. No, VTOR is not available in M0 for relocation of the tables.

    And your example makes sense to me.

    I think the key point is that the bus-matrix does some remap, not mask.

Reply
  • Yes, the M0 always default fetch to vector table at address 0x0 when an interrupt triggers. No, VTOR is not available in M0 for relocation of the tables.

    And your example makes sense to me.

    I think the key point is that the bus-matrix does some remap, not mask.

Children
More questions in this forum