找回密码
 立即注册

微信扫码登录

查看: 530|回复: 1

[BLE SDK] 怎么把 boot_general.link 改成 Memory Section 形式?

[复制链接]

9

主题

12

回帖

146

积分

荣耀黄金

积分
146
发表于 2026-5-29 15:34:27 | 显示全部楼层 |阅读模式 来自 广东深圳
Information
说明:   建议参照本版块置顶帖内容输入必要信息
芯片型号: TL321X
SDK及版本: tl_ble_sdk V4.0.4.4
怎么把 boot_general.link 改成 Memory Section 形式?

MEMORY {  
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 512K  /* 定义Flash区域 */  
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 128K  /* 定义RAM区域 */
}

0

主题

2

回帖

32

积分

英勇黄铜

积分
32
发表于 2026-8-7 11:44:06 | 显示全部楼层 来自 上海
本帖最后由 TL_CJY 于 2026-8-7 11:46 编辑



ENTRY(_RESET_ENTRY)

MEMORY
{
    FLASH (rx) : ORIGIN = 0x20000000, LENGTH = 0x100000              /* Flash, unified addressing, XIP code */
    ILM   (rx) : ORIGIN = 0x00068000, LENGTH = 0x18000               /* IRAM: retention/ram_code/iram (96KB) */
    DLM   (rw) : ORIGIN = 0x00080000, LENGTH = 0x8000                /* DRAM: data/bss/heap (32KB) */
}

