tsk_lock causing a hard fault when called from an ISR

Hi,
I'm running RL-ARM and uVision4 4.14.4.0 on a Cortex-M3 (LM3S9B96)
I'm running several tasks and I want to temporarily disable them while a critical section of the code is running.
As far as I can tell (when I step through the code), tsk_lock( ) is causing a hard fault when called from an ISR.
I checked the documentation and did not see any restrictions.
Am I missing something?

khaled.

Parents
  • The ISR doesn't need any task lock since the OS will not perform any potential task switch until the ISR ends.

    And since an ISR can happen when different tasks are active, it would be strange for an ISR to try to play with running tasks. The normal interaction between an ISR and tasks is that an ISR uses any of the isr_xx() functions to inform the scheduler that it needs to reschedule when the ISR ends - for example that the ISR have received serial data and that there may be a very high-priority task waiting for serial data to process.

    Another thing an ISR can do is play with interrupt sources - for example deactivate some interrupt sources. However, that should be avoided since it makes the code harder to read and test. Interaction between different ISR should be handled by normal interrupt prioritizes while interaction between an ISR and other tasks should be handled with the isr_xx() functions.

Reply
  • The ISR doesn't need any task lock since the OS will not perform any potential task switch until the ISR ends.

    And since an ISR can happen when different tasks are active, it would be strange for an ISR to try to play with running tasks. The normal interaction between an ISR and tasks is that an ISR uses any of the isr_xx() functions to inform the scheduler that it needs to reschedule when the ISR ends - for example that the ISR have received serial data and that there may be a very high-priority task waiting for serial data to process.

    Another thing an ISR can do is play with interrupt sources - for example deactivate some interrupt sources. However, that should be avoided since it makes the code harder to read and test. Interaction between different ISR should be handled by normal interrupt prioritizes while interaction between an ISR and other tasks should be handled with the isr_xx() functions.

Children
More questions in this forum