Files
tactility/Devices/simulator/Source/Main.cpp
T
Ken Van Hoeylandt 72089f74f3 Refactor SDL/FreeRTOS implementation to support macOS simulator properly (#653)
- 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-21 19:52:01 -04: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