SECTIONS
{
    NDS_SAG_LMA_FLASH = ORIGIN(FLASH) ;
    . = ORIGIN(FLASH);
    PROVIDE (BIN_BEGIN = .);
    .vectors        : { KEEP(*(.vectors )) }                                   > FLASH
    .flash_code     : { KEEP(*(.flash_code )) }                                > FLASH
    . = 0x00068000;
    .retention_reset    : AT( ALIGN(LOADADDR (.flash_code) + SIZEOF (.flash_code),8))
        { KEEP(*(.retention_reset )) }                                         > ILM
    PROVIDE (_RETENTION_RESET_VMA_START = ADDR(.retention_reset));
    PROVIDE (_RETENTION_RESET_LMA_START = LOADADDR(.retention_reset));
    PROVIDE (_RETENTION_RESET_VMA_END = .);

    . = ALIGN(8);
    .retention_data : AT( ALIGN(LOADADDR (.retention_reset) + SIZEOF (.retention_reset),8))
        { KEEP(*(.retention_data )) }                                          > ILM
    PROVIDE (_RETENTION_DATA_VMA_START = ADDR(.retention_data));
    PROVIDE (_RETENTION_DATA_LMA_START = LOADADDR(.retention_data));
    PROVIDE (_RETENTION_DATA_VMA_END = .);

    . = ALIGN(8);
    .ram_code   : AT( ALIGN(LOADADDR (.retention_data) + SIZEOF (.retention_data),8))
        { KEEP(*(.ram_code )) KEEP(*libgcc.a:save-restore.o) KEEP(*(.exec.itable)) } > ILM
    PROVIDE (_RAMCODE_VMA_END = .);
    PROVIDE (_RAMCODE_VMA_START = ADDR(.ram_code));
    PROVIDE (_RAMCODE_LMA_START = LOADADDR(.ram_code));
    PROVIDE (_RAMCODE_SIZE = SIZEOF (.ram_code));

    /*******************************************/
    . = ALIGN(8);
    .iram_noinit_data (NOLOAD):{ KEEP(*(.iram_noinit_data )) }                 > ILM

    . = ALIGN(8);
    PROVIDE (_IRAM_BSS_VMA_START = .);
    .iram_bss (NOLOAD): { KEEP(*(.iram_bss )) }                                > ILM
    PROVIDE (_IRAM_BSS_VMA_END = .);
    /*******************************************/

    . = ALIGN(LOADADDR (.ram_code) + SIZEOF (.ram_code), 8);
    .text           : AT(ALIGN(LOADADDR (.ram_code) + SIZEOF (.ram_code), 8))
        { *(.text .stub .text.* .gnu.linkonce.t.* ) KEEP(*(.text.*personality* )) *(.gnu.warning )  } > FLASH
    .rodata         : AT(ALIGN(LOADADDR (.text) + SIZEOF (.text), ALIGNOF(.rodata)))
        { *(.rodata .rodata.* .gnu.linkonce.r.* )}                              > FLASH
    .eh_frame_hdr   : AT(ALIGN(LOADADDR (.rodata) + SIZEOF (.rodata), ALIGNOF(.eh_frame_hdr)))
        { *(.eh_frame_hdr ) }                                                  > FLASH
    . = ALIGN(0x20);
    .eh_frame   : AT(ALIGN(LOADADDR (.eh_frame_hdr) + SIZEOF (.eh_frame_hdr), 32))
        { KEEP(*(.eh_frame )) }                                                > FLASH
    . = 0x00080000;

    PROVIDE( __global_pointer$ = . + (4K / 2) );
    .rf_certification_cfg : AT(ALIGN(LOADADDR(.eh_frame) + SIZEOF(.eh_frame), ALIGNOF(.rf_certification_cfg)))
        { KEEP(*(.rf_certification_cfg)) }                                     > DLM
    PROVIDE (_RF_CERTIFICATION_CFG_ADDR_OFFSET = LOADADDR(.rf_certification_cfg) - BIN_BEGIN);

    . = ALIGN(8);
    .data   : AT(ALIGN(LOADADDR (.rf_certification_cfg) + SIZEOF (.rf_certification_cfg),  ALIGNOF(.data)))
        { *(.data .data.* .gnu.linkonce.d.* ) KEEP(*(.gnu.linkonce.d.*personality* )) SORT(CONSTRUCTORS)
          *(.srodata.cst16 ) *(.srodata.cst8 ) *(.srodata.cst4 ) *(.srodata.cst2 ) *(.srodata .srodata.* ) *(.sdata .sdata.* .gnu.linkonce.s.* ) *(.sdata2 .sdata2.* .gnu.linkonce.s.* )
        }                                                                      > DLM
    PROVIDE (_DATA_VMA_END = .);
    PROVIDE (_DATA_VMA_START = ADDR(.data));
    PROVIDE (_DATA_LMA_START = LOADADDR(.data));

    . = ALIGN(8);
    PROVIDE (_BSS_VMA_START = .);
    .sbss   (NOLOAD)    : { *(.dynsbss ) *(.sbss .sbss.* .gnu.linkonce.sb.* ) *(.scommon .scommon.* ) } > DLM
    .bss    (NOLOAD)    : { *(.dynbss ) *(.bss .bss.* .gnu.linkonce.b.* ) *(COMMON ) . = ALIGN(8); } > DLM
    /* When using the S file _FILL_STK function (which clears all the values in the stack space to 0x55),
     * if _BSS_VMA_END does not have four-byte alignment, there may be an out-of-bounds access beyond _STACK_TOP,
     * resulting in a store access fault.
     */
    PROVIDE (_BSS_VMA_END = ((. + 3) / 4)*4);

    .sdk_version    : AT(LOADADDR (.data) + SIZEOF (.data))
        { KEEP(*(.sdk_version )) }                                             > DLM

    PROVIDE (BIN_SIZE = LOADADDR(.sdk_version) + SIZEOF(.sdk_version) - BIN_BEGIN);

    . = ALIGN(8);
    /* end is the starting address of the heap, the heap grows upward */
    _end = .;
    PROVIDE (end = .);
    PROVIDE (_STACK_TOP = ORIGIN(DLM) + LENGTH(DLM));
    PROVIDE (FLASH_SIZE = LENGTH(FLASH));
}

ASSERT((BIN_SIZE)<= FLASH_SIZE, "BIN FILE OVERFLOW");


/********************************************************************/
你好,同学,以上是 AI 生成的,没有经过测试,不一定对哦,仅供你参考。
如果有什么问题,可以再交流。
/********************************************************************/
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Telink forum ( 沪ICP备17008231号-1 )

GMT+8, 2026-8-28 18:30 , Processed in 0.104965 second(s), 25 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表