From ccbf961506b07dd323b572d1f976e20162012f2e Mon Sep 17 00:00:00 2001 From: Hugues Kamba Date: Thu, 17 Dec 2020 15:11:02 +0000 Subject: [PATCH 1/3] Fix code when a different blockdevice is used Use the correct bd object. --- CMakeLists.txt | 30 ++++++++++++++++++++++++++++++ main.cpp | 24 +++++++++++++----------- 2 files changed, 43 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d693379..36bf8f0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,36 @@ target_sources(${APP_TARGET} main.cpp ) +list(APPEND mbed_storage_libs) + +if("DATAFLASH" IN_LIST MBED_TARGET_LABELS) + list(APPEND mbed_storage_libs mbed-storage-dataflash) +endif() + +if("FLASHIAP" IN_LIST MBED_TARGET_LABELS) + list(APPEND mbed_storage_libs mbed-storage-flashiap) +endif() + +if("I2CEE" IN_LIST MBED_TARGET_LABELS) + list(APPEND mbed_storage_libs mbed-storage-i2cee) +endif() + +if("QSPIF" IN_LIST MBED_TARGET_LABELS) + list(APPEND mbed_storage_libs mbed-storage-qspif) +endif() + +if("OSPIF" IN_LIST MBED_TARGET_LABELS) + list(APPEND mbed_storage_libs mbed-storage-ospif) +endif() + +if("SD" IN_LIST MBED_TARGET_LABELS) + list(APPEND mbed_storage_libs mbed-storage-sd) +endif() + +if("SPIF" IN_LIST MBED_TARGET_LABELS) + list(APPEND mbed_storage_libs mbed-storage-spif) +endif() + target_link_libraries(${APP_TARGET} PRIVATE mbed-os diff --git a/main.cpp b/main.cpp index 70e79e7..aa8aae5 100644 --- a/main.cpp +++ b/main.cpp @@ -20,30 +20,32 @@ // Block devices #if COMPONENT_QSPIF #include "QSPIFBlockDevice.h" +QSPIFBlockDevice bd; +#endif + +#if COMPONENT_OSPIF +#include "OSPIFBlockDevice.h" +OSPIFBlockDevice bd; #endif #if COMPONENT_SPIF #include "SPIFBlockDevice.h" +// Physical block device, can be any device that supports the BlockDevice API +SPIFBlockDevice bd; #endif #if COMPONENT_DATAFLASH #include "DataFlashBlockDevice.h" -#endif +DataFlashBlockDevice bd; +#endif #if COMPONENT_SD #include "SDBlockDevice.h" -#endif - -#include "HeapBlockDevice.h" - - // Physical block device, can be any device that supports the BlockDevice API -SDBlockDevice bd( - MBED_CONF_SD_SPI_MOSI, - MBED_CONF_SD_SPI_MISO, - MBED_CONF_SD_SPI_CLK, - MBED_CONF_SD_SPI_CS); +SDBlockDevice bd; +#endif +#include "HeapBlockDevice.h" // Entry point for the example int main() { From d030b2c3666e2a43a5326115c8a0f11385f4df56 Mon Sep 17 00:00:00 2001 From: Hugues Kamba Date: Thu, 17 Dec 2020 15:12:02 +0000 Subject: [PATCH 2/3] CMake: Include only the storage library needed --- CMakeLists.txt | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 36bf8f0..6c56931 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,14 +38,14 @@ if("I2CEE" IN_LIST MBED_TARGET_LABELS) list(APPEND mbed_storage_libs mbed-storage-i2cee) endif() -if("QSPIF" IN_LIST MBED_TARGET_LABELS) - list(APPEND mbed_storage_libs mbed-storage-qspif) -endif() - if("OSPIF" IN_LIST MBED_TARGET_LABELS) list(APPEND mbed_storage_libs mbed-storage-ospif) endif() +if("QSPIF" IN_LIST MBED_TARGET_LABELS) + list(APPEND mbed_storage_libs mbed-storage-qspif) +endif() + if("SD" IN_LIST MBED_TARGET_LABELS) list(APPEND mbed_storage_libs mbed-storage-sd) endif() @@ -57,10 +57,8 @@ endif() target_link_libraries(${APP_TARGET} PRIVATE mbed-os - mbed-events mbed-storage - mbed-storage-qspif - mbed-storage-flashiap + ${mbed_storage_libs} ) mbed_set_post_build(${APP_TARGET}) From 3b03bad90380bf55c86d03a27118567b397db054 Mon Sep 17 00:00:00 2001 From: Hugues Kamba Date: Thu, 17 Dec 2020 15:18:21 +0000 Subject: [PATCH 3/3] Travis CI: Fix mbedtools commands to checkout repositories and build --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1a43383..7ca7802 100644 --- a/.travis.yml +++ b/.travis.yml @@ -88,9 +88,9 @@ matrix: - pip install "Jinja2>=2.10.1,<2.11" - pip install "intelhex>=1.3,<=2.2.1" script: - - mbedtools checkout - - echo mbedtools build -t GCC_ARM -m ${TARGET_NAME} -b ${PROFILE} - - mbedtools build -t GCC_ARM -m ${TARGET_NAME} -b ${PROFILE} + - mbedtools deploy + - echo mbedtools compile -t GCC_ARM -m ${TARGET_NAME} -b ${PROFILE} + - mbedtools compile -t GCC_ARM -m ${TARGET_NAME} -b ${PROFILE} - ccache -s - &build-test