This is an automated email from Gerrit. "Walter Ji <walter...@oss.cipunited.com>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/7870
-- gerrit commit 46751c638391e9dfac72e6a9e91b972a6fee0f35 Author: Walter Ji <walter...@oss.cipunited.com> Date: Mon Aug 28 10:35:49 2023 +0800 target: add MIPS mAptiv support MIPS mAptiv(microAptiv) is a MCU focus on entry-level embedded market. It is high-efficient and compact, with MIPS r3 ISA support. Change-Id: I4014cbdee091dddc286fcc535188d3ba7e92d0ff Signed-off-by: Walter Ji <walter...@oss.cipunited.com> diff --git a/src/target/Makefile.am b/src/target/Makefile.am index 3481627399..d6aa91d7c4 100644 --- a/src/target/Makefile.am +++ b/src/target/Makefile.am @@ -122,6 +122,7 @@ MIPS32_SRC = \ %D%/mips32.c \ %D%/mips_common.c \ %D%/mips_m4k.c \ + %D%/mips_mAptiv.c \ %D%/mips32_pracc.c \ %D%/mips32_dmaacc.c \ %D%/mips_ejtag.c @@ -210,6 +211,8 @@ ARC_SRC = \ %D%/mips_mips64.h \ %D%/mips_ejtag.h \ %D%/mips_common.h \ + %D%/mips_iAptiv.h \ + %D%/mips_mAptiv.h \ %D%/mips32_pracc.h \ %D%/mips32_dmaacc.h \ %D%/mips64_pracc.h \ diff --git a/src/target/mips_mAptiv.c b/src/target/mips_mAptiv.c new file mode 100644 index 0000000000..cf378d8f26 --- /dev/null +++ b/src/target/mips_mAptiv.c @@ -0,0 +1,91 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +/*************************************************************************** + * Copyright (C) 2008 by Spencer Oliver * + * s...@spen-soft.co.uk * + * * + * Copyright (C) 2008 by David T.L. Wong * + * * + * Copyright (C) 2009 by David N. Claffey <dnclaf...@gmail.com> * + * * + * Copyright (C) 2011 by Drasko DRASKOVIC * + * drasko.drasko...@gmail.com * + * * + ***************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "breakpoints.h" +#include "mips32.h" +#include "mips_m4k.h" +#include "mips_mAptiv.h" +#include "mips_common.h" +#include "mips32_dmaacc.h" +#include "target_type.h" +#include "register.h" + +static int mips_mAptiv_init_arch_info(struct target *target, + struct mips_mAptiv_common *mips_mAptiv, struct jtag_tap *tap) +{ + struct mips32_common *mips32 = &mips_mAptiv->mips32; + + mips_mAptiv->common_magic = MIPSMAPTIV_COMMON_MAGIC; + + /* initialize mips specific info */ + mips32_init_arch_info(target, mips32, tap); + mips32->arch_info = mips_mAptiv; + + return ERROR_OK; +} + +static int mips_mAptiv_target_create(struct target *target, Jim_Interp *interp) +{ + struct mips_mAptiv_common *mips_mAptiv = calloc(1, sizeof(struct mips_mAptiv_common)); + + mips_mAptiv_init_arch_info(target, mips_mAptiv, target->tap); + + return ERROR_OK; +} + +const struct command_registration mips_mAptiv_command_handlers[] = { + { + .chain = mips32_command_handlers, + }, + COMMAND_REGISTRATION_DONE +}; + +struct target_type mips_mAptiv_target = { + .name = "mips_mAptiv", + + .poll = mips_common_poll, + .arch_state = mips32_arch_state, + + .halt = mips_common_halt, + .resume = mips_common_resume, + .step = mips_common_step, + + .assert_reset = mips_common_assert_reset, + .deassert_reset = mips_common_deassert_reset, + + .get_gdb_reg_list = mips32_get_gdb_reg_list, + + .read_memory = mips_common_read_memory, + .write_memory = mips_common_write_memory, + .checksum_memory = mips32_checksum_memory, + .blank_check_memory = mips32_blank_check_memory, + + .run_algorithm = mips32_run_algorithm, + + .add_breakpoint = mips_common_add_breakpoint, + .remove_breakpoint = mips_common_remove_breakpoint, + .add_watchpoint = mips_common_add_watchpoint, + .remove_watchpoint = mips_common_remove_watchpoint, + .hit_watchpoint = mips_common_hit_watchpoint, + + .commands = mips_mAptiv_command_handlers, + .target_create = mips_mAptiv_target_create, + .init_target = mips_common_init_target, + .examine = mips_common_examine, +}; diff --git a/src/target/mips_mAptiv.h b/src/target/mips_mAptiv.h new file mode 100644 index 0000000000..8cfbeaa0e9 --- /dev/null +++ b/src/target/mips_mAptiv.h @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +/*************************************************************************** + * Copyright (C) 2008 by Spencer Oliver * + * s...@spen-soft.co.uk * + * * + * Copyright (C) 2008 by David T.L. Wong * + * * + * Copyright (C) 2011 by Drasko DRASKOVIC * + * drasko.drasko...@gmail.com * + * * + ***************************************************************************/ + +#ifndef MIPS_MAPTIV_H +#define MIPS_MAPTIV_H + +struct target; + +#define MIPSMAPTIV_COMMON_MAGIC 0xB321B321 + +struct mips_mAptiv_common { + uint32_t common_magic; + bool is_pic32; + struct mips32_common mips32; +}; + +inline struct mips_mAptiv_common *target_to_mAptiv(struct target *target) +{ + return container_of(target->arch_info, + struct mips_mAptiv_common, mips32); +} + +extern const struct command_registration mips_mAptiv_command_handlers[]; + +#endif /*MIPS_MAPTIV_H*/ diff --git a/src/target/target.c b/src/target/target.c index 96f4ae7d3e..eefeaca63c 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -85,6 +85,7 @@ static struct target_type *target_types[] = { &arm11_target, &ls1_sap_target, &mips_m4k_target, + &mips_mAptiv_target, &avr_target, &dsp563xx_target, &dsp5680xx_target, diff --git a/src/target/target_type.h b/src/target/target_type.h index 678ce0f466..bc317e0b7a 100644 --- a/src/target/target_type.h +++ b/src/target/target_type.h @@ -340,6 +340,7 @@ extern struct target_type hla_target; extern struct target_type ls1_sap_target; extern struct target_type mem_ap_target; extern struct target_type mips_m4k_target; +extern struct target_type mips_mAptiv_target; extern struct target_type mips_mips64_target; extern struct target_type or1k_target; extern struct target_type quark_d20xx_target; --