Bird
0
0

Identify the error in this FreeRTOS ISR code snippet:

medium📝 Debug Q6 of 15
FreeRTOS - Interrupt Management
Identify the error in this FreeRTOS ISR code snippet:
void ISR_Handler() {
  xSemaphoreGive(xSemaphore);
}
AMissing return type for ISR_Handler
BISR_Handler should not be a void function
CSemaphore variable not declared
DUsing xSemaphoreGive instead of xSemaphoreGiveFromISR inside ISR
Step-by-Step Solution
Solution:
  1. Step 1: Check correct semaphore function for ISR

    Inside ISR, xSemaphoreGiveFromISR must be used, not xSemaphoreGive.
  2. Step 2: Confirm other code parts

    Function has correct return type and ISR can be void; semaphore declaration is not shown but assumed correct.
  3. Final Answer:

    Using xSemaphoreGive instead of xSemaphoreGiveFromISR inside ISR -> Option D
  4. Quick Check:

    Use xSemaphoreGiveFromISR in ISR [OK]
Quick Trick: Use FromISR versions of API inside ISRs [OK]
Common Mistakes:
  • Using normal API calls inside ISR
  • Forgetting ISR return type
  • Assuming void functions are invalid for ISR

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes