updates build system to support selection of Target memory, includes trace buffer

This commit is contained in:
2026-05-28 12:44:29 +02:00
parent d45a8f9231
commit 1903fb0c9c
4 changed files with 24 additions and 7 deletions
-5
View File
@@ -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 -1
View File
@@ -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
}
+8
View File
@@ -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.*) }
}