开源改变世界

部分.rodata’ will not fit in region ROM’ #177

推推 grbl 2年前 (2023-02-06) 290次浏览
关闭
SergeySn 打开了这个问题 2020 年 1 月 21 日 · 8条评论
关闭

部分.rodata' will not fit in region ROM’#177

SergeySn 打开了这个问题 2020 年 1 月 21 日 · 8条评论

评论

部分.rodata' will not fit in region ROM' #177

我正在尝试调试 BigTreeTech SKR Mini E3 板上的代码。当我单击构建按钮时 – 它编译正常。当我单击“平台 IO:上传”按钮时,它会通过 STLINK 进行编译和上传。但是当我点击“开始调试”菜单时,它给了我一个错误:

执行任务:platformio debug
Processing STM32F103RC_bigtree_NOUSB(平台:ststm32;框架:arduino;板:genericSTM32F103RC)
详细模式可以通过-v, --verbose选项
配置启用:https
://docs.platformio.org/page/boards/ststm32/genericSTM32F103RC.html 平台: ST STM32 6.0.0 > STM32F103RC(48k RAM。256k 闪存)
硬件:STM32F103RCT6 72MHz,48KB RAM,256KB 闪存
调试:当前(stlink)外部(blackmagic,jlink,stlink)
软件包:framework-arduinoststm32-maple 1.10000.190819(1.0 .0)、toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)、tool-stm32duino 1.0.1
转换 Marlin.ino
LDF:库依赖查找器 -> http://bit.ly/configure-pio-ldf
LDF 模式:Finder ~ chain,Compatibility ~ soft … 在
调试
模式下
构建.pio/build/STM32F103RC_bigtree_NOUSB/FrameworkArduinoVariant/wirish/boards_setup.cpp.o … 编译.pio/build/STM32F103RC_bigtree_NOUSB/lib479/EEPROM/EEPROM.cpp.o 编译.pio/build/STM32F103RC_bigtree_NOUSB/lib2.flash/EEEP co 归档 .pio/build/STM32F103RC_bigtree_NOUSB/lib479/libEEPROM.a 索引 .pio/build/STM32F103RC_bigtree_NOUSB/lib479/libEEPROM.a 链接 .pio/build/STM32F103RC_bigtree_NOUSB/firmware.elf

