diff --git a/components/storage/blockdevice/COMPONENT_RSPIF/SPIFReducedBlockDevice.h b/components/storage/blockdevice/COMPONENT_RSPIF/SPIFReducedBlockDevice.h index 53bf7d83c7..e7434e4c67 100644 --- a/components/storage/blockdevice/COMPONENT_RSPIF/SPIFReducedBlockDevice.h +++ b/components/storage/blockdevice/COMPONENT_RSPIF/SPIFReducedBlockDevice.h @@ -20,6 +20,22 @@ #include "drivers/DigitalOut.h" #include "features/storage/blockdevice/BlockDevice.h" +#ifndef MBED_CONF_RSPIF_DRIVER_SPI_MOSI +#define MBED_CONF_RSPIF_DRIVER_SPI_MOSI NC +#endif +#ifndef MBED_CONF_RSPIF_DRIVER_SPI_MISO +#define MBED_CONF_RSPIF_DRIVER_SPI_MISO NC +#endif +#ifndef MBED_CONF_RSPIF_DRIVER_SPI_CLK +#define MBED_CONF_RSPIF_DRIVER_SPI_CLK NC +#endif +#ifndef MBED_CONF_RSPIF_DRIVER_SPI_CS +#define MBED_CONF_RSPIF_DRIVER_SPI_CS NC +#endif +#ifndef MBED_CONF_RSPIF_DRIVER_SPI_FREQ +#define MBED_CONF_RSPIF_DRIVER_SPI_FREQ 40000000 +#endif + /** Reduced BlockDevice for SPI based flash devices * *Should only be used by Boot Loader* * @@ -66,7 +82,11 @@ public: * @param csel SPI chip select pin * @param freq Clock speed of the SPI bus (defaults to 40MHz) */ - SPIFReducedBlockDevice(PinName mosi, PinName miso, PinName sclk, PinName csel, int freq = 40000000); + SPIFReducedBlockDevice(PinName mosi = MBED_CONF_RSPIF_DRIVER_SPI_MOSI, + PinName miso = MBED_CONF_RSPIF_DRIVER_SPI_MISO, + PinName sclk = MBED_CONF_RSPIF_DRIVER_SPI_CLK, + PinName csel = MBED_CONF_RSPIF_DRIVER_SPI_CS, + int freq = MBED_CONF_RSPIF_DRIVER_SPI_FREQ); /** Initialize a block device * diff --git a/components/storage/blockdevice/COMPONENT_RSPIF/mbed_lib.json b/components/storage/blockdevice/COMPONENT_RSPIF/mbed_lib.json index 11b5f7c53c..11477938cc 100644 --- a/components/storage/blockdevice/COMPONENT_RSPIF/mbed_lib.json +++ b/components/storage/blockdevice/COMPONENT_RSPIF/mbed_lib.json @@ -1,11 +1,11 @@ { "name": "rspif-driver", "config": { - "SPI_MOSI": "NC", - "SPI_MISO": "NC", - "SPI_CLK": "NC", - "SPI_CS": "NC", - "SPI_FREQ": "40000000" + "SPI_MOSI": "SPI_MOSI", + "SPI_MISO": "SPI_MISO", + "SPI_CLK": "SPI_SCK", + "SPI_CS": "SPI_CS", + "SPI_FREQ":"40000000" }, "target_overrides": { "K82F": { diff --git a/features/storage/system_storage/SystemStorage.cpp b/features/storage/system_storage/SystemStorage.cpp index e9ae6b5001..84190dcf72 100644 --- a/features/storage/system_storage/SystemStorage.cpp +++ b/features/storage/system_storage/SystemStorage.cpp @@ -70,13 +70,7 @@ MBED_WEAK BlockDevice *BlockDevice::get_default_instance() #elif COMPONENT_RSPIF - static SPIFReducedBlockDevice default_bd( - MBED_CONF_RSPIF_DRIVER_SPI_MOSI, - MBED_CONF_RSPIF_DRIVER_SPI_MISO, - MBED_CONF_RSPIF_DRIVER_SPI_CLK, - MBED_CONF_RSPIF_DRIVER_SPI_CS, - MBED_CONF_RSPIF_DRIVER_SPI_FREQ - ); + static SPIFReducedBlockDevice default_bd; return &default_bd; diff --git a/tools/test_configs/RSPIFBlockDeviceAndHeapBlockDevice.json b/tools/test_configs/RSPIFBlockDeviceAndHeapBlockDevice.json new file mode 100644 index 0000000000..a53c4c5e0a --- /dev/null +++ b/tools/test_configs/RSPIFBlockDeviceAndHeapBlockDevice.json @@ -0,0 +1,25 @@ +{ + "config": { + "sim-blockdevice": { + "help": "Simulated block device, requires sufficient heap", + "macro_name": "MBED_TEST_SIM_BLOCKDEVICE", + "value": "HeapBlockDevice" + }, + "test-blockdevice": { + "help": "Used blockdevice", + "macro_name": "MBED_TEST_BLOCKDEVICE", + "value": "SPIFReducedBlockDevice" + }, + "test-filesystem": { + "help": "Used filesystem", + "macro_name": "MBED_TEST_FILESYSTEM", + "value": "LittleFileSystem" + } + }, + "target_overrides": { + "NRF52840_DK": { + "target.components_remove": ["QSPI", "QSPIF"], + "target.components_add" : ["SPI", "RSPIF"] + } + } +}