- split fileio handling into fileio part and image handling

- reworked etm/etb into a generic etm part with trace capture drivers (currently only etb supported)
- added XScale debug handler binary to repository
- added Thumb disassembling (thanks to Vincent Palatin for this patch)
- added support for non-CFI compatible flashes to cfi driver (currently only SST39VFxxx devices supported)
This checkin is experimental, not suitable for general use


git-svn-id: svn://svn.berlios.de/openocd/trunk@155 b42882b7-edfa-0310-969c-e2dbd0fdcd60
This commit is contained in:
drath
2007-05-29 11:23:42 +00:00
parent e8af4de0a7
commit 237e894805
26 changed files with 2543 additions and 959 deletions

View File

@@ -1,5 +1,5 @@
INCLUDES = -I$(top_srcdir)/src/helper -I$(top_srcdir)/src/jtag -I$(top_srcdir)/src/target $(all_includes) INCLUDES = -I$(top_srcdir)/src/helper -I$(top_srcdir)/src/jtag -I$(top_srcdir)/src/target $(all_includes)
METASOURCES = AUTO METASOURCES = AUTO
noinst_LIBRARIES = libflash.a noinst_LIBRARIES = libflash.a
libflash_a_SOURCES = flash.c lpc2000.c cfi.c at91sam7.c str7x.c str9x.c nand.c lpc3180_nand_controller.c libflash_a_SOURCES = flash.c lpc2000.c cfi.c non_cfi.c at91sam7.c str7x.c str9x.c nand.c lpc3180_nand_controller.c
noinst_HEADERS = flash.h lpc2000.h cfi.h at91sam7.h str7x.h str9x.h nand.h lpc3180_nand_controller.h noinst_HEADERS = flash.h lpc2000.h cfi.h non_cfi.h at91sam7.h str7x.h str9x.h nand.h lpc3180_nand_controller.h

File diff suppressed because it is too large Load Diff

View File

@@ -30,10 +30,12 @@ typedef struct cfi_flash_bank_s
working_area_t *erase_check_algorithm; working_area_t *erase_check_algorithm;
int x16_as_x8; int x16_as_x8;
int jedec_probe;
int not_cfi;
u16 manufacturer; u16 manufacturer;
u16 device_id; u16 device_id;
char qry[3]; char qry[3];
/* identification string */ /* identification string */
@@ -108,6 +110,8 @@ typedef struct cfi_spansion_pri_ext_s
u8 VppMax; u8 VppMax;
u8 TopBottom; u8 TopBottom;
int _reversed_geometry; int _reversed_geometry;
u32 _unlock1;
u32 _unlock2;
} cfi_spansion_pri_ext_t; } cfi_spansion_pri_ext_t;
/* Atmel primary extended query table as defined for and used by /* Atmel primary extended query table as defined for and used by
@@ -124,6 +128,17 @@ typedef struct cfi_atmel_pri_ext_s
u8 page_mode; u8 page_mode;
} cfi_atmel_pri_ext_t; } cfi_atmel_pri_ext_t;
enum {
CFI_UNLOCK_555_2AA,
CFI_UNLOCK_5555_2AAA,
};
typedef struct cfi_unlock_addresses_s
{
u32 unlock1;
u32 unlock2;
} cfi_unlock_addresses_t;
typedef struct cfi_fixup_s typedef struct cfi_fixup_s
{ {
u16 mfr; u16 mfr;
@@ -135,6 +150,7 @@ typedef struct cfi_fixup_s
#define CFI_MFR_AMD 0x0001 #define CFI_MFR_AMD 0x0001
#define CFI_MFR_ATMEL 0x001F #define CFI_MFR_ATMEL 0x001F
#define CFI_MFR_ST 0x0020 /* STMicroelectronics */ #define CFI_MFR_ST 0x0020 /* STMicroelectronics */
#define CFI_MFR_SST 0x00BF
#define CFI_MFR_ANY 0xffff #define CFI_MFR_ANY 0xffff
#define CFI_ID_ANY 0xffff #define CFI_ID_ANY 0xffff

View File

