如何修改链接器脚本以将代码放入有间隙的闪存中?

问题描述

我正在使用 ARM 微控制器并使用 GCC 进行编译。我想将某些(const)变量和函数放在闪存中的特定地址,我成功地做到了这一点。但是,我不知道如何将剩余的代码放在flash中的剩余区域。我尝试了以下方法,但无济于事:

FLASH                 (rx): ORIGIN=0x801852C,LENGTH=1000   /* 1st part of the code should go here */
MY_CONST_VARIABLE     (rx): ORIGIN=0x8018914,LENGTH=4
THE_REST_OF_THE_FLASH (rx): ORIGIN=0x8018918,LENGTH=457484 /* The rest of the code should go here */

  .text :
  {
    . = ALIGN(4);
    *(.text)           /* .text sections (code) */
    *(.text*)          /* .text* sections (code) */
    *(.glue_7)         /* glue arm to thumb code */
    *(.glue_7t)        /* glue thumb to arm code */
    *(.eh_frame)

    KEEP (*(.init))
    KEEP (*(.fini))

    . = ALIGN(4);
    _etext = .;        /* define a global symbols at end of code */
  } >FLASH >THE_REST_OF_THE_FLASH

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)