tools/kwbimage: add DEBUG option
authorChris Packham <judge.packham@gmail.com>
Wed, 9 Nov 2016 09:21:45 +0000 (22:21 +1300)
committerStefan Roese <sr@denx.de>
Thu, 1 Dec 2016 08:10:49 +0000 (09:10 +0100)
Offset 0x1 in the generated kwb image file is a set of flags, bit 0
enables debug output from the BootROM firmware.  Allow a DEBUG option in
the kwb configuration to request debug output from the BootROM firmware.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Signed-off-by: Stefan Roese <sr@denx.de>
tools/kwbimage.c
tools/kwbimage.h

index ad182c5c5d9af5f57cfbf42d129162dd47fce18e..69844d91696563cb5607184ff283b0cc01a18a05 100644 (file)
@@ -69,6 +69,7 @@ struct image_cfg_element {
                IMAGE_CFG_PAYLOAD,
                IMAGE_CFG_DATA,
                IMAGE_CFG_BAUDRATE,
+               IMAGE_CFG_DEBUG,
        } type;
        union {
                unsigned int version;
@@ -87,6 +88,7 @@ struct image_cfg_element {
                unsigned int nandpagesz;
                struct ext_hdr_v0_reg regdata;
                unsigned int baudrate;
+               unsigned int debug;
        };
 };
 
@@ -425,6 +427,9 @@ static void *image_create_v1(size_t *imagesz, struct image_tool_params *params,
        e = image_find_option(IMAGE_CFG_BAUDRATE);
        if (e)
                main_hdr->options = baudrate_to_option(e->baudrate);
+       e = image_find_option(IMAGE_CFG_DEBUG);
+       if (e)
+               main_hdr->flags = e->debug ? 0x1 : 0;
 
        binarye = image_find_option(IMAGE_CFG_BINARY);
        if (binarye) {
@@ -579,6 +584,10 @@ static int image_create_config_parse_oneline(char *line,
                char *value = strtok_r(NULL, deliminiters, &saveptr);
                el->type = IMAGE_CFG_BAUDRATE;
                el->baudrate = strtoul(value, NULL, 10);
+       } else if (!strcmp(keyword, "DEBUG")) {
+               char *value = strtok_r(NULL, deliminiters, &saveptr);
+               el->type = IMAGE_CFG_DEBUG;
+               el->debug = strtoul(value, NULL, 10);
        } else {
                fprintf(stderr, "Ignoring unknown line '%s'\n", line);
        }
index 9b06004a0b10bdd98b931eb6f959fbde9cfefd49..01c2f1f3238b57e4e9b78029c6331cf2b02abb5c 100644 (file)
@@ -73,7 +73,7 @@ struct kwb_header {
 /* Structure of the main header, version 1 (Armada 370, Armada XP) */
 struct main_hdr_v1 {
        uint8_t  blockid;               /* 0 */
-       uint8_t  reserved1;             /* 1 */
+       uint8_t  flags;                 /* 1 */
        uint16_t reserved2;             /* 2-3 */
        uint32_t blocksize;             /* 4-7 */
        uint8_t  version;               /* 8 */