@@ -35,6 +35,7 @@
#include <errno.h> #include <errno.h>
#include <fileio.h> #include <fileio.h>
#include <image.h>
/* command handlers */ /* command handlers */
int handle_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); int handle_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
@@ -493,9 +494,7 @@ int handle_flash_write_command(struct command_context_s *cmd_ctx, char *cmd, cha
u8 *buffer; u8 *buffer;
u32 buf_cnt; u32 buf_cnt;
fileio_t file; image_t image;
fileio_image_t image_info;
enum fileio_sec_type sec_type;
duration_t duration; duration_t duration;
char *duration_text; char *duration_text;
@@ -511,7 +510,12 @@ int handle_flash_write_command(struct command_context_s *cmd_ctx, char *cmd, cha
duration_start_measure(&duration); duration_start_measure(&duration);
fileio_identify_image_type(&sec_type, (argc == 4) ? args[3] : NULL); identify_image_type(&image.type, (argc == 4) ? args[3] : NULL);
image.base_address_set = 1;
image.base_address = strtoul(args[1], NULL, 0);
image.start_address_set = 0;
offset = strtoul(args[2], NULL, 0); offset = strtoul(args[2], NULL, 0);
p = get_flash_bank_by_num(strtoul(args[0], NULL, 0)); p = get_flash_bank_by_num(strtoul(args[0], NULL, 0));
@@ -521,20 +525,16 @@ int handle_flash_write_command(struct command_context_s *cmd_ctx, char *cmd, cha
return ERROR_OK; return ERROR_OK;
} }
image_info.base_address = strtoul(args[2], NULL, 0); if (image_open(&image, args[1], FILEIO_READ) != ERROR_OK)
image_info.has_start_address = 0;
if (fileio_open(&file, args[1], FILEIO_READ,
FILEIO_IMAGE, &image_info, sec_type) != ERROR_OK)
{ {
command_print(cmd_ctx, "flash write error: %s", file.error_str); command_print(cmd_ctx, "flash write error: %s", image.error_str);
return ERROR_OK; return ERROR_OK;
} }
binary_size = file.size; binary_size = image.size;
buffer = malloc(binary_size); buffer = malloc(binary_size);
fileio_read(&file, binary_size, buffer, &buf_cnt); image_read(&image, binary_size, buffer, &buf_cnt);
if ((retval = p->driver->write(p, buffer, offset, buf_cnt)) != ERROR_OK) if ((retval = p->driver->write(p, buffer, offset, buf_cnt)) != ERROR_OK)
{ {
@@ -571,12 +571,12 @@ int handle_flash_write_command(struct command_context_s *cmd_ctx, char *cmd, cha
{ {
duration_stop_measure(&duration, &duration_text); duration_stop_measure(&duration, &duration_text);
command_print(cmd_ctx, "wrote file %s to flash bank %i at offset 0x%8.8x in %s", command_print(cmd_ctx, "wrote file %s to flash bank %i at offset 0x%8.8x in %s",
file.url, strtoul(args[0], NULL, 0), offset, duration_text); args[1], strtoul(args[0], NULL, 0), offset, duration_text);
free(duration_text); free(duration_text);
} }
free(buffer); free(buffer);
fileio_close(&file); image_close(&image);
return ERROR_OK; return ERROR_OK;
} }

View File

@@ -38,6 +38,7 @@
#include "flash.h" #include "flash.h"
#include "time_support.h" #include "time_support.h"
#include "fileio.h" #include "fileio.h"
#include "image.h"
int nand_register_commands(struct command_context_s *cmd_ctx); int nand_register_commands(struct command_context_s *cmd_ctx);
int handle_nand_list_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); int handle_nand_list_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
@@ -1163,10 +1164,8 @@ int handle_nand_write_command(struct command_context_s *cmd_ctx, char *cmd, char
u32 buf_cnt; u32 buf_cnt;
enum oob_formats oob_format = NAND_OOB_NONE; enum oob_formats oob_format = NAND_OOB_NONE;
fileio_t file; image_t image;
fileio_image_t image_info; int image_type_identified = 0;
int sec_type_identified = 0;
enum fileio_sec_type sec_type;
duration_t duration; duration_t duration;
char *duration_text; char *duration_text;
@@ -1201,9 +1200,9 @@ int handle_nand_write_command(struct command_context_s *cmd_ctx, char *cmd, char
oob_format |= NAND_OOB_RAW | NAND_OOB_ONLY; oob_format |= NAND_OOB_RAW | NAND_OOB_ONLY;
else else
{ {
if (fileio_identify_image_type(&sec_type, args[i]) == ERROR_OK) if (identify_image_type(&image.type, args[i]) == ERROR_OK)
{ {
sec_type_identified = 1; image_type_identified = 1;
} }
else else
{ {
@@ -1214,27 +1213,27 @@ int handle_nand_write_command(struct command_context_s *cmd_ctx, char *cmd, char
} }
/* if no image type option was encountered, set the default */ /* if no image type option was encountered, set the default */
if (!sec_type_identified) if (!image_type_identified)
{ {
fileio_identify_image_type(&sec_type, NULL); identify_image_type(&image.type, NULL);
sec_type_identified = 1; image_type_identified = 1;
} }
image_info.base_address = strtoul(args[2], NULL, 0); image.base_address_set = 1;
image_info.has_start_address = 0; image.base_address = strtoul(args[2], NULL, 0);
image.start_address_set = 0;
if (fileio_open(&file, args[1], FILEIO_READ, if (image_open(&image, args[1], FILEIO_READ) != ERROR_OK)
FILEIO_IMAGE, &image_info, sec_type) != ERROR_OK)
{ {
command_print(cmd_ctx, "flash write error: %s", file.error_str); command_print(cmd_ctx, "flash write error: %s", image.error_str);
return ERROR_OK; return ERROR_OK;
} }
/* the offset might have been overwritten by the image base address */ /* the offset might have been overwritten by the image base address */
offset = image_info.base_address; offset = image.base_address;
buf_cnt = binary_size = file.size; buf_cnt = binary_size = image.size;
if (!(oob_format & NAND_OOB_ONLY)) if (!(oob_format & NAND_OOB_ONLY))
{ {
@@ -1263,7 +1262,7 @@ int handle_nand_write_command(struct command_context_s *cmd_ctx, char *cmd, char
if (page) if (page)
{ {
fileio_read(&file, page_size, page, &size_read); image_read(&image, page_size, page, &size_read);
buf_cnt -= size_read; buf_cnt -= size_read;
if (size_read < page_size) if (size_read < page_size)
{ {
@@ -1273,7 +1272,7 @@ int handle_nand_write_command(struct command_context_s *cmd_ctx, char *cmd, char
if (oob) if (oob)
{ {
fileio_read(&file, oob_size, oob, &size_read); image_read(&image, oob_size, oob, &size_read);
buf_cnt -= size_read; buf_cnt -= size_read;
if (size_read < oob_size) if (size_read < oob_size)
{ {
@@ -1284,7 +1283,7 @@ int handle_nand_write_command(struct command_context_s *cmd_ctx, char *cmd, char
if (nand_write_page(p, offset / p->page_size, page, page_size, oob, oob_size) != ERROR_OK) if (nand_write_page(p, offset / p->page_size, page, page_size, oob, oob_size) != ERROR_OK)
{ {
command_print(cmd_ctx, "failed writing file %s to NAND flash %s at offset 0x%8.8x", command_print(cmd_ctx, "failed writing file %s to NAND flash %s at offset 0x%8.8x",
file.url, args[0], offset); args[1], args[0], offset);
return ERROR_OK; return ERROR_OK;
} }
offset += page_size; offset += page_size;
@@ -1292,7 +1291,7 @@ int handle_nand_write_command(struct command_context_s *cmd_ctx, char *cmd, char
duration_stop_measure(&duration, &duration_text); duration_stop_measure(&duration, &duration_text);
command_print(cmd_ctx, "wrote file %s to NAND flash %s at offset 0x%8.8x in %s", command_print(cmd_ctx, "wrote file %s to NAND flash %s at offset 0x%8.8x in %s",
file.url, args[0], image_info.base_address, duration_text); args[1], args[0], image.base_address, duration_text);
free(duration_text); free(duration_text);
} }
else else
@@ -1318,8 +1317,7 @@ int handle_nand_dump_command(struct command_context_s *cmd_ctx, char *cmd, char
{ {
if (p->device) if (p->device)
{ {
fileio_t file; fileio_t fileio;
fileio_image_t image_info;
duration_t duration; duration_t duration;
char *duration_text; char *duration_text;
int retval; int retval;
@@ -1367,14 +1365,10 @@ int handle_nand_dump_command(struct command_context_s *cmd_ctx, char *cmd, char
oob_size = 64; oob_size = 64;
oob = malloc(oob_size); oob = malloc(oob_size);
} }
image_info.base_address = address;
image_info.has_start_address = 0;
if (fileio_open(&file, args[1], FILEIO_WRITE, if (fileio_open(&fileio, args[1], FILEIO_WRITE, FILEIO_BINARY) != ERROR_OK)
FILEIO_IMAGE, &image_info, FILEIO_PLAIN) != ERROR_OK)
{ {
command_print(cmd_ctx, "dump_image error: %s", file.error_str); command_print(cmd_ctx, "dump_image error: %s", fileio.error_str);
return ERROR_OK; return ERROR_OK;
} }
@@ -1391,13 +1385,13 @@ int handle_nand_dump_command(struct command_context_s *cmd_ctx, char *cmd, char
if (page) if (page)
{ {
fileio_write(&file, page_size, page, &size_written); fileio_write(&fileio, page_size, page, &size_written);
bytes_done += page_size; bytes_done += page_size;
} }
if (oob) if (oob)
{ {
fileio_write(&file, oob_size, oob, &size_written); fileio_write(&fileio, oob_size, oob, &size_written);
bytes_done += oob_size; bytes_done += oob_size;
} }
@@ -1411,10 +1405,10 @@ int handle_nand_dump_command(struct command_context_s *cmd_ctx, char *cmd, char
if (oob) if (oob)
free(oob); free(oob);
fileio_close(&file); fileio_close(&fileio);
duration_stop_measure(&duration, &duration_text); duration_stop_measure(&duration, &duration_text);
command_print(cmd_ctx, "dumped %lli byte in %s", file.size, duration_text); command_print(cmd_ctx, "dumped %lli byte in %s", fileio.size, duration_text);
free(duration_text); free(duration_text);
} }
else else

175
src/flash/non_cfi.c Normal file
View File

@@ -0,0 +1,175 @@
/***************************************************************************
* Copyright (C) 2007 by Dominic Rath *
* Dominic.Rath@gmx.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* 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. *
***************************************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include "log.h"
#include "flash.h"
#include "cfi.h"
#include "non_cfi.h"
/* non-CFI compatible flashes */
non_cfi_t non_cfi_flashes[] = {
{
.mfr = CFI_MFR_SST,
.id = 0xd4,
.pri_id = 0x02,
.dev_size = 0x10,
.interface_desc = 0x0,
.max_buf_write_size = 0x0,
.num_erase_regions = 1,
.erase_region_info =
{
0x0010000f,
0x00000000
}
},
{
.mfr = CFI_MFR_SST,
.id = 0xd5,
.pri_id = 0x02,
.dev_size = 0x11,
.interface_desc = 0x0,
.max_buf_write_size = 0x0,
.num_erase_regions = 1,
.erase_region_info =
{
0x0010001f,
0x00000000
}
},
{
.mfr = CFI_MFR_SST,
.id = 0xd6,
.pri_id = 0x02,
.dev_size = 0x12,
.interface_desc = 0x0,
.max_buf_write_size = 0x0,
.num_erase_regions = 1,
.erase_region_info =
{
0x0010003f,
0x00000000
}
},
{
.mfr = CFI_MFR_SST,
.id = 0xd7,
.pri_id = 0x02,
.dev_size = 0x13,
.interface_desc = 0x0,
.max_buf_write_size = 0x0,
.num_erase_regions = 1,
.erase_region_info =
{
0x0010007f,
0x00000000
}
},
{
.mfr = 0,
.id = 0,
}
};
void cfi_fixup_non_cfi(flash_bank_t *bank, void *param)
{
cfi_flash_bank_t *cfi_info = bank->driver_priv;
non_cfi_t *non_cfi = non_cfi_flashes;
while (non_cfi->mfr)
{
if ((cfi_info->manufacturer == non_cfi->mfr)
&& (cfi_info->device_id == non_cfi->id))
{
break;
}
non_cfi++;
}
cfi_info->not_cfi = 1;
/* fill in defaults for non-critical data */
cfi_info->vcc_min = 0x0;
cfi_info->vcc_max = 0x0;
cfi_info->vpp_min = 0x0;
cfi_info->vpp_max = 0x0;
cfi_info->word_write_timeout_typ = 0x0;
cfi_info->buf_write_timeout_typ = 0x0;
cfi_info->block_erase_timeout_typ = 0x0;
cfi_info->chip_erase_timeout_typ = 0x0;
cfi_info->word_write_timeout_max = 0x0;
cfi_info->buf_write_timeout_max = 0x0;
cfi_info->block_erase_timeout_max = 0x0;
cfi_info->chip_erase_timeout_max = 0x0;
cfi_info->qry[0] = 'Q';
cfi_info->qry[1] = 'R';
cfi_info->qry[2] = 'Y';
cfi_info->pri_id = non_cfi->pri_id;
cfi_info->pri_addr = 0x0;
cfi_info->alt_id = 0x0;
cfi_info->alt_addr = 0x0;
cfi_info->alt_ext = NULL;
cfi_info->interface_desc = non_cfi->interface_desc;
cfi_info->max_buf_write_size = non_cfi->max_buf_write_size;
cfi_info->num_erase_regions = non_cfi->num_erase_regions;
cfi_info->erase_region_info = non_cfi->erase_region_info;
if (cfi_info->pri_id == 0x2)
{
cfi_spansion_pri_ext_t *pri_ext = malloc(sizeof(cfi_spansion_pri_ext_t));
pri_ext->pri[0] = 'P';
pri_ext->pri[1] = 'R';
pri_ext->pri[2] = 'I';
pri_ext->major_version = '1';
pri_ext->minor_version = '0';
pri_ext->SiliconRevision = 0x0;
pri_ext->EraseSuspend = 0x0;
pri_ext->EraseSuspend = 0x0;
pri_ext->BlkProt = 0x0;
pri_ext->TmpBlkUnprotect = 0x0;
pri_ext->BlkProtUnprot = 0x0;
pri_ext->SimultaneousOps = 0x0;
pri_ext->BurstMode = 0x0;
pri_ext->PageMode = 0x0;
pri_ext->VppMin = 0x0;
pri_ext->VppMax = 0x0;
pri_ext->TopBottom = 0x0;
pri_ext->_reversed_geometry = 0;
cfi_info->pri_ext = pri_ext;
} else if ((cfi_info->pri_id == 0x1) || (cfi_info->pri_id == 0x3))
{
ERROR("BUG: non-CFI flashes using the Intel commandset are not yet supported");
exit(-1);
}
}

41
src/flash/non_cfi.h Normal file
View File

@@ -0,0 +1,41 @@
/***************************************************************************
* Copyright (C) 2007 by Dominic Rath *
* Dominic.Rath@gmx.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* 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. *
***************************************************************************/
#ifndef NON_CFI_H
#define NON_CFI_H
#include "types.h"
typedef struct non_cfi_s
{
u16 mfr;
u16 id;
u16 pri_id;
u8 dev_size;
u16 interface_desc;
u16 max_buf_write_size;
u8 num_erase_regions;
u32 erase_region_info[6];
} non_cfi_t;
extern non_cfi_t non_cfi_flashes[];
extern void cfi_fixup_non_cfi(flash_bank_t *bank, void *param);
#endif /* NON_CFI_H */

View File

@@ -98,7 +98,7 @@ int fileio_open_local(fileio_t *fileio)
} }
} }
if (fileio->pri_type == FILEIO_IMAGE) if (fileio->type == FILEIO_BINARY)
strcat(access, "b"); strcat(access, "b");
if (!(fileio_local->file = fopen(fileio->url, access))) if (!(fileio_local->file = fopen(fileio->url, access)))
@@ -120,126 +120,7 @@ int fileio_open_local(fileio_t *fileio)
return ERROR_OK; return ERROR_OK;
} }
//#ifdef FILEIO_BUFFER_COMPLETE_IHEX int fileio_open(fileio_t *fileio, char *url, enum fileio_access access, enum fileio_type type)
int fileio_ihex_buffer_complete(fileio_t *fileio)
{
fileio_image_t *image = fileio->pri_type_private;
fileio_ihex_t *ihex = fileio->sec_type_private;
u32 raw_bytes_read, raw_bytes;
int retval;
u32 full_address = image->base_address;
char *buffer = malloc(ihex->raw_size);
u32 cooked_bytes = 0x0;
ihex->raw_size = fileio->size;
ihex->buffer = malloc(ihex->raw_size >> 1);
if ((retval = fileio_dispatch_read(fileio, ihex->raw_size, (u8*)buffer, &raw_bytes_read)) != ERROR_OK)
{
free(buffer);
ERROR("failed buffering IHEX file, read failed");
return ERROR_FILEIO_OPERATION_FAILED;
}
if (raw_bytes_read != ihex->raw_size)
{
free(buffer);
ERROR("failed buffering complete IHEX file, only partially read");
return ERROR_FILEIO_OPERATION_FAILED;
}
raw_bytes = 0x0;
while (raw_bytes < raw_bytes_read)
{
u32 count;
u32 address;
u32 record_type;
u32 checksum;
if (sscanf(&buffer[raw_bytes], ":%2x%4x%2x", &count, &address, &record_type) != 3)
{
snprintf(fileio->error_str, FILEIO_MAX_ERROR_STRING, "invalid IHEX record");
return ERROR_FILEIO_OPERATION_FAILED;
}
raw_bytes += 9;
if (record_type == 0)
{
if ((full_address & 0xffff) != address)
{
free(buffer);
ERROR("can't handle non-linear IHEX file");
snprintf(fileio->error_str, FILEIO_MAX_ERROR_STRING, "can't handle non-linear IHEX file");
return ERROR_FILEIO_OPERATION_FAILED;
}
while (count-- > 0)
{
sscanf(&buffer[raw_bytes], "%2hhx", &ihex->buffer[cooked_bytes]);
raw_bytes += 2;
cooked_bytes += 1;
full_address++;
}
}
else if (record_type == 1)
{
free(buffer);
fileio->size = cooked_bytes;
return ERROR_OK;
}
else if (record_type == 4)
{
u16 upper_address;
sscanf(&buffer[raw_bytes], "%4hx", &upper_address);
raw_bytes += 4;
if ((full_address >> 16) != upper_address)
{
free(buffer);
ERROR("can't handle non-linear IHEX file");
snprintf(fileio->error_str, FILEIO_MAX_ERROR_STRING, "can't handle non-linear IHEX file");
return ERROR_FILEIO_OPERATION_FAILED;
}
}
else if (record_type == 5)
{
u32 start_address;
sscanf(&buffer[raw_bytes], "%8x", &start_address);
raw_bytes += 8;
image->has_start_address = 1;
image->start_address = be_to_h_u32((u8*)&start_address);
}
else
{
free(buffer);
ERROR("unhandled IHEX record type: %i", record_type);
snprintf(fileio->error_str, FILEIO_MAX_ERROR_STRING, "unhandled IHEX record type: %i", record_type);
return ERROR_FILEIO_OPERATION_FAILED;
}
sscanf(&buffer[raw_bytes], "%2x", &checksum);
raw_bytes += 2;
/* consume new-line character(s) */
if ((buffer[raw_bytes] == '\n') || (buffer[raw_bytes] == '\r'))
raw_bytes++;
if ((buffer[raw_bytes] == '\n') || (buffer[raw_bytes] == '\r'))
raw_bytes++;
}
free(buffer);
ERROR("premature end of IHEX file, no end-of-file record found");
snprintf(fileio->error_str, FILEIO_MAX_ERROR_STRING, "premature end of IHEX file, no end-of-file record found");
return ERROR_FILEIO_OPERATION_FAILED;
}
//#endif
int fileio_open(fileio_t *fileio, char *url, enum fileio_access access,
enum fileio_pri_type pri_type, void *pri_info, enum fileio_sec_type sec_type)
{ {
int retval = ERROR_OK; int retval = ERROR_OK;
char *resource_identifier = NULL; char *resource_identifier = NULL;
@@ -261,9 +142,8 @@ int fileio_open(fileio_t *fileio, char *url, enum fileio_access access,
fileio->location = FILEIO_LOCAL; fileio->location = FILEIO_LOCAL;
} }
fileio->type = type;
fileio->access = access; fileio->access = access;
fileio->pri_type = pri_type;
fileio->sec_type = sec_type;
fileio->url = strdup(url); fileio->url = strdup(url);
switch (fileio->location) switch (fileio->location)
@@ -279,50 +159,6 @@ int fileio_open(fileio_t *fileio, char *url, enum fileio_access access,
if (retval != ERROR_OK) if (retval != ERROR_OK)
return retval; return retval;
if (fileio->pri_type == FILEIO_TEXT)
{
/* do nothing for now */
return ERROR_OK;
}
else if (fileio->pri_type == FILEIO_IMAGE)
{
fileio_image_t *image = malloc(sizeof(fileio_image_t));
fileio_image_t *image_info = pri_info;
fileio->pri_type_private = image;
*image = *image_info;
if (fileio->sec_type == FILEIO_PLAIN)
{
fileio->sec_type_private = NULL;
}
else if (fileio->sec_type == FILEIO_IHEX)
{
fileio_ihex_t *fileio_ihex;
if (fileio->access != FILEIO_READ)
{
ERROR("can't write/append to a IHEX file");
snprintf(fileio->error_str, FILEIO_MAX_ERROR_STRING, "can't write/append to a IHEX file");
fileio_close(fileio);
return ERROR_FILEIO_OPERATION_FAILED;
}
fileio_ihex = malloc(sizeof(fileio_ihex_t));
fileio->sec_type_private = fileio_ihex;
fileio_ihex->position = 0;
fileio_ihex->raw_size = fileio->size;
#ifdef FILEIO_BUFFER_COMPLETE_IHEX
if (fileio_ihex_buffer_complete(fileio) != ERROR_OK)
{
fileio_close(fileio);
return ERROR_FILEIO_OPERATION_FAILED;
}
#endif
}
}
return ERROR_OK; return ERROR_OK;
} }
@@ -369,29 +205,6 @@ int fileio_close(fileio_t *fileio)
free(fileio->url); free(fileio->url);
if (fileio->pri_type == FILEIO_TEXT)
{
/* do nothing for now */
}
else if (fileio->pri_type == FILEIO_IMAGE)
{
if (fileio->sec_type == FILEIO_PLAIN)
{
/* nothing special to do for plain binary */
}
else if (fileio->sec_type == FILEIO_IHEX)
{
fileio_ihex_t *fileio_ihex = fileio->sec_type_private;
if (fileio_ihex->buffer)
free(fileio_ihex->buffer);
free(fileio->sec_type_private);
}
free(fileio->pri_type_private);
}
return ERROR_OK; return ERROR_OK;
} }
@@ -432,7 +245,7 @@ int fileio_local_read(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_read)
return ERROR_OK; return ERROR_OK;
} }
int fileio_dispatch_read(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_read) int fileio_read(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_read)
{ {
switch (fileio->location) switch (fileio->location)
{ {
@@ -445,38 +258,6 @@ int fileio_dispatch_read(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_read)
} }
} }
int fileio_read_ihex(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_read)
{
fileio_ihex_t *fileio_ihex = fileio->sec_type_private;
if ((fileio_ihex->position + size) > fileio->size)
{
/* don't read past the end of the file */
size = (fileio->size - fileio_ihex->position);
}
#ifdef FILEIO_BUFFER_COMPLETE_IHEX
memcpy(buffer, fileio_ihex->buffer + fileio_ihex->position, size);
*size_read = size;
#endif
return ERROR_OK;
}
int fileio_read(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_read)
{
if (fileio->sec_type == FILEIO_PLAIN)
{
return fileio_dispatch_read(fileio, size, buffer, size_read);
}
else if (fileio->sec_type == FILEIO_IHEX)
{
return fileio_read_ihex(fileio, size, buffer, size_read);
}
return ERROR_OK;
}
int fileio_local_write(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_written) int fileio_local_write(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_written)
{ {
fileio_local_t *fileio_local = fileio->location_private; fileio_local_t *fileio_local = fileio->location_private;
@@ -486,7 +267,7 @@ int fileio_local_write(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_written
return ERROR_OK; return ERROR_OK;
} }
int fileio_dispatch_write(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_written) int fileio_write(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_written)
{ {
switch (fileio->location) switch (fileio->location)
{ {
@@ -499,48 +280,3 @@ int fileio_dispatch_write(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_writ
return ERROR_OK; return ERROR_OK;
} }
int fileio_write(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_written)
{
int retval = ERROR_FILEIO_OPERATION_NOT_SUPPORTED;
if (fileio->sec_type == FILEIO_PLAIN)
{
retval = fileio_dispatch_write(fileio, size, buffer, size_written);
}
else if (fileio->sec_type == FILEIO_IHEX)
{
return ERROR_FILEIO_OPERATION_NOT_SUPPORTED;
}
if (retval != ERROR_OK)
return retval;
fileio->size += size;
return ERROR_OK;
}
int fileio_identify_image_type(enum fileio_sec_type *sec_type, char *type_string)
{
if (type_string)
{
if (!strcmp(type_string, "bin"))
{
*sec_type = FILEIO_PLAIN;
}
else if (!strcmp(type_string, "ihex"))
{
*sec_type = FILEIO_IHEX;
}
else
{
return ERROR_FILEIO_RESOURCE_TYPE_UNKNOWN;
}
}
else
{
*sec_type = FILEIO_PLAIN;
}
return ERROR_OK;
}

View File

@@ -22,28 +22,20 @@
#define FILEIO_MAX_ERROR_STRING (128) #define FILEIO_MAX_ERROR_STRING (128)
/* make buffering of complete intel-hex format files optional #include "types.h"
* to account for resource-limited hosts
*/
#define FILEIO_BUFFER_COMPLETE_IHEX
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <errno.h>
#include <ctype.h>
enum fileio_pri_type enum fileio_type
{ {
FILEIO_TEXT = 0x1, FILEIO_TEXT,
FILEIO_IMAGE = 0x2, FILEIO_BINARY,
};
enum fileio_sec_type
{
FILEIO_PLAIN = 0x10,
FILEIO_IHEX = 0x20,
/*
* Possible future enhancements:
* FILEIO_ELF,
* FILEIO_SRECORD,
*/
}; };
enum fileio_location enum fileio_location
@@ -73,48 +65,23 @@ typedef struct fileio_s
char *url; char *url;
char error_str[FILEIO_MAX_ERROR_STRING]; char error_str[FILEIO_MAX_ERROR_STRING];
long long size; long long size;
enum fileio_pri_type pri_type; enum fileio_type type;
enum fileio_sec_type sec_type;
enum fileio_location location; enum fileio_location location;
enum fileio_access access; enum fileio_access access;
void *location_private; void *location_private;
void *pri_type_private;
void *sec_type_private;
} fileio_t; } fileio_t;
typedef struct fileio_text_s
{
} fileio_text_t;
typedef struct fileio_image_s
{
u32 base_address;
int has_start_address;
u32 start_address;
} fileio_image_t;
typedef struct fileio_local_s typedef struct fileio_local_s
{ {
FILE *file; FILE *file;
struct stat file_stat; struct stat file_stat;
} fileio_local_t; } fileio_local_t;
typedef struct fileio_ihex_s
{
u32 position;
u32 raw_size;
#ifdef FILEIO_BUFFER_COMPLETE_IHEX
u8 *buffer;
#endif
} fileio_ihex_t;
extern int fileio_identify_image_type(enum fileio_sec_type *sec_type, char *type_string);
extern int fileio_write(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_written); extern int fileio_write(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_written);
extern int fileio_read(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_read); extern int fileio_read(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_read);
extern int fileio_seek(fileio_t *fileio, u32 position); extern int fileio_seek(fileio_t *fileio, u32 position);
extern int fileio_close(fileio_t *fileio); extern int fileio_close(fileio_t *fileio);
extern int fileio_open(fileio_t *fileio, char *url, enum fileio_access access, extern int fileio_open(fileio_t *fileio, char *url, enum fileio_access access, enum fileio_type type);
enum fileio_pri_type pri_type, void *pri_info, enum fileio_sec_type sec_type);
#define ERROR_FILEIO_LOCATION_UNKNOWN (-1200) #define ERROR_FILEIO_LOCATION_UNKNOWN (-1200)
#define ERROR_FILEIO_NOT_FOUND (-1201) #define ERROR_FILEIO_NOT_FOUND (-1201)

View File

@@ -1282,6 +1282,7 @@ int jtag_examine_chain()
{ {
ERROR("number of discovered devices in JTAG chain (%i) doesn't match configuration (%i)", ERROR("number of discovered devices in JTAG chain (%i) doesn't match configuration (%i)",
device_count, jtag_num_devices); device_count, jtag_num_devices);
ERROR("check the config file and ensure proper JTAG communication (connections, speed, ...)");
exit(-1); exit(-1);
} }

View File

@@ -18,7 +18,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#define OPENOCD_VERSION "Open On-Chip Debugger (2007-04-26 16:40 CEST)" #define OPENOCD_VERSION "Open On-Chip Debugger (2007-05-29 13:15 CEST)"
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"

View File

@@ -3,7 +3,7 @@ METASOURCES = AUTO
noinst_LIBRARIES = libtarget.a noinst_LIBRARIES = libtarget.a
libtarget_a_SOURCES = target.c register.c breakpoints.c armv4_5.c embeddedice.c etm.c arm7tdmi.c arm9tdmi.c \ libtarget_a_SOURCES = target.c register.c breakpoints.c armv4_5.c embeddedice.c etm.c arm7tdmi.c arm9tdmi.c \
arm_jtag.c arm7_9_common.c algorithm.c arm920t.c arm720t.c armv4_5_mmu.c armv4_5_cache.c arm_disassembler.c \ arm_jtag.c arm7_9_common.c algorithm.c arm920t.c arm720t.c armv4_5_mmu.c armv4_5_cache.c arm_disassembler.c \
arm966e.c arm926ejs.c etb.c xscale.c arm_simulator.c arm966e.c arm926ejs.c etb.c xscale.c arm_simulator.c image.c
noinst_HEADERS = target.h register.h armv4_5.h embeddedice.h etm.h arm7tdmi.h arm9tdmi.h \ noinst_HEADERS = target.h register.h armv4_5.h embeddedice.h etm.h arm7tdmi.h arm9tdmi.h \
arm_jtag.h arm7_9_common.h arm920t.h arm720t.h armv4_5_mmu.h armv4_5_cache.h breakpoints.h algorithm.h \ arm_jtag.h arm7_9_common.h arm920t.h arm720t.h armv4_5_mmu.h armv4_5_cache.h breakpoints.h algorithm.h \
arm_disassembler.h arm966e.h arm926ejs.h etb.h xscale.h arm_simulator.h arm_disassembler.h arm966e.h arm926ejs.h etb.h xscale.h arm_simulator.h image.h

View File

@@ -2096,8 +2096,6 @@ int arm7_9_register_commands(struct command_context_s *cmd_ctx)
arm7_9_cmd = register_command(cmd_ctx, NULL, "arm7_9", NULL, COMMAND_ANY, "arm7/9 specific commands"); arm7_9_cmd = register_command(cmd_ctx, NULL, "arm7_9", NULL, COMMAND_ANY, "arm7/9 specific commands");
register_command(cmd_ctx, arm7_9_cmd, "etm", handle_arm7_9_etm_command, COMMAND_CONFIG, NULL);
register_command(cmd_ctx, arm7_9_cmd, "write_xpsr", handle_arm7_9_write_xpsr_command, COMMAND_EXEC, "write program status register <value> <not cpsr|spsr>"); register_command(cmd_ctx, arm7_9_cmd, "write_xpsr", handle_arm7_9_write_xpsr_command, COMMAND_EXEC, "write program status register <value> <not cpsr|spsr>");
register_command(cmd_ctx, arm7_9_cmd, "write_xpsr_im8", handle_arm7_9_write_xpsr_im8_command, COMMAND_EXEC, "write program status register <8bit immediate> <rotate> <not cpsr|spsr>"); register_command(cmd_ctx, arm7_9_cmd, "write_xpsr_im8", handle_arm7_9_write_xpsr_im8_command, COMMAND_EXEC, "write program status register <8bit immediate> <rotate> <not cpsr|spsr>");
@@ -2115,7 +2113,8 @@ int arm7_9_register_commands(struct command_context_s *cmd_ctx)
COMMAND_ANY, "use DCC downloads for larger memory writes <enable|disable>"); COMMAND_ANY, "use DCC downloads for larger memory writes <enable|disable>");
armv4_5_register_commands(cmd_ctx); armv4_5_register_commands(cmd_ctx);
etb_register_commands(cmd_ctx, arm7_9_cmd);
etm_register_commands(cmd_ctx);
return ERROR_OK; return ERROR_OK;
} }
@@ -2425,83 +2424,6 @@ int handle_arm7_9_dcc_downloads_command(struct command_context_s *cmd_ctx, char
return ERROR_OK; return ERROR_OK;
} }
int handle_arm7_9_etm_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
target_t *target;
armv4_5_common_t *armv4_5;
arm7_9_common_t *arm7_9;
if (argc != 1)
{
ERROR("incomplete 'arm7_9 etm <target>' command");
exit(-1);
}
target = get_target_by_num(strtoul(args[0], NULL, 0));
if (!target)
{
ERROR("target number '%s' not defined", args[0]);
exit(-1);
}
if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK)
{
command_print(cmd_ctx, "current target isn't an ARM7/ARM9 target");
return ERROR_OK;
}
arm7_9->has_etm = 1;
return ERROR_OK;
}
int handle_arm7_9_etb_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
target_t *target;
jtag_device_t *jtag_device;
armv4_5_common_t *armv4_5;
arm7_9_common_t *arm7_9;
if (argc != 2)
{
ERROR("incomplete 'arm7_9 etb <target> <chain_pos>' command");
exit(-1);
}
target = get_target_by_num(strtoul(args[0], NULL, 0));
if (!target)
{
ERROR("target number '%s' not defined", args[0]);
exit(-1);
}
if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK)
{
command_print(cmd_ctx, "current target isn't an ARM7/ARM9 target");
return ERROR_OK;
}
jtag_device = jtag_get_device(strtoul(args[1], NULL, 0));
if (!jtag_device)
{
ERROR("jtag device number '%s' not defined", args[1]);
exit(-1);
}
arm7_9->etb = malloc(sizeof(etb_t));
arm7_9->etb->chain_pos = strtoul(args[1], NULL, 0);
arm7_9->etb->cur_scan_chain = -1;
arm7_9->etb->reg_cache = NULL;
arm7_9->etb->RAM_width = 0;
arm7_9->etb->RAM_depth = 0;
return ERROR_OK;
}
int arm7_9_init_arch_info(target_t *target, arm7_9_common_t *arm7_9) int arm7_9_init_arch_info(target_t *target, arm7_9_common_t *arm7_9)
{ {
armv4_5_common_t *armv4_5 = &arm7_9->armv4_5_common; armv4_5_common_t *armv4_5 = &arm7_9->armv4_5_common;
@@ -2515,8 +2437,7 @@ int arm7_9_init_arch_info(target_t *target, arm7_9_common_t *arm7_9)
arm7_9->force_hw_bkpts = 0; arm7_9->force_hw_bkpts = 0;
arm7_9->use_dbgrq = 0; arm7_9->use_dbgrq = 0;
arm7_9->has_etm = 0; arm7_9->etm_ctx = NULL;
arm7_9->etb = NULL;
arm7_9->has_single_step = 0; arm7_9->has_single_step = 0;
arm7_9->has_monitor_mode = 0; arm7_9->has_monitor_mode = 0;
arm7_9->has_vector_catch = 0; arm7_9->has_vector_catch = 0;

View File

@@ -25,7 +25,7 @@
#include "breakpoints.h" #include "breakpoints.h"
#include "target.h" #include "target.h"
#include "etb.h" #include "etm.h"
#define ARM7_9_COMMON_MAGIC 0x0a790a79 #define ARM7_9_COMMON_MAGIC 0x0a790a79
@@ -35,7 +35,6 @@ typedef struct arm7_9_common_s
arm_jtag_t jtag_info; arm_jtag_t jtag_info;
reg_cache_t *eice_cache; reg_cache_t *eice_cache;
reg_cache_t *etm_cache;
u32 arm_bkpt; u32 arm_bkpt;
u16 thumb_bkpt; u16 thumb_bkpt;
@@ -48,8 +47,8 @@ typedef struct arm7_9_common_s
int dbgreq_adjust_pc; int dbgreq_adjust_pc;
int use_dbgrq; int use_dbgrq;
int has_etm; etm_context_t *etm_ctx;
etb_t *etb;
int has_single_step; int has_single_step;
int has_monitor_mode; int has_monitor_mode;
int has_vector_catch; int has_vector_catch;

View File

@@ -744,10 +744,10 @@ void arm7tdmi_build_reg_cache(target_t *target)
(*cache_p)->next = embeddedice_build_reg_cache(target, arm7_9); (*cache_p)->next = embeddedice_build_reg_cache(target, arm7_9);
arm7_9->eice_cache = (*cache_p)->next; arm7_9->eice_cache = (*cache_p)->next;
if (arm7_9->has_etm) if (arm7_9->etm_ctx)
{ {
(*cache_p)->next->next = etm_build_reg_cache(target, jtag_info, 0); (*cache_p)->next->next = etm_build_reg_cache(target, jtag_info, arm7_9->etm_ctx);
arm7_9->etm_cache = (*cache_p)->next->next; arm7_9->etm_ctx->reg_cache = (*cache_p)->next->next;
} }
} }

View File

@@ -874,16 +874,10 @@ void arm9tdmi_build_reg_cache(target_t *target)
(*cache_p)->next = embeddedice_build_reg_cache(target, arm7_9); (*cache_p)->next = embeddedice_build_reg_cache(target, arm7_9);
arm7_9->eice_cache = (*cache_p)->next; arm7_9->eice_cache = (*cache_p)->next;
if (arm7_9->has_etm) if (arm7_9->etm_ctx)
{ {
(*cache_p)->next->next = etm_build_reg_cache(target, jtag_info, 0); (*cache_p)->next->next = etm_build_reg_cache(target, jtag_info, arm7_9->etm_ctx);
arm7_9->etm_cache = (*cache_p)->next->next; arm7_9->etm_ctx->reg_cache = (*cache_p)->next->next;
}
if (arm7_9->etb)
{
(*cache_p)->next->next->next = etb_build_reg_cache(arm7_9->etb);
arm7_9->etb->reg_cache = (*cache_p)->next->next->next;
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -133,7 +133,7 @@ union arm_shifter_operand
} immediate; } immediate;
struct { struct {
u8 Rm; u8 Rm;
u8 shift; u8 shift; /* 0: LSL, 1: LSR, 2: ASR, 3: ROR, 4: RRX */
u8 shift_imm; u8 shift_imm;
} immediate_shift; } immediate_shift;
struct { struct {
@@ -164,7 +164,7 @@ typedef struct arm_load_store_instr_s
u32 offset; u32 offset;
struct { struct {
u8 Rm; u8 Rm;
u8 shift; u8 shift; /* 0: LSL, 1: LSR, 2: ASR, 3: ROR, 4: RRX */
u8 shift_imm; u8 shift_imm;
} reg; } reg;
} offset; } offset;
@@ -195,6 +195,7 @@ typedef struct arm_instruction_s
} arm_instruction_t; } arm_instruction_t;
extern int arm_evaluate_opcode(u32 opcode, u32 address, arm_instruction_t *instruction); extern int arm_evaluate_opcode(u32 opcode, u32 address, arm_instruction_t *instruction);
extern int thumb_evaluate_opcode(u16 opcode, u32 address, arm_instruction_t *instruction);
#define COND(opcode) (arm_condition_strings[(opcode & 0xf0000000)>>28]) #define COND(opcode) (arm_condition_strings[(opcode & 0xf0000000)>>28])

View File

@@ -257,6 +257,11 @@ int pass_condition(u32 cpsr, u32 opcode)
return 0; return 0;
} }
int thumb_pass_branch_condition(u32 cpsr, u16 opcode)
{
return pass_condition(cpsr, (opcode & 0x0f00) << 20);
}
/* simulate a single step (if possible) /* simulate a single step (if possible)
* if the dry_run_pc argument is provided, no state is changed, * if the dry_run_pc argument is provided, no state is changed,
* but the new pc is stored in the variable pointed at by the argument * but the new pc is stored in the variable pointed at by the argument
@@ -275,26 +280,43 @@ int arm_simulate_step(target_t *target, u32 *dry_run_pc)
target_read_u32(target, current_pc, &opcode); target_read_u32(target, current_pc, &opcode);
arm_evaluate_opcode(opcode, current_pc, &instruction); arm_evaluate_opcode(opcode, current_pc, &instruction);
instruction_size = 4; instruction_size = 4;
/* check condition code (for all instructions) */
if (!pass_condition(buf_get_u32(armv4_5->core_cache->reg_list[ARMV4_5_CPSR].value, 0, 32), opcode))
{
if (dry_run_pc)
{
*dry_run_pc = current_pc + instruction_size;
}
else
{
buf_set_u32(armv4_5->core_cache->reg_list[15].value, 0, 32, current_pc + instruction_size);
}
return ERROR_OK;
}
} }
else else
{ {
/* TODO: add support for Thumb instruction set */ target_read_u32(target, current_pc, &opcode);
arm_evaluate_opcode(opcode, current_pc, &instruction);
instruction_size = 2; instruction_size = 2;
}
/* check condition code */
if (!pass_condition(buf_get_u32(armv4_5->core_cache->reg_list[ARMV4_5_CPSR].value, 0, 32), opcode))
{
if (dry_run_pc)
{
*dry_run_pc = current_pc + instruction_size;
}
else
{
buf_set_u32(armv4_5->core_cache->reg_list[15].value, 0, 32, current_pc + instruction_size);
}
return ERROR_OK; /* check condition code (only for branch instructions) */
if ((!thumb_pass_branch_condition(buf_get_u32(armv4_5->core_cache->reg_list[ARMV4_5_CPSR].value, 0, 32), opcode)) &&
(instruction.type == ARM_B))
{
if (dry_run_pc)
{
*dry_run_pc = current_pc + instruction_size;
}
else
{
buf_set_u32(armv4_5->core_cache->reg_list[15].value, 0, 32, current_pc + instruction_size);
}
return ERROR_OK;
}
} }
/* examine instruction type */ /* examine instruction type */

