Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于编译时显示占用的问题 #8494

Closed
wirano opened this issue Jan 16, 2024 · 2 comments · Fixed by #8697
Closed

关于编译时显示占用的问题 #8494

wirano opened this issue Jan 16, 2024 · 2 comments · Fixed by #8697

Comments

@wirano
Copy link
Contributor

wirano commented Jan 16, 2024

观察到 scon 在生成 cmake 工程时使用 size 工具显示工程的占用空间。除了 size 工具外,还可以添加 --gc-sections,--print-memory-usage 选项让 ld 输出占用信息。相比之下使用 --gc-sections,--print-memory-usage 输出的信息更加直观。

请问使用 size 而不是 --gc-sections,--print-memory-usage 是有什么考虑吗(--gc-sections,--print-memory-usage 依赖 bsp 作者添加链接选项,但这应该可以通过脚本在生成工程阶段实现)

   text	   data	    bss	    dec	    hex	filename
  24363	    340	   1344	  26047	   65bf	rtthread.elf
Memory region         Used Size  Region Size  %age Used
           FLASH:       24364 B       256 KB      9.29%
            SRAM:        1684 B        32 KB      5.14%
@BernardXiong
Copy link
Member

支持PR,完善更多信息显示输出

@runsunlg
Copy link

链接选项--gc-sections一般要与编译选项-function-sections,-fdata-sections使用,因此还需要修改编译选项,这几个选项一般是作为优化可执行文件大小用的,去掉了不用的函数和全局变量。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants