summaryrefslogtreecommitdiff
path: root/arch/arm
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@st.com>2020-03-18 11:25:02 +0300
committerPatrick Delaunay <patrick.delaunay@st.com>2020-05-14 10:02:12 +0300
commitd0686c69ff6cb8d8e63052bde8ca00e6468dd88d (patch)
tree3a53ba361812d3b1a04e13f8624a7852c285d886 /arch/arm
parent99d643cb411775037453bf24cac6b8eb0917bfe7 (diff)
downloadu-boot-d0686c69ff6cb8d8e63052bde8ca00e6468dd88d.tar.xz
stm32mp: stm32prog: support for script
Support an U-Boot script included in uimage instead of flashlayout file (text file in tsv format). This feature is used to execute this script directly when U-Boot is loaded in DDR (for update without STM32CubeProgrammer for example). A simple example with dfu-util only is: $> echo "dfu 0" > script.cmd $> mkimage -C none -A arm -T script -d script.cmd script.uimg $> mkimage -T stm32image -a 0xC0000000 -e 0xC0000000 -d script.uimg \ script.stm32 $> dfu-util -d 0483:df11 -a 1 -D tf-a.stm32 $> dfu-util -d 0483:df11 -a 0 -D script.stm32 $> dfu-util -d 0483:df11 -a 0 -D u-boot.stm32 $> dfu-util -d 0483:df11 -a 0 -e Then you can used dfu-utils to update your device To increase speed, you can also switch to fastboot protocol with: echo "fastboot 0" > script.cmd Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
index 15bbdc2cb6..baf9b6bd1e 100644
--- a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
+++ b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <command.h>
#include <dfu.h>
+#include <image.h>
#include <asm/arch/stm32prog.h>
#include "stm32prog.h"
@@ -44,6 +45,7 @@ static int do_stm32prog(cmd_tbl_t *cmdtp, int flag, int argc,
int dev, ret;
enum stm32prog_link_t link = LINK_UNDEFINED;
bool reset = false;
+ struct image_header_s header;
struct stm32prog_data *data;
if (argc < 3 || argc > 5)
@@ -71,6 +73,18 @@ static int do_stm32prog(cmd_tbl_t *cmdtp, int flag, int argc,
if (argc > 4)
size = simple_strtoul(argv[4], NULL, 16);
+ /* check STM32IMAGE presence */
+ if (size == 0 &&
+ !stm32prog_header_check((struct raw_header_s *)addr, &header)) {
+ size = header.image_length + BL_HEADER_SIZE;
+
+ /* uImage detected in STM32IMAGE, execute the script */
+ if (IMAGE_FORMAT_LEGACY ==
+ genimg_get_format((void *)(addr + BL_HEADER_SIZE)))
+ return image_source_script(addr + BL_HEADER_SIZE,
+ "script@1");
+ }
+
enable_vidconsole();
data = (struct stm32prog_data *)malloc(sizeof(*data));