imx: bootaux: PoC for elf firmware support
Subsystems (3)
RFC PATCH 1/1 imx: bootaux: PoC for elf firmware support
From: Igor Opaniuk <[email protected]>
Currently imx-specific bootaux command doesn't support ELF format firmware for Cortex-M4 core.
This patches introduces a PoC implementation of handling elf firmware (load_elf_image_phdr() was copy-pasted from elf.c just for PoC).
This has the advantage that the user does not need to know to which address the binary has been linked to. However, in order to handle and load the elf sections to the right address, we need to translate the Cortex-M4 core memory addresses to primary/host CPU memory addresses (Cortex A7/A9 cores).
This allows to boot firmwares from any location with just using bootaux, e.g.:
tftp ${loadaddr} hello_world.elf && bootaux ${loadaddr}
Questions:
1. I really doubt that hardcoding the memory map for Cortex-A7/Cortex-M4 is a good idea. Does it make sense to move this table to <board>-u-boot.dtsi instead?
2. How does similar "firmware loading" work is done on iMX8/iMX8M, where U-boot is used only as non-secure bootloader.
I assume that this is responsibility of TF-A, who does all Cortex-M initialization and firmware "deploying"?
---
arch/arm/include/asm/mach-imx/sys_proto.h | 6 ++ arch/arm/mach-imx/imx_bootaux.c | 84 +++++++++++++++++++++-- arch/arm/mach-imx/mx7/soc.c | 26 +++++++ 3 files changed, 112 insertions(+), 4 deletions(-)
arch/arm/include/asm/mach-imx/sys_proto.h +6 -0
@@ -104,6 +104,12 @@ void gpr_init(void);#endif /* CONFIG_MX6 */ +struct memorymap { +unsigned long auxcore; +unsigned long host; +unsigned long size; +}; +u32 get_nr_cpus (void );u32 get_cpu_rev (void );u32 get_cpu_speed_grade_hz (void );
arch/arm/mach-imx/imx_bootaux.c +80 -4
104 lines not on this page · raw message
arch/arm/mach-imx/mx7/soc.c +26 -0
@@ -193,6 +193,32 @@ static void init_cpu_basic(void)#endif } +#ifdef CONFIG_IMX_BOOTAUX +/* +* Table of mappings of of physical mem regions in both +* Cortex-A7 and Cortex-M4 address spaces. +* +* For additional details check sections 2.1.2 and 2.1.3 in +* i.MX7Dual Applications Processor Reference Manual +*/ +const struct memorymap hostmap[] = { + { .auxcore =0x00000000 , .host =0x00180000 , .size =0x8000 },/* OCRAM_S */ + { .auxcore =0x00180000 , .host =0x00180000 , .size =0x8000 },/* OCRAM_S */ + { .auxcore =0x20180000 , .host =0x00180000 , .size =0x8000 },/* OCRAM_S */ + { .auxcore =0x1fff8000 , .host =0x007f8000 , .size =0x8000 },/* TCML */ + { .auxcore =0x20000000 , .host =0x00800000 , .size =0x8000 },/* TCMU */ + { .auxcore =0x00900000 , .host =0x00900000 , .size =0x20000 },/* OCRAM_128KB */ + { .auxcore =0x20200000 , .host =0x00900000 , .size =0x20000 },/* OCRAM_128KB */ + { .auxcore =0x00920000 , .host =0x00920000 , .size =0x20000 },/* OCRAM_EPDC */ + { .auxcore =0x20220000 , .host =0x00920000 , .size =0x20000 },/* OCRAM_EPDC */ + { .auxcore =0x00940000 , .host =0x00940000 , .size =0x20000 },/* OCRAM_PXP */ + { .auxcore =0x20240000 , .host =0x00940000 , .size =0x20000 },/* OCRAM_PXP */ + { .auxcore =0x10000000 , .host =0x80000000 , .size =0x0fff0000 },/* DDR Code alias */ + { .auxcore =0x80000000 , .host =0x80000000 , .size =0xe0000000 },/* DDRC */ + {/* sentinel */ } +}; +#endif +#ifndef CONFIG_SKIP_LOWLEVEL_INIT /* enable all periherial can be accessed in nosec mode */ static void init_csu (void )
Signature · 1 line
2.17.1