Skip to content

Commit 39d4628

Browse files
author
Cruz Monrreal
authored
Merge pull request #9475 from davidsaada/david_flashiap_no_default
FlashIAP Block device: Assert if default constructor is used without setting config parameters
2 parents 695179b + 22309c9 commit 39d4628

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

components/storage/blockdevice/COMPONENT_FLASHIAP/FlashIAPBlockDevice.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include "FlashIAPBlockDevice.h"
2020
#include "mbed_critical.h"
21+
#include "mbed_error.h"
2122

2223
using namespace mbed;
2324
#include <inttypes.h>
@@ -38,7 +39,10 @@ using namespace mbed;
3839
FlashIAPBlockDevice::FlashIAPBlockDevice(uint32_t address, uint32_t size)
3940
: _flash(), _base(address), _size(size), _is_initialized(false), _init_ref_count(0)
4041
{
41-
42+
if ((address == 0xFFFFFFFF) || (size == 0)) {
43+
MBED_ERROR(MBED_ERROR_INVALID_ARGUMENT,
44+
"Base address and size need to be set in flashiap-block-device configuration in order to use default constructor");
45+
}
4246
}
4347

4448
FlashIAPBlockDevice::~FlashIAPBlockDevice()

0 commit comments

Comments
 (0)