feat(radio): OS compatibility layer (#5840)

This commit is contained in:
Raphael Coeffic
2025-05-03 19:07:49 +10:00
committed by GitHub
parent c996612b0a
commit ab2a19e153
92 changed files with 1740 additions and 896 deletions
+21 -4
View File
@@ -484,9 +484,16 @@ if(NATIVE_BUILD)
${RADIOLIB_NATIVE_SRC}
)
# Add -DSIMU here PUBLIC, so it can be imported by other targets
# Add SIMU and POSIX_THREAD here PUBLIC, so it can be imported by other targets
# via INTERFACE_COMPILE_OPTIONS
target_compile_options(radiolib_native PUBLIC -DSIMU)
target_compile_options(radiolib_native PUBLIC -DSIMU -DPOSIX_THREADS)
target_sources(radiolib_native PUBLIC
os/async_native.cpp
os/sleep_native.cpp
os/task_pthread.cpp
os/time_native.cpp
os/timer_pthread.cpp
)
add_dependencies(radiolib_native ${RADIO_DEPENDENCIES})
set_property(TARGET radiolib_native PROPERTY POSITION_INDEPENDENT_CODE ON)
@@ -554,13 +561,23 @@ if(BOOTLOADER)
set(RADIO_DEPENDENCIES ${RADIO_DEPENDENCIES} bootloader)
endif()
add_definitions(-DFREE_RTOS)
add_executable(firmware ${SRC})
link_libraries(firmware -lstdc++)
add_dependencies(firmware ${RADIO_DEPENDENCIES})
set_target_properties(firmware PROPERTIES EXCLUDE_FROM_ALL TRUE)
target_compile_definitions(board PUBLIC FREE_RTOS)
target_compile_definitions(board_lib PUBLIC FREE_RTOS)
target_compile_definitions(firmware PUBLIC FREE_RTOS)
target_sources(firmware PUBLIC
os/async_freertos.cpp
os/sleep_freertos.cpp
os/task_freertos.cpp
os/time_freertos.cpp
os/timer_freertos.cpp
)
if(DEBUG)
target_compile_definitions(board PRIVATE -DDEBUG)
target_compile_definitions(firmware PRIVATE -DDEBUG)