board/arm/qemu: Adjust the address mapping in the LD script

Summary:
1. The start location of FLASH reserves the extended bootloader
2. DTB data is reserved at the start location of RAM

Signed-off-by: wangming9 <wangming9@xiaomi.com>
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
This commit is contained in:
wangming9 2024-01-05 21:28:35 +08:00 committed by Xiang Xiao
parent 080c22e944
commit 1f0cc62a8d
4 changed files with 85 additions and 76 deletions

View File

@ -40,9 +40,9 @@ CONFIG_DEV_ZERO=y
CONFIG_ELF=y
CONFIG_EXAMPLES_HELLO=m
CONFIG_EXPERIMENTAL=y
CONFIG_FLASH_SIZE=134217728
CONFIG_FLASH_START=0
CONFIG_FLASH_VSTART=0
CONFIG_FLASH_SIZE=127926272
CONFIG_FLASH_START=0x00600000
CONFIG_FLASH_VSTART=0x00600000
CONFIG_FS_HOSTFS=y
CONFIG_FS_PROCFS=y
CONFIG_HAVE_CXX=y
@ -67,9 +67,9 @@ CONFIG_NSH_READLINE=y
CONFIG_ONESHOT=y
CONFIG_PATH_INITIAL="/system/bin"
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=536870912
CONFIG_RAM_START=0x40000000
CONFIG_RAM_VSTART=0x40000000
CONFIG_RAM_SIZE=132120576
CONFIG_RAM_START=0x40200000
CONFIG_RAM_VSTART=0x40200000
CONFIG_RAW_BINARY=y
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RR_INTERVAL=200

View File

@ -27,9 +27,9 @@ CONFIG_DEFAULT_TASK_STACKSIZE=4096
CONFIG_DEV_ZERO=y
CONFIG_EXAMPLES_HELLO=y
CONFIG_EXPERIMENTAL=y
CONFIG_FLASH_SIZE=134217728
CONFIG_FLASH_START=0
CONFIG_FLASH_VSTART=0
CONFIG_FLASH_SIZE=127926272
CONFIG_FLASH_START=0x00600000
CONFIG_FLASH_VSTART=0x00600000
CONFIG_FS_PROCFS=y
CONFIG_FS_ROMFS=y
CONFIG_HAVE_CXX=y
@ -47,9 +47,9 @@ CONFIG_NSH_READLINE=y
CONFIG_ONESHOT=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAMLOG=y
CONFIG_RAM_SIZE=134217728
CONFIG_RAM_START=0x40000000
CONFIG_RAM_VSTART=0x40000000
CONFIG_RAM_SIZE=132120576
CONFIG_RAM_START=0x40200000
CONFIG_RAM_VSTART=0x40200000
CONFIG_RAW_BINARY=y
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RR_INTERVAL=200

View File

@ -24,9 +24,9 @@ CONFIG_DEFAULT_TASK_STACKSIZE=4096
CONFIG_DEV_ZERO=y
CONFIG_EXAMPLES_HELLO=y
CONFIG_EXPERIMENTAL=y
CONFIG_FLASH_SIZE=134217728
CONFIG_FLASH_START=0
CONFIG_FLASH_VSTART=0
CONFIG_FLASH_SIZE=127926272
CONFIG_FLASH_START=0x00600000
CONFIG_FLASH_VSTART=0x00600000
CONFIG_FS_PROCFS=y
CONFIG_FS_ROMFS=y
CONFIG_HAVE_CXX=y
@ -44,9 +44,9 @@ CONFIG_NSH_READLINE=y
CONFIG_ONESHOT=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAMLOG=y
CONFIG_RAM_SIZE=134217728
CONFIG_RAM_START=0x40000000
CONFIG_RAM_VSTART=0x40000000
CONFIG_RAM_SIZE=132120576
CONFIG_RAM_START=0x40200000
CONFIG_RAM_VSTART=0x40200000
CONFIG_RAW_BINARY=y
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RR_INTERVAL=200

