Mechanism for setting exception handlers #127

Closed
opened 2021-02-13 17:35:57 -06:00 by davidgiven · 3 comments
davidgiven commented 2021-02-13 17:35:57 -06:00 (Migrated from github.com)

I could be wrong, but there doesn't appear to be any way of setting exception handlers from code other than to create specially-named functions such as isr_svcall, which the documentation suggestsnot to do.

The implementation numbers interrupts/exceptions from 0 for IRQ0. As these appear immediately after the vector table, it ought to be possible to use negative numbers to refer to the exceptions --- these are actually documented in the ARM documentation at https://developer.arm.com/documentation/dui0497/a/the-cortex-m0-processor/exception-model/exception-types, so SVCall is interrupt -5. However, calling irq_set_exclusive_handler() doesn't work because you can only use it on vectors which are already pointing at __unhandled_user_irq.

Given how clean the rest of the SDK's design is, it'd be nice to have a blessed-by-the-API way of doing this.

I could be wrong, but there doesn't appear to be any way of setting exception handlers from code other than to create specially-named functions such as `isr_svcall`, which the documentation suggestsnot to do. The implementation numbers interrupts/exceptions from 0 for IRQ0. As these appear immediately after the vector table, it ought to be possible to use negative numbers to refer to the exceptions --- these are actually documented in the ARM documentation at https://developer.arm.com/documentation/dui0497/a/the-cortex-m0-processor/exception-model/exception-types, so `SVCall` is interrupt -5. However, calling `irq_set_exclusive_handler()` doesn't work because you can only use it on vectors which are already pointing at `__unhandled_user_irq`. Given how clean the rest of the SDK's design is, it'd be nice to have a blessed-by-the-API way of doing this.
kilograham commented 2021-02-13 18:22:05 -06:00 (Migrated from github.com)

that is really good point! you can certainly use isr_svcall as a workaround for now, but we should add an API

that is really good point! you can certainly use isr_svcall as a workaround for now, but we should add an API
kilograham commented 2021-04-01 17:40:38 -05:00 (Migrated from github.com)

note also that the vector table is installed in RAM by default, also, so you could write to this...

Also note, that we are working on FreeRTOS "port"

note also that the vector table is installed in RAM by default, also, so you could write to this... Also note, that we are working on FreeRTOS "port"
kilograham commented 2021-05-11 19:22:21 -05:00 (Migrated from github.com)

merged into develop

merged into develop
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk#127
No description provided.