The only remaining user is arm7_9 so remove it from the target API and add
it to struct arm7_9_common to support all its variants with minimal
changes. Many of the variants are likely not correct in the cache/mmu
handling when the bulk write is triggered. This patch does nothing to
change that, except for arm946e, where it was easier to do what might be
the right thing.
Change-Id: Ie73ac07507ff0936fefdb90760046cc8810ed182
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1220
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
15 files changed:
.get_gdb_reg_list = arm_get_gdb_reg_list,
.read_memory = arm720t_read_memory,
.get_gdb_reg_list = arm_get_gdb_reg_list,
.read_memory = arm720t_read_memory,
- .write_memory = arm7_9_write_memory,
+ .write_memory = arm7_9_write_memory_opt,
.read_phys_memory = arm720t_read_phys_memory,
.write_phys_memory = arm720t_write_phys_memory,
.mmu = arm720_mmu,
.virt2phys = arm720_virt2phys,
.read_phys_memory = arm720t_read_phys_memory,
.write_phys_memory = arm720t_write_phys_memory,
.mmu = arm720_mmu,
.virt2phys = arm720_virt2phys,
- .bulk_write_memory = arm7_9_bulk_write_memory,
-
.checksum_memory = arm_checksum_memory,
.blank_check_memory = arm_blank_check_memory,
.checksum_memory = arm_checksum_memory,
.blank_check_memory = arm_blank_check_memory,
+int arm7_9_write_memory_opt(struct target *target,
+ uint32_t address,
+ uint32_t size,
+ uint32_t count,
+ const uint8_t *buffer)
+{
+ struct arm7_9_common *arm7_9 = target_to_arm7_9(target);
+
+ if (size == 4 && count > 32 && arm7_9->bulk_write_memory)
+ return arm7_9->bulk_write_memory(target, address, count, buffer);
+ else
+ return arm7_9_write_memory(target, address, size, count, buffer);
+}
+
static int dcc_count;
static const uint8_t *dcc_buffer;
static int dcc_count;
static const uint8_t *dcc_buffer;
void (*pre_restore_context)(struct target *target);
/**< Callback function called before restoring the processor context */
void (*pre_restore_context)(struct target *target);
/**< Callback function called before restoring the processor context */
+
+ /**
+ * Write target memory in multiples of 4 bytes, optimized for
+ * writing large quantities of data.
+ */
+ int (*bulk_write_memory)(struct target *target, uint32_t address,
+ uint32_t count, const uint8_t *buffer);
};
static inline struct arm7_9_common *target_to_arm7_9(struct target *target)
};
static inline struct arm7_9_common *target_to_arm7_9(struct target *target)
uint32_t size, uint32_t count, uint8_t *buffer);
int arm7_9_write_memory(struct target *target, uint32_t address,
uint32_t size, uint32_t count, const uint8_t *buffer);
uint32_t size, uint32_t count, uint8_t *buffer);
int arm7_9_write_memory(struct target *target, uint32_t address,
uint32_t size, uint32_t count, const uint8_t *buffer);
+int arm7_9_write_memory_opt(struct target *target, uint32_t address,
+ uint32_t size, uint32_t count, const uint8_t *buffer);
int arm7_9_bulk_write_memory(struct target *target, uint32_t address,
uint32_t count, const uint8_t *buffer);
int arm7_9_bulk_write_memory(struct target *target, uint32_t address,
uint32_t count, const uint8_t *buffer);
arm7_9->enable_single_step = arm7_9_enable_eice_step;
arm7_9->disable_single_step = arm7_9_disable_eice_step;
arm7_9->enable_single_step = arm7_9_enable_eice_step;
arm7_9->disable_single_step = arm7_9_disable_eice_step;
+ arm7_9->bulk_write_memory = arm7_9_bulk_write_memory;
+
arm7_9->post_debug_entry = NULL;
arm7_9->pre_restore_context = NULL;
arm7_9->post_debug_entry = NULL;
arm7_9->pre_restore_context = NULL;
.get_gdb_reg_list = arm_get_gdb_reg_list,
.read_memory = arm7_9_read_memory,
.get_gdb_reg_list = arm_get_gdb_reg_list,
.read_memory = arm7_9_read_memory,
- .write_memory = arm7_9_write_memory,
- .bulk_write_memory = arm7_9_bulk_write_memory,
+ .write_memory = arm7_9_write_memory_opt,
.checksum_memory = arm_checksum_memory,
.blank_check_memory = arm_blank_check_memory,
.checksum_memory = arm_checksum_memory,
.blank_check_memory = arm_blank_check_memory,
+int arm920t_write_memory_opt(struct target *target, uint32_t address,
+ uint32_t size, uint32_t count, const uint8_t *buffer)
+{
+ struct arm7_9_common *arm7_9 = target_to_arm7_9(target);
+
+ if (size == 4 && count > 32 && arm7_9->bulk_write_memory)
+ return arm7_9->bulk_write_memory(target, address, count, buffer);
+ else
+ return arm920t_write_memory(target, address, size, count, buffer);
+}
+
/* EXPORTED to FA256 */
int arm920t_soft_reset_halt(struct target *target)
{
/* EXPORTED to FA256 */
int arm920t_soft_reset_halt(struct target *target)
{
.get_gdb_reg_list = arm_get_gdb_reg_list,
.read_memory = arm920t_read_memory,
.get_gdb_reg_list = arm_get_gdb_reg_list,
.read_memory = arm920t_read_memory,
- .write_memory = arm920t_write_memory,
+ .write_memory = arm920t_write_memory_opt,
.read_phys_memory = arm920t_read_phys_memory,
.write_phys_memory = arm920t_write_phys_memory,
.mmu = arm920_mmu,
.virt2phys = arm920_virt2phys,
.read_phys_memory = arm920t_read_phys_memory,
.write_phys_memory = arm920t_write_phys_memory,
.mmu = arm920_mmu,
.virt2phys = arm920_virt2phys,
- .bulk_write_memory = arm7_9_bulk_write_memory,
-
.checksum_memory = arm_checksum_memory,
.blank_check_memory = arm_blank_check_memory,
.checksum_memory = arm_checksum_memory,
.blank_check_memory = arm_blank_check_memory,
uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer);
int arm920t_write_memory(struct target *target,
uint32_t address, uint32_t size, uint32_t count, const uint8_t *buffer);
uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer);
int arm920t_write_memory(struct target *target,
uint32_t address, uint32_t size, uint32_t count, const uint8_t *buffer);
+int arm920t_write_memory_opt(struct target *target,
+ uint32_t address, uint32_t size, uint32_t count, const uint8_t *buffer);
int arm920t_post_debug_entry(struct target *target);
void arm920t_pre_restore_context(struct target *target);
int arm920t_get_ttb(struct target *target, uint32_t *result);
int arm920t_post_debug_entry(struct target *target);
void arm920t_pre_restore_context(struct target *target);
int arm920t_get_ttb(struct target *target, uint32_t *result);
+int arm926ejs_write_memory_opt(struct target *target, uint32_t address,
+ uint32_t size, uint32_t count, const uint8_t *buffer)
+{
+ struct arm7_9_common *arm7_9 = target_to_arm7_9(target);
+
+ if (size == 4 && count > 32 && arm7_9->bulk_write_memory)
+ return arm7_9->bulk_write_memory(target, address, count, buffer);
+ else
+ return arm926ejs_write_memory(target, address, size, count, buffer);
+}
+
static int arm926ejs_write_phys_memory(struct target *target,
uint32_t address, uint32_t size,
uint32_t count, const uint8_t *buffer)
static int arm926ejs_write_phys_memory(struct target *target,
uint32_t address, uint32_t size,
uint32_t count, const uint8_t *buffer)
.get_gdb_reg_list = arm_get_gdb_reg_list,
.read_memory = arm7_9_read_memory,
.get_gdb_reg_list = arm_get_gdb_reg_list,
.read_memory = arm7_9_read_memory,
- .write_memory = arm926ejs_write_memory,
- .bulk_write_memory = arm7_9_bulk_write_memory,
+ .write_memory = arm926ejs_write_memory_opt,
.checksum_memory = arm_checksum_memory,
.blank_check_memory = arm_blank_check_memory,
.checksum_memory = arm_checksum_memory,
.blank_check_memory = arm_blank_check_memory,
int arm926ejs_arch_state(struct target *target);
int arm926ejs_write_memory(struct target *target,
uint32_t address, uint32_t size, uint32_t count, const uint8_t *buffer);
int arm926ejs_arch_state(struct target *target);
int arm926ejs_write_memory(struct target *target,
uint32_t address, uint32_t size, uint32_t count, const uint8_t *buffer);
+int arm926ejs_write_memory_opt(struct target *target,
+ uint32_t address, uint32_t size, uint32_t count, const uint8_t *buffer);
int arm926ejs_soft_reset_halt(struct target *target);
extern const struct command_registration arm926ejs_command_handlers[];
int arm926ejs_soft_reset_halt(struct target *target);
extern const struct command_registration arm926ejs_command_handlers[];
- retval = arm7_9_write_memory(target, address, size, count, buffer);
+ retval = arm7_9_write_memory_opt(target, address, size, count, buffer);
if (retval != ERROR_OK)
return retval;
if (retval != ERROR_OK)
return retval;
.read_memory = arm946e_read_memory,
.write_memory = arm946e_write_memory,
.read_memory = arm946e_read_memory,
.write_memory = arm946e_write_memory,
- .bulk_write_memory = arm7_9_bulk_write_memory,
-
.checksum_memory = arm_checksum_memory,
.blank_check_memory = arm_blank_check_memory,
.checksum_memory = arm_checksum_memory,
.blank_check_memory = arm_blank_check_memory,
.get_gdb_reg_list = arm_get_gdb_reg_list,
.read_memory = arm7_9_read_memory,
.get_gdb_reg_list = arm_get_gdb_reg_list,
.read_memory = arm7_9_read_memory,
- .write_memory = arm7_9_write_memory,
- .bulk_write_memory = arm7_9_bulk_write_memory,
+ .write_memory = arm7_9_write_memory_opt,
.checksum_memory = arm_checksum_memory,
.blank_check_memory = arm_blank_check_memory,
.checksum_memory = arm_checksum_memory,
.blank_check_memory = arm_blank_check_memory,
arm7_9->enable_single_step = arm9tdmi_enable_single_step;
arm7_9->disable_single_step = arm9tdmi_disable_single_step;
arm7_9->enable_single_step = arm9tdmi_enable_single_step;
arm7_9->disable_single_step = arm9tdmi_disable_single_step;
+ arm7_9->bulk_write_memory = arm7_9_bulk_write_memory;
+
arm7_9->post_debug_entry = NULL;
arm7_9->pre_restore_context = NULL;
arm7_9->post_debug_entry = NULL;
arm7_9->pre_restore_context = NULL;
.get_gdb_reg_list = arm_get_gdb_reg_list,
.read_memory = arm7_9_read_memory,
.get_gdb_reg_list = arm_get_gdb_reg_list,
.read_memory = arm7_9_read_memory,
- .write_memory = arm7_9_write_memory,
- .bulk_write_memory = arm7_9_bulk_write_memory,
+ .write_memory = arm7_9_write_memory_opt,
.checksum_memory = arm_checksum_memory,
.blank_check_memory = arm_blank_check_memory,
.checksum_memory = arm_checksum_memory,
.blank_check_memory = arm_blank_check_memory,
arm7_9->enable_single_step = arm9tdmi_enable_single_step;
arm7_9->disable_single_step = arm9tdmi_disable_single_step;
arm7_9->enable_single_step = arm9tdmi_enable_single_step;
arm7_9->disable_single_step = arm9tdmi_disable_single_step;
+ arm7_9->bulk_write_memory = arm7_9_bulk_write_memory;
+
arm7_9->post_debug_entry = NULL;
arm7_9->pre_restore_context = NULL;
arm7_9->post_debug_entry = NULL;
arm7_9->pre_restore_context = NULL;
.get_gdb_reg_list = arm_get_gdb_reg_list,
.read_memory = arm920t_read_memory,
.get_gdb_reg_list = arm_get_gdb_reg_list,
.read_memory = arm920t_read_memory,
- .write_memory = arm920t_write_memory,
- .bulk_write_memory = arm7_9_bulk_write_memory,
+ .write_memory = arm920t_write_memory_opt,
.checksum_memory = arm_checksum_memory,
.blank_check_memory = arm_blank_check_memory,
.checksum_memory = arm_checksum_memory,
.blank_check_memory = arm_blank_check_memory,
arm7_9->enable_single_step = feroceon_enable_single_step;
arm7_9->disable_single_step = feroceon_disable_single_step;
arm7_9->enable_single_step = feroceon_enable_single_step;
arm7_9->disable_single_step = feroceon_disable_single_step;
+ arm7_9->bulk_write_memory = feroceon_bulk_write_memory;
+
/* MOE is not implemented */
arm7_9->examine_debug_reason = feroceon_examine_debug_reason;
/* MOE is not implemented */
arm7_9->examine_debug_reason = feroceon_examine_debug_reason;
.get_gdb_reg_list = arm_get_gdb_reg_list,
.read_memory = arm7_9_read_memory,
.get_gdb_reg_list = arm_get_gdb_reg_list,
.read_memory = arm7_9_read_memory,
- .write_memory = arm926ejs_write_memory,
- .bulk_write_memory = feroceon_bulk_write_memory,
+ .write_memory = arm926ejs_write_memory_opt,
.checksum_memory = arm_checksum_memory,
.blank_check_memory = arm_blank_check_memory,
.checksum_memory = arm_checksum_memory,
.blank_check_memory = arm_blank_check_memory,
.get_gdb_reg_list = arm_get_gdb_reg_list,
.read_memory = arm7_9_read_memory,
.get_gdb_reg_list = arm_get_gdb_reg_list,
.read_memory = arm7_9_read_memory,
- .write_memory = arm7_9_write_memory,
- .bulk_write_memory = feroceon_bulk_write_memory,
+ .write_memory = arm7_9_write_memory_opt,
.checksum_memory = arm_checksum_memory,
.blank_check_memory = arm_blank_check_memory,
.checksum_memory = arm_checksum_memory,
.blank_check_memory = arm_blank_check_memory,
return target->type->write_phys_memory(target, address, size, count, buffer);
}
return target->type->write_phys_memory(target, address, size, count, buffer);
}
-static int target_bulk_write_memory_default(struct target *target,
- uint32_t address, uint32_t count, const uint8_t *buffer)
-{
- return target_write_memory(target, address, 4, count, buffer);
-}
-
int target_add_breakpoint(struct target *target,
struct breakpoint *breakpoint)
{
int target_add_breakpoint(struct target *target,
struct breakpoint *breakpoint)
{
if (target->type->write_buffer == NULL)
target->type->write_buffer = target_write_buffer_default;
if (target->type->write_buffer == NULL)
target->type->write_buffer = target_write_buffer_default;
- if (target->type->bulk_write_memory == NULL)
- target->type->bulk_write_memory = target_bulk_write_memory_default;
-
if (target->type->get_gdb_fileio_info == NULL)
target->type->get_gdb_fileio_info = target_get_gdb_fileio_info_default;
if (target->type->get_gdb_fileio_info == NULL)
target->type->get_gdb_fileio_info = target_get_gdb_fileio_info_default;
if (size >= 4) {
int aligned = size - (size % 4);
if (size >= 4) {
int aligned = size - (size % 4);
- /* use bulk writes above a certain limit. This may have to be changed */
- if (aligned > 128) {
- retval = target->type->bulk_write_memory(target, address, aligned / 4, buffer);
- if (retval != ERROR_OK)
- return retval;
- } else {
- retval = target_write_memory(target, address, 4, aligned / 4, buffer);
- if (retval != ERROR_OK)
- return retval;
- }
+ retval = target_write_memory(target, address, 4, aligned / 4, buffer);
+ if (retval != ERROR_OK)
+ return retval;
buffer += aligned;
address += aligned;
buffer += aligned;
address += aligned;
int (*write_buffer)(struct target *target, uint32_t address,
uint32_t size, const uint8_t *buffer);
int (*write_buffer)(struct target *target, uint32_t address,
uint32_t size, const uint8_t *buffer);
- /**
- * Write target memory in multiples of 4 bytes, optimized for
- * writing large quantities of data. Do @b not call this
- * function directly, use target_bulk_write_memory() instead.
- */
- int (*bulk_write_memory)(struct target *target, uint32_t address,
- uint32_t count, const uint8_t *buffer);
-
int (*checksum_memory)(struct target *target, uint32_t address,
uint32_t count, uint32_t *checksum);
int (*blank_check_memory)(struct target *target, uint32_t address,
int (*checksum_memory)(struct target *target, uint32_t address,
uint32_t count, uint32_t *checksum);
int (*blank_check_memory)(struct target *target, uint32_t address,
Linking to existing account procedure
If you already have an account and want to add another login method
you
MUST first sign in with your existing account and
then change URL to read
https://review.openocd.org/login/?link
to get to this page again but this time it'll work for linking. Thank you.
SSH host keys fingerprints
1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=.. |
|+o.. . |
|*.o . . |
|+B . . . |
|Bo. = o S |
|Oo.+ + = |
|oB=.* = . o |
| =+=.+ + E |
|. .=o . o |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)