kconfig: Add link parameters that can print remaining memory information

LD: nuttx
Memory region         Used Size  Region Size  %age Used
           flash:      284272 B       512 KB     54.22%
           sram1:       13296 B         2 MB      0.63%
           sram2:          0 GB         2 MB      0.00%
CP: nuttx.hex
CP: nuttx.bin

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
This commit is contained in:
wangmingrong1 2024-10-23 21:16:06 +08:00 committed by Xiang Xiao
parent a63c807353
commit f11b04fc61
6 changed files with 9 additions and 0 deletions

View File

@ -229,6 +229,8 @@ if(CONFIG_DEBUG_LINK_MAP)
add_link_options(-Wl,--cref -Wl,-Map=nuttx.map) add_link_options(-Wl,--cref -Wl,-Map=nuttx.map)
endif() endif()
add_link_options(-Wl,--print-memory-usage)
if(CONFIG_DEBUG_SYMBOLS) if(CONFIG_DEBUG_SYMBOLS)
add_compile_options(${CONFIG_DEBUG_SYMBOLS_LEVEL}) add_compile_options(${CONFIG_DEBUG_SYMBOLS_LEVEL})
endif() endif()

View File

@ -324,6 +324,7 @@ else
endif endif
LDFLAGS += --entry=__start LDFLAGS += --entry=__start
LDFLAGS += --print-memory-usage
endif endif

View File

@ -195,6 +195,8 @@ ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y)
ifeq ($(shell expr "$(GCCVER)" \>= 12), 1) ifeq ($(shell expr "$(GCCVER)" \>= 12), 1)
LDFLAGS += --no-warn-rwx-segments LDFLAGS += --no-warn-rwx-segments
endif endif
LDFLAGS += --print-memory-usage
endif endif
# Add the builtin library # Add the builtin library

View File

@ -200,4 +200,6 @@ if(CONFIG_ARCH_TOOLCHAIN_GNU)
if(GCCVER GREATER_EQUAL 12) if(GCCVER GREATER_EQUAL 12)
add_link_options(-Wl,--no-warn-rwx-segments) add_link_options(-Wl,--no-warn-rwx-segments)
endif() endif()
add_link_options(-Wl,--print-memory-usage)
endif() endif()

View File

@ -104,6 +104,7 @@ elseif(CONFIG_LTO_FULL)
if(CONFIG_ARCH_TOOLCHAIN_GNU) if(CONFIG_ARCH_TOOLCHAIN_GNU)
add_compile_options(-fno-builtin) add_compile_options(-fno-builtin)
add_compile_options(-fuse-linker-plugin) add_compile_options(-fuse-linker-plugin)
add_link_options(-wl,--print-memory-usage)
endif() endif()
endif() endif()

View File

@ -382,6 +382,7 @@ else
endif endif
endif endif
LDFLAGS += --print-memory-usage
endif endif
# Add the builtin library # Add the builtin library