diff --git a/armsrc/ldscript b/armsrc/ldscript deleted file mode 100644 index 0824205a2..000000000 --- a/armsrc/ldscript +++ /dev/null @@ -1,64 +0,0 @@ -/* ------------------------------------------------------------------------------ - This code is licensed to you under the terms of the GNU GPL, version 2 or, - at your option, any later version. See the LICENSE.txt file for the text of - the license. ------------------------------------------------------------------------------ - Linker script for the ARM binary ------------------------------------------------------------------------------ -*/ -INCLUDE ../common_arm/ldscript.common - -PHDRS -{ - text PT_LOAD FLAGS(5); - data PT_LOAD; - bss PT_LOAD; -} - -ENTRY(Vector) -SECTIONS -{ - .start : { - *(.startos) - } >osimage :text - - .text : { - *(.text) - *(.text.*) - *(.eh_frame) - *(.glue_7) - *(.glue_7t) - } >osimage :text - - .rodata : { - *(.rodata) - *(.rodata.*) - *(fpga_all_bit.data) - . = ALIGN(8); - } >osimage :text - - .data : { - *(.data) - *(.data.*) - *(.ramfunc) - . = ALIGN(4); - } >ram AT>osimage :data - - __data_src_start__ = LOADADDR(.data); - __data_start__ = ADDR(.data); - __data_end__ = __data_start__ + SIZEOF(.data); - __os_size__ = SIZEOF(.text) + SIZEOF(.data) + SIZEOF(.rodata); - - .bss : { - __bss_start__ = .; - *(.bss) - *(.bss.*) - . = ALIGN(4); - __bss_end__ = .; - } >ram AT>ram :bss - - .commonarea (NOLOAD) : { - *(.commonarea) - } >commonarea :NONE -} diff --git a/armsrc/ldscript.osimage.at32 b/armsrc/ldscript.osimage.at32 new file mode 100644 index 000000000..02eb6eb84 --- /dev/null +++ b/armsrc/ldscript.osimage.at32 @@ -0,0 +1,29 @@ +/* +----------------------------------------------------------------------------- + This code is licensed to you under the terms of the GNU GPL, version 2 or, + at your option, any later version. See the LICENSE.txt file for the text of + the license. +----------------------------------------------------------------------------- + Linker script for the ARM binary +----------------------------------------------------------------------------- +*/ + +INCLUDE ../common_arm/ldscript.defs.at32 +INCLUDE ../common_arm/ldscript.common + +INCLUDE ./ldscript.osimage.phdrs + +ENTRY(Reset_Handler) + +SECTIONS +{ + /* The startup code goes first into FLASH, AT32 is startup from 'startup_at32f435_437.s' */ + .isr_vector : + { + . = ALIGN(4); + KEEP(*(.isr_vector)) /* Startup code */ + . = ALIGN(4); + } >osimage :text +} + +INCLUDE ./ldscript.osimage.sections diff --git a/armsrc/ldscript.osimage.at91 b/armsrc/ldscript.osimage.at91 new file mode 100644 index 000000000..c492526cd --- /dev/null +++ b/armsrc/ldscript.osimage.at91 @@ -0,0 +1,18 @@ +/* +----------------------------------------------------------------------------- + This code is licensed to you under the terms of the GNU GPL, version 2 or, + at your option, any later version. See the LICENSE.txt file for the text of + the license. +----------------------------------------------------------------------------- + Linker script for the ARM binary +----------------------------------------------------------------------------- +*/ + +INCLUDE ../common_arm/ldscript.defs.at91 +INCLUDE ../common_arm/ldscript.common + +INCLUDE ./ldscript.osimage.phdrs + +ENTRY(Vector) + +INCLUDE ./ldscript.osimage.sections diff --git a/armsrc/ldscript.osimage.phdrs b/armsrc/ldscript.osimage.phdrs new file mode 100644 index 000000000..8b212ebe0 --- /dev/null +++ b/armsrc/ldscript.osimage.phdrs @@ -0,0 +1,6 @@ +PHDRS +{ + text PT_LOAD FLAGS(5); + data PT_LOAD; + bss PT_LOAD; +} \ No newline at end of file diff --git a/armsrc/ldscript.osimage.sections b/armsrc/ldscript.osimage.sections new file mode 100644 index 000000000..bcfc8f362 --- /dev/null +++ b/armsrc/ldscript.osimage.sections @@ -0,0 +1,65 @@ +/*----------------------------------------------------------------------------- + * Copyright (C) Proxmark3 contributors. See AUTHORS.md for details. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * See LICENSE.txt for the text of the license. + *----------------------------------------------------------------------------- + *----------------------------------------------------------------------------- + * Common linker script, for os image for sections. + *----------------------------------------------------------------------------- + */ + +SECTIONS +{ + .start : { + *(.startos) + } >osimage :text + + .text : { + *(.text) + *(.text.*) + *(.eh_frame) + *(.glue_7) + *(.glue_7t) + } >osimage :text + + .rodata : { + *(.rodata) + *(.rodata.*) + *(fpga_all_bit.data) + . = ALIGN(8); + } >osimage :text + + .data : { + *(.data) + *(.data.*) + *(.ramfunc) + . = ALIGN(4); + } >ram AT>osimage :data + + __data_src_start__ = LOADADDR(.data); + __data_start__ = ADDR(.data); + __data_end__ = __data_start__ + SIZEOF(.data); + __os_size__ = SIZEOF(.text) + SIZEOF(.data) + SIZEOF(.rodata); + + .bss : { + __bss_start__ = .; + *(.bss) + *(.bss.*) + . = ALIGN(4); + __bss_end__ = .; + } >ram AT>ram :bss + + .commonarea (NOLOAD) : { + *(.commonarea) + } >commonarea :NONE +}