openocd: some minor fixes in wrapper
Change-Id: I94ecde881d5eaeea280e5c6de3c3abc16c2903f4
This commit is contained in:
@ -292,6 +292,11 @@ int main(int argc, char *argv[])
|
|||||||
while (single_step_requested) {
|
while (single_step_requested) {
|
||||||
int repeat = 5;
|
int repeat = 5;
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
|
freeze_timers();
|
||||||
|
update_mmu_watch();
|
||||||
|
unfreeze_timers();
|
||||||
|
|
||||||
unfreeze_cycle_counter();
|
unfreeze_cycle_counter();
|
||||||
while ((retval = target_step(target_a9, 1, 0, 1)) && (repeat--)) {
|
while ((retval = target_step(target_a9, 1, 0, 1)) && (repeat--)) {
|
||||||
LOG << "ERROR: Single-step could not be executed at instruction " <<
|
LOG << "ERROR: Single-step could not be executed at instruction " <<
|
||||||
@ -436,6 +441,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
arm_regs_t regs;
|
arm_regs_t regs;
|
||||||
|
|
||||||
|
// Read registers from abort stack, as they are now modified
|
||||||
oocdw_read_from_memory(sp_abt, 4, 4, (uint8_t*)(®s.r[2]));
|
oocdw_read_from_memory(sp_abt, 4, 4, (uint8_t*)(®s.r[2]));
|
||||||
|
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
@ -491,8 +497,10 @@ int main(int argc, char *argv[])
|
|||||||
if (op.flags & (OP_FLAG_READ | OP_FLAG_WRITE)) {
|
if (op.flags & (OP_FLAG_READ | OP_FLAG_WRITE)) {
|
||||||
fail::simulator.onMemoryAccess(NULL, op.mem_addr, op.mem_size, op.flags & OP_FLAG_WRITE, lr_abt - 8);
|
fail::simulator.onMemoryAccess(NULL, op.mem_addr, op.mem_size, op.flags & OP_FLAG_WRITE, lr_abt - 8);
|
||||||
} else {
|
} else {
|
||||||
LOG << "FATAL ERROR: Disassembling instruction in mmu handler failed" << endl;
|
/* As some memory accesses can't be decoded, because we are executing data, this is going
|
||||||
exit(-1);
|
* to be handled as a trap.
|
||||||
|
*/
|
||||||
|
fail::simulator.onTrap(NULL, fail::ANY_TRAP);
|
||||||
}
|
}
|
||||||
} else if (pc == sym_GenericTrapHandler) {
|
} else if (pc == sym_GenericTrapHandler) {
|
||||||
freeze_timers();
|
freeze_timers();
|
||||||
@ -542,7 +550,9 @@ int main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
freeze_timers();
|
freeze_timers();
|
||||||
fail::simulator.onMemoryAccess(NULL, halt.address, 1, iswrite, pc);
|
LOG << "WATCHPOINT EVENT ADDR: " << hex << halt.address << dec << " LENGTH: " << halt.addr_len <<
|
||||||
|
" TYPE: " << (iswrite?'W':'R') << endl;
|
||||||
|
fail::simulator.onMemoryAccess(NULL, halt.address, halt.addr_len, iswrite, pc);
|
||||||
unfreeze_timers();
|
unfreeze_timers();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -550,6 +560,9 @@ int main(int argc, char *argv[])
|
|||||||
LOG << "FATAL ERROR: Single-step is handled in previous loop phase" << endl;
|
LOG << "FATAL ERROR: Single-step is handled in previous loop phase" << endl;
|
||||||
exit (-1);
|
exit (-1);
|
||||||
break;
|
break;
|
||||||
|
case DBG_REASON_DBGRQ:
|
||||||
|
// Do nothing
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
LOG << "FATAL ERROR: Target halted in unexpected cpu state " << current_dr << endl;
|
LOG << "FATAL ERROR: Target halted in unexpected cpu state " << current_dr << endl;
|
||||||
exit (-1);
|
exit (-1);
|
||||||
@ -717,10 +730,21 @@ void oocdw_delete_halt_condition(struct halt_condition *hc)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
watchpoint_remove(target_a9, hc->address);
|
// Check if wp is set on hardware
|
||||||
free_watchpoints++;
|
//struct watchpoint *watchpoint = target_a9->watchpoints;
|
||||||
LOG << hex << "Removing WP " << hc->address << ":" << hc->addr_len << ":" <<
|
|
||||||
((hc->type == HALT_TYPE_WP_READ)? "R" : (hc->type == HALT_TYPE_WP_WRITE)? "W" : "R/W") << dec<< endl;
|
// while (watchpoint) {
|
||||||
|
// // Multiple watchpoints activated? No single answer possible
|
||||||
|
// if (hc->address == watchpoint->address) {
|
||||||
|
watchpoint_remove(target_a9, hc->address);
|
||||||
|
free_watchpoints++;
|
||||||
|
LOG << hex << "Removing WP " << hc->address << ":" << hc->addr_len << ":" <<
|
||||||
|
((hc->type == HALT_TYPE_WP_READ)? "R" : (hc->type == HALT_TYPE_WP_WRITE)? "W" : "R/W") << dec<< endl;
|
||||||
|
// }
|
||||||
|
// watchpoint = watchpoint->next;
|
||||||
|
// }
|
||||||
|
// LOG << "FATAL ERROR: Can't remove WP, because it is not set on target" << endl;
|
||||||
|
// exit(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1204,7 +1228,12 @@ void oocdw_write_to_memory(uint32_t address, uint32_t chunk_size,
|
|||||||
write_target = target_m3;
|
write_target = target_m3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target_write_memory(write_target, address, chunk_size, chunk_num, data)) {
|
if (chunk_size > 4) {
|
||||||
|
LOG << "FATAL ERROR: WRITING CHUNKS BIGGER THAN 4 BYTE NOT ALLOWED" << endl;
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (target_write_phys_memory(write_target, address, chunk_size, chunk_num, data )) {
|
||||||
LOG << "FATAL ERROR: Writing to memory failed." << endl;
|
LOG << "FATAL ERROR: Writing to memory failed." << endl;
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user