Helper library to use modem_ref driver.

Dependencies:   WizziCom WizziDebug ram_fs modem_ref

Dependents:   D7A_Localisation D7A_1x_demo_send_file_data_and_forget D7A_1x_demo_CodeUpgradeProtocol D7A_1x_demo_LoRaWAN ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers modem_cup.h Source File

modem_cup.h

00001 #include "mbed.h"
00002 #include "bin_SH2050.h"
00003 #include "bootloader_SH2050.h"
00004 #include "modem_d7a.h"
00005 
00006 //------------------------------------------------------------------
00007 // CUP Package files structure:
00008 //   | SIZE |  ADDR  |      BINARY        |  PAD    | CRC  | Next Archive
00009 //   |  4B  |   4B   |        XB          | 0-3 B   |  4B  | ...
00010 //   |                                              |      | ...
00011 //   |<------------------CRC----------------------->|      | ...
00012 //   |<-----------------------SIZE------------------------>| ...
00013 //
00014 // Archive must be word-aligned
00015 // Archives can be concatenated
00016 // ADDR is the destination address of the installed archive
00017 // SIZE accounts for whole archive (including itself)
00018 // Binary size must be multiple of word (i.e pad=4)
00019 // CRC calculated on whole archive (obviously excluding itself)
00020 // Values (size,addr) are stored little-endian
00021 
00022 //======================================================================
00023 // cup_cfg_t
00024 //----------------------------------------------------------------------
00025 /// @brief  This is the structure of the CUP Config FILE.
00026 ///         This file _MUST_ always be located a the same place (EEPROM
00027 ///         Origin) as BOOT/CUP access it in a hardcoded way.
00028 /// !! Do NOT touch this except if you're a CUP Master !!
00029 //======================================================================
00030 TYPEDEF_STRUCT_PACKED
00031 {
00032     // The CUP Command
00033     uint16_t  cmd;
00034     // Number of Archives to be CUP'ed
00035     uint16_t  arch_nb;
00036     // This field has 2 meanings:
00037     // - when read-out it gives start address of CUP-Code file
00038     // - when written (for a CUP start) it gives the offset (in bytes) at
00039     //   which the first archive is stored in CUP-Code file
00040     uint32_t  src_offset;
00041     // CRC32 of the arch_nb concatenated archives starting at offset
00042     uint32_t  signature;
00043     // TODO: Deciphering key. For now CUP MAX size
00044     uint32_t  key;
00045     // Debug / Uart config
00046     uint32_t  dbg_cfg;
00047 } cup_cfg_t;    
00048 
00049 TYPEDEF_STRUCT_PACKED
00050 {
00051     uint8_t* data;
00052     uint8_t cfg_fid;
00053     uint8_t code_fid;
00054     uint32_t code_size;
00055     uint32_t data_size;
00056     uint32_t local_mtu;
00057     uint32_t nb_archives;
00058     uint32_t signature;
00059     uint32_t mfg_id;
00060     uint32_t dev_id;
00061     uint32_t hw_id;
00062     uint8_t fw_major;
00063     uint8_t fw_minor;
00064     uint16_t fw_patch;
00065     uint32_t fw_hash;
00066     uint8_t target_fw_major;
00067     uint8_t target_fw_minor;
00068     uint8_t target_fw_patch;
00069     uint32_t target_fw_hash;
00070 } cup_param_t;
00071 
00072 void modem_cup_update(revision_t* rev);
00073