Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit fee8ca9

Browse files
facchinmpennam
authored andcommitted
freertos: start scheduler and loop task on header inclusion
1 parent 9f0dc38 commit fee8ca9

File tree

2 files changed

+24
-0
lines changed
  • cores/arduino
  • libraries/Arduino_FreeRTOS/src/portable/FSP

2 files changed

+24
-0
lines changed

‎cores/arduino/main.cpp‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ void unsecure_registers() {
6464
#define str(s) #s
6565

6666
extern "C" void Stacktrace_Handler(void);
67+
extern "C" __attribute__((weak)) void start_freertos_on_header_inclusion() {}
6768

6869
void arduino_main(void)
6970
{
@@ -111,6 +112,7 @@ void arduino_main(void)
111112
Serial.begin(115200);
112113
#endif
113114
startAgt();
115+
start_freertos_on_header_inclusion();
114116
setup();
115117
while (1)
116118
{

‎libraries/Arduino_FreeRTOS/src/portable/FSP/port.c‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,28 @@ static void prvTaskExitError(void);
225225

226226
#endif
227227

228+
void loop_thread_func(void* arg) {
229+
setup();
230+
while (1)
231+
{
232+
loop();
233+
}
234+
}
235+
236+
static TaskHandle_t loop_task;
237+
void start_freertos_on_header_inclusion() {
238+
xTaskCreate(
239+
(TaskFunction_t)loop_thread_func,
240+
"Loop Thread",
241+
4096 / 4, /* usStackDepth in words */
242+
NULL, /* pvParameters */
243+
4, /* uxPriority */
244+
&loop_task /* pxCreatedTask */
245+
);
246+
247+
vTaskStartScheduler();
248+
}
249+
228250
/* Arduino specific overrides */
229251
void delay(uint32_t ms) {
230252
if (xTaskGetSchedulerState() == taskSCHEDULER_RUNNING) {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /