public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Chris Packham <judge.packham@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] tools/kwbimage: add DEBUG option
Date: Wed,  9 Nov 2016 22:21:45 +1300	[thread overview]
Message-ID: <20161109092145.11924-1-judge.packham@gmail.com> (raw)

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>
---

 tools/kwbimage.c | 9 +++++++++
 tools/kwbimage.h | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/tools/kwbimage.c b/tools/kwbimage.c
index ad182c5c5d9a..69844d916965 100644
--- a/tools/kwbimage.c
+++ b/tools/kwbimage.c
@@ -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);
 	}
diff --git a/tools/kwbimage.h b/tools/kwbimage.h
index 9b06004a0b10..01c2f1f3238b 100644
--- a/tools/kwbimage.h
+++ b/tools/kwbimage.h
@@ -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 */
-- 
2.10.2

             reply	other threads:[~2016-11-09  9:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-09  9:21 Chris Packham [this message]
2016-12-01 12:55 ` [U-Boot] [PATCH] tools/kwbimage: add DEBUG option Stefan Roese

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161109092145.11924-1-judge.packham@gmail.com \
    --to=judge.packham@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox