summaryrefslogtreecommitdiff
path: root/src/target/image.h
diff options
context:
space:
mode:
authordrath <drath@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2007-05-30 15:47:18 +0000
committerdrath <drath@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2007-05-30 15:47:18 +0000
commitf94d66d7c5f3c018ba72593b720746e4c5be1a16 (patch)
treed4d7d3e2ac6d3fd940c1026417eb738decd8055f /src/target/image.h
parentcf013d2e135373438815315f48ce86e4b558c58b (diff)
downloadopenocd+libswd-f94d66d7c5f3c018ba72593b720746e4c5be1a16.tar.gz
openocd+libswd-f94d66d7c5f3c018ba72593b720746e4c5be1a16.tar.bz2
openocd+libswd-f94d66d7c5f3c018ba72593b720746e4c5be1a16.tar.xz
openocd+libswd-f94d66d7c5f3c018ba72593b720746e4c5be1a16.zip
- reworked image handling to support multiple sections (tested with ihex file containing gaps)
This checkin is still experimental, not recommended for general use git-svn-id: svn://svn.berlios.de/openocd/trunk@159 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/target/image.h')
-rw-r--r--src/target/image.h23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/target/image.h b/src/target/image.h
index 3df175a8..75288791 100644
--- a/src/target/image.h
+++ b/src/target/image.h
@@ -24,11 +24,12 @@
#include "target.h"
#define IMAGE_MAX_ERROR_STRING (128)
+#define IMAGE_MAX_SECTIONS (128)
typedef enum image_type
{
IMAGE_BINARY, /* plain binary */
- IMAGE_IHEX, /* intel hex-record format */
+ IMAGE_IHEX, /* intel hex-record format */
IMAGE_MEMORY, /* target-memory pseudo-image */
/*
* Possible future enhancements:
@@ -37,15 +38,23 @@ typedef enum image_type
*/
} image_type_t;
+typedef struct image_section_s
+{
+ u32 base_address;
+ u32 size;
+ int flags;
+} image_section_t;
+
typedef struct image_s
{
image_type_t type; /* image type (plain, ihex, ...) */
void *type_private; /* type private data */
- int base_address_set; /* whether the image start address has been set */
- u32 base_address; /* base address of image in target memory */
+ int num_sections; /* number of sections contained in the image */
+ image_section_t *sections; /* array of sections */
+ int base_address_set; /* whether the image has a base address set (for relocation purposes) */
+ int base_address; /* base address, if one is set */
int start_address_set; /* whether the image has a start address (entry point) associated */
u32 start_address; /* start address, if one is set */
- u32 size; /* image size in byte */
char error_str[IMAGE_MAX_ERROR_STRING];
} image_t;
@@ -57,9 +66,8 @@ typedef struct image_binary_s
typedef struct image_ihex_s
{
fileio_t fileio;
- u32 position;
- u32 raw_size;
u8 *buffer;
+ u8 **section_pointer;
} image_ihex_t;
typedef struct image_memory_s
@@ -68,8 +76,7 @@ typedef struct image_memory_s
} image_memory_t;
extern int image_open(image_t *image, void *source, enum fileio_access access);
-extern int image_read(image_t *image, u32 size, u8 *buffer, u32 *size_written);
-extern int image_write(image_t *image, u32 size, u8 *buffer, u32 *size_written);
+extern int image_read_section(image_t *image, int section, u32 offset, u32 size, u8 *buffer, u32 *size_read);
extern int image_close(image_t *image);
extern int identify_image_type(image_type_t *type, char *type_string);