英文:
STM32 CubeIDE Place a static library in specified memory region and mapped to the absolute memory address
问题
我有一个STM32 CubeIDE项目。
我想将一个静态库放置在内部闪存的绝对内存地址的上部,而应用程序代码将放置在闪存的开头。
但库的内容分配在与应用程序代码相同的文本区域下。
我在链接器脚本中这样做:
MEMORY
{
ROM (rx) : ORIGIN = 0x08000000, LENGTH = 244K
LIB_region (rx) : ORIGIN = 0x0803D000, LENGTH = 4K
RAM1 (xrw) : ORIGIN = 0x20000000, LENGTH = 32K
RAM2 (xrw) : ORIGIN = 0x20009000, LENGTH = 28K
}
...
my_lib_section :
{
*(libTestLib.a)
} > LIB_region
英文:
I have an STM32 CubeIDE project.
I want to place a static library in an absolute memory address in the upper part of the internal flash while the application code will be placed at the beginning of the flash.
But the content of the library is allocated under the text region with the application code
I did this in the linker script:
MEMORY
{
ROM (rx) : ORIGIN = 0x08000000, LENGTH = 244K
LIB_region (rx) : ORIGIN = 0x0803D000, LENGTH = 4K
RAM1 (xrw) : ORIGIN = 0x20000000, LENGTH = 32K
RAM2 (xrw) : ORIGIN = 0x20009000, LENGTH = 28K
}
...
my_lib_section :
{
*(libTestLib.a)
} > LIB_region
答案1
得分: 1
你可以使用以下语法来包含文件的所有部分:
my_lib_section :
{
libTestLib.a
} > LIB_region
请参阅GNU链接器命令语言手册的section placement部分:
filename
您可以简单地指定要放置在当前输出部分的特定输入文件;来自该文件的所有部分都将放置在当前部分定义中。
如果您只想要从库中的 .text 部分,可以使用以下方式:
my_lib_section :
{
libTestLib.a (*.text)
} > LIB_region
英文:
You should be able to include all the sections of a file using the following syntax:
my_lib_section :
{
libTestLib.a
} > LIB_region
See the section placement section of the GNU linker command language manual:
> filename
>
>You may simply name a particular input file to be placed in the current output section; all sections from that file are placed in the current section definition.
If you just wanted the .text section from the library, this should work:
my_lib_section :
{
libTestLib.a (*.text)
} > LIB_region
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论