Attached are the remaining patches for the first round of target->type->mcr/mrc support.
There is a writeup in TODO of the harder targets that remain. E.g. arm966e support requires good knowledge of that target + ideally access to test hardware, so that's not something I can or should attempt at this point. Old cp15 commands still work and should only be retired once the new mrc/mcr can be tested on actual targets. It would be great if I could have this tested *before* a release, but the test cycles of OpenOCD(identify a user who has a target and is willing and able to test) are long enough that I would be pleased if all targets could have tested mcr/mrc interface in the course of a few months and a release or two... This whole mrc/mcr thing is about driving OpenOCD in the direction of polymorphic interfaces at the C and command level, ref recent "mww phys" work. mrc/mcr commands are only added if the target->type supports mcr/mrc. That way help isn't quite as cluttered. Previous behavior was to fail when executing the commands. -- Øyvind Harboe http://www.zylin.com/zy1000.html ARM7 ARM9 ARM11 XScale Cortex JTAG debugger and flash programmer
From cb544b57767f97657fe54ead8712cc0b3ef02683 Mon Sep 17 00:00:00 2001 From: =?utf-8?q?=C3=98yvind=20Harboe?= <[email protected]> Date: Sat, 24 Oct 2009 13:17:04 +0200 Subject: [PATCH] add mrc mcr interface. --- src/target/cortex_a8.c | 29 +++++++++++++++++++++++++++++ 1 files changed, 29 insertions(+), 0 deletions(-) diff --git a/src/target/cortex_a8.c b/src/target/cortex_a8.c index 025a468..540bbf6 100644 --- a/src/target/cortex_a8.c +++ b/src/target/cortex_a8.c @@ -70,6 +70,11 @@ int cortex_a8_dap_write_coreregister_u32(target_t *target, int cortex_a8_assert_reset(target_t *target); int cortex_a8_deassert_reset(target_t *target); +static int cortex_a8_mrc(target_t *target, int cpnum, uint32_t op1, + uint32_t op2, uint32_t CRn, uint32_t CRm, uint32_t *value); +static int cortex_a8_mcr(target_t *target, int cpnum, uint32_t op1, + uint32_t op2, uint32_t CRn, uint32_t CRm, uint32_t value); + target_type_t cortexa8_target = { .name = "cortex_a8", @@ -106,6 +111,8 @@ target_type_t cortexa8_target = .target_create = cortex_a8_target_create, .init_target = cortex_a8_init_target, .examine = cortex_a8_examine, + .mrc = cortex_a8_mrc, + .mcr = cortex_a8_mcr, .quit = NULL }; @@ -276,6 +283,28 @@ int cortex_a8_write_cp15(target_t *target, uint32_t op1, uint32_t op2, return cortex_a8_write_cp(target, value, 15, op1, CRn, CRm, op2); } +static int cortex_a8_mrc(target_t *target, int cpnum, uint32_t op1, uint32_t op2, uint32_t CRn, uint32_t CRm, uint32_t *value) +{ + if (cpnum!=15) + { + LOG_ERROR("Only cp15 is supported"); + return ERROR_FAIL; + } + return cortex_a8_read_cp15(target, op1, op2, CRn, CRm, value); +} + +static int cortex_a8_mcr(target_t *target, int cpnum, uint32_t op1, uint32_t op2, uint32_t CRn, uint32_t CRm, uint32_t value) +{ + if (cpnum!=15) + { + LOG_ERROR("Only cp15 is supported"); + return ERROR_FAIL; + } + return cortex_a8_write_cp15(target, op1, op2, CRn, CRm, value); +} + + + int cortex_a8_dap_read_coreregister_u32(target_t *target, uint32_t *value, int regnum) { -- 1.6.0.4
From 1f69e11c241bbecbef033647299067d521f62e9a Mon Sep 17 00:00:00 2001 From: =?utf-8?q?=C3=98yvind=20Harboe?= <[email protected]> Date: Sat, 24 Oct 2009 13:24:35 +0200 Subject: [PATCH] Only register mrc mcr commands when one of the targets support them. --- src/target/target.c | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/target/target.c b/src/target/target.c index 99b3d18..c06d193 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -780,11 +780,22 @@ int target_init(struct command_context_s *cmd_ctx) if (target->type->mcr == NULL) { target->type->mcr = default_mcr; + } else + { + /* FIX! multiple targets will generally register global commands + * multiple times. Only register this one if *one* of the + * targets need the command. Hmm... make it a command on the + * Jim Tcl target object? + */ + register_jim(cmd_ctx, "mcr", jim_mcrmrc, "write coprocessor <cpnum> <op1> <op2> <CRn> <CRm> <value>"); } if (target->type->mrc == NULL) { target->type->mrc = default_mrc; + } else + { + register_jim(cmd_ctx, "mrc", jim_mcrmrc, "read coprocessor <cpnum> <op1> <op2> <CRn> <CRm>"); } @@ -1604,9 +1615,6 @@ int target_register_user_commands(struct command_context_s *cmd_ctx) register_jim(cmd_ctx, "ocd_mem2array", jim_mem2array, "read memory and return as a TCL array for script processing <ARRAYNAME> <WIDTH = 32/16/8> <ADDRESS> <COUNT>"); register_jim(cmd_ctx, "ocd_array2mem", jim_array2mem, "convert a TCL array to memory locations and write the values <ARRAYNAME> <WIDTH = 32/16/8> <ADDRESS> <COUNT>"); - register_jim(cmd_ctx, "mrc", jim_mcrmrc, "read coprocessor <cpnum> <op1> <op2> <CRn> <CRm>"); - register_jim(cmd_ctx, "mcr", jim_mcrmrc, "write coprocessor <cpnum> <op1> <op2> <CRn> <CRm> <value>"); - register_command(cmd_ctx, NULL, "fast_load_image", handle_fast_load_image_command, COMMAND_ANY, "same args as load_image, image stored in memory - mainly for profiling purposes"); -- 1.6.0.4
From 1bdf249f7948cb6aed3ad98b81f63ac44525edf7 Mon Sep 17 00:00:00 2001 From: =?utf-8?q?=C3=98yvind=20Harboe?= <[email protected]> Date: Sat, 24 Oct 2009 14:50:57 +0200 Subject: [PATCH] Wrote up list of remaining tasks for target->type->mrc/mcr --- TODO | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/TODO b/TODO index fa9477a..3f2e98c 100644 --- a/TODO +++ b/TODO @@ -137,6 +137,12 @@ Once the above are completed: https://lists.berlios.de/pipermail/openocd-development/2009-July/009426.html - regression: "reset halt" between 729(works) and 788(fails): @par https://lists.berlios.de/pipermail/openocd-development/2009-July/009206.html +- mcr/mrc target->type support + - missing from ARM11, ARM920t, ARM966e, XScale. + It's possible that the current syntax is unable to support read-modify-write + operations(see arm966e). + - mcr/mrc - retire cp15 commands when there the mrc/mrc commands have been + tested from: arm926ejs, arm720t, cortex_a8 - ARM7/9: - clean up "arm9tdmi vector_catch". Should be available for other arm9 (e.g. arm926ejs) and some(???) arm7 cores. @par -- 1.6.0.4
_______________________________________________ Openocd-development mailing list [email protected] https://lists.berlios.de/mailman/listinfo/openocd-development
