]> Git Repo - J-u-boot.git/blobdiff - arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
stm32mp: stm32prog: support for script
[J-u-boot.git] / arch / arm / mach-stm32mp / cmd_stm32prog / cmd_stm32prog.c
index 15bbdc2cb6565fe31ee28d4b9b88ab2895624451..baf9b6bd1ea3e518755a7aa4c3dc337782e48699 100644 (file)
@@ -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));
This page took 0.026919 seconds and 4 git commands to generate.