0
0
FreeRTOSprogramming~20 mins

configMAX_SYSCALL_INTERRUPT_PRIORITY in FreeRTOS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
FreeRTOS Interrupt Priority Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What is the output of this FreeRTOS priority check?

Consider the following FreeRTOS configuration snippet and interrupt priority check:

#define configMAX_SYSCALL_INTERRUPT_PRIORITY 5
void ISR_Handler(void) {
    uint8_t priority = get_interrupt_priority();
    if(priority >= configMAX_SYSCALL_INTERRUPT_PRIORITY) {
        printf("Safe to call FreeRTOS API\n");
    } else {
        printf("Unsafe to call FreeRTOS API\n");
    }
}

// Assume get_interrupt_priority() returns 4

What will be printed when ISR_Handler() runs?

FreeRTOS
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 5
void ISR_Handler(void) {
    uint8_t priority = get_interrupt_priority();
    if(priority >= configMAX_SYSCALL_INTERRUPT_PRIORITY) {
        printf("Safe to call FreeRTOS API\n");
    } else {
        printf("Unsafe to call FreeRTOS API\n");
    }
}

// get_interrupt_priority() returns 4
AUnsafe to call FreeRTOS API
BCompilation error due to missing function
CSafe to call FreeRTOS API
DRuntime error due to invalid priority
Attempts:
2 left
💡 Hint

Remember lower numeric priority values mean higher urgency in FreeRTOS.

🧠 Conceptual
intermediate
1:30remaining
What does configMAX_SYSCALL_INTERRUPT_PRIORITY control?

In FreeRTOS, what is the role of configMAX_SYSCALL_INTERRUPT_PRIORITY?

AIt configures the maximum number of system calls allowed per interrupt.
BIt sets the highest interrupt priority from which FreeRTOS API calls are allowed.
CIt defines the lowest interrupt priority in the system.
DIt disables all interrupts above a certain priority level.
Attempts:
2 left
💡 Hint

Think about which interrupts can safely use FreeRTOS API functions.

🔧 Debug
advanced
2:30remaining
Why does this ISR cause a crash when calling FreeRTOS API?

Given this ISR code snippet:

#define configMAX_SYSCALL_INTERRUPT_PRIORITY 3
void ISR_Handler(void) {
    uint8_t priority = get_interrupt_priority(); // returns 2
    vTaskNotifyGiveFromISR(taskHandle, NULL);
}

Why might this cause a system crash?

AThe configMAX_SYSCALL_INTERRUPT_PRIORITY value must be set to 0.
BThe taskHandle is NULL causing a null pointer dereference.
CvTaskNotifyGiveFromISR requires a different API call for this priority level.
DThe interrupt priority (2) is higher than configMAX_SYSCALL_INTERRUPT_PRIORITY (3), so calling FreeRTOS API is unsafe.
Attempts:
2 left
💡 Hint

Check the priority comparison rules for calling FreeRTOS API from interrupts.

📝 Syntax
advanced
2:00remaining
Which option correctly defines configMAX_SYSCALL_INTERRUPT_PRIORITY for Cortex-M3?

For a Cortex-M3 microcontroller with 4 bits of priority, which definition correctly sets configMAX_SYSCALL_INTERRUPT_PRIORITY to priority level 5?

A#define configMAX_SYSCALL_INTERRUPT_PRIORITY (5 << (8 - 4))
B#define configMAX_SYSCALL_INTERRUPT_PRIORITY 5
C#define configMAX_SYSCALL_INTERRUPT_PRIORITY (5 >> (8 - 4))
D#define configMAX_SYSCALL_INTERRUPT_PRIORITY (5 << 4)
Attempts:
2 left
💡 Hint

Remember Cortex-M uses the top bits of the priority byte for priority levels.

🚀 Application
expert
3:00remaining
How many interrupt priorities can safely call FreeRTOS API if configMAX_SYSCALL_INTERRUPT_PRIORITY is 10?

Assuming a system with 256 interrupt priority levels (0 highest, 255 lowest), and configMAX_SYSCALL_INTERRUPT_PRIORITY is set to 10, how many interrupt priority levels can safely call FreeRTOS API functions?

A245 priority levels (11 through 255 inclusive)
B10 priority levels (1 through 10 inclusive)
C246 priority levels (10 through 255 inclusive)
D256 priority levels (all priorities)
Attempts:
2 left
💡 Hint

Count all priorities numerically greater than or equal to configMAX_SYSCALL_INTERRUPT_PRIORITY.