X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Ftarget%2Fimage.c;h=b1b7e3a6af723eeeb330d0526bafb4e7ae3827ed;hb=c8d351b1bf592046cef7dc48d84eb10a1ba93993;hp=4a4a7cca99db2d3b107199c8c8978650e2d67203;hpb=374127301ec1d72033b9d573b72c7abdfd61990d;p=openocd.git diff --git a/src/target/image.c b/src/target/image.c index 4a4a7cca99..b1b7e3a6af 100644 --- a/src/target/image.c +++ b/src/target/image.c @@ -24,7 +24,7 @@ * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * ***************************************************************************/ #ifdef HAVE_CONFIG_H @@ -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; @@ -785,6 +788,7 @@ int image_open(struct image *image, const char *url, const char *type_string) } } else if (image->type == IMAGE_BUILDER) { image->num_sections = 0; + image->base_address_set = 0; image->sections = NULL; image->type_private = NULL; } @@ -899,7 +903,7 @@ int image_read_section(struct image *image, return ERROR_OK; } -int image_add_section(struct image *image, uint32_t base, uint32_t size, int flags, uint8_t *data) +int image_add_section(struct image *image, uint32_t base, uint32_t size, int flags, uint8_t const *data) { struct imagesection *section;