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.

RM48L952: Exception Handling

Part Number: RM48L952


I have two questions:

Que 1:

If I have Bootloader that starts at address 0x0 and Application that is some offset from there (e.g. 0x40000), what is the best way for my application to handle exceptions like dabort? Right now I branch from 0x10 to my application's dabort handler. The downside is the bootloader can't handle dabort faults now. Is there a better way?

Que 2:

I want to do some preprocessing of an Application exception in the Boot before returning to Application. For example:

1. Application (starts at 0x40000) gets dabort and goes to 0x10 (bootloader starts at 0x0 - 0x40000)

2. Instruction at 0x10 branches to subroutine in bootloader space BootExcpHdl() at 0x1000

3 .At the end of BootExcpHdl() in bootloader, I want to branch to application address 0x400100 and continue executing from there.

Right now, at #2 I get another dabort as soon I try to execute from from bootloader address 0x1000.

How do I get around this?

Thanks.

  • Hello,

    Please check whether this is helpful :

    Best regards,

    Miro

  • The scheme in the link won't work for because it assumes application has fixed start address to branch to. My application can has different start address determined at boot time which is why I need some preprocessing on interrupt to determine where the application vectors are. Anything else to try?

  • Guy,

    The option #2 is a good way.

    The offset should be used for the branch in sys_intvecs.asm. The offset for abort (0x10) is: 0x1000 - 0x10 - 0x8

    Example for the sys_intvecs.asm for your bootloader:

    b _c_int00 ;0x00

    b #0xFF4 ;0x1000-0x04-0x08

    b #0xFF0 ;0x1000-0x08-0x08

    b #0xFEC ;0x1000-0xC-0x8

    b #0xFE8 ;0x1000-0x10-0x08

    reservedEntry

    b reservedEntry

    ldr pc,[pc, #-0x1b0]

    ldr pc,[pc, #-0x1b0]

  • Thanks. That's how I proceeded. Regarding offset-0x8, I've read many account that the branch target must be intended address - 0x8 (and I understand why the - 0x8). However, this has never worked for me. I always have to branch to the actual offset address without subtracting 0x8. Is this compiler dependent? Any reason why the straight offset works for me and not the -8?

  • Hello Guy,

    The PC relative address is calculated at link time. I think the address offset is independent of the compiler.

    The address offset (PC = current executing instruction + two instructions' length (0x8 bytes)) is determined by the ARM Cortex-R architecture.