Cortex-M3: don't exit()

Get rid of undesirable and needless exit() calls
from the Cortex-M3 support.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
This commit is contained in:
David Brownell 2009-11-16 16:42:51 -08:00
parent 56adbaffd0
commit 47f2305229
1 changed files with 10 additions and 24 deletions

View File

@ -858,9 +858,8 @@ cortex_m3_set_breakpoint(struct target *target, struct breakpoint *breakpoint)
fp_num++; fp_num++;
if (fp_num >= cortex_m3->fp_num_code) if (fp_num >= cortex_m3->fp_num_code)
{ {
LOG_DEBUG("ERROR Can not find free FP Comparator"); LOG_ERROR("Can not find free FPB Comparator!");
LOG_WARNING("ERROR Can not find free FP Comparator"); return ERROR_FAIL;
exit(-1);
} }
breakpoint->set = fp_num + 1; breakpoint->set = fp_num + 1;
hilo = (breakpoint->address & 0x2) ? FPCR_REPLACE_BKPT_HIGH : FPCR_REPLACE_BKPT_LOW; hilo = (breakpoint->address & 0x2) ? FPCR_REPLACE_BKPT_HIGH : FPCR_REPLACE_BKPT_LOW;
@ -1372,16 +1371,11 @@ static int cortex_m3_read_memory(struct target *target, uint32_t address,
{ {
struct armv7m_common *armv7m = target_to_armv7m(target); struct armv7m_common *armv7m = target_to_armv7m(target);
struct swjdp_common *swjdp = &armv7m->swjdp_info; struct swjdp_common *swjdp = &armv7m->swjdp_info;
int retval; int retval = ERROR_INVALID_ARGUMENTS;
/* sanitize arguments */
if (((size != 4) && (size != 2) && (size != 1)) || (count == 0) || !(buffer))
return ERROR_INVALID_ARGUMENTS;
/* cortex_m3 handles unaligned memory access */ /* cortex_m3 handles unaligned memory access */
if (count && buffer) {
switch (size) switch (size) {
{
case 4: case 4:
retval = mem_ap_read_buf_u32(swjdp, buffer, 4 * count, address); retval = mem_ap_read_buf_u32(swjdp, buffer, 4 * count, address);
break; break;
@ -1391,9 +1385,7 @@ static int cortex_m3_read_memory(struct target *target, uint32_t address,
case 1: case 1:
retval = mem_ap_read_buf_u8(swjdp, buffer, count, address); retval = mem_ap_read_buf_u8(swjdp, buffer, count, address);
break; break;
default: }
LOG_ERROR("BUG: we shouldn't get here");
exit(-1);
} }
return retval; return retval;
@ -1404,14 +1396,10 @@ static int cortex_m3_write_memory(struct target *target, uint32_t address,
{ {
struct armv7m_common *armv7m = target_to_armv7m(target); struct armv7m_common *armv7m = target_to_armv7m(target);
struct swjdp_common *swjdp = &armv7m->swjdp_info; struct swjdp_common *swjdp = &armv7m->swjdp_info;
int retval; int retval = ERROR_INVALID_ARGUMENTS;
/* sanitize arguments */ if (count && buffer) {
if (((size != 4) && (size != 2) && (size != 1)) || (count == 0) || !(buffer)) switch (size) {
return ERROR_INVALID_ARGUMENTS;
switch (size)
{
case 4: case 4:
retval = mem_ap_write_buf_u32(swjdp, buffer, 4 * count, address); retval = mem_ap_write_buf_u32(swjdp, buffer, 4 * count, address);
break; break;
@ -1421,9 +1409,7 @@ static int cortex_m3_write_memory(struct target *target, uint32_t address,
case 1: case 1:
retval = mem_ap_write_buf_u8(swjdp, buffer, count, address); retval = mem_ap_write_buf_u8(swjdp, buffer, count, address);
break; break;
default: }
LOG_ERROR("BUG: we shouldn't get here");
exit(-1);
} }
return retval; return retval;