Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
链接脚本_lds_sct_icf_分散加载
20
STM32F407 外挂SRAM 后 link.lds问题
发布于 2021-10-25 15:28:35 浏览:1239
订阅该版
[tocm] 最近做个项目,当网络断开时需要把数据存储在本地,我使用STM32F407 外挂了一个SRAM。 ###自己的开发模式: 1.menuconfig 构建 MDK工程,MDK工程只用于后期的Debug 2.开发时会使用 rtthreadAssistant 插件进行开发 ###SRAM使用方式: 在程序中构建一个SRAM大小的Buffer进行操作使用 ```c /* sram buffer */ #if defined(__CC_ARM) || defined(__CLANG_ARM) rt_uint8_t sram_buffer[SRAM_SIZE] __attribute__((at(SRAM_BANK_ADDR))); #elif defined(__ICCARM__) || defined(__GNUC__) rt_uint8_t sram_buffer[SRAM_SIZE] __attribute__((section(".sram"))); #endif ``` - MDK中直接使用ARM_CC编译器没什么可说的,直接使用即可 - rtthreadAssistant 这个插件就是使用的 gcc 编译器,需要更改 **link.lds** 文件 ### 当前 link.lds 更改如下: ```c /* * linker script for STM32F4xx with GNU ld * bernard.xiong 2009-10-14 */ /* Program Entry, set to mark it as "used" and avoid gc */ MEMORY { ROM (rx) : ORIGIN = 0x08020000, LENGTH = 1024k /* 1024KB flash */ RAM (rw) : ORIGIN = 0x20000000, LENGTH = 128k /* 128K sram */ SRAM(rw) : ORIGIN = 0x60000000, LENGTH = 1024k } ENTRY(Reset_Handler) _system_stack_size = 0x200; SECTIONS { .text : { . = ALIGN(4); _stext = .; KEEP(*(.isr_vector)) /* Startup code */ . = ALIGN(4); *(.text) /* remaining code */ *(.text.*) /* remaining code */ *(.rodata) /* read-only data (constants) */ *(.rodata*) *(.glue_7) *(.glue_7t) *(.gnu.linkonce.t*) /* section information for finsh shell */ . = ALIGN(4); __fsymtab_start = .; KEEP(*(FSymTab)) __fsymtab_end = .; . = ALIGN(4); __vsymtab_start = .; KEEP(*(VSymTab)) __vsymtab_end = .; /* section information for initial. */ . = ALIGN(4); __rt_init_start = .; KEEP(*(SORT(.rti_fn*))) __rt_init_end = .; . = ALIGN(4); PROVIDE(__ctors_start__ = .); KEEP (*(SORT(.init_array.*))) KEEP (*(.init_array)) PROVIDE(__ctors_end__ = .); . = ALIGN(4); _etext = .; } > ROM = 0 /* .ARM.exidx is sorted, so has to go in its own output section. */ __exidx_start = .; .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) /* This is used by the startup in order to initialize the .data secion */ _sidata = .; } > ROM __exidx_end = .; /* sram section */ .sram (NOLOAD): { . = ALIGN(4); _ssram = .; *(.sram) . = ALIGN(4); _esram = .; } > SRAM /* .data section which is used for initialized data */ .data : AT (_sidata) { . = ALIGN(4); /* This is used by the startup in order to initialize the .data secion */ _sdata = . ; *(.data) *(.data.*) *(.gnu.linkonce.d*) PROVIDE(__dtors_start__ = .); KEEP(*(SORT(.dtors.*))) KEEP(*(.dtors)) PROVIDE(__dtors_end__ = .); . = ALIGN(4); /* This is used by the startup in order to initialize the .data secion */ _edata = . ; } >RAM .stack : { . = ALIGN(4); _sstack = .; . = . + _system_stack_size; . = ALIGN(4); _estack = .; } >RAM __bss_start = .; .bss : { . = ALIGN(4); /* This is used by the startup in order to initialize the .bss secion */ _sbss = .; *(.bss) *(.bss.*) *(COMMON) . = ALIGN(4); /* This is used by the startup in order to initialize the .bss secion */ _ebss = . ; *(.bss.init) } > RAM __bss_end = .; _end = .; /* Stabs debugging sections. */ .stab 0 : { *(.stab) } .stabstr 0 : { *(.stabstr) } .stab.excl 0 : { *(.stab.excl) } .stab.exclstr 0 : { *(.stab.exclstr) } .stab.index 0 : { *(.stab.index) } .stab.indexstr 0 : { *(.stab.indexstr) } .comment 0 : { *(.comment) } /* DWARF debug sections. * Symbols in the DWARF debugging sections are relative to the beginning * of the section so we begin them at 0. */ /* DWARF 1 */ .debug 0 : { *(.debug) } .line 0 : { *(.line) } /* GNU DWARF 1 extensions */ .debug_srcinfo 0 : { *(.debug_srcinfo) } .debug_sfnames 0 : { *(.debug_sfnames) } /* DWARF 1.1 and DWARF 2 */ .debug_aranges 0 : { *(.debug_aranges) } .debug_pubnames 0 : { *(.debug_pubnames) } /* DWARF 2 */ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } .debug_abbrev 0 : { *(.debug_abbrev) } .debug_line 0 : { *(.debug_line) } .debug_frame 0 : { *(.debug_frame) } .debug_str 0 : { *(.debug_str) } .debug_loc 0 : { *(.debug_loc) } .debug_macinfo 0 : { *(.debug_macinfo) } /* SGI/MIPS DWARF 2 extensions */ .debug_weaknames 0 : { *(.debug_weaknames) } .debug_funcnames 0 : { *(.debug_funcnames) } .debug_typenames 0 : { *(.debug_typenames) } .debug_varnames 0 : { *(.debug_varnames) } } ``` 可以看出 增加了 SRAM;但是两种方式 编译出来的 **rtthread.bin**文件大小却差异很大。 我看MDK 中 把这个buffer 放在了 .data段;而scons 却放在了 .bss段。各位大神有用过的么 请指点一下。
查看更多
1
个回答
默认排序
按发布时间排序
李肯陪你玩赚嵌入式
认证专家
2021-10-25
2022年度和2023年度RT-Thread社区优秀开源布道师,COC深圳城市开发者社区主理人,专注于嵌入式物联网的架构设计
![image.png](https://oss-club.rt-thread.org/uploads/20211025/60d56bd869ffdca6097b05f9881baa38.png) 这里是不是搞反了?
撰写答案
登录
注册新账号
关注者
1
被浏览
1.2k
关于作者
zhujie
这家伙很懒,什么也没写!
提问
28
回答
14
被采纳
2
关注TA
发私信
相关问题
1
程序分散加载到外部QSPI FLASH 启动问题
2
studio的链接脚本使用问题。跳转过后程序不执行。
3
link.lds每次修改后,编译会忽略修改
4
RTT-stdio 设置flash地址
5
ethernet 和 use memory layout冲突
6
studio创建的工程为什么链接脚本里ROM和RAM都比MCU本身的小
7
请问如何修改IAR的工程的linker的路径?
8
程序分散加载,使用 use mcroslib 程序无法启动
9
OTA升级链接脚本的修改
10
rthread studio怎么修改link.lds文件来支持外部sram
推荐文章
1
RT-Thread应用项目汇总
2
玩转RT-Thread系列教程
3
国产MCU移植系列教程汇总,欢迎查看!
4
机器人操作系统 (ROS2) 和 RT-Thread 通信
5
五分钟玩转RT-Thread新社区
6
【技术三千问】之《玩转ART-Pi》,看这篇就够了!干货汇总
7
关于STM32H7开发板上使用SDIO接口驱动SD卡挂载文件系统的问题总结
8
STM32的“GPU”——DMA2D实例详解
9
RT-Thread隐藏的宝藏之completion
10
【ART-PI】RT-Thread 开启RTC 与 Alarm组件
最新文章
1
【RT-Thread】【ci】【scons】将ci.attachconfig.yml和scons结合使用
2
Rt-thread中OTA下载后,bootloader不搬程序
3
ulog 日志 LOG_HEX 输出时间改为本地日期时间
4
在RT-Thread Studio中构建前执行python命令
5
研究一了一段时间RTT,直接标准版上手太难,想用nano,但又舍不得组件
热门标签
RT-Thread Studio
串口
Env
LWIP
SPI
AT
Bootloader
Hardfault
CAN总线
FinSH
ART-Pi
USB
DMA
文件系统
RT-Thread
SCons
RT-Thread Nano
线程
MQTT
STM32
RTC
FAL
rt-smart
I2C_IIC
ESP8266
UART
WIZnet_W5500
ota在线升级
cubemx
PWM
flash
freemodbus
BSP
packages_软件包
潘多拉开发板_Pandora
定时器
ADC
flashDB
GD32
socket
编译报错
中断
Debug
rt_mq_消息队列_msg_queue
SFUD
msh
keil_MDK
ulog
C++_cpp
MicroPython
本月问答贡献
出出啊
1518
个答案
343
次被采纳
小小李sunny
1444
个答案
290
次被采纳
张世争
813
个答案
177
次被采纳
crystal266
547
个答案
161
次被采纳
whj467467222
1222
个答案
149
次被采纳
本月文章贡献
出出啊
1
篇文章
5
次点赞
小小李sunny
1
篇文章
1
次点赞
张世争
1
篇文章
3
次点赞
crystal266
2
篇文章
2
次点赞
whj467467222
2
篇文章
2
次点赞
回到
顶部
发布
问题
分享
好友
手机
浏览
扫码手机浏览
投诉
建议
回到
底部