OpenOCD
|
Go to the source code of this file.
Macros | |
#define | field16(elf, field) |
#define | field32(elf, field) |
#define | field64(elf, field) |
Functions | |
static int | autodetect_image_type (struct image *image, const char *url) |
static int | identify_image_type (struct image *image, const char *type_string, const char *url) |
int | image_add_section (struct image *image, target_addr_t base, uint32_t size, uint64_t flags, uint8_t const *data) |
int | image_calculate_checksum (const uint8_t *buffer, uint32_t nbytes, uint32_t *checksum) |
void | image_close (struct image *image) |
static int | image_elf32_read_headers (struct image *image) |
static int | image_elf32_read_section (struct image *image, int section, target_addr_t offset, uint32_t size, uint8_t *buffer, size_t *size_read) |
static int | image_elf64_read_headers (struct image *image) |
static int | image_elf64_read_section (struct image *image, int section, target_addr_t offset, uint32_t size, uint8_t *buffer, size_t *size_read) |
static int | image_elf_read_headers (struct image *image) |
static int | image_elf_read_section (struct image *image, int section, target_addr_t offset, uint32_t size, uint8_t *buffer, size_t *size_read) |
static int | image_ihex_buffer_complete (struct image *image) |
Allocate memory dynamically instead of on the stack. More... | |
static int | image_ihex_buffer_complete_inner (struct image *image, char *lpsz_line, struct imagesection *section) |
static int | image_mot_buffer_complete (struct image *image) |
Allocate memory dynamically instead of on the stack. More... | |
static int | image_mot_buffer_complete_inner (struct image *image, char *lpsz_line, struct imagesection *section) |
int | image_open (struct image *image, const char *url, const char *type_string) |
int | image_read_section (struct image *image, int section, target_addr_t offset, uint32_t size, uint8_t *buffer, size_t *size_read) |
#define field16 | ( | elf, | |
field | |||
) |
#define field32 | ( | elf, | |
field | |||
) |
#define field64 | ( | elf, | |
field | |||
) |
|
static |
Definition at line 41 of file image.c.
References buffer, ELFMAG, ERROR_FILEIO_OPERATION_FAILED, ERROR_OK, FILEIO_BINARY, fileio_close(), fileio_open(), fileio_read(), FILEIO_READ, IMAGE_BINARY, IMAGE_ELF, IMAGE_IHEX, IMAGE_SRECORD, LOG_DEBUG, SELFMAG, image::type, and fileio::url.
Referenced by identify_image_type().
|
static |
Definition at line 91 of file image.c.
References autodetect_image_type(), ERROR_IMAGE_TYPE_UNKNOWN, ERROR_OK, IMAGE_BINARY, IMAGE_BUILDER, IMAGE_ELF, IMAGE_IHEX, IMAGE_MEMORY, IMAGE_SRECORD, image::type, and fileio::url.
Referenced by image_open().
int image_add_section | ( | struct image * | image, |
target_addr_t | base, | ||
uint32_t | size, | ||
uint64_t | flags, | ||
uint8_t const * | data | ||
) |
Definition at line 1160 of file image.c.
References imagesection::base_address, ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, imagesection::flags, IMAGE_BUILDER, image::num_sections, imagesection::private, image::sections, size, imagesection::size, and image::type.
Referenced by gdb_v_packet().
int image_calculate_checksum | ( | const uint8_t * | buffer, |
uint32_t | nbytes, | ||
uint32_t * | checksum | ||
) |
Definition at line 1254 of file image.c.
References buffer, ERROR_OK, keep_alive(), and LOG_DEBUG.
Referenced by COMMAND_HELPER(), default_flash_verify(), qspi_verify(), and target_checksum_memory().
void image_close | ( | struct image * | image | ) |
Definition at line 1197 of file image.c.
References image_ihex::buffer, image_mot::buffer, image_memory::cache, image_binary::fileio, image_ihex::fileio, image_elf::fileio, image_mot::fileio, fileio_close(), image_elf::header32, image_elf::header64, IMAGE_BINARY, IMAGE_BUILDER, IMAGE_ELF, IMAGE_IHEX, IMAGE_MEMORY, IMAGE_SRECORD, image_elf::is_64_bit, NULL, image::num_sections, imagesection::private, image::sections, image_elf::segments32, image_elf::segments64, image::type, and image::type_private.
Referenced by COMMAND_HANDLER(), COMMAND_HELPER(), gdb_connection_closed(), gdb_v_packet(), load_usb_blaster_firmware(), and ulink_load_firmware().
|
static |
some ELF linkers produce binaries with all the program header p_paddr fields zero (there can be however one loadable segment that has valid physical address 0x0). If we have such a binary with more than one PT_LOAD header, then use p_vaddr instead of p_paddr (ARM ELF standard demands p_paddr = 0 anyway, and BFD library uses this approach to workaround zero-initialized p_paddrs when obtaining lma - look at elf.c of BDF)
Definition at line 349 of file image.c.
References imagesection::base_address, Elf32_Ehdr::e_entry, Elf32_Ehdr::e_phnum, Elf32_Ehdr::e_phoff, ERROR_FILEIO_OPERATION_FAILED, ERROR_IMAGE_FORMAT_ERROR, ERROR_OK, field16, field32, image_elf::fileio, fileio_read(), fileio_seek(), imagesection::flags, image_elf::header32, LOG_ERROR, image::num_sections, Elf32_Phdr::p_filesz, Elf32_Phdr::p_flags, Elf32_Phdr::p_memsz, Elf32_Phdr::p_paddr, Elf32_Phdr::p_type, Elf32_Phdr::p_vaddr, imagesection::private, PT_LOAD, image::sections, image_elf::segment_count, image_elf::segments32, imagesection::size, image::start_address, image::start_address_set, and image::type_private.
Referenced by image_elf_read_headers().
|
static |
Definition at line 645 of file image.c.
References buffer, ERROR_OK, field32, image_elf::fileio, fileio_read(), fileio_seek(), LOG_DEBUG, LOG_ERROR, MIN, offset, Elf32_Phdr::p_filesz, Elf32_Phdr::p_offset, imagesection::private, image::sections, size, TARGET_PRIxADDR, and image::type_private.
Referenced by image_elf_read_section().
|
static |
some ELF linkers produce binaries with all the program header p_paddr fields zero (there can be however one loadable segment that has valid physical address 0x0). If we have such a binary with more than one PT_LOAD header, then use p_vaddr instead of p_paddr (ARM ELF standard demands p_paddr = 0 anyway, and BFD library uses this approach to workaround zero-initialized p_paddrs when obtaining lma - look at elf.c of BDF)
Definition at line 474 of file image.c.
References imagesection::base_address, Elf64_Ehdr::e_entry, Elf64_Ehdr::e_phnum, Elf64_Ehdr::e_phoff, ERROR_FILEIO_OPERATION_FAILED, ERROR_IMAGE_FORMAT_ERROR, ERROR_OK, field16, field32, field64, image_elf::fileio, fileio_read(), fileio_seek(), imagesection::flags, image_elf::header64, LOG_ERROR, image::num_sections, Elf64_Phdr::p_filesz, Elf64_Phdr::p_flags, Elf64_Phdr::p_memsz, Elf64_Phdr::p_paddr, Elf64_Phdr::p_type, Elf64_Phdr::p_vaddr, imagesection::private, PT_LOAD, image::sections, image_elf::segment_count, image_elf::segments64, imagesection::size, image::start_address, image::start_address_set, and image::type_private.
Referenced by image_elf_read_headers().
|
static |
Definition at line 688 of file image.c.
References buffer, ERROR_OK, field64, image_elf::fileio, fileio_read(), fileio_seek(), LOG_DEBUG, LOG_ERROR, MIN, offset, Elf64_Phdr::p_filesz, Elf64_Phdr::p_offset, imagesection::private, image::sections, size, TARGET_PRIxADDR, and image::type_private.
Referenced by image_elf_read_section().
|
static |
Definition at line 599 of file image.c.
References EI_CLASS, EI_DATA, EI_NIDENT, ELFCLASS32, ELFCLASS64, ELFDATA2LSB, ELFDATA2MSB, ELFMAG, image_elf::endianness, ERROR_FILEIO_OPERATION_FAILED, ERROR_IMAGE_FORMAT_ERROR, ERROR_OK, image_elf::fileio, fileio_read(), image_elf32_read_headers(), image_elf64_read_headers(), image_elf::is_64_bit, LOG_DEBUG, LOG_ERROR, SELFMAG, and image::type_private.
Referenced by image_open().
|
static |
Definition at line 731 of file image.c.
References buffer, image_elf32_read_section(), image_elf64_read_section(), image_elf::is_64_bit, offset, size, and image::type_private.
Referenced by image_read_section().
|
static |
Allocate memory dynamically instead of on the stack.
This is important w/embedded hosts.
Definition at line 326 of file image.c.
References ERROR_FAIL, image_ihex_buffer_complete_inner(), IMAGE_MAX_SECTIONS, and LOG_ERROR.
Referenced by image_open().
|
static |
Definition at line 114 of file image.c.
References imagesection::base_address, be_to_h_u32(), image_ihex::buffer, count, dummy, ERROR_IMAGE_CHECKSUM, ERROR_IMAGE_FORMAT_ERROR, ERROR_OK, image_ihex::fileio, fileio_feof(), fileio_fgets(), fileio_size(), imagesection::flags, IMAGE_MAX_SECTIONS, LOG_ERROR, LOG_WARNING, image::num_sections, imagesection::private, image::sections, imagesection::size, image::start_address, image::start_address_set, and image::type_private.
Referenced by image_ihex_buffer_complete().
|
static |
Allocate memory dynamically instead of on the stack.
This is important w/embedded hosts.
Definition at line 926 of file image.c.
References ERROR_FAIL, IMAGE_MAX_SECTIONS, image_mot_buffer_complete_inner(), and LOG_ERROR.
Referenced by image_open().
|
static |
Definition at line 746 of file image.c.
References imagesection::base_address, image_mot::buffer, count, dummy, ERROR_IMAGE_CHECKSUM, ERROR_IMAGE_FORMAT_ERROR, ERROR_OK, image_mot::fileio, fileio_feof(), fileio_fgets(), fileio_size(), imagesection::flags, LOG_ERROR, LOG_WARNING, image::num_sections, imagesection::private, image::sections, imagesection::size, and image::type_private.
Referenced by image_mot_buffer_complete().
int image_open | ( | struct image * | image, |
const char * | url, | ||
const char * | type_string | ||
) |
Definition at line 949 of file image.c.
References imagesection::base_address, image::base_address, image::base_address_set, image_memory::cache, image_memory::cache_address, ERROR_FAIL, ERROR_OK, image_binary::fileio, image_ihex::fileio, image_elf::fileio, image_mot::fileio, FILEIO_BINARY, fileio_close(), fileio_open(), FILEIO_READ, fileio_size(), FILEIO_TEXT, imagesection::flags, get_target(), identify_image_type(), IMAGE_BINARY, IMAGE_BUILDER, IMAGE_ELF, image_elf_read_headers(), IMAGE_IHEX, image_ihex_buffer_complete(), IMAGE_MEMORY, image_mot_buffer_complete(), IMAGE_SRECORD, LOG_ERROR, NULL, image::num_sections, image::sections, imagesection::size, target, image_memory::target, image::type, and image::type_private.
Referenced by COMMAND_HANDLER(), COMMAND_HELPER(), gdb_v_packet(), load_usb_blaster_firmware(), and ulink_load_firmware().
int image_read_section | ( | struct image * | image, |
int | section, | ||
target_addr_t | offset, | ||
uint32_t | size, | ||
uint8_t * | buffer, | ||
size_t * | size_read | ||
) |
Definition at line 1065 of file image.c.
References imagesection::base_address, buffer, image_memory::cache, image_memory::cache_address, ERROR_COMMAND_SYNTAX_ERROR, ERROR_IMAGE_TEMPORARILY_UNAVAILABLE, ERROR_OK, image_binary::fileio, fileio_read(), fileio_seek(), IMAGE_BINARY, IMAGE_BUILDER, IMAGE_ELF, image_elf_read_section(), IMAGE_IHEX, IMAGE_MEMORY, IMAGE_MEMORY_CACHE_SIZE, IMAGE_SRECORD, LOG_DEBUG, NULL, offset, imagesection::private, image::sections, size, imagesection::size, image_memory::target, TARGET_PRIxADDR, target_read_buffer(), image::type, and image::type_private.
Referenced by COMMAND_HANDLER(), COMMAND_HELPER(), etm_read_instruction(), flash_write_unlock_verify(), ublast2_write_firmware_section(), ulink_write_firmware_section(), and xscale_read_instruction().