Skip to content

Commit b84f377

Browse files
Yossi LevyYossi Levy
authored andcommitted
Removing nvstore. adding back the option for configuration as in the external repo
1 parent 473f8d3 commit b84f377

File tree

4 files changed

+36
-20
lines changed

4 files changed

+36
-20
lines changed

components/storage/blockdevice/COMPONENT_FLASHIAP/FlashIAPBlockDevice.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,6 @@
3636
#define DEBUG_PRINTF(...)
3737
#endif
3838

39-
FlashIAPBlockDevice::FlashIAPBlockDevice()
40-
: _flash(), _base(0), _size(0), _is_initialized(false), _init_ref_count(0)
41-
{
42-
DEBUG_PRINTF("FlashIAPBlockDevice: %" PRIX32 " %" PRIX32 "\r\n", address, size);
43-
}
44-
4539
FlashIAPBlockDevice::FlashIAPBlockDevice(uint32_t address, uint32_t size)
4640
: _flash(), _base(address), _size(size), _is_initialized(false), _init_ref_count(0)
4741
{

components/storage/blockdevice/COMPONENT_FLASHIAP/FlashIAPBlockDevice.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,15 @@
2828
*/
2929
class FlashIAPBlockDevice : public BlockDevice {
3030
public:
31-
/** Creates a FlashIAPBlockDevice **/
32-
FlashIAPBlockDevice();
3331

3432
/** Creates a FlashIAPBlockDevice
3533
*
3634
* @param address Physical address where the block device start
3735
* @param size The block device size
3836
*/
39-
FlashIAPBlockDevice(uint32_t address, uint32_t size = 0);
40-
37+
FlashIAPBlockDevice(uint32_t address = MBED_CONF_FLASHIAP_BLOCK_DEVICE_BASE_ADDRESS,
38+
uint32_t size = MBED_CONF_FLASHIAP_BLOCK_DEVICE_SIZE);
39+
4140
virtual ~FlashIAPBlockDevice();
4241

4342
/** Initialize a block device
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "flashiap-block-device",
3+
"config": {
4+
"base-address": {
5+
"help": "Base address for the block device on the external flash.",
6+
"value": "0xFFFFFFFF"
7+
},
8+
"size": {
9+
"help": "Memory allocated for block device.",
10+
"value": "0"
11+
}
12+
},
13+
"target_overrides": {
14+
"REALTEK_RTL8195AM": {
15+
"base-address": "0x1C0000",
16+
"size": "0x40000"
17+
}
18+
}
19+
}

features/storage/system_storage/SystemStorage.cpp

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#endif
3232

3333
#if COMPONENT_FLASHIAP
34-
#include "nvstore.h"
3534
#include "FlashIAPBlockDevice.h"
3635
#endif
3736

@@ -85,12 +84,12 @@ MBED_WEAK BlockDevice *BlockDevice::get_default_instance()
8584

8685
#elif COMPONENT_FLASHIAP
8786

88-
uint32_t top_address;
87+
#if (MBED_CONF_FLASHIAP_BLOCK_DEVICE_SIZE == 0) && (MBED_CONF_FLASHIAP_BLOCK_DEVICE_BASE_ADDRESS == 0xFFFFFFFF)
88+
89+
size_t flash_size;
90+
uint32_t start_address;
8991
uint32_t bottom_address;
90-
size_t area_size;
9192
FlashIAP flash;
92-
NVStore &nvstore = NVStore::get_instance();
93-
nvstore.get_area_params(0, top_address, area_size); //Find where nvstore begins
9493

9594
int ret = flash.init();
9695
if (ret != 0) {
@@ -99,16 +98,21 @@ MBED_WEAK BlockDevice *BlockDevice::get_default_instance()
9998

10099
//Find the start of first sector after text area
101100
bottom_address = align_up(FLASHIAP_ROM_END, flash.get_sector_size(FLASHIAP_ROM_END));
102-
103-
if (top_address <= bottom_address) {
104-
return 0;
105-
}
101+
start_address = flash.get_flash_start();
102+
flash_size = flash.get_flash_size();
106103

107104
ret = flash.deinit();
108105

109-
static FlashIAPBlockDevice default_bd(bottom_address, top_address - bottom_address);
106+
static FlashIAPBlockDevice default_bd(bottom_address, start_address + flash_size - bottom_address);
107+
108+
#else
109+
110+
static FlashIAPBlockDevice default_bd;
111+
112+
#endif
110113

111114
return &default_bd;
115+
112116
#else
113117

114118
return NULL;

0 commit comments

Comments
 (0)