簡體   English   中英

如何將GNU鏈接器腳本ld轉換為分散文件(ARM)

[英]How to convert a GNU linker Script ld to Scatter File (ARM)

我想從GCC遷移到新的ARM COMPILER6。但是我無法很好地將Gnu liker腳本(ld)轉換為等效的ARM Scatter文件。

原始代碼如下:

arm-none-eabi-ld -T link.ld test.o shared/bootcode.o shared/vertors.o -o test.elf

其中link.ld腳本如下

ENTRY(bootcode)
SECTIONS
{
    . = 0x00000000;

    /* Code starts with vectors, then bootcode, then other code */
    .text :
    {
        *vectors.o(vectors)
        *bootcode.o(boot)
        *(.text) /* remainder of code */
    } =0

    .data : { *(.data) }
    .bss  : { *(.bss)  }

   /* Notes section
    * This is not used so we discard it. Although not used it needs to be
    * explicitly mentioned in the linker script as some toolchains will place
    * the notes section at adderss 0 if it is not explicitly mentioned*/
    /DISCARD/ : { *(.note*) }
    }

我想使用armlink作為鏈接器:

armlink --cpu=8-A.32 --entry=bootcode test.o shared/bootcode.o shared/vertors.o -o test.elf --scatter=ld.scat

但是我沒有成功創建有效的分散文件。 我嘗試使用armlink選項(--first,-last,-ro_base,-rw_base),但未按預期進行(我獲得了成功的編譯,但測試無法正常進行)。

有什么想法嗎?

我在這里查看了文檔: http : //infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0803d/pge1362065973150.html

您要遷移的GNU Linker腳本可以重寫為:

LOAD_ROM 0x0000              
{
    EXEC_ROM_1 0x0000   ; Name of first exec region (EXEC_ROM_1),
                        ; Start address for exec region (0x0000)
    {
        vectors.o(VECTORS)
        * (InRoot$$Sections)  ; All library sections that must be in a
                              ; root region, for example, __main.o,
                              ; __scatter*.o, __dc*.o, and * Region$$Table

    }
    EXEC_ROM_2 +0    ; Name of second exec region (EXEC_ROM_2)
    {
        bootcode.o(BOOT, +FIRST)
        * (+RO)
    }
    SRAM +0      ; Name of third exec region (SRAM)
    {
        * (+RW, +ZI)         ; Place all RW and ZI data into
                             ; this exec region
    }
}

為了指定映像的入口點,可以使用命令行選項--entry=bootcode就像在命令行中已經指定的那樣。

armlink --cpu=8-A.32 --entry=bootcode test.o shared/bootcode.o shared/vertors.o -o test.elf --scatter=ld.scat

armlink允許讀取GNU LD鏈接程序腳本,但是有限制。 標志是“ --linker_script = ld_script”。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM