22
22
*/
23
23
24
24
// #include "mbed.h"
25
+ #include " FlashIAP.h"
25
26
#include " LittleFileSystem.h"
26
27
#include " fslittle_debug.h"
27
28
#include " fslittle_test.h"
@@ -48,6 +49,15 @@ using namespace utest::v1;
48
49
#endif
49
50
// / @endcond
50
51
52
+ // Align a value to a specified size.
53
+ // Parameters :
54
+ // val - [IN] Value.
55
+ // size - [IN] Size.
56
+ // Return : Aligned value.
57
+ static inline uint32_t align_up (uint32_t val, uint32_t size)
58
+ {
59
+ return (((val - 1 ) / size) + 1 ) * size;
60
+ }
51
61
52
62
/* DEVICE_SPI
53
63
* This symbol is defined in targets.json if the target has a SPI interface, which is required for SDCard support.
@@ -1247,7 +1257,29 @@ control_t fslittle_fopen_test_00(const size_t call_count)
1247
1257
(void ) call_count;
1248
1258
int32_t ret = -1 ;
1249
1259
1260
+ #if (MBED_CONF_FLASHIAP_BLOCK_DEVICE_SIZE == 0) && (MBED_CONF_FLASHIAP_BLOCK_DEVICE_BASE_ADDRESS == 0xFFFFFFFF)
1261
+
1262
+ size_t flash_size;
1263
+ uint32_t start_address;
1264
+ uint32_t bottom_address;
1265
+ mbed::FlashIAP flash_driver;
1266
+
1267
+ ret = flash_driver.init ();
1268
+ TEST_ASSERT_EQUAL (0 , ret);
1269
+
1270
+ // Find the start of first sector after text area
1271
+ bottom_address = align_up (FLASHIAP_APP_ROM_END_ADDR, flash_driver.get_sector_size (FLASHIAP_APP_ROM_END_ADDR));
1272
+ start_address = flash_driver.get_flash_start ();
1273
+ flash_size = flash_driver.get_flash_size ();
1274
+ ret = flash_driver.deinit ();
1275
+ flash = new FlashIAPBlockDevice (bottom_address, start_address + flash_size - bottom_address);
1276
+
1277
+ #else
1278
+
1250
1279
flash = new FlashIAPBlockDevice ();
1280
+
1281
+ #endif
1282
+
1251
1283
ret = flash->init ();
1252
1284
TEST_ASSERT_EQUAL (0 , ret);
1253
1285
0 commit comments