- corrected stm32x_handle_options_write_command, incorrect options printed
- added prepare_reset_halt handler for cortex_m3 git-svn-id: svn://svn.berlios.de/openocd/trunk@184 b42882b7-edfa-0310-969c-e2dbd0fdcd60
This commit is contained in:
parent
712be40f8d
commit
eba4e394d8
|
@ -736,7 +736,7 @@ int stm32x_handle_options_write_command(struct command_context_s *cmd_ctx, char
|
||||||
|
|
||||||
if (argc < 4)
|
if (argc < 4)
|
||||||
{
|
{
|
||||||
command_print(cmd_ctx, "stm32x options_write <bank> <RSTSTNDBY|NORSTSTNDBY> <RSTSTOP|NORSTSTOP> <SWWDG|HWWDG>");
|
command_print(cmd_ctx, "stm32x options_write <bank> <SWWDG|HWWDG> <RSTSTNDBY|NORSTSTNDBY> <RSTSTOP|NORSTSTOP>");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -386,7 +386,8 @@ int server_loop(command_context_t *command_context)
|
||||||
MSG msg;
|
MSG msg;
|
||||||
while (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
|
while (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
|
||||||
{
|
{
|
||||||
if (msg.message==WM_QUIT) shutdown_openocd = 1;
|
if (msg.message == WM_QUIT)
|
||||||
|
shutdown_openocd = 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,6 @@ armv7m_core_reg_t armv7m_core_reg_list_arch_info[] =
|
||||||
|
|
||||||
int armv7m_core_reg_arch_type = -1;
|
int armv7m_core_reg_arch_type = -1;
|
||||||
|
|
||||||
|
|
||||||
/* Keep different contexts for the process being debugged and debug algorithms */
|
/* Keep different contexts for the process being debugged and debug algorithms */
|
||||||
enum armv7m_runcontext armv7m_get_context(target_t *target)
|
enum armv7m_runcontext armv7m_get_context(target_t *target)
|
||||||
{
|
{
|
||||||
|
|
|
@ -67,6 +67,7 @@ target_type_t cortexm3_target =
|
||||||
.assert_reset = cortex_m3_assert_reset,
|
.assert_reset = cortex_m3_assert_reset,
|
||||||
.deassert_reset = cortex_m3_deassert_reset,
|
.deassert_reset = cortex_m3_deassert_reset,
|
||||||
.soft_reset_halt = cortex_m3_soft_reset_halt,
|
.soft_reset_halt = cortex_m3_soft_reset_halt,
|
||||||
|
.prepare_reset_halt = cortex_m3_prepare_reset_halt,
|
||||||
|
|
||||||
.get_gdb_reg_list = armv7m_get_gdb_reg_list,
|
.get_gdb_reg_list = armv7m_get_gdb_reg_list,
|
||||||
|
|
||||||
|
@ -129,14 +130,12 @@ int cortex_m3_exec_opcode(target_t *target,u32 opcode, int len /* MODE, r0_inval
|
||||||
u32 savedram;
|
u32 savedram;
|
||||||
int retvalue;
|
int retvalue;
|
||||||
|
|
||||||
{
|
|
||||||
ahbap_read_system_u32(swjdp, 0x20000000, &savedram);
|
ahbap_read_system_u32(swjdp, 0x20000000, &savedram);
|
||||||
ahbap_write_system_u32(swjdp, 0x20000000, opcode);
|
ahbap_write_system_u32(swjdp, 0x20000000, opcode);
|
||||||
ahbap_write_coreregister_u32(swjdp, 0x20000000, 15);
|
ahbap_write_coreregister_u32(swjdp, 0x20000000, 15);
|
||||||
cortex_m3_single_step_core(target);
|
cortex_m3_single_step_core(target);
|
||||||
armv7m->core_cache->reg_list[15].dirty = 1;
|
armv7m->core_cache->reg_list[15].dirty = 1;
|
||||||
retvalue = ahbap_write_system_atomic_u32(swjdp, 0x20000000, savedram);
|
retvalue = ahbap_write_system_atomic_u32(swjdp, 0x20000000, savedram);
|
||||||
}
|
|
||||||
|
|
||||||
return retvalue;
|
return retvalue;
|
||||||
}
|
}
|
||||||
|
@ -401,7 +400,7 @@ enum target_state cortex_m3_poll(target_t *target)
|
||||||
else if (target->state == TARGET_RESET)
|
else if (target->state == TARGET_RESET)
|
||||||
{
|
{
|
||||||
/* Cannot switch context while running so endreset is called with target->state == TARGET_RESET */
|
/* Cannot switch context while running so endreset is called with target->state == TARGET_RESET */
|
||||||
DEBUG("Exit from reset with dcb_dhcsr %x", cortex_m3->dcb_dhcsr);
|
DEBUG("Exit from reset with dcb_dhcsr 0x%x", cortex_m3->dcb_dhcsr);
|
||||||
cortex_m3_endreset_event(target);
|
cortex_m3_endreset_event(target);
|
||||||
target->state = TARGET_RUNNING;
|
target->state = TARGET_RUNNING;
|
||||||
prev_target_state = TARGET_RUNNING;
|
prev_target_state = TARGET_RUNNING;
|
||||||
|
@ -435,7 +434,7 @@ enum target_state cortex_m3_poll(target_t *target)
|
||||||
|
|
||||||
/* Read Debug Fault Status Register, added to figure out the lockup when running flashtest.script */
|
/* Read Debug Fault Status Register, added to figure out the lockup when running flashtest.script */
|
||||||
ahbap_read_system_atomic_u32(swjdp, NVIC_DFSR, &cortex_m3->nvic_dfsr);
|
ahbap_read_system_atomic_u32(swjdp, NVIC_DFSR, &cortex_m3->nvic_dfsr);
|
||||||
DEBUG("dcb_dhcsr %x, nvic_dfsr %x, target->state: %s", cortex_m3->dcb_dhcsr, cortex_m3->nvic_dfsr, target_state_strings[target->state]);
|
DEBUG("dcb_dhcsr 0x%x, nvic_dfsr 0x%x, target->state: %s", cortex_m3->dcb_dhcsr, cortex_m3->nvic_dfsr, target_state_strings[target->state]);
|
||||||
return target->state;
|
return target->state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -504,6 +503,23 @@ int cortex_m3_soft_reset_halt(struct target_s *target)
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int cortex_m3_prepare_reset_halt(struct target_s *target)
|
||||||
|
{
|
||||||
|
armv7m_common_t *armv7m = target->arch_info;
|
||||||
|
cortex_m3_common_t *cortex_m3 = armv7m->arch_info;
|
||||||
|
swjdp_common_t *swjdp = &cortex_m3->swjdp_info;
|
||||||
|
|
||||||
|
/* Enable debug requests */
|
||||||
|
ahbap_read_system_atomic_u32(swjdp, DCB_DHCSR, &cortex_m3->dcb_dhcsr);
|
||||||
|
if (!(cortex_m3->dcb_dhcsr & C_DEBUGEN))
|
||||||
|
ahbap_write_system_u32(swjdp, DCB_DHCSR, DBGKEY | C_DEBUGEN );
|
||||||
|
|
||||||
|
/* Enter debug state on reset, cf. end_reset_event() */
|
||||||
|
ahbap_write_system_u32(swjdp, DCB_DEMCR, TRCENA | VC_HARDERR | VC_BUSERR | VC_CORERESET );
|
||||||
|
|
||||||
|
return ERROR_OK;
|
||||||
|
}
|
||||||
|
|
||||||
int cortex_m3_resume(struct target_s *target, int current, u32 address, int handle_breakpoints, int debug_execution)
|
int cortex_m3_resume(struct target_s *target, int current, u32 address, int handle_breakpoints, int debug_execution)
|
||||||
{
|
{
|
||||||
/* get pointers to arch-specific information */
|
/* get pointers to arch-specific information */
|
||||||
|
@ -584,6 +600,7 @@ int cortex_m3_resume(struct target_s *target, int current, u32 address, int hand
|
||||||
/* Set/Clear C_MASKINTS in a separate operation */
|
/* Set/Clear C_MASKINTS in a separate operation */
|
||||||
if ((cortex_m3->dcb_dhcsr & C_MASKINTS) != (dcb_dhcsr & C_MASKINTS))
|
if ((cortex_m3->dcb_dhcsr & C_MASKINTS) != (dcb_dhcsr & C_MASKINTS))
|
||||||
ahbap_write_system_atomic_u32(swjdp, DCB_DHCSR, dcb_dhcsr | C_HALT );
|
ahbap_write_system_atomic_u32(swjdp, DCB_DHCSR, dcb_dhcsr | C_HALT );
|
||||||
|
|
||||||
/* Restart core */
|
/* Restart core */
|
||||||
ahbap_write_system_atomic_u32(swjdp, DCB_DHCSR, dcb_dhcsr );
|
ahbap_write_system_atomic_u32(swjdp, DCB_DHCSR, dcb_dhcsr );
|
||||||
target->debug_reason = DBG_REASON_NOTHALTED;
|
target->debug_reason = DBG_REASON_NOTHALTED;
|
||||||
|
@ -1265,7 +1282,7 @@ int cortex_m3_init_target(struct command_context_s *cmd_ctx, struct target_s *ta
|
||||||
target_read_u32(target, CPUID, &cpuid);
|
target_read_u32(target, CPUID, &cpuid);
|
||||||
if (((cpuid >> 4) & 0xc3f) == 0xc23)
|
if (((cpuid >> 4) & 0xc3f) == 0xc23)
|
||||||
DEBUG("CORTEX-M3 processor detected");
|
DEBUG("CORTEX-M3 processor detected");
|
||||||
DEBUG("cpuid %x", cpuid);
|
DEBUG("cpuid: 0x%8.8x", cpuid);
|
||||||
|
|
||||||
target_read_u32(target, NVIC_ICTR, &ictr);
|
target_read_u32(target, NVIC_ICTR, &ictr);
|
||||||
cortex_m3->intlinesnum = (ictr & 0x1F) + 1;
|
cortex_m3->intlinesnum = (ictr & 0x1F) + 1;
|
||||||
|
@ -1273,7 +1290,7 @@ int cortex_m3_init_target(struct command_context_s *cmd_ctx, struct target_s *ta
|
||||||
for (i = 0; i < cortex_m3->intlinesnum; i++)
|
for (i = 0; i < cortex_m3->intlinesnum; i++)
|
||||||
{
|
{
|
||||||
target_read_u32(target, NVIC_ISE0 + 4 * i, cortex_m3->intsetenable + i);
|
target_read_u32(target, NVIC_ISE0 + 4 * i, cortex_m3->intsetenable + i);
|
||||||
DEBUG("interrupt enable[%i] = 0x%x", i, cortex_m3->intsetenable[i]);
|
DEBUG("interrupt enable[%i] = 0x%8.8x", i, cortex_m3->intsetenable[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup FPB */
|
/* Setup FPB */
|
||||||
|
|
|
@ -197,6 +197,7 @@ int cortex_m3_step(struct target_s *target, int current, u32 address, int handle
|
||||||
int cortex_m3_assert_reset(target_t *target);
|
int cortex_m3_assert_reset(target_t *target);
|
||||||
int cortex_m3_deassert_reset(target_t *target);
|
int cortex_m3_deassert_reset(target_t *target);
|
||||||
int cortex_m3_soft_reset_halt(struct target_s *target);
|
int cortex_m3_soft_reset_halt(struct target_s *target);
|
||||||
|
int cortex_m3_prepare_reset_halt(struct target_s *target);
|
||||||
|
|
||||||
int cortex_m3_read_memory(struct target_s *target, u32 address, u32 size, u32 count, u8 *buffer);
|
int cortex_m3_read_memory(struct target_s *target, u32 address, u32 size, u32 count, u8 *buffer);
|
||||||
int cortex_m3_write_memory(struct target_s *target, u32 address, u32 size, u32 count, u8 *buffer);
|
int cortex_m3_write_memory(struct target_s *target, u32 address, u32 size, u32 count, u8 *buffer);
|
||||||
|
|
|
@ -439,7 +439,7 @@ int ahbap_write_buf(swjdp_common_t *swjdp, u8 *buffer, int count, u32 address)
|
||||||
}
|
}
|
||||||
if (errorcount > 1)
|
if (errorcount > 1)
|
||||||
{
|
{
|
||||||
WARNING("Block read error address %x, count %x", address, count);
|
WARNING("Block read error address 0x%x, count 0x%x", address, count);
|
||||||
return ERROR_JTAG_DEVICE_ERROR;
|
return ERROR_JTAG_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -531,7 +531,7 @@ int ahbap_read_buf(swjdp_common_t *swjdp, u8 *buffer, int count, u32 address)
|
||||||
}
|
}
|
||||||
if (errorcount > 1)
|
if (errorcount > 1)
|
||||||
{
|
{
|
||||||
WARNING("Block read error address %x, count %x", address, count);
|
WARNING("Block read error address 0x%x, count 0x%x", address, count);
|
||||||
return ERROR_JTAG_DEVICE_ERROR;
|
return ERROR_JTAG_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -600,7 +600,7 @@ int ahbap_block_read_u32(swjdp_common_t *swjdp, u32 *buffer, int count, u32 addr
|
||||||
}
|
}
|
||||||
if (errorcount > 1)
|
if (errorcount > 1)
|
||||||
{
|
{
|
||||||
WARNING("Block read error address %x, count %x", address, count);
|
WARNING("Block read error address 0x%x, count 0x%x", address, count);
|
||||||
return ERROR_JTAG_DEVICE_ERROR;
|
return ERROR_JTAG_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue