From 22309c93d0d0990262ed9b72f3aae0b6d1e20ba3 Mon Sep 17 00:00:00 2001 From: David Saada Date: Wed, 23 Jan 2019 16:30:36 +0200 Subject: [PATCH] FlashIAP BD: Assert if default constructor is used w/o config change --- .../blockdevice/COMPONENT_FLASHIAP/FlashIAPBlockDevice.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/storage/blockdevice/COMPONENT_FLASHIAP/FlashIAPBlockDevice.cpp b/components/storage/blockdevice/COMPONENT_FLASHIAP/FlashIAPBlockDevice.cpp index b4d5dac38d..43e19acc82 100644 --- a/components/storage/blockdevice/COMPONENT_FLASHIAP/FlashIAPBlockDevice.cpp +++ b/components/storage/blockdevice/COMPONENT_FLASHIAP/FlashIAPBlockDevice.cpp @@ -18,6 +18,7 @@ #include "FlashIAPBlockDevice.h" #include "mbed_critical.h" +#include "mbed_error.h" using namespace mbed; #include @@ -38,7 +39,10 @@ using namespace mbed; FlashIAPBlockDevice::FlashIAPBlockDevice(uint32_t address, uint32_t size) : _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()