aboutsummaryrefslogtreecommitdiff
path: root/src/target/image.c
diff options
context:
space:
mode:
authorFranck Jullien <franck.jullien@gmail.com>2013-12-24 10:07:14 +0100
committerSpencer Oliver <spen@spen-soft.co.uk>2013-12-30 15:49:15 +0000
commitf4947e8b88059f55445c4606578d7e195de6baed (patch)
tree7e095354e733230e0af5f20e644f0d861819cd7f /src/target/image.c
parent3d73c0bb5124e9a6f185f8a0ae08aad565acd028 (diff)
downloadriscv-openocd-f4947e8b88059f55445c4606578d7e195de6baed.zip
riscv-openocd-f4947e8b88059f55445c4606578d7e195de6baed.tar.gz
riscv-openocd-f4947e8b88059f55445c4606578d7e195de6baed.tar.bz2
target/image: allow for comments in IHEX files
This is not in the Intel hex file format specification but some hex files may include comments (i.e. Altera USB-Blaster II firmware) starting with '#'. This patch makes image_ihex_buffer_complete_inner to skip comment lines. Change-Id: Id1f57d84d75da45e592f1c72b2b8c29193bc14e3 Signed-off-by: Franck Jullien <franck.jullien@gmail.com> Reviewed-on: http://openocd.zylin.com/1842 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Diffstat (limited to 'src/target/image.c')
-rw-r--r--src/target/image.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/target/image.c b/src/target/image.c
index f47ba22..8bcba34 100644
--- a/src/target/image.c
+++ b/src/target/image.c
@@ -152,6 +152,9 @@ static int image_ihex_buffer_complete_inner(struct image *image,
uint8_t cal_checksum = 0;
size_t bytes_read = 0;
+ if (lpszLine[0] == '#')
+ continue;
+
if (sscanf(&lpszLine[bytes_read], ":%2" SCNx32 "%4" SCNx32 "%2" SCNx32, &count,
&address, &record_type) != 3)
return ERROR_IMAGE_FORMAT_ERROR;