2 * Copyright(c) 2015-2016 Intel Corporation.
4 * Jessica Gomez (jessica.gomez.hernandez@intel.com)
5 * Ivan De Cesaris (ivan.de.cesaris@intel.com)
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * Contact Information:
26 * Debugger for Intel Quark D20xx
27 * The CPU TAP (Lakemont TAP) is used for software debug and the CLTAP is
28 * used for SoC level operations.
31 * Intel Quark microcontroller D2000 Debug Operations (web search for doc num 333241)
38 #include <helper/log.h>
41 #include "target_type.h"
42 #include "breakpoints.h"
44 #include "x86_32_common.h"
46 int quark_d20xx_target_create(struct target
*t
, Jim_Interp
*interp
)
48 struct x86_32_common
*x86_32
= calloc(1, sizeof(struct x86_32_common
));
50 LOG_ERROR("%s out of memory", __func__
);
53 x86_32_common_init_arch_info(t
, x86_32
);
54 lakemont_init_arch_info(t
, x86_32
);
55 x86_32
->core_type
= LMT3_5
;
59 int quark_d20xx_init_target(struct command_context
*cmd_ctx
, struct target
*t
)
61 return lakemont_init_target(cmd_ctx
, t
);
64 static int quark_d20xx_reset_deassert(struct target
*t
)
68 /* Can't detect if a warm reset happened while halted but we can make the
69 * openocd and target state consistent here if in probe mode already
71 if (!check_not_halted(t
)) {
72 retval
= lakemont_update_after_probemode_entry(t
);
73 if (retval
!= ERROR_OK
) {
74 LOG_ERROR("%s core state update fail", __func__
);
77 /* resume target if reset mode is run */
79 retval
= lakemont_resume(t
, 1, 0, 0, 0);
80 if (retval
!= ERROR_OK
) {
81 LOG_ERROR("%s could not resume target", __func__
);
90 struct target_type quark_d20xx_target
= {
91 .name
= "quark_d20xx",
92 .target_create
= quark_d20xx_target_create
,
93 .init_target
= quark_d20xx_init_target
,
94 /* lakemont probemode specific code */
95 .poll
= lakemont_poll
,
96 .arch_state
= lakemont_arch_state
,
97 .halt
= lakemont_halt
,
98 .resume
= lakemont_resume
,
99 .step
= lakemont_step
,
100 .assert_reset
= lakemont_reset_assert
,
101 .deassert_reset
= quark_d20xx_reset_deassert
,
102 /* common x86 code */
103 .commands
= x86_32_command_handlers
,
104 .get_gdb_reg_list
= x86_32_get_gdb_reg_list
,
105 .read_memory
= x86_32_common_read_memory
,
106 .write_memory
= x86_32_common_write_memory
,
107 .add_breakpoint
= x86_32_common_add_breakpoint
,
108 .remove_breakpoint
= x86_32_common_remove_breakpoint
,
109 .add_watchpoint
= x86_32_common_add_watchpoint
,
110 .remove_watchpoint
= x86_32_common_remove_watchpoint
,
111 .virt2phys
= x86_32_common_virt2phys
,
112 .read_phys_memory
= x86_32_common_read_phys_mem
,
113 .write_phys_memory
= x86_32_common_write_phys_mem
,
114 .mmu
= x86_32_common_mmu
,