Skip to content

Commit d33e9ea

Browse files
committed
Fixed calling taskEXIT_CRITICAL and taskENTER_CRITICAL
1 parent 0bcdde1 commit d33e9ea

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

cores/rp2040/_freertos.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,8 @@ extern "C" {
5454

5555
extern void __freertos_idle_other_core() __attribute__((weak));
5656
extern void __freertos_resume_other_core() __attribute__((weak));
57+
58+
extern void __freertos_task_exit_critical() __attribute__((weak));
59+
extern void __freertos_task_enter_critical() __attribute__((weak));
5760
}
5861
extern SemaphoreHandle_t __get_freertos_mutex_for_ptr(mutex_t *m, bool recursive = false);

cores/rp2040/wiring_private.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,8 @@
2323
#include <hardware/gpio.h>
2424
#include <hardware/sync.h>
2525
#include <map>
26+
#include "_freertos.h"
2627

27-
// FreeRTOS potential includes
28-
extern void taskEXIT_CRITICAL() __attribute__((weak));
29-
extern void taskENTER_CRITICAL() __attribute__((weak));
3028

3129
// Support nested IRQ disable/re-enable
3230
#ifndef maxIRQs
@@ -37,7 +35,7 @@ static uint32_t _irqStack[2][maxIRQs];
3735

3836
extern "C" void interrupts() {
3937
if (__freeRTOSinitted) {
40-
taskEXIT_CRITICAL();
38+
__freertos_task_exit_critical();
4139
} else {
4240
auto core = get_core_num();
4341
if (!_irqStackTop[core]) {
@@ -50,7 +48,7 @@ extern "C" void interrupts() {
5048

5149
extern "C" void noInterrupts() {
5250
if (__freeRTOSinitted) {
53-
taskENTER_CRITICAL();
51+
__freertos_task_enter_critical();
5452
} else {
5553
auto core = get_core_num();
5654
if (_irqStackTop[core] == maxIRQs) {

libraries/FreeRTOS/src/variantHooks.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@ extern "C" {
9191
bool __freertos_check_if_in_isr() {
9292
return portCHECK_IF_IN_ISR();
9393
}
94+
95+
void __freertos_task_exit_critical() {
96+
taskEXIT_CRITICAL();
97+
}
98+
99+
void __freertos_task_enter_critical() {
100+
taskENTER_CRITICAL();
101+
}
94102
}
95103

96104

0 commit comments

Comments
 (0)