LOG_DEBUG("ELF image detected.");
image->type = IMAGE_ELF;
}
- else if ((buffer[0]==':') /* record start byte */
- &&(isxdigit(buffer[1]))
- &&(isxdigit(buffer[2]))
- &&(isxdigit(buffer[3]))
- &&(isxdigit(buffer[4]))
- &&(isxdigit(buffer[5]))
- &&(isxdigit(buffer[6]))
- &&(buffer[7]=='0') /* record type : 00 -> 05 */
- &&(buffer[8]>='0')&&(buffer[8]<'6'))
+ else if ((buffer[0]==':') /* record start byte */
+ &&(isxdigit(buffer[1]))
+ &&(isxdigit(buffer[2]))
+ &&(isxdigit(buffer[3]))
+ &&(isxdigit(buffer[4]))
+ &&(isxdigit(buffer[5]))
+ &&(isxdigit(buffer[6]))
+ &&(buffer[7]=='0') /* record type : 00 -> 05 */
+ &&(buffer[8]>='0')&&(buffer[8]<'6'))
{
LOG_DEBUG("IHEX image detected.");
image->type = IMAGE_IHEX;
return ERROR_OK;
}
-int identify_image_type(image_t *image, char *type_string, char *url)
+static int identify_image_type(image_t *image, char *type_string, char *url)
{
if (type_string)
{
return ERROR_OK;
}
-int image_ihex_buffer_complete(image_t *image)
+static int image_ihex_buffer_complete(image_t *image)
{
image_ihex_t *ihex = image->type_private;
fileio_t *fileio = &ihex->fileio;
return ERROR_IMAGE_FORMAT_ERROR;
}
-int image_elf_read_headers(image_t *image)
+static int image_elf_read_headers(image_t *image)
{
image_elf_t *elf = image->type_private;
u32 read_bytes;
return ERROR_IMAGE_FORMAT_ERROR;
}
-
elf->endianness = elf->header->e_ident[EI_DATA];
if ((elf->endianness!=ELFDATA2LSB)
&&(elf->endianness!=ELFDATA2MSB))
return ERROR_OK;
}
-int image_elf_read_section(image_t *image, int section, u32 offset, u32 size, u8 *buffer, u32 *size_read)
+static int image_elf_read_section(image_t *image, int section, u32 offset, u32 size, u8 *buffer, u32 *size_read)
{
image_elf_t *elf = image->type_private;
Elf32_Phdr *segment = (Elf32_Phdr *)image->sections[section].private;
return ERROR_OK;
}
-int image_mot_buffer_complete(image_t *image)
+static int image_mot_buffer_complete(image_t *image)
{
image_mot_t *mot = image->type_private;
fileio_t *fileio = &mot->fileio;
}
else if (image->type == IMAGE_MEMORY)
{
+ target_t *target = get_target_by_num(strtoul(url, NULL, 0));
+ if (target==NULL)
+ {
+ LOG_ERROR("Target '%s' does not exist", url);
+ return ERROR_FAIL;
+ }
+
image_memory_t *image_memory;
image->num_sections = 1;
image_memory = image->type_private = malloc(sizeof(image_memory_t));
- image_memory->target = get_target_by_num(strtoul(url, NULL, 0));;
+ image_memory->target = target;
image_memory->cache = NULL;
image_memory->cache_address = 0x0;
}
*checksum = crc;
return ERROR_OK;
}
-
-