/home/serg/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi /bin/ld: .pio/build/STM32F103RC_bigtree_NOUSB/firmware.elf section .rodata' will not fit in region rom’
/home/serg/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1 /../../../../arm-none-eabi/bin/ld: region `rom’ 溢出 12244 字节
collect2: error: ld returned 1 exit status
[.pio/build/STM32F103RC_bigtree_NOUSB/firmware.精灵]错误1

可能出了什么问题?

部分.rodata' will not fit in region ROM' #177

更改您的默认环境。在 platformio.ini 中改为“STM32F103RC_bigtree_512K_NOUSB”而不是 256k。它告诉您启用的东西太多,代码不适合。它与 STlink 一起工作,因为它在没有任何健全性检查的情况下进行原始数据上传

部分.rodata' will not fit in region ROM' #177

@brew99 非常感谢您提供的信息。虽然我的新板是STM32F103RCT6芯片的1.2版本,只有256k。
我还有以前版本的STM32F103RET6芯片的板子,有512k。所以,我试过了,但出现了这个错误:

DATA:    [===       ]  26.4% (used 12968 bytes from 49152 bytes)
PROGRAM: [=====     ]  46.9% (used 245724 bytes from 524288 bytes)
...
target halted due to debug-request, current mode: Handler HardFault
xPSR: 0x00000003 pc: 00000000 msp: 0x464c4544
Info : device id = 0x10036414
Info : flash size = 512kbytes
0x00000000 in ?? ()
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x00010100 msp: 0x464c457c
Loading section .text, size 0x3614c lma 0x8007000
Loading section .ARM.exidx, size 0x190 lma 0x803d150
Loading section .data, size 0x10b0 lma 0x803d2e0
Loading section .rodata, size 0x4c4c lma 0x803e390
Info : Padding image section 0 at 0x0803d14c with 4 bytes
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x00010100 msp: 0x464c457c
Start address 0x80073f8, load size 245720
Transfer rate: 19 KB/sec, 13651 bytes/write.
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x00010100 msp: 0x464c457c
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x00010100 msp: 0x464c457c
Temporary breakpoint 1 at 0x800ad62: file /home/serg/.platformio/packages/framework-arduinoststm32-maple/STM32F1/cores/maple/main.cpp, line 38.
PlatformIO: Initialization completed
PlatformIO: Resume the execution to `debug_init_break = tbreak main`
PlatformIO: More configuration options -> http://bit.ly/pio-debug
Note: automatically using hardware breakpoints for read-only addresses.

此外,即使选择了 STM32F103RC_bigtree_NOUSB 开发板,它也能正常编译,我可以通过 microSD 卡将它上传到开发板,而且它工作正常。编译器说代码是 245724 字节。(见上文)所以,代码小于 256k。

但是当我通过 STLINK 上传代码时 – 它停止工作了。我想知道 STLINK 是否覆盖了引导加载程序?
有人说我的STLINK起始地址不对。但是我该如何检查或修复它呢?

部分.rodata' will not fit in region ROM' #177

即使你的新 V1.2 板有 RCT6 标签,它仍然有 512k,所以你应该可以使用“STM32F103RC_bigtree_512K_NOUSB”。如果你有标记为 RET6 的芯片,那么你需要使用“STM32F103RE”环境。基本上实际芯片都是 512,但出于营销目的,RCT6 的市场价为 256。

我相信引导加载程序是 0x0 到 0x7000。因此,如果您通过 STLINK 加载固件,则起始地址需要为 0x7000,大小为 80000。您应该始终通过 STLINK 读取(从 0x000 开始,以便也捕获引导加载程序),然后保存文件,然后再开始更改或加载新文件。

部分.rodata' will not fit in region ROM' #177

@brew99非常感谢您的明确解释。现在我知道如何解决尺寸问题了。我删除了一些未使用的代码,因此它适合两种配置。现在它可以在调试模式下完美编译。
但是当我单击调试按钮时 – 它会转到 Start.S 文件第 51 行:

ldr r1,=__msp_init

在那里显示当前执行点一秒钟,然后退出调试器。
在调试控制台中,它显示以下内容:

Reading symbols from /a/proj/VSCode/BIGTREETECH-SKR-mini-E3-/firmware/V1.2/Marlin-2.0.x-SKR-Mini-E3-V1.2/.pio/build/STM32F103RC_bigtree_NOUSB/firmware.elf...
done.
PlatformIO Unified Debugger -> http://bit.ly/pio-debug
PlatformIO: debug_tool = stlink
PlatformIO: Initializing remote target...
xPack OpenOCD, 64-bit Open On-Chip Debugger 0.10.0+dev (2019-07-17-11:25)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
hla_swd
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : tcl server disabled
Info : telnet server disabled
Info : clock speed 1000 kHz
Info : STLINK V2J32M22 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.254104
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : accepting 'gdb' connection from pipe
target halted due to debug-request, current mode: Handler HardFault
xPSR: 0x00000003 pc: 00000000 msp: 0x464c454c
Info : device id = 0x10036414
Info : flash size = 256kbytes
0x00000000 in ?? ()
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x00010100 msp: 0x464c457c
Loading section .text, size 0x18a24 lma 0x8007000
Loading section .ARM.exidx, size 0x8 lma 0x801fa28
Loading section .data, size 0x1058 lma 0x801fa30
Loading section .rodata, size 0x176c lma 0x8020a88
Info : Padding image section 0 at 0x0801fa24 with 4 bytes
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x00010100 msp: 0x464c457c
Start address 0x80073f8, load size 111088
Transfer rate: 18 KB/sec, 11108 bytes/write.
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x00010100 msp: 0x464c457c
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x00010100 msp: 0x464c457c
Temporary breakpoint 1 at 0x800ab16: file /home/serg/.platformio/packages/framework-arduinoststm32-maple/STM32F1/cores/maple/main.cpp, line 38.
PlatformIO: Initialization completed
PlatformIO: Resume the execution to `debug_init_break = tbreak main`
PlatformIO: More configuration options -> http://bit.ly/pio-debug
Note: automatically using hardware breakpoints for read-only addresses.

可能出了什么问题?
另外,如何将起始地址更改为 0x7000 ?(或确保它已经存在)

部分.rodata' will not fit in region ROM' #177

除了编译 Marlin,然后放在 SD 卡上,我没有使用过 VSC/platformio。我不将它与 STLINK 硬件一起使用。

我使用 STlink 硬件通过此处找到的 STM ST-link 实用程序进行读/写:
实用程序

如果你只想要没有引导加载程序的固件,那就是你放置起始地址 0x7000 的地方,否则如果你想要它,那么从 0x0000 开始。0x80000 应该是 32 个数据位的大小。

它建议阅读,然后保存一个默认文件,然后再开始弄乱它并编写新的固件/引导加载程序

部分.rodata' will not fit in region ROM' #177

啊,我明白了。谢谢。
顺便说一句,如果你不使用 Platformio 和 STLINK,你如何调试它?

部分.rodata' will not fit in region ROM' #177
brew99 评论了 2020 年 1 月 25 日  

您是在谈论调试 marlin 代码吗?如果是这样,我不调试它,只是更改/启用一些东西或参数,然后在 VSC/Platformio 中编译/构建。

我使用 STlink 的唯一目的是读取我的 V1.0 板,然后更改地址以使其达到 512k(它在引导加载程序中被硬锁定为 256k,因为它是 V1 的第一批生产运行之一.0 板)。我还尝试在其上加载 v1.2 引导加载程序,这也有效。

部分.rodata' will not fit in region ROM' #177

知道了。谢谢!