NuMaker bootloader with SD mode

Files at this revision

API Documentation at this revision

Comitter:
cyliang
Date:
Mon Mar 13 02:08:34 2023 +0000
Parent:
6:4dc994a04a99
Commit message:
Update main.cpp, SD lib & OS to v6.17.0

Changed in this revision

NuMaker-mbed-SD-driver.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
mbed_app.json Show annotated file Show diff for this revision Revisions of this file
--- a/NuMaker-mbed-SD-driver.lib	Thu Feb 25 10:17:10 2021 +0800
+++ b/NuMaker-mbed-SD-driver.lib	Mon Mar 13 02:08:34 2023 +0000
@@ -1,1 +1,1 @@
-https://github.com/OpenNuvoton/NuMaker-mbed-SD-driver/#7b763a96fa361da47a294efbe4bc201f7fb9c818
+https://github.com/OpenNuvoton/NuMaker-mbed-SD-driver/#14c1976088b84b9dab92125325a26c4cf9de345b
\ No newline at end of file
--- a/main.cpp	Thu Feb 25 10:17:10 2021 +0800
+++ b/main.cpp	Mon Mar 13 02:08:34 2023 +0000
@@ -1,9 +1,10 @@
 #include "mbed.h"
-#if defined(TARGET_NUMAKER_PFM_NUC472) || defined(TARGET_NUMAKER_PFM_M487)
+#if defined(TARGET_NUMAKER_PFM_NUC472) || defined(TARGET_NUMAKER_PFM_M487) || defined(TARGET_NUMAKER_IOT_M467)
 #include "NuSDBlockDevice.h"
 #else
 #include "SDBlockDevice.h"
 #endif
+#include "FlashSimBlockDevice.h"
 #include "FATFileSystem.h"
 
 #define SD_MOUNT_PATH           "sd"
@@ -13,8 +14,10 @@
 #error "target.restrict_size must be set for your target in mbed_app.json"
 #endif
 
-#if defined(TARGET_NUMAKER_PFM_NUC472) || defined(TARGET_NUMAKER_PFM_M487)
-NuSDBlockDevice sd;
+#if defined(TARGET_NUMAKER_PFM_NUC472) || defined(TARGET_NUMAKER_PFM_M487) || defined(TARGET_NUMAKER_IOT_M467)
+NuSDBlockDevice *bd_ = new NuSDBlockDevice();
+// Add flash-simulate layer on top of NUSD not implementing "erase" characteristic
+FlashSimBlockDevice *bd = new FlashSimBlockDevice(bd_);
 #else
 //Pin order: MOSI, MISO, SCK, CS
 SDBlockDevice sd(MBED_CONF_APP_SD_CARD_MOSI, MBED_CONF_APP_SD_CARD_MISO,
@@ -27,8 +30,7 @@
 
 int main()
 {
-    sd.init();
-    fs.mount(&sd);
+    int err = fs.mount(bd);
 #ifdef MBED_MAJOR_VERSION
     printf("Mbed OS version %d.%d.%d\r\n\n", MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION);
 #endif
@@ -46,8 +48,7 @@
     }
 
     fs.unmount();
-    sd.deinit();
-
+ 
     printf("Starting application\r\n");
 
     mbed_start_application(POST_APPLICATION_ADDR);
--- a/mbed-os.lib	Thu Feb 25 10:17:10 2021 +0800
+++ b/mbed-os.lib	Mon Mar 13 02:08:34 2023 +0000
@@ -1,1 +1,1 @@
-https://github.com/ARMmbed/mbed-os/#f9ee4e849f8cbd64f1ec5fdd4ad256585a208360
+https://github.com/ARMmbed/mbed-os/#17dc3dc2e6e2817a8bd3df62f38583319f0e4fed
\ No newline at end of file
--- a/mbed_app.json	Thu Feb 25 10:17:10 2021 +0800
+++ b/mbed_app.json	Mon Mar 13 02:08:34 2023 +0000
@@ -51,6 +51,10 @@
             "sd_card_miso": "D12",
             "sd_card_sck":  "D13",
             "sd_card_cs":   "D10"
+        },
+        "NUMAKER_IOT_M467": {
+            "target.restrict_size": "0x40000",
+            "update_file": "\"mbed-os-example-bootloader-blinky_application.bin\""
         }
     }
 }