Program to update the D7A modem's firmware.

Dependencies:   modem_ref_helper DebouncedInterrupt

Revision:
1:765933092750
Parent:
0:82a60d86ab2e
Child:
2:e0cdfa7d2a8b
--- a/main.cpp	Wed Oct 26 10:03:59 2016 +0000
+++ b/main.cpp	Wed Oct 26 11:01:26 2016 +0000
@@ -8,6 +8,9 @@
 // File IDs
 #define D7A_FID_FIRMWARE_VERSION        (2)
 
+uint8_t root_key[D7A_ROOT_KEY_SIZE] = {
+    0xCE, 0x57, 0x74, 0x0B, 0x04, 0x1E, 0xCA, 0xFE
+};
 
 // callbacks structure
 const d7a_callbacks_t callbacks = {
@@ -41,7 +44,9 @@
     
     // Start & initialize
     DBG_OPEN();
-    PRINT("\r\n--- D7A WM Updater ---\r\n");
+    PRINT("\r\n-----------------------------------\r\n");
+    PRINT("---------- D7A WM Updater ---------\r\n");
+    PRINT("-----------------------------------\r\n");
 
     DebouncedInterrupt user_interrupt(USER_BUTTON);
     user_interrupt.attach(button_push_isr, IRQ_FALL, 200, true);
@@ -53,22 +58,22 @@
     
     PRINT("-----------------------------------\r\n");
     PRINT("--------- D7A Modem infos ---------\r\n");
-    PRINT("Manufacturer ID:  0x%08X\r\n", rev.manufacturer_id);
-    PRINT("Device ID:        0x%08X\r\n", rev.device_id);
-    PRINT("Hardware version: 0x%08X\r\n", rev.hw_version);
-    PRINT("Firmware version: v%d.%d.%d\r\n", rev.fw_version.major, rev.fw_version.minor, rev.fw_version.patch);
-    PRINT("Firmware hash:    0x%08x\r\n", rev.fw_version.hash);
-    PRINT("File system CRC:  0x%08x\r\n", rev.fs_crc);
+    PRINT("Manufacturer ID:  0x%08X\r\n",       rev.manufacturer_id);
+    PRINT("Device ID:        0x%08X\r\n",       rev.device_id);
+    PRINT("Hardware version: 0x%08X\r\n",       rev.hw_version);
+    PRINT("Firmware version: v%d.%d.%d\r\n",    rev.fw_version.major, rev.fw_version.minor, rev.fw_version.patch);
+    PRINT("Firmware hash:    0x%08x\r\n",       rev.fw_version.hash);
+    PRINT("File system CRC:  0x%08x\r\n",       rev.fs_crc);
     PRINT("-----------------------------------\r\n");
     
     // Check package infos
     CUP_Archive cup_pkg;
     
     PRINT("-------- CUP Archive infos --------\r\n");
-    PRINT("Firmware version: v%d.%d.%d\r\n", cup_pkg.fw_major, cup_pkg.fw_minor, cup_pkg.fw_patch);
-    PRINT("Size:             %d\r\n", cup_pkg.data_size);
-    PRINT("Nb archives:      %d\r\n", cup_pkg.nb_archives);
-    PRINT("Signature:        0x%08X\r\n", cup_pkg.signature);
+    PRINT("Firmware version: v%d.%d.%d\r\n",    cup_pkg.fw_major, cup_pkg.fw_minor, cup_pkg.fw_patch);
+    PRINT("Size:             %d\r\n",           cup_pkg.data_size);
+    PRINT("Nb archives:      %d\r\n",           cup_pkg.nb_archives);
+    PRINT("Signature:        0x%08X\r\n",       cup_pkg.signature);
     PRINT("-----------------------------------\r\n");
     
     // Read CUP config with root permissions
@@ -76,10 +81,10 @@
     D7A_READ(&cup_cfg, CUP_CFG_FID, 0, sizeof(cup_cfg_t), root_key);
     
     PRINT("----- CUP Configuration infos -----\r\n");
-    PRINT("Src offset:       0x%08X\r\n", cup_cfg.src_offset);
-    PRINT("Signature:        0x%08X\r\n", cup_cfg.signature);
-    PRINT("File max size:    %d\r\n", cup_cfg.key);
-    PRINT("Dbg config:       0x%08X\r\n", cup_cfg.dbg_cfg);
+    PRINT("Src offset:       0x%08X\r\n",       cup_cfg.src_offset);
+    PRINT("Signature:        0x%08X\r\n",       cup_cfg.signature);
+    PRINT("File max size:    %d\r\n",           cup_cfg.key);
+    PRINT("Dbg config:       0x%08X\r\n",       cup_cfg.dbg_cfg);
     PRINT("-----------------------------------\r\n");
     
     uint32_t version_old = (rev.fw_version.major << 24) | (rev.fw_version.minor << 16) | rev.fw_version.patch;