Discussion:
[OpenOCD-devel] [PATCH]: 9e5ce04 mips32: add bmips32 option
gerrit
2017-06-18 17:44:49 UTC
Permalink
This is an automated email from Gerrit.

Salvador Arroyo (***@yahoo.es) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/4164

-- gerrit

commit 9e5ce04db5e0e83727f86589eceeb39f22f2100c
Author: Salvador Arroyo <***@yahoo.es>
Date: Sun Jun 18 19:32:15 2017 +0200

mips32: add bmips32 option

This option adds 3 additonal NOP instructions after
DERET. Resume and stepping execute clean with no
errors. Fasdata transfer is not supported and not
used. The code executes only in sync mode.
A working area can be added to run miniprograms.

Change-Id: I27d08e68b6e6b90c1b62e4e36d320c07418371f5
Signed-off-by: Salvador Arroyo <***@yahoo.es>

diff --git a/src/target/mips32.c b/src/target/mips32.c
index 5316396..ef67353 100644
--- a/src/target/mips32.c
+++ b/src/target/mips32.c
@@ -981,6 +981,8 @@ COMMAND_HANDLER(mips32_handle_scan_delay_command)
const Jim_Nvp mode_options[] = {
{"sync", (pa_mode << 8) + opt_sync},
{"async", (pa_mode << 8) + opt_async},
+ {"mips32", (core_mode << 8) + opt_mips32},
+ {"bmips32", (core_mode << 8) + opt_bmips32},

{"help", HELP_OPTION},

@@ -991,6 +993,8 @@ const Jim_Nvp mode_options[] = {
const Jim_Nvp mode_messages[] = {
{" mode sync: in sync with pracc (safer)", (pa_mode << 8) + opt_sync},
{" mode async: in async pracc mode (faster)", (pa_mode << 8) + opt_async},
+ {" mode mips32: mips32 pracc mode", (core_mode << 8) + opt_mips32},
+ {" mode bmips32: bmips32 pracc mode", (core_mode << 8) + opt_bmips32},

{NULL, -1}
};
diff --git a/src/target/mips32_pracc.c b/src/target/mips32_pracc.c
index 37e4e26..6e8fdc2 100644
--- a/src/target/mips32_pracc.c
+++ b/src/target/mips32_pracc.c
@@ -400,7 +400,7 @@ int mips32_pracc_queue_exec(struct mips_ejtag *ejtag_info, struct pracc_queue_in

mips_ejtag_update_clocks(ejtag_info);

- if (ejtag_info->mode[pa_mode] == opt_sync)
+ if (ejtag_info->mode[pa_mode] == opt_sync || ejtag_info->mode[core_mode] == opt_bmips32)
return mips32_pracc_exec(ejtag_info, ctx, buf, check_last);

union scan_in {
diff --git a/src/target/mips_ejtag.c b/src/target/mips_ejtag.c
index 93ca480..9e2c84c 100644
--- a/src/target/mips_ejtag.c
+++ b/src/target/mips_ejtag.c
@@ -235,14 +235,23 @@ error:

int mips_ejtag_exit_debug(struct mips_ejtag *ejtag_info)
{
- pa_list pracc_list = {.instr = MIPS32_DRET(ejtag_info->isa), .addr = 0};
- struct pracc_queue_info ctx = {.max_code = 1, .pracc_list = &pracc_list, .code_count = 1, .store_count = 0};
+ struct pracc_queue_info ctx = {.ejtag_info = ejtag_info};
+ pracc_queue_init(&ctx);
+
+ pracc_add(&ctx, 0, MIPS32_DRET(ctx.isa));

- /* execute our dret instruction */
- ctx.retval = mips32_pracc_queue_exec(ejtag_info, &ctx, NULL, 0); /* shift out instr, omit last check */
+ /* if bmips add 3 additional Nop's */
+ if (ejtag_info->mode[core_mode] == opt_bmips32)
+ for (int i = 0; i != 3; i++)
+ pracc_add(&ctx, 0, MIPS32_NOP);
+
+ /* execute our dret instruction, do not check */
+ ctx.retval = mips32_pracc_queue_exec(ejtag_info, &ctx, NULL, 0);

/* pic32mx workaround, false pending at low core clock */
jtag_add_sleep(1000);
+
+ pracc_queue_free(&ctx);
return ctx.retval;
}

diff --git a/src/target/mips_ejtag.h b/src/target/mips_ejtag.h
index 5bd9ab2..9f77830 100644
--- a/src/target/mips_ejtag.h
+++ b/src/target/mips_ejtag.h
@@ -183,7 +183,8 @@

enum working_modes {
pa_mode = 0,
- max_mode = 1,
+ core_mode = 1,
+ max_mode = 2,
};

struct mips_ejtag {
@@ -232,6 +233,11 @@ enum pa_mode_opt {
opt_async = 1,
};

+enum core_mode_opt {
+ opt_mips32 = 0,
+ opt_bmips32 = 1,
+};
+
void mips_ejtag_set_instr(struct mips_ejtag *ejtag_info, uint32_t new_instr);
int mips_ejtag_enter_debug(struct mips_ejtag *ejtag_info);
int mips_ejtag_exit_debug(struct mips_ejtag *ejtag_info);
diff --git a/src/target/mips_m4k.c b/src/target/mips_m4k.c
index 9a1cd6b..3a49a65 100644
--- a/src/target/mips_m4k.c
+++ b/src/target/mips_m4k.c
@@ -1055,7 +1055,7 @@ static int mips_m4k_read_memory(struct target *target, target_addr_t address,
t = buffer;

int retval;
- if (size == 4 && count > 32) {
+ if (size == 4 && count > 32 && ejtag_info->mode[core_mode] != opt_bmips32) {
retval = mips_m4k_bulk_read_memory(target, address, count, t);
if (retval == ERROR_OK)
goto save;
@@ -1095,7 +1095,7 @@ static int mips_m4k_write_memory(struct target *target, target_addr_t address,
return ERROR_TARGET_NOT_HALTED;
}

- if (size == 4 && count > 32) {
+ if (size == 4 && count > 32 && ejtag_info->mode[core_mode] != opt_bmips32) {
int retval = mips_m4k_bulk_write_memory(target, address, count, buffer);
if (retval == ERROR_OK)
return ERROR_OK;

--

Loading...