The ExecuTorch Platform Abstraction Layer (PAL) provides a way for execution environments to override operations like:
The PAL function declarations are in executorch/runtime/platform/platform.h.
The default PAL implementation is in executorch/runtime/platform/target/Posix.cpp. It uses std::chrono::steady_clock for the time, prints log messages to stderr, and makes other default assumptions.
But, if they don't work for your system, you can override the default PAL by:
executorch/runtime/platform/platform.h in one of your application's .c or .cpp files.et_pal_*() functions.No build system changes necessary. The default PAL functions are weak symbols, so providing your own strong-symbol definition will override them at link time.
If you run into build problems because your system doesn't support the functions called by Posix.cpp, you can instead use the no-op minimal PAL at executorch/runtime/platform/target/Minimal.cpp by building with the buck2 flag -c executorch.pal_default=minimal. This will avoid calling fprintf(), std::chrono::steady_clock, and anything else that Posix.cpp uses. But since the Minimal.cpp et_pal_*() functions are no-ops, you will need to override all of them.