Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed abort() from stlink-lib #1116

Merged
merged 1 commit into from
Mar 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions src/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,7 @@ static inline uint32_t read_flash_sr(stlink_t *sl, unsigned bank) {
} else if (sl->flash_type == STLINK_FLASH_TYPE_H7) {
sr_reg = (bank==BANK_1)?FLASH_H7_SR1:FLASH_H7_SR2;
} else {
ELOG("unsupported flash method, abort");
ELOG("unsupported flash method, abort\n");
return(-1);
}

Expand Down Expand Up @@ -1010,7 +1010,7 @@ static inline unsigned int is_flash_busy(stlink_t *sl) {
} else if (sl->flash_type == STLINK_FLASH_TYPE_H7) {
sr_busy_shift = FLASH_H7_SR_QW;
} else {
ELOG("unsupported flash method, abort");
ELOG("unsupported flash method, abort\n");
return(-1);
}

Expand Down Expand Up @@ -1617,9 +1617,8 @@ int stlink_write_mem32(stlink_t *sl, uint32_t addr, uint16_t len) {
DLOG("*** stlink_write_mem32 %u bytes to %#x\n", len, addr);

if (len % 4 != 0) {
fprintf(stderr, "Error: Data length doesn't have a 32 bit alignment: +%d byte.\n",
len % 4);
abort();
ELOG("Data length doesn't have a 32 bit alignment: +%d byte.\n", len % 4);
return(-1);
}

return(sl->backend->write_mem32(sl, addr, len));
Expand All @@ -1629,9 +1628,8 @@ int stlink_read_mem32(stlink_t *sl, uint32_t addr, uint16_t len) {
DLOG("*** stlink_read_mem32 ***\n");

if (len % 4 != 0) { // !!! never ever: fw gives just wrong values
fprintf(stderr, "Error: Data length doesn't have a 32 bit alignment: +%d byte.\n",
len % 4);
abort();
ELOG("Data length doesn't have a 32 bit alignment: +%d byte.\n", len % 4);
return(-1);
}

return(sl->backend->read_mem32(sl, addr, len));
Expand All @@ -1641,9 +1639,8 @@ int stlink_write_mem8(stlink_t *sl, uint32_t addr, uint16_t len) {
DLOG("*** stlink_write_mem8 ***\n");

if (len > 0x40) { // !!! never ever: Writing more then 0x40 bytes gives unexpected behaviour
fprintf(stderr, "Error: Data length > 64: +%d byte.\n",
len);
abort();
ELOG("Data length > 64: +%d byte.\n", len);
return(-1);
}

return(sl->backend->write_mem8(sl, addr, len));
Expand Down