首页 > 解决方案 > 我无法从链接描述文件的 .text 部分中排除文件

问题描述

  .text :
  {
    . = ALIGN(4);
    *(EXCLUDE_FILE(*blink.c.obj) .text .text*) /* Exclude blink from this section */
    *(.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


  _load_flash_start = _etext; /* define a global symbol that starts at LOAD_FLASH */
  .fast_code_section:
  {
    /*. = ALIGN(4);*/
    . = _etext;
    _fast_code_start = .;                   /* define a global symbol at start of FAST_RAM */
    *(.fast_code_section*)
    *blink.c.obj (.text .text*)
    _fast_code_end = .;                     /* define a global symbol at end of FAST_RAM */
  } >FAST_RAM AT> LOAD_FLASH

我想通过在链接描述文件中使用 EXCLUDE_FILE 来排除要分配到 .text 部分(FLASH)的文件 blink.c。我想要另一个部分(.fast_code_section)中的blink.c文件。

当我查看 .map 文件时,我可以看到 blink.c 中的所有函数仍分配给 .text 部分。

我正在使用 gcc,目标平台是 stm32

标签: cgccstm32linker-scripts

解决方案


推荐阅读