View File

@@ -23,7 +23,7 @@
#include "register.h" #include "register.h"
#include "target.h" #include "target.h"
enum armv4_5_mode typedef enum armv4_5_mode
{ {
ARMV4_5_MODE_USR = 16, ARMV4_5_MODE_USR = 16,
ARMV4_5_MODE_FIQ = 17, ARMV4_5_MODE_FIQ = 17,
@@ -33,16 +33,16 @@ enum armv4_5_mode
ARMV4_5_MODE_UND = 27, ARMV4_5_MODE_UND = 27,
ARMV4_5_MODE_SYS = 31, ARMV4_5_MODE_SYS = 31,
ARMV4_5_MODE_ANY = -1 ARMV4_5_MODE_ANY = -1
}; } armv4_5_mode_t;
extern char* armv4_5_mode_strings[]; extern char* armv4_5_mode_strings[];
enum armv4_5_state typedef enum armv4_5_state
{ {
ARMV4_5_STATE_ARM, ARMV4_5_STATE_ARM,
ARMV4_5_STATE_THUMB, ARMV4_5_STATE_THUMB,
ARMV4_5_STATE_JAZELLE, ARMV4_5_STATE_JAZELLE,
}; } armv4_5_state_t;
extern char* armv4_5_state_strings[]; extern char* armv4_5_state_strings[];

Some files were not shown because too many files have changed in this diff Show More