Ken Van Hoeylandt c788f3abf9 Run SDL from main() and place FreeRTOS in separate thread
This fixes macOS support.
Updated GitHub Actions to publish macOS simulator build for testing,
updated amd64 to x86_64 for consistent naming.
2026-09-16 17:37:13 +02:00

44 lines
840 B
C++

#include "Main.h"
#include <Tactility/Thread.h>
#include "FreeRTOS.h"
#include "task.h"
#include <tactility/log.h>
constexpr auto* TAG = "FreeRTOS";
namespace simulator {
static MainFunction mainFunction = nullptr;
void setMain(MainFunction newMainFunction) {
mainFunction = newMainFunction;
}
static void freertosMainTask(void*) {
LOG_I(TAG, "starting app_main()");
assert(simulator::mainFunction);
mainFunction();
LOG_I(TAG, "returned from app_main()");
vTaskDelete(nullptr);
}
void freertosMain() {
BaseType_t task_result = xTaskCreate(
freertosMainTask,
"main",
8192,
nullptr,
static_cast<UBaseType_t>(tt::Thread::Priority::Normal),
nullptr
);
assert(task_result == pdTRUE);
// Blocks forever
vTaskStartScheduler();
}
} // namespace