adds the generation of the offsetof defines to CMakeLists.txt

As the offsets into the TX_THREAD are needed to access certain fields and the members for smp are quite difficult to obtain this was the safest option
This commit is contained in:
2026-03-10 20:59:58 +01:00
parent 70bbde8502
commit 2e955b9342
3 changed files with 74 additions and 2 deletions

View File

@@ -0,0 +1,22 @@
if(NOT DEFINED INPUT)
message(FATAL_ERROR "INPUT is required")
endif()
if(NOT DEFINED OUTPUT)
message(FATAL_ERROR "OUTPUT is required")
endif()
file(STRINGS "${INPUT}" OFFSET_LINES REGEX "->")
set(OFFSET_CONTENT "/* Generated by GenerateAsmOffsets.cmake. */\n")
foreach(LINE IN LISTS OFFSET_LINES)
string(REGEX MATCH "->([A-Za-z0-9_]+)[^0-9-]*(-?[0-9]+)" _ "${LINE}")
if(NOT CMAKE_MATCH_1)
continue()
endif()
string(APPEND OFFSET_CONTENT "#define ${CMAKE_MATCH_1} ${CMAKE_MATCH_2}\n")
endforeach()
file(WRITE "${OUTPUT}" "${OFFSET_CONTENT}")