This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new f11b04fc61 kconfig: Add link parameters that can print remaining
memory information
f11b04fc61 is described below
commit f11b04fc61a51f9e06556b5e0eadac54da9db86d
Author: wangmingrong1 <[email protected]>
AuthorDate: Wed Oct 23 21:16:06 2024 +0800
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 <[email protected]>
---
arch/arm/src/cmake/gcc.cmake | 2 ++
arch/arm/src/common/Toolchain.defs | 1 +
arch/arm64/src/Toolchain.defs | 2 ++
arch/arm64/src/cmake/Toolchain.cmake | 2 ++
arch/risc-v/src/cmake/Toolchain.cmake | 1 +
arch/risc-v/src/common/Toolchain.defs | 1 +
6 files changed, 9 insertions(+)
diff --git a/arch/arm/src/cmake/gcc.cmake b/arch/arm/src/cmake/gcc.cmake
index 82012d04f4..7ad27f6072 100644
--- a/arch/arm/src/cmake/gcc.cmake
+++ b/arch/arm/src/cmake/gcc.cmake
@@ -229,6 +229,8 @@ if(CONFIG_DEBUG_LINK_MAP)
add_link_options(-Wl,--cref -Wl,-Map=nuttx.map)
endif()
+add_link_options(-Wl,--print-memory-usage)
+
if(CONFIG_DEBUG_SYMBOLS)
add_compile_options(${CONFIG_DEBUG_SYMBOLS_LEVEL})
endif()
diff --git a/arch/arm/src/common/Toolchain.defs
b/arch/arm/src/common/Toolchain.defs
index 0601b28aef..e5f7fd923c 100644
--- a/arch/arm/src/common/Toolchain.defs
+++ b/arch/arm/src/common/Toolchain.defs
@@ -324,6 +324,7 @@ else
endif
LDFLAGS += --entry=__start
+ LDFLAGS += --print-memory-usage
endif
diff --git a/arch/arm64/src/Toolchain.defs b/arch/arm64/src/Toolchain.defs
index 84a7cb3814..ab580d29e0 100644
--- a/arch/arm64/src/Toolchain.defs
+++ b/arch/arm64/src/Toolchain.defs
@@ -195,6 +195,8 @@ ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y)
ifeq ($(shell expr "$(GCCVER)" \>= 12), 1)
LDFLAGS += --no-warn-rwx-segments
endif
+
+ LDFLAGS += --print-memory-usage
endif
# Add the builtin library
diff --git a/arch/arm64/src/cmake/Toolchain.cmake
b/arch/arm64/src/cmake/Toolchain.cmake
index 1e6ab41d03..0e900784b7 100644
--- a/arch/arm64/src/cmake/Toolchain.cmake
+++ b/arch/arm64/src/cmake/Toolchain.cmake
@@ -200,4 +200,6 @@ if(CONFIG_ARCH_TOOLCHAIN_GNU)
if(GCCVER GREATER_EQUAL 12)
add_link_options(-Wl,--no-warn-rwx-segments)
endif()
+
+ add_link_options(-Wl,--print-memory-usage)
endif()
diff --git a/arch/risc-v/src/cmake/Toolchain.cmake
b/arch/risc-v/src/cmake/Toolchain.cmake
index b7f6b8805c..aecbfcfaf5 100644
--- a/arch/risc-v/src/cmake/Toolchain.cmake
+++ b/arch/risc-v/src/cmake/Toolchain.cmake
@@ -104,6 +104,7 @@ elseif(CONFIG_LTO_FULL)
if(CONFIG_ARCH_TOOLCHAIN_GNU)
add_compile_options(-fno-builtin)
add_compile_options(-fuse-linker-plugin)
+ add_link_options(-wl,--print-memory-usage)
endif()
endif()
diff --git a/arch/risc-v/src/common/Toolchain.defs
b/arch/risc-v/src/common/Toolchain.defs
index 1f1871b550..a99f57e83e 100644
--- a/arch/risc-v/src/common/Toolchain.defs
+++ b/arch/risc-v/src/common/Toolchain.defs
@@ -382,6 +382,7 @@ else
endif
endif
+ LDFLAGS += --print-memory-usage
endif
# Add the builtin library