Skip to content

Commit

Permalink
warn and abort on unsupported access.
Browse files Browse the repository at this point in the history
should only happen currently after adding a new flash family.
  • Loading branch information
grevaillot committed Apr 21, 2020
1 parent 7718f6e commit c8adbf3
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,8 @@ static inline unsigned int is_flash_locked(stlink_t *sl) {
cr_reg = STM32WB_FLASH_CR;
cr_lock_shift = STM32WB_FLASH_CR_LOCK;
} else {
ELOG("unsupported flash method, abort");
assert(false);
return -1;
}

Expand Down Expand Up @@ -427,6 +429,8 @@ static void unlock_flash(stlink_t *sl) {
} else if (sl->flash_type == STLINK_FLASH_TYPE_WB) {
key_reg = STM32WB_FLASH_KEYR;
} else {
ELOG("unsupported flash method, abort");
assert(false);
return;
}

Expand Down Expand Up @@ -476,6 +480,8 @@ static void lock_flash(stlink_t *sl) {
cr_reg = STM32WB_FLASH_CR;
cr_lock_shift = STM32WB_FLASH_CR_LOCK;
} else {
ELOG("unsupported flash method, abort");
assert(false);
return;
}

Expand Down Expand Up @@ -523,6 +529,8 @@ static bool is_flash_option_locked(stlink_t *sl) {
optlock_shift = STM32WB_FLASH_CR_OPTLOCK;
break;
default:
ELOG("unsupported flash method, abort");
assert(false);
return -1;
}

Expand Down Expand Up @@ -566,8 +574,9 @@ static int lock_flash_option(stlink_t *sl) {
optcr_reg = STM32WB_FLASH_CR;
optlock_shift = STM32WB_FLASH_CR_OPTLOCK;
break;

default:
ELOG("unsupported flash method, abort");
assert(false);
return -1;
}

Expand Down Expand Up @@ -614,6 +623,8 @@ static int unlock_flash_option(stlink_t *sl)
break;

default:
ELOG("unsupported flash method, abort");
assert(false);
return -1;
}

Expand Down

0 comments on commit c8adbf3

Please sign in to comment.