Program to update the D7A modem's firmware.

Dependencies:   modem_ref_helper DebouncedInterrupt

Revision:
5:ac38f09fd179
Parent:
4:23cb73bb11b3
Child:
7:5b8648784381
--- a/cup.cpp	Wed Oct 26 15:06:49 2016 +0000
+++ b/cup.cpp	Wed Nov 02 14:01:03 2016 +0000
@@ -5,8 +5,8 @@
 #include "d7a.h"
 #include "dbg.h"
 
-#define FLASH_PAGE_SIZE (256)
-#define TU_LOCAL        (220)
+#define MODEM_FLASH_PAGE_SIZE   (256)
+#define TU_LOCAL                (220)
 
 
 CUP_Archive::CUP_Archive(void) :
@@ -26,7 +26,7 @@
 {
     cup_cfg_t cfg = {
         .cmd = 0x10AD,
-        .arch_nb = 100,
+        .arch_nb = 20,
     };
     
     uint32_t fof = 0;
@@ -48,7 +48,7 @@
     {
         // Calculate offset if needed
         PRINT("/!\\ CUP process will overwrite Archive: 0x%08X + %d > 0x%08X /!\\\r\n", addr, dsize, src_offset);
-        eaddr = ((eaddr / FLASH_PAGE_SIZE) + 1) * FLASH_PAGE_SIZE;
+        eaddr = ((eaddr / MODEM_FLASH_PAGE_SIZE) + 1) * MODEM_FLASH_PAGE_SIZE;
         offset = eaddr - src_offset;
         PRINT("/!\\ CUP Shifting archive storage to 0x%08X (Offset 0x%X) /!\\\r\n", eaddr, offset);
     }
@@ -95,7 +95,7 @@
         
     D7A_WRITE((uint8_t*)&cfg, CUP_CFG_FID, 0, 12, root_key);
     
-    PRINT("Done.\r\nWaiting for reboot...\r\n");
+    PRINT("Waiting for reboot...\r\n");
     
     d7a_wait_ready();