- minimum autoconf 2.59 is now required and verified - due to issues with AS_HELP_STRING
- native win32 now handles WSAECONNRESET - no longer exits openocd - qCRC packet now works correctly under cygwin (gdb compare-sections command) - removed __USE_GNU define from gdbserver.c - gdb qSupported packet is now handled, with this we are able to tell gdb packet size, memory map of target - added new target script gdb_program_config - called before gdb flash programming - new gdb server command gdb_memory_map (enable|disable> - default is disable - new gdb server command gdb_flash_program (enable|disable> - default is disable - gdb flash programming supported - vFlash packets - image_elf_read_section now does not clear any remaining data, this was causing the gdb checksum to fail with certain files - reformat of usbprog.c - memory leak in command_print fixed - updated texi doc to include new commands - added gdb programming section to docs git-svn-id: svn://svn.berlios.de/openocd/trunk@246 b42882b7-edfa-0310-969c-e2dbd0fdcd60
This commit is contained in:
@@ -360,12 +360,12 @@ int image_elf_read_headers(image_t *image)
|
||||
return ERROR_FILEIO_OPERATION_FAILED;
|
||||
}
|
||||
|
||||
if (strncmp((char*)elf->header->e_ident,ELFMAG,SELFMAG)!=0)
|
||||
if (strncmp((char*)elf->header->e_ident,ELFMAG,SELFMAG) != 0)
|
||||
{
|
||||
ERROR("invalid ELF file, bad magic number");
|
||||
return ERROR_IMAGE_FORMAT_ERROR;
|
||||
}
|
||||
if (elf->header->e_ident[EI_CLASS]!=ELFCLASS32)
|
||||
if (elf->header->e_ident[EI_CLASS] != ELFCLASS32)
|
||||
{
|
||||
ERROR("invalid ELF file, only 32bits files are supported");
|
||||
return ERROR_IMAGE_FORMAT_ERROR;
|
||||
@@ -373,28 +373,28 @@ int image_elf_read_headers(image_t *image)
|
||||
|
||||
|
||||
elf->endianness = elf->header->e_ident[EI_DATA];
|
||||
if ((elf->endianness!=ELFDATA2LSB)
|
||||
&&(elf->endianness!=ELFDATA2MSB))
|
||||
if ((elf->endianness != ELFDATA2LSB)
|
||||
&&(elf->endianness != ELFDATA2MSB))
|
||||
{
|
||||
ERROR("invalid ELF file, unknown endianess setting");
|
||||
return ERROR_IMAGE_FORMAT_ERROR;
|
||||
}
|
||||
|
||||
elf->segment_count = field16(elf,elf->header->e_phnum);
|
||||
if (elf->segment_count==0)
|
||||
elf->segment_count = field16(elf, elf->header->e_phnum);
|
||||
if (elf->segment_count == 0)
|
||||
{
|
||||
ERROR("invalid ELF file, no program headers");
|
||||
return ERROR_IMAGE_FORMAT_ERROR;
|
||||
}
|
||||
|
||||
elf->segments = malloc(elf->segment_count*sizeof(Elf32_Phdr));
|
||||
elf->segments = malloc(elf->segment_count * sizeof(Elf32_Phdr));
|
||||
|
||||
if ((retval = fileio_read(&elf->fileio, elf->segment_count*sizeof(Elf32_Phdr), (u8*)elf->segments, &read_bytes)) != ERROR_OK)
|
||||
if ((retval = fileio_read(&elf->fileio, elf->segment_count * sizeof(Elf32_Phdr), (u8*)elf->segments, &read_bytes)) != ERROR_OK)
|
||||
{
|
||||
ERROR("cannot read ELF segment headers, read failed");
|
||||
return retval;
|
||||
}
|
||||
if (read_bytes != elf->segment_count*sizeof(Elf32_Phdr))
|
||||
if (read_bytes != elf->segment_count * sizeof(Elf32_Phdr))
|
||||
{
|
||||
ERROR("cannot read ELF segment headers, only partially read");
|
||||
return ERROR_FILEIO_OPERATION_FAILED;
|
||||
@@ -411,16 +411,16 @@ int image_elf_read_headers(image_t *image)
|
||||
{
|
||||
if ((field32(elf, elf->segments[i].p_type) == PT_LOAD) && (field32(elf, elf->segments[i].p_filesz) != 0))
|
||||
{
|
||||
image->sections[j].size = field32(elf,elf->segments[i].p_memsz);
|
||||
image->sections[j].base_address = field32(elf,elf->segments[i].p_paddr);
|
||||
image->sections[j].size = field32(elf, elf->segments[i].p_memsz);
|
||||
image->sections[j].base_address = field32(elf, elf->segments[i].p_paddr);
|
||||
image->sections[j].private = &elf->segments[i];
|
||||
image->sections[j].flags = field32(elf,elf->segments[i].p_flags);
|
||||
image->sections[j].flags = field32(elf, elf->segments[i].p_flags);
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
image->start_address_set = 1;
|
||||
image->start_address = field32(elf,elf->header->e_entry);
|
||||
image->start_address = field32(elf, elf->header->e_entry);
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
@@ -442,9 +442,9 @@ int image_elf_read_section(image_t *image, int section, u32 offset, u32 size, u8
|
||||
/* maximal size present in file for the current segment */
|
||||
read_size = MIN(size, field32(elf, segment->p_filesz) - offset);
|
||||
DEBUG("read elf: size = 0x%x at 0x%x", read_size,
|
||||
field32(elf,segment->p_offset) + offset);
|
||||
field32(elf, segment->p_offset) + offset);
|
||||
/* read initialized area of the segment */
|
||||
if ((retval = fileio_seek(&elf->fileio, field32(elf,segment->p_offset) + offset)) != ERROR_OK)
|
||||
if ((retval = fileio_seek(&elf->fileio, field32(elf, segment->p_offset) + offset)) != ERROR_OK)
|
||||
{
|
||||
ERROR("cannot find ELF segment content, seek failed");
|
||||
return retval;
|
||||
@@ -462,16 +462,7 @@ int image_elf_read_section(image_t *image, int section, u32 offset, u32 size, u8
|
||||
if (!size)
|
||||
return ERROR_OK;
|
||||
}
|
||||
/* if there is remaining zeroed area in current segment */
|
||||
if (offset < field32(elf, segment->p_memsz))
|
||||
{
|
||||
/* fill zeroed part (BSS) of the segment */
|
||||
read_size = MIN(size, field32(elf, segment->p_memsz) - offset);
|
||||
DEBUG("zero fill: size = 0x%x", read_size);
|
||||
memset(buffer, 0, read_size);
|
||||
*size_read += read_size;
|
||||
}
|
||||
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -1040,6 +1040,7 @@ int handle_target_command(struct command_context_s *cmd_ctx, char *cmd, char **a
|
||||
(*last_target_p)->reset_script = NULL;
|
||||
(*last_target_p)->post_halt_script = NULL;
|
||||
(*last_target_p)->pre_resume_script = NULL;
|
||||
(*last_target_p)->gdb_program_script = NULL;
|
||||
|
||||
(*last_target_p)->working_area = 0x0;
|
||||
(*last_target_p)->working_area_size = 0x0;
|
||||
@@ -1120,6 +1121,12 @@ int handle_target_script_command(struct command_context_s *cmd_ctx, char *cmd, c
|
||||
free(target->pre_resume_script);
|
||||
target->pre_resume_script = strdup(args[2]);
|
||||
}
|
||||
else if (strcmp(args[1], "gdb_program_config") == 0)
|
||||
{
|
||||
if (target->gdb_program_script)
|
||||
free(target->gdb_program_script);
|
||||
target->gdb_program_script = strdup(args[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
ERROR("unknown event type: '%s", args[1]);
|
||||
|
||||
@@ -157,6 +157,7 @@ typedef struct target_s
|
||||
char *reset_script; /* script file to initialize the target after a reset */
|
||||
char *post_halt_script; /* script file to execute after the target halted */
|
||||
char *pre_resume_script; /* script file to execute before the target resumed */
|
||||
char *gdb_program_script; /* script file to execute before programming vis gdb */
|
||||
u32 working_area; /* working area (initialized RAM) */
|
||||
u32 working_area_size; /* size in bytes */
|
||||
u32 backup_working_area; /* whether the content of the working area has to be preserved */
|
||||
@@ -180,6 +181,7 @@ enum target_event
|
||||
TARGET_EVENT_RESET, /* target entered reset */
|
||||
TARGET_EVENT_DEBUG_HALTED, /* target entered debug state, but was executing on behalf of the debugger */
|
||||
TARGET_EVENT_DEBUG_RESUMED, /* target resumed to execute on behalf of the debugger */
|
||||
TARGET_EVENT_GDB_PROGRAM /* target about to be be programmed by gdb */
|
||||
};
|
||||
|
||||
typedef struct target_event_callback_s
|
||||
|
||||
Reference in New Issue
Block a user