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:
22
port/threadx_smp/cmake/GenerateAsmOffsets.cmake
Normal file
22
port/threadx_smp/cmake/GenerateAsmOffsets.cmake
Normal 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}")
|
||||
Reference in New Issue
Block a user