FlashIAP BD: Assert if default constructor is used w/o config change

pull/9475/head
David Saada 2019-01-23 16:30:36 +02:00
parent a6509cf47f
commit 22309c93d0
1 changed files with 5 additions and 1 deletions

View File

@ -18,6 +18,7 @@
#include "FlashIAPBlockDevice.h" #include "FlashIAPBlockDevice.h"
#include "mbed_critical.h" #include "mbed_critical.h"
#include "mbed_error.h"
using namespace mbed; using namespace mbed;
#include <inttypes.h> #include <inttypes.h>
@ -38,7 +39,10 @@ using namespace mbed;
FlashIAPBlockDevice::FlashIAPBlockDevice(uint32_t address, uint32_t size) FlashIAPBlockDevice::FlashIAPBlockDevice(uint32_t address, uint32_t size)
: _flash(), _base(address), _size(size), _is_initialized(false), _init_ref_count(0) : _flash(), _base(address), _size(size), _is_initialized(false), _init_ref_count(0)
{ {
if ((address == 0xFFFFFFFF) || (size == 0)) {
MBED_ERROR(MBED_ERROR_INVALID_ARGUMENT,
"Base address and size need to be set in flashiap-block-device configuration in order to use default constructor");
}
} }
FlashIAPBlockDevice::~FlashIAPBlockDevice() FlashIAPBlockDevice::~FlashIAPBlockDevice()