panda: non-returning openocd-loop at terminate

Previously for correct termination, the PandaController called
the finish-function of the openocd wrapper, invoked a coroutine
switch and waited for the openocd wrapper to finish up and switch
coroutine again, so the PandaController could exit with correct
exitStatus. Now the openocd-wrapper directly exits with chosen
exit status.

Change-Id: I8d318a4143c53340896ccee4d059a0d79fdcfe89
This commit is contained in:
Lars Rademacher
2013-10-24 11:05:38 +02:00
parent 5638a7473e
commit 582459c5bb
4 changed files with 8 additions and 11 deletions

View File

@ -46,6 +46,7 @@ using std::dec;
* Flag for finishing main loop execution.
*/
static bool oocdw_exection_finished = false;
static int oocdw_exCode;
/*
* Initially set target struct pointers for use in
@ -334,12 +335,7 @@ int main(int argc, char *argv[])
LOG << "finished" << endl;
/*
* Return to experiment flow to properly exit execution
*/
fail::simulator.resume();
return 0;
exit(oocdw_exCode);
}
@ -598,9 +594,10 @@ void oocdw_write_reg(uint32_t reg_num, enum arm_reg_group rg, uint32_t data)
reg->type->set(reg, (uint8_t*)(&data));
}
void oocdw_finish()
void oocdw_finish(int exCode)
{
oocdw_exection_finished = true;
oocdw_exCode = exCode;
}
void oocdw_read_from_memory(uint32_t address, uint32_t chunk_size,