Skip to content

STM32WB: FLASH compilation issue with baremetal #13633

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

Merged
merged 1 commit into from
Sep 23, 2020
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
6 changes: 6 additions & 0 deletions targets/TARGET_STM/TARGET_STM32WB/flash_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
/* Family specific include for WB with HW semaphores */
#include "hw.h"
#include "hw_conf.h"
#if MBED_CONF_BLE_PRESENT
#include "shci.h"
#endif

/* Used in HCIDriver.cpp/stm32wb_start_ble() */
int BLE_inited = 0;
Expand Down Expand Up @@ -90,6 +92,7 @@ int32_t flash_erase_sector(flash_t *obj, uint32_t address)
return -1;
}

#if MBED_CONF_BLE_PRESENT
if (BLE_inited) {
/*
* Notify the CPU2 that some flash erase activity may be executed
Expand All @@ -99,6 +102,7 @@ int32_t flash_erase_sector(flash_t *obj, uint32_t address)
*/
SHCI_C2_FLASH_EraseActivity(ERASE_ACTIVITY_ON);
}
#endif

do {
/* PESD bit mechanism used by M0+ to protect its timing */
Expand Down Expand Up @@ -137,13 +141,15 @@ int32_t flash_erase_sector(flash_t *obj, uint32_t address)

while (__HAL_FLASH_GET_FLAG(FLASH_FLAG_CFGBSY));

#if MBED_CONF_BLE_PRESENT
if (BLE_inited) {
/**
* Notify the CPU2 there will be no request anymore to erase the flash
* On reception of this command, the CPU2 disables the BLE timing protection versus flash erase processing
*/
SHCI_C2_FLASH_EraseActivity(ERASE_ACTIVITY_OFF);
}
#endif

/* Lock the Flash to disable the flash control register access (recommended
to protect the FLASH memory against possible unwanted operation) */
Expand Down