FreeRTOS移植正点原子malloc.h报错:.\Objects\project.axf: Error: L6406E: No space in execution regions with

找了很久的博客都没有找到解决方法,都是互相抄袭,直到我看到了https://www.cnblogs.com/hexia7935/p/16449377.html

问题主要有以下两个:

1.FreeRtosConfig.h文件中
  #define configTOTAL_HEAP_SIZE                    ((size_t)(9*1024))   

2.malloc.h文件中

#define MEM1_MAX_SIZE            (7*1024)

网友力量还是强大,感谢能够分享解决方法的大佬!

Light_system\Light_system.axf: Error: L6406E: No space in execution regions with .ANY selector matching main.o(.bss). Light_system\Light_system.axf: Error: L6406E: No space in execution regions with .ANY selector matching startup_stm32f103xb.o(STACK). Light_system\Light_system.axf: Error: L6406E: No space in execution regions with .ANY selector matching freertos.o(.bss). Light_system\Light_system.axf: Error: L6406E: No space in execution regions with .ANY selector matching tasks.o(.bss). Light_system\Light_system.axf: Error: L6406E: No space in execution regions with .ANY selector matching usart.o(.bss). Light_system\Light_system.axf: Error: L6406E: No space in execution regions with .ANY selector matching i2c.o(.bss). Light_system\Light_system.axf: Error: L6406E: No space in execution regions with .ANY selector matching stm32f1xx_hal_timebase_tim.o(.bss). Light_system\Light_system.axf: Error: L6406E: No space in execution regions with .ANY selector matching tasks.o(.data). Light_system\Light_system.axf: Error: L6406E: No space in execution regions with .ANY selector matching freertos.o(.data). Light_system\Light_system.axf: Error: L6406E: No space in execution regions with .ANY selector matching heap_4.o(.data). Light_system\Light_system.axf: Error: L6406E: No space in execution regions with .ANY selector matching rtc.o(.bss). Light_system\Light_system.axf: Error: L6406E: No space in execution regions with .ANY selector matching stm32f1xx_hal.o(.data). Light_system\Light_system.axf: Error: L6406E: No space in execution regions with .ANY selector matching port.o(.data). Light_system\Light_system.axf: Error: L6406E: No space in execution regions with .ANY selector matching system_stm32f1xx.o(.data). Light_system\Light_system.axf: Error: L6406E: No space in execution regions with .ANY selector matching stdout.o(.data). Light_system\Light_system.axf: Error: L6406E: No space in execution regions with .ANY selector matching main.o(.data). Light_system\Light_system.axf: E
最新发布
03-16
### STM32 链接器错误 L6406E 原因分析 当遇到 `Error: L6406E: No space in execution regions with .ANY selector` 错误时,表明链接过程中某些段(如 `.bss`, `.data`, 或其他自定义段)无法被放置到指定的内存区域中,因为这些区域的空间不足以容纳它们[^1]。 对于 STM32 设备而言,这类问题通常源于以下几个方面: - **静态变量过多**:如果应用程序中有大量全局或静态变量,则会增加 BSS 和 DATA 段大小。 - **堆栈配置不当**:默认情况下,操作系统可能分配了较大的堆栈空间给线程或其他组件,这可能会挤占 RAM 中用于存储动态数据和其他用途的部分。 - **闪存/内部 SRAM 容量有限**:特别是选用较低端型号时,其内置资源相对较少,在复杂应用下容易耗尽可用地址空间。 - **库文件体积庞大**:第三方函数库或者 HAL 库版本更新可能导致二进制尺寸膨胀;另外,启用调试信息也会使最终镜像变大。 针对上述情况,可以采取如下措施来解决问题: #### 修改链接脚本中的内存布局 通过调整 Linker Script 文件内的 MEMORY 和 SECTIONS 设置重新规划各部分所处位置以及相互间关系。例如,将一些不常用的数据移到外部扩展 SDRAM 上面去减轻核心芯片负担;或是利用多块不同属性的内部 RAM 来分散压力。 ```c MEMORY { FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 512K /* Flash memory */ RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 64K /* Internal SRAM */ } SECTIONS { ... } ``` #### 减少不必要的初始化零值数组 BSS 段专门用来保存那些未经显式赋初值即自动置为全零的对象集合。因此,尽可能减少此类声明的数量有助于降低该分区需求。 #### 合理设定任务优先级与堆栈大小 仔细评估各个 RTOS Task 所需最小工作环境并据此适当缩小 Stack Size 参数,从而释放更多自由度供其它重要模块使用。 #### 使用更高效的编译选项 提高 GCC 编译参数 `-O2` 或者更高水平 (-Os),让工具链尝试去除冗余指令序列以减小程序体积极限压缩率。 #### 移除无用功能特性 审视整个工程结构,关闭任何非必要的中间件服务、外设驱动乃至硬件加速单元的支持开关,进而裁剪掉相应实现逻辑带来的额外负载。 #### 利用外部存储设备 考虑引入 SPI NOR Flash 等外围器件作为补充方案之一,把不太频繁访问却占据较大连续区块的内容迁移到那里处理即可缓解当前困境。 ### 实际操作指南 具体实施时可参照以下步骤逐一排查直至恢复正常构建流程为止: 1. 检查现有项目配置是否合理; 2. 尝试精简源码规模及其依赖项; 3. 对比官方示例模板寻找差异之处加以修正; 4. 参考社区论坛分享的经验贴获取灵感启发; 5. 如果条件允许的话升级至性能更强的新平台系列。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值