Skip to content

Commit 1e903b0

Browse files
committed
Add missing definitions for esp-idf
1 parent 2660eb8 commit 1e903b0

File tree

6 files changed

+48
-4
lines changed

6 files changed

+48
-4
lines changed

FreeRTOS/include/freertos/FreeRTOS.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,20 @@
755755
#define traceSTREAM_BUFFER_RECEIVE_FROM_ISR( xStreamBuffer, xReceivedLength )
756756
#endif
757757

758+
#ifdef ESP_PLATFORM
759+
#ifndef traceISR_EXIT_TO_SCHEDULER
760+
#define traceISR_EXIT_TO_SCHEDULER()
761+
#endif
762+
763+
#ifndef traceISR_EXIT
764+
#define traceISR_EXIT()
765+
#endif
766+
767+
#ifndef traceISR_ENTER
768+
#define traceISR_ENTER(_n_)
769+
#endif
770+
#endif // ESP_PLATFORM
771+
758772
#ifndef configGENERATE_RUN_TIME_STATS
759773
#define configGENERATE_RUN_TIME_STATS 0
760774
#endif

FreeRTOS/include/freertos/portable.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@
3333
#ifndef PORTABLE_H
3434
#define PORTABLE_H
3535

36+
#ifdef ESP_PLATFORM
37+
#include "freertos/portmacro.h"
38+
#else
3639
#include "portmacro.h"
40+
#endif
3741

3842
#if portBYTE_ALIGNMENT == 32
3943
#define portBYTE_ALIGNMENT_MASK ( 0x001f )

FreeRTOS/portable/esp-idf/port_common.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ void esp_startup_start_app_common(void)
6969
esp_gdbstub_init();
7070
#endif // CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME
7171

72-
#ifdef CONFIG_IDF_RTOS_RTTHREAD
73-
app_main();
74-
#else
72+
#if !defined CONFIG_IDF_RTOS_RTTHREAD
7573
portBASE_TYPE res = xTaskCreatePinnedToCore(&main_task, "main",
7674
ESP_TASK_MAIN_STACK, NULL,
7775
ESP_TASK_MAIN_PRIO, NULL, ESP_TASK_MAIN_CORE);

FreeRTOS/portable/esp-idf/riscv/include/freertos/portmacro.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,13 @@ FORCE_INLINE_ATTR bool xPortCanYield(void)
340340

341341
BaseType_t rt_err_to_freertos(rt_err_t rt_err);
342342

343+
#if CONFIG_APPTRACE_SV_ENABLE
344+
extern int xPortSwitchFlag;
345+
#define os_task_switch_is_pended(_cpu_) (xPortSwitchFlag)
346+
#else
347+
#define os_task_switch_is_pended(_cpu_) (false)
348+
#endif
349+
343350
#ifdef __cplusplus
344351
}
345352
#endif

FreeRTOS/portable/esp-idf/riscv/port.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@
5656
#include "portmacro.h"
5757
#include "esp_memory_utils.h"
5858

59+
/* ---------------------------------------------------- Variables ------------------------------------------------------
60+
*
61+
* ------------------------------------------------------------------------------------------------------------------ */
5962

63+
static const char *TAG = "cpu_start";
6064

6165
/* ---------------------------------------------- Port Implementations -------------------------------------------------
6266
*
@@ -66,7 +70,7 @@
6670

6771
BaseType_t xPortInIsrContext(void)
6872
{
69-
rreturn (BaseType_t)rt_interrupt_get_nest();
73+
return (BaseType_t)rt_interrupt_get_nest();
7074
}
7175

7276
BaseType_t IRAM_ATTR xPortInterruptedFromISRContext(void)

FreeRTOS/tasks.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,10 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
494494
void vTaskStartScheduler( void )
495495
{
496496
xSchedulerRunning = pdTRUE;
497+
#ifdef ESP_PLATFORM
498+
extern int rtthread_startup(void);
499+
rtthread_startup();
500+
#endif
497501
}
498502
/*-----------------------------------------------------------*/
499503

@@ -1220,6 +1224,19 @@ TaskHandle_t xTaskGetIdleTaskHandleForCPU( UBaseType_t cpuid )
12201224
return xTaskGetIdleTaskHandle();
12211225
}
12221226

1227+
#if ( configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H == 1 )
1228+
1229+
#include "freertos_tasks_c_additions.h"
1230+
1231+
#ifdef FREERTOS_TASKS_C_ADDITIONS_INIT
1232+
static void freertos_tasks_c_additions_init( void )
1233+
{
1234+
FREERTOS_TASKS_C_ADDITIONS_INIT();
1235+
}
1236+
#endif
1237+
1238+
#endif /* if ( configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H == 1 ) */
1239+
12231240
/* Unimplemented */
12241241
#include "esp_log.h"
12251242
static const char *TAG = "freertos";

0 commit comments

Comments
 (0)