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

Committer:
Jeej
Date:
Thu Mar 10 09:40:29 2022 +0000
Revision:
87:ae859849b6b4
Parent:
75:dad2f09cb870
Increase cb stack size

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jeej 75:dad2f09cb870 1 #include "mbed.h"
Jeej 75:dad2f09cb870 2 #include "bin_SH2050.h"
Jeej 75:dad2f09cb870 3 #include "bootloader_SH2050.h"
Jeej 75:dad2f09cb870 4 #include "modem_d7a.h"
Jeej 75:dad2f09cb870 5
Jeej 75:dad2f09cb870 6 //------------------------------------------------------------------
Jeej 75:dad2f09cb870 7 // CUP Package files structure:
Jeej 75:dad2f09cb870 8 // | SIZE | ADDR | BINARY | PAD | CRC | Next Archive
Jeej 75:dad2f09cb870 9 // | 4B | 4B | XB | 0-3 B | 4B | ...
Jeej 75:dad2f09cb870 10 // | | | ...
Jeej 75:dad2f09cb870 11 // |<------------------CRC----------------------->| | ...
Jeej 75:dad2f09cb870 12 // |<-----------------------SIZE------------------------>| ...
Jeej 75:dad2f09cb870 13 //
Jeej 75:dad2f09cb870 14 // Archive must be word-aligned
Jeej 75:dad2f09cb870 15 // Archives can be concatenated
Jeej 75:dad2f09cb870 16 // ADDR is the destination address of the installed archive
Jeej 75:dad2f09cb870 17 // SIZE accounts for whole archive (including itself)
Jeej 75:dad2f09cb870 18 // Binary size must be multiple of word (i.e pad=4)
Jeej 75:dad2f09cb870 19 // CRC calculated on whole archive (obviously excluding itself)
Jeej 75:dad2f09cb870 20 // Values (size,addr) are stored little-endian
Jeej 75:dad2f09cb870 21
Jeej 75:dad2f09cb870 22 //======================================================================
Jeej 75:dad2f09cb870 23 // cup_cfg_t
Jeej 75:dad2f09cb870 24 //----------------------------------------------------------------------
Jeej 75:dad2f09cb870 25 /// @brief This is the structure of the CUP Config FILE.
Jeej 75:dad2f09cb870 26 /// This file _MUST_ always be located a the same place (EEPROM
Jeej 75:dad2f09cb870 27 /// Origin) as BOOT/CUP access it in a hardcoded way.
Jeej 75:dad2f09cb870 28 /// !! Do NOT touch this except if you're a CUP Master !!
Jeej 75:dad2f09cb870 29 //======================================================================
Jeej 75:dad2f09cb870 30 TYPEDEF_STRUCT_PACKED
Jeej 75:dad2f09cb870 31 {
Jeej 75:dad2f09cb870 32 // The CUP Command
Jeej 75:dad2f09cb870 33 uint16_t cmd;
Jeej 75:dad2f09cb870 34 // Number of Archives to be CUP'ed
Jeej 75:dad2f09cb870 35 uint16_t arch_nb;
Jeej 75:dad2f09cb870 36 // This field has 2 meanings:
Jeej 75:dad2f09cb870 37 // - when read-out it gives start address of CUP-Code file
Jeej 75:dad2f09cb870 38 // - when written (for a CUP start) it gives the offset (in bytes) at
Jeej 75:dad2f09cb870 39 // which the first archive is stored in CUP-Code file
Jeej 75:dad2f09cb870 40 uint32_t src_offset;
Jeej 75:dad2f09cb870 41 // CRC32 of the arch_nb concatenated archives starting at offset
Jeej 75:dad2f09cb870 42 uint32_t signature;
Jeej 75:dad2f09cb870 43 // TODO: Deciphering key. For now CUP MAX size
Jeej 75:dad2f09cb870 44 uint32_t key;
Jeej 75:dad2f09cb870 45 // Debug / Uart config
Jeej 75:dad2f09cb870 46 uint32_t dbg_cfg;
Jeej 75:dad2f09cb870 47 } cup_cfg_t;
Jeej 75:dad2f09cb870 48
Jeej 75:dad2f09cb870 49 TYPEDEF_STRUCT_PACKED
Jeej 75:dad2f09cb870 50 {
Jeej 75:dad2f09cb870 51 uint8_t* data;
Jeej 75:dad2f09cb870 52 uint8_t cfg_fid;
Jeej 75:dad2f09cb870 53 uint8_t code_fid;
Jeej 75:dad2f09cb870 54 uint32_t code_size;
Jeej 75:dad2f09cb870 55 uint32_t data_size;
Jeej 75:dad2f09cb870 56 uint32_t local_mtu;
Jeej 75:dad2f09cb870 57 uint32_t nb_archives;
Jeej 75:dad2f09cb870 58 uint32_t signature;
Jeej 75:dad2f09cb870 59 uint32_t mfg_id;
Jeej 75:dad2f09cb870 60 uint32_t dev_id;
Jeej 75:dad2f09cb870 61 uint32_t hw_id;
Jeej 75:dad2f09cb870 62 uint8_t fw_major;
Jeej 75:dad2f09cb870 63 uint8_t fw_minor;
Jeej 75:dad2f09cb870 64 uint16_t fw_patch;
Jeej 75:dad2f09cb870 65 uint32_t fw_hash;
Jeej 75:dad2f09cb870 66 uint8_t target_fw_major;
Jeej 75:dad2f09cb870 67 uint8_t target_fw_minor;
Jeej 75:dad2f09cb870 68 uint8_t target_fw_patch;
Jeej 75:dad2f09cb870 69 uint32_t target_fw_hash;
Jeej 75:dad2f09cb870 70 } cup_param_t;
Jeej 75:dad2f09cb870 71
Jeej 75:dad2f09cb870 72 void modem_cup_update(revision_t* rev);
Jeej 75:dad2f09cb870 73