forked from apache/nuttx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
arm64/imx9: provide EL3 bootloader support for iMX9
This provides a capable bootloader that may be run from OCRAM. The OCRAM contains regions that are always zero, so the linker file avoids those with best effort. iMX9 infrastructure expects: - 0x20480000 (Start of OCRAM, AHAB) - 0x2049a000 (NuttX or SPL) - 0x204e0000 (ARM Trustzone, not used) When started from sd-card, the offsets are: - 0x1f000 with AHAB - 0xa000 without AHAB Signed-off-by: Eero Nurkkala <[email protected]>
- Loading branch information
Showing
6 changed files
with
300 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# | ||
# This file is autogenerated: PLEASE DO NOT EDIT IT. | ||
# | ||
# You can use "make menuconfig" to make any modifications to the installed .config file. | ||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your | ||
# modifications. | ||
# | ||
# CONFIG_STANDARD_SERIAL is not set | ||
CONFIG_ARCH="arm64" | ||
CONFIG_ARCH_ARM64=y | ||
CONFIG_ARCH_BOARD="imx93-evk" | ||
CONFIG_ARCH_BOARD_IMX93_EVK=y | ||
CONFIG_ARCH_BOOT_EL3=y | ||
CONFIG_ARCH_CHIP="imx9" | ||
CONFIG_ARCH_CHIP_IMX93=y | ||
CONFIG_ARCH_CHIP_IMX9=y | ||
CONFIG_ARCH_INTERRUPTSTACK=4096 | ||
CONFIG_ARM64_DCACHE_DISABLE=y | ||
CONFIG_ARM64_DECODEFIQ=y | ||
CONFIG_BUILTIN=y | ||
CONFIG_DEBUG_ASSERTIONS=y | ||
CONFIG_DEBUG_FEATURES=y | ||
CONFIG_DEBUG_FULLOPT=y | ||
CONFIG_DEBUG_SYMBOLS=y | ||
CONFIG_DEFAULT_TASK_STACKSIZE=8192 | ||
CONFIG_DEV_ZERO=y | ||
CONFIG_EXAMPLES_HELLO=y | ||
CONFIG_EXPERIMENTAL=y | ||
CONFIG_FS_PROCFS=y | ||
CONFIG_FS_ROMFS=y | ||
CONFIG_HAVE_CXX=y | ||
CONFIG_HAVE_CXXINITIALIZE=y | ||
CONFIG_IDLETHREAD_STACKSIZE=8192 | ||
CONFIG_IMX9_BOOTLOADER=y | ||
CONFIG_IMX9_GPIO_IRQ=y | ||
CONFIG_IMX9_LPUART1=y | ||
CONFIG_INIT_ENTRYPOINT="nsh_main" | ||
CONFIG_INTELHEX_BINARY=y | ||
CONFIG_LPUART1_SERIAL_CONSOLE=y | ||
CONFIG_MM_FILL_ALLOCATIONS=y | ||
CONFIG_NSH_ARCHINIT=y | ||
CONFIG_NSH_BUILTIN_APPS=y | ||
CONFIG_NSH_FILEIOSIZE=512 | ||
CONFIG_NSH_READLINE=y | ||
CONFIG_PREALLOC_TIMERS=4 | ||
CONFIG_RAMLOG=y | ||
CONFIG_RAM_SIZE=548864 | ||
CONFIG_RAM_START=0x2049a000 | ||
CONFIG_RAW_BINARY=y | ||
CONFIG_READLINE_CMD_HISTORY=y | ||
CONFIG_RR_INTERVAL=200 | ||
CONFIG_SCHED_HPWORK=y | ||
CONFIG_SCHED_HPWORKPRIORITY=192 | ||
CONFIG_SCHED_LPWORK=y | ||
CONFIG_SCHED_LPWORKPRIORITY=50 | ||
CONFIG_SPINLOCK=y | ||
CONFIG_STACK_COLORATION=y | ||
CONFIG_START_MONTH=3 | ||
CONFIG_START_YEAR=2022 | ||
CONFIG_SYMTAB_ORDEREDBYNAME=y | ||
CONFIG_SYSTEM_NSH=y | ||
CONFIG_SYSTEM_SYSTEM=y | ||
CONFIG_SYSTEM_TIME64=y | ||
CONFIG_TESTING_GETPRIME=y | ||
CONFIG_TESTING_OSTEST=y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
/**************************************************************************** | ||
* boards/arm64/imx9/imx93-evk/scripts/ocramboot.ld | ||
* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. The | ||
* ASF licenses this file to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance with the | ||
* License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
* | ||
****************************************************************************/ | ||
|
||
OUTPUT_ARCH(aarch64) | ||
|
||
ENTRY(__start) | ||
EXTERN(__start) | ||
|
||
/* Memory is organized as follows: | ||
* - ahab reserves memory from 2048k to 0x2049a000 | ||
* - NuttX is compiled into 0x2049a000, ahab expects NuttX here | ||
* - Heap memory is allocated from ocram end to idlestack top | ||
*/ | ||
|
||
MEMORY | ||
{ | ||
ocram (rx) : ORIGIN = 0x2049a000, LENGTH = 0x37ff0 | ||
ocram_data (rw) : ORIGIN = 0x204e0000, LENGTH = 0x2000 | ||
ocram_noload (rw) : ORIGIN = 0x204f0000, LENGTH = 0x30000 | ||
} | ||
|
||
PHDRS | ||
{ | ||
/* R = 100, W = 010, X = 001 */ | ||
|
||
text PT_LOAD FLAGS(5); /* RX */ | ||
rodata PT_LOAD FLAGS(4); /* R */ | ||
data PT_LOAD FLAGS(6); /* RW */ | ||
} | ||
|
||
SECTIONS | ||
{ | ||
.text : | ||
{ | ||
_stext = ABSOLUTE(.); /* Text section */ | ||
*(.start .start.*) /* Place __start here */ | ||
*(.text .text.*) | ||
*(.text.cold) | ||
*(.text.unlikely) | ||
*(.fixup) | ||
*(.gnu.warning) | ||
} > ocram :text | ||
|
||
.init_section : | ||
{ | ||
_sinit = ABSOLUTE(.); | ||
KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))) | ||
KEEP(*(.init_array .ctors)) | ||
_einit = ABSOLUTE(.); | ||
} > ocram :text | ||
|
||
/* Vector table must be page aligned */ | ||
|
||
.vector : ALIGN(4096) | ||
{ | ||
_vector_start = ABSOLUTE(.); | ||
KEEP(*(.exc_vector_table)) | ||
KEEP(*(".exc_vector_table.*")) | ||
KEEP(*(.vectors)) | ||
_vector_end = ABSOLUTE(.); | ||
} > ocram :text | ||
|
||
_etext = .; | ||
|
||
.rodata : ALIGN(8) | ||
{ | ||
_srodata = ABSOLUTE(.); /* Read-only data */ | ||
*(.rodata .rodata.*) | ||
*(.data.rel.ro) | ||
*(.data.rel.ro.*) | ||
} > ocram :rodata | ||
|
||
_erodata = .; /* End of read-only data */ | ||
_eronly = .; /* End of read-only data */ | ||
|
||
.data : ALIGN(8) | ||
{ | ||
_sdata = ABSOLUTE(.); | ||
*(.data.page_aligned) | ||
*(.data .data.*) | ||
. = ALIGN(8); | ||
*(.data.rel) | ||
*(.data.rel.*) | ||
CONSTRUCTORS | ||
. = ALIGN(8); | ||
_edata = ABSOLUTE(.); | ||
} > ocram_data :data | ||
|
||
.bss (NOLOAD) : | ||
{ | ||
. = ALIGN(8); | ||
_sbss = ABSOLUTE(.); | ||
*(.bss .bss.*) | ||
. = ALIGN(8); | ||
_ebss = ABSOLUTE(.); | ||
} > ocram_noload | ||
|
||
.initstack : | ||
{ | ||
_s_initstack = ABSOLUTE(.); | ||
*(.initstack) | ||
} > ocram_noload | ||
|
||
/* End of data must be page aligned */ | ||
|
||
. = ALIGN(4096); | ||
|
||
g_idle_topstack = .; | ||
_e_initstack = .; | ||
|
||
/* This makes sure arm64_mmu.c doesn't touch MMU regions, | ||
* we handle it at imx9_boot.c. | ||
*/ | ||
_sztext = 0; | ||
_szrodata = 0; | ||
_szbss = 0; | ||
_szdata = 0; | ||
|
||
/* Sections to be discarded */ | ||
/DISCARD/ : { | ||
*(.exit.text) | ||
*(.exit.data) | ||
*(.exitcall.exit) | ||
*(.eh_frame) | ||
} | ||
|
||
/* Stabs debugging sections. */ | ||
.stab 0 : { *(.stab) } | ||
.stabstr 0 : { *(.stabstr) } | ||
.stab.excl 0 : { *(.stab.excl) } | ||
.stab.exclstr 0 : { *(.stab.exclstr) } | ||
.stab.index 0 : { *(.stab.index) } | ||
.stab.indexstr 0 : { *(.stab.indexstr) } | ||
.comment 0 : { *(.comment) } | ||
} | ||
|
||
_heapend = ORIGIN(ocram_noload) + LENGTH(ocram_noload); | ||
_szbootloader = _heapend - _stext; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
############################################################################ | ||
# tools/imx9/Config.mk | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. The | ||
# ASF licenses this file to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance with the | ||
# License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
############################################################################ | ||
|
||
# These are the macros that will be used in the NuttX make system to compile | ||
# and assembly source files and to insert the resulting object files into an | ||
# archive. These replace the default definitions at tools/Config.mk | ||
|
||
# POSTBUILD -- Perform post build operations | ||
|
||
ifeq ($(CONFIG_IMX9_BOOTLOADER),y) | ||
define POSTBUILD | ||
$(Q) echo "Removing sections" | ||
$(Q) $(OBJCOPY) -O binary -R .bss -R .initstack $(BIN) nuttx.bin | ||
$(Q) ([ $$? -eq 0 ] && echo "Done.") | ||
endef | ||
endif |