View File

@ -17,15 +17,20 @@
* under the License.
*
****************************************************************************/
#include <nuttx/config.h>
OUTPUT_ARCH(arm)
ENTRY(__start)
PHDRS
MEMORY
{
text PT_LOAD ;
ROM (rx) : ORIGIN = CONFIG_FLASH_START, LENGTH = CONFIG_FLASH_SIZE
RAM (rwx): ORIGIN = CONFIG_RAM_START, LENGTH = CONFIG_RAM_SIZE
}
SECTIONS
{
. = 0x40101000;
/* where the global variable out-of-bounds detection information located */
@ -43,73 +48,77 @@ SECTIONS
#endif
.text : {
_stext = .; /* Text section */
*(.vectors)
*(.text)
*(.text.cold)
*(.text.unlikely)
*(.fixup)
*(.gnu.warning)
} :text
_stext = .; /* Text section */
__text_start = .;
*(.vectors)
*(.text*)
*(.fixup)
*(.gnu.warning)
} > ROM
. = ALIGN(4096);
.init_section : {
_sinit = ABSOLUTE(.);
KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
KEEP(*(.init_array EXCLUDE_FILE(*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o) .ctors))
_einit = ABSOLUTE(.);
} :text
. = ALIGN(4096);
_etext = .; /* End_1 of .text */
_sztext = _etext - _stext;
_sinit = ABSOLUTE(.);
KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
KEEP(*(.init_array EXCLUDE_FILE(*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o) .ctors))
_einit = ABSOLUTE(.);
. = ALIGN(4096);
_etext = .; /* End_1 of .text */
_sztext = _etext - _stext;
} > ROM
.ARM.extab :
{
*(.ARM.extab*)
} > ROM
/* .ARM.exidx is sorted, so has to go in its own output section. */
PROVIDE_HIDDEN (__exidx_start = .);
.ARM.exidx :
{
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
} > ROM
PROVIDE_HIDDEN (__exidx_end = .);
.rodata : {
_srodata = .; /* Read-only data */
*(.rodata)
*(.rodata.*)
*(.data.rel.ro)
*(.data.rel.ro.*)
} :text
. = ALIGN(4096);
_erodata = .; /* End of read-only data */
_szrodata = _erodata - _srodata;
_eronly = .; /* End of read-only data */
_srodata = .; /* Read-only data */
*(.rodata*)
*(.data.rel.ro*)
KEEP(*(SORT(.scattered_array*)));
. = ALIGN(4096);
_erodata = .;
} > ROM
_eronly = LOADADDR(.data);
.data : { /* Data */
_sdata = .;
*(.data.page_aligned)
*(.data)
. = ALIGN(8);
__start_impls = .;
*(.impls)
KEEP(*(.impls))
. = ALIGN(4);
__stop_impls = .;
*(.data.rel)
*(.data.rel.*)
CONSTRUCTORS
} :text
_edata = .; /* End+1 of .data */
_sdata = .;
*(.data*)
. = ALIGN(8);
_edata = .;
} > RAM AT > ROM
.noinit : {
_snoinit = ABSOLUTE(.);
*(.noinit*)
_enoinit = ABSOLUTE(.);
} > RAM
.bss : { /* BSS */
_sbss = .;
*(.bss)
. = ALIGN(1 << 3);
} :text
. = ALIGN(4096);
_ebss = .;
_szbss = _ebss - _sbss;
.initstack : { /* INIT STACK */
_s_initstack = .;
*(.initstack)
. = ALIGN(16);
} :text
. = ALIGN(4096);
_e_initstack = . ;
_szdata = _e_initstack - _sdata;
*(.bss*)
. = ALIGN(4096);
_ebss = .;
} > RAM
/* Sections to be discarded */
/DISCARD/ : {
*(.exit.text)
*(.exit.data)
*(.exitcall.exit)
*(.eh_frame)
}
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }