diff --git a/arch/sim/Kconfig b/arch/sim/Kconfig index 2919801010278..2be924136e597 100644 --- a/arch/sim/Kconfig +++ b/arch/sim/Kconfig @@ -794,4 +794,11 @@ config SIM_USB_PRIO endif +config SIM_CUSTOM_DATA_SECTION + string "Custom data section name for Simulator" + default "" + ---help--- + Custom data section name for Simulator to allow + developer to define special data sections. + endif # ARCH_SIM diff --git a/arch/sim/src/Makefile b/arch/sim/src/Makefile index 60cf7b8a4ea16..3d028b9f7e65c 100644 --- a/arch/sim/src/Makefile +++ b/arch/sim/src/Makefile @@ -414,6 +414,9 @@ ifeq ($(CONFIG_MM_KASAN_GLOBAL),y) .kasan.global : {KEEP(*(.data..LASAN0)) KEEP (*(.data.rel.local..LASAN0)) }\n \ .interp : {*(.interp)}/g' nuttx.ld endif +ifneq ($(CONFIG_SIM_CUSTOM_DATA_SECTION),"") + $(Q) sed -i '/\.data *:/i $(shell echo $(CONFIG_SIM_CUSTOM_DATA_SECTION))' nuttx.ld +endif ifeq ($(CONFIG_ALLSYMS)$(CONFIG_MM_KASAN_GLOBAL),) $(if $(CONFIG_HAVE_CXX),\ $(Q) "$(CXX)" $(CFLAGS) $(LDFLAGS) -o $(TOPDIR)/$@ $(HEADOBJ) nuttx.rel $(HOSTOBJS) $(STDLIBS),\