12
12
#include " certificates.h"
13
13
14
14
MBEDH7FlashFormatter::MBEDH7FlashFormatter ():
15
- _root(QSPI_SO0, QSPI_SO1, QSPI_SO2, QSPI_SO3, QSPI_SCK, QSPI_CS, QSPIF_POLARITY_MODE_1, 40000000 ),
16
- _wifi_data(& _root, 1 ),
15
+ _root(mbed::BlockDevice::get_default_instance() ),
16
+ _wifi_data(_root, 1 ),
17
17
_wifi_data_fs(" wlan" ),
18
- _ota_data(& _root, 2 ),
18
+ _ota_data(_root, 2 ),
19
19
_ota_data_fs(" fs" ),
20
- _kvstore_data(& _root, 3 )
20
+ _kvstore_data(_root, 3 )
21
21
{
22
22
}
23
23
24
24
bool MBEDH7FlashFormatter::checkPartition ()
25
25
{
26
- if (_root. init () != QSPIF_BD_ERROR_OK )
26
+ if (_root-> init () != mbed::BD_ERROR_OK )
27
27
{
28
28
return false ;
29
29
}
@@ -33,7 +33,7 @@ bool MBEDH7FlashFormatter::checkPartition()
33
33
return false ;
34
34
}
35
35
36
- if (_ota_data.init () != QSPIF_BD_ERROR_OK || _ota_data_fs.mount (&_ota_data) != 0 )
36
+ if (_ota_data.init () != mbed::BD_ERROR_OK || _ota_data_fs.mount (&_ota_data) != 0 )
37
37
{
38
38
return false ;
39
39
}
@@ -45,22 +45,22 @@ bool MBEDH7FlashFormatter::checkPartition()
45
45
_ota_data_fs.unmount ();
46
46
_ota_data.deinit ();
47
47
48
- if (_kvstore_data.init () != QSPIF_BD_ERROR_OK )
48
+ if (_kvstore_data.init () != mbed::BD_ERROR_OK )
49
49
{
50
50
return false ;
51
51
}
52
52
53
53
_kvstore_data.deinit ();
54
- _root. deinit ();
54
+ _root-> deinit ();
55
55
56
56
return true ;
57
57
}
58
58
59
59
bool MBEDH7FlashFormatter::formatPartition () {
60
- _root. erase (0x0 , _root. get_erase_size ());
61
- mbed::MBRBlockDevice::partition (& _root, 1 , 0x0B , 0 , 1024 * 1024 );
62
- mbed::MBRBlockDevice::partition (& _root, 2 , 0x0B , 1024 * 1024 , 13 * 1024 * 1024 );
63
- mbed::MBRBlockDevice::partition (& _root, 3 , 0x0B , 13 * 1024 * 1024 , 14 * 1024 * 1024 );
60
+ _root-> erase (0x0 , _root-> get_erase_size ());
61
+ mbed::MBRBlockDevice::partition (_root, 1 , 0x0B , 0 , 1024 * 1024 );
62
+ mbed::MBRBlockDevice::partition (_root, 2 , 0x0B , 1024 * 1024 , 13 * 1024 * 1024 );
63
+ mbed::MBRBlockDevice::partition (_root, 3 , 0x0B , 13 * 1024 * 1024 , 14 * 1024 * 1024 );
64
64
65
65
if (_ota_data_fs.mount (&_ota_data) != 0 ) {
66
66
if (_ota_data_fs.reformat (&_ota_data) != 0 ) {
@@ -73,7 +73,7 @@ bool MBEDH7FlashFormatter::formatPartition() {
73
73
if (!formatWifiPartition ()) {
74
74
return false ;
75
75
}
76
- _root. deinit ();
76
+ _root-> deinit ();
77
77
return true ;
78
78
}
79
79
@@ -139,7 +139,7 @@ bool MBEDH7FlashFormatter::formatWifiPartition() {
139
139
while (byte_count < file_size) {
140
140
if (byte_count + chunck_size > file_size)
141
141
chunck_size = file_size - byte_count;
142
- int ret = _root. program (wifi_firmware_image_data, offset + byte_count, chunck_size);
142
+ int ret = _root-> program (wifi_firmware_image_data, offset + byte_count, chunck_size);
143
143
if (ret != 0 ) {
144
144
return false ;
145
145
}
0 commit comments