updates build system to support selection of Target memory, includes trace buffer
This commit is contained in:
+14
-1
@@ -1,11 +1,11 @@
|
||||
cmake_minimum_required(VERSION 3.21)
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)
|
||||
###############################################################################
|
||||
# we are building embedded, so no shared libs
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
include(${CMAKE_TOOLCHAIN_FILE})
|
||||
###############################################################################
|
||||
add_subdirectory(port/moonlight)
|
||||
set(TARGET_MEM "ram" CACHE STRING "memory map to use")
|
||||
###############################################################################
|
||||
# Adds picolibc
|
||||
#set(CMAKE_SYSTEM_PROCESSOR riscv)
|
||||
@@ -27,6 +27,9 @@ set(NETXDUO_CUSTOM_PORT ${CMAKE_CURRENT_LIST_DIR}/port/netxduo)
|
||||
set(NXD_ENABLE_FILE_SERVERS OFF)
|
||||
add_subdirectory(third-party/netxduo)
|
||||
if(NX_DEBUG)
|
||||
target_compile_definitions(netxduo PRIVATE NX_DEBUG)
|
||||
endif()
|
||||
if(NX_DEBUG_PACKET)
|
||||
target_compile_definitions(netxduo PRIVATE NX_DEBUG NX_DEBUG_PACKET NX_ENABLE_PACKET_DEBUG_INFO)
|
||||
endif()
|
||||
if(TX_TRACE)
|
||||
@@ -34,14 +37,19 @@ if(TX_TRACE)
|
||||
target_compile_definitions(threadx_smp PUBLIC TX_ENABLE_EVENT_TRACE)
|
||||
target_compile_definitions(netxduo PUBLIC TX_ENABLE_EVENT_TRACE)
|
||||
endif()
|
||||
target_include_directories(netxduo PRIVATE ${CMAKE_CURRENT_LIST_DIR}/port/moonlight)
|
||||
target_link_libraries(netxduo PUBLIC threadx c)
|
||||
###############################################################################
|
||||
project(threadx_demo C ASM)
|
||||
set(TARGET_MEM "ram" CACHE STRING "memory map to use")
|
||||
option(NX_DEBUG "compile netxduo debug output in" OFF)
|
||||
option(NX_DEBUG_PACKET "compile netxduo debug output for ethernet packets in" OFF)
|
||||
option(TX_TRACE "Enable dump of traces to be read by TraceX" OFF)
|
||||
set(CMAKE_EXECUTABLE_SUFFIX_C ".elf")
|
||||
|
||||
function(setup_target TARGET)
|
||||
set(options)
|
||||
set(oneValueArgs TARGET_MEM)
|
||||
set(multiValueArgs LIBRARIES SOURCES)
|
||||
cmake_parse_arguments(ST "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
if(ST_UNPARSED_ARGUMENTS)
|
||||
@@ -60,6 +68,11 @@ function(setup_target TARGET)
|
||||
target_link_libraries(${TARGET} PRIVATE ${ST_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(ST_TARGET_MEM)
|
||||
set(TARGET_MEM "${ST_TARGET_MEM}")
|
||||
endif()
|
||||
target_link_options(${TARGET} PUBLIC -T ${TARGET_MEM}.lds)
|
||||
|
||||
target_link_options(${TARGET} PRIVATE
|
||||
-Wl,-Map=${CMAKE_BINARY_DIR}/${TARGET}.map)
|
||||
|
||||
|
||||
@@ -7,10 +7,6 @@ set(MOONLIGHT_INC_DIR ${MOONLIGHT_ROOT}/inc)
|
||||
set(MOONLIGHT_SRC_DIR ${MOONLIGHT_ROOT}/src)
|
||||
set(MOONLIGHT_LDS_DIR ${MOONLIGHT_ROOT}/lds)
|
||||
|
||||
if(NOT DEFINED TARGET_MEM)
|
||||
set(TARGET_MEM "ram" CACHE STRING "memory map to use")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED MOONLIGHT_TRAP_SOURCE)
|
||||
set(MOONLIGHT_TRAP_SOURCE ${MOONLIGHT_SRC_DIR}/trap_non_vectored.c)
|
||||
endif()
|
||||
@@ -36,6 +32,5 @@ target_compile_options(moonlight
|
||||
target_link_options(moonlight
|
||||
INTERFACE
|
||||
-nostartfiles
|
||||
-T ${MOONLIGHT_LDS_DIR}/${TARGET_MEM}.lds
|
||||
-Wl,--gc-sections
|
||||
)
|
||||
|
||||
@@ -2,6 +2,7 @@ MEMORY
|
||||
{
|
||||
rom (rxai!w) : ORIGIN = 0x10080000, LENGTH = 8k
|
||||
flash (rxai!w) : ORIGIN = 0x20000000, LENGTH = 16M
|
||||
ram (wxa!ri) : ORIGIN = 0x30000000, LENGTH = 128K
|
||||
ram (wxa!ri) : ORIGIN = 0x30000000, LENGTH = 256K
|
||||
trace (wxa!ri) : ORIGIN = 0x31000000, LENGTH = 1M
|
||||
dram (wxa!ri) : ORIGIN = 0x40000000, LENGTH = 1024M
|
||||
}
|
||||
|
||||
@@ -105,5 +105,13 @@ SECTIONS
|
||||
PROVIDE( tohost = . );
|
||||
PROVIDE( fromhost = . + 8 );
|
||||
|
||||
.trace_buffer (NOLOAD) :
|
||||
{
|
||||
. = ORIGIN(trace);
|
||||
__trace_buffer_start = .;
|
||||
. = ORIGIN(trace) + LENGTH(trace); /* pad until end of trace */
|
||||
__trace_buffer_end = .;
|
||||
} > trace
|
||||
|
||||
/DISCARD/ : { *(.eh_frame*) *(.comment) *(.note .note.*) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user