1616 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1717*/
1818
19+ /* *************************************************************************************
20+ INCLUDE
21+ **************************************************************************************/
22+
1923#include < WiFiNINA.h>
2024#include < FlashStorage.h>
2125
3034#define NINA_RESETN FPGA_SPIWIFI_RESET
3135#endif /* ARDUINO_SAMD_MKRVIDOR4000 */
3236
37+ /* *************************************************************************************
38+ DEFINE
39+ **************************************************************************************/
40+
3341#define SDU_START 0x2000
3442#define SDU_SIZE 0x4000
3543
3644#define SKETCH_START (uint32_t *)(SDU_START + SDU_SIZE)
3745
46+ /* *************************************************************************************
47+ CONST
48+ **************************************************************************************/
49+
3850const char * UPDATE_FILE_NAME = " /fs/UPDATE.BIN" ;
3951const char * UPDATE_FILE_NAME_LZSS = " /fs/UPDATE.BIN.LZSS" ;
4052
@@ -73,6 +85,10 @@ static const uint32_t crc_table[256] = {
7385 0xb3667a2e , 0xc4614ab8 , 0x5d681b02 , 0x2a6f2b94 , 0xb40bbe37 , 0xc30c8ea1 , 0x5a05df1b , 0x2d02ef8d
7486};
7587
88+ /* *************************************************************************************
89+ FUNCTIONS
90+ **************************************************************************************/
91+
7692uint32_t crc_update (uint32_t crc, const void * data, size_t data_len)
7793{
7894 const unsigned char *d = (const unsigned char *)data;
@@ -87,11 +103,19 @@ uint32_t crc_update(uint32_t crc, const void * data, size_t data_len)
87103 return crc & 0xffffffff ;
88104}
89105
106+ /* *************************************************************************************
107+ GLOBAL VARIABLES
108+ **************************************************************************************/
109+
90110FlashClass flash;
91111
92112// Initialize C library
93113extern " C" void __libc_init_array (void );
94114
115+ /* *************************************************************************************
116+ MAIN
117+ **************************************************************************************/
118+
95119int main () {
96120 init ();
97121
0 commit comments