简体   繁体   English

我的BSS部分的尺寸是否重要?

[英]Is my BSS section in critical size?

I have written a small application for my heating system in my apartment, at the end of compilation I am becoming the following output : 我已经在我的公寓中为加热系统编写了一个小型应用程序,在编译结束时,我将得到以下输出:

 'Invoking: Cross ARM GNU Print Size'
arm-none-eabi-size --format=berkeley "Phaethon_F446.elf"
text       data     bss     dec     hex filename
142935      924   77140  220999   35f47 Phaethon_F446.elf

I am using the STM32F446RE with 128 KB RAM, if I am correct, the bss section needs 75KB of RAM; 我正在使用具有128 KB RAM的STM32F446RE,如果我是正确的话,bss部分需要75KB RAM。 that means more than 50% of the RAM is gone. 这意味着超过50%的RAM已耗尽。

  • Am I wrong? 我错了吗?
  • Kills bss my RAM or this value is represented wrong from the compiler? 杀死bss我的RAM或从编译器表示该值错误?

  • What should I change in my software? 我应该在软件中进行哪些更改?

Yes, you are right, according to the report, the ~50% of the RAM is being taken by .bss. 是的,您是对的,根据该报告,.bss占用了约50%的RAM。 To be sure, you could generate the map file to find out how (or where) the variables are being allocated (-Wl,-Map=output.map). 可以肯定的是,您可以生成映射文件来查找变量的分配方式(或位置)(-Wl,-Map = output.map)。

Regarding a solution, you have to optimise the software (are all the variables needed? Are you using compiler optimisations as -O3/... options ? Can you re-use variables?) I have no idea about your code/algorithms/etc, but it looks like a lot of bytes just for a heating system. 关于解决方案,您必须优化软件(是否需要所有变量?您是否正在将编译器优化用作-O3 / ... 选项 ?可以重用变量吗?)我对您的代码/算法/等一无所知,但看起来仅是供暖系统就需要很多字节。

The linker script will show you the borders (that is, the current size) of the .bss section (and how your memory is splitted), just in case you want to modify it (you can choose how the memory is distributed). 链接脚本将为您显示.bss节的边框(即当前大小)(以及内存的分割方式),以防万一您要修改它(可以选择内存的分配方式)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM