mach-imx: bootaux: elf firmware support
authorIgor Opaniuk <igor.opaniuk@toradex.com>
Mon, 30 Dec 2019 11:56:44 +0000 (13:56 +0200)
committerStefano Babic <sbabic@denx.de>
Tue, 7 Jan 2020 09:26:56 +0000 (10:26 +0100)
commitc0f037f6a2ae2cb869a350534cef9771358fabcf
tree0484508a6c441a1025cffc28f7ee94751233ad48
parentebabbf1169b1948625762800346876d196974ecb
mach-imx: bootaux: elf firmware support

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).
ELF64 binaries isn't supported yet.

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}

Similar translation table can be found in the Linux remoteproc
driver [1].

[1] https://elixir.bootlin.com/linux/latest/source/drivers/remoteproc/imx_rproc.c

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
arch/arm/include/asm/mach-imx/sys_proto.h
arch/arm/mach-imx/imx_bootaux.c
arch/arm/mach-imx/mx7/soc.c