FlashStorage and Int Arrays

I try to restore a int array (int baro[90]) from the flash memory on a SAMD21:

int baro[90];  // the array to store
typedef struct {
  int flash_baro[90];
  bool flash_baro_set;
} Backup;
FlashStorage(flash_ram_backup, Backup); //reserve the flash space
//Read out the struct to flash_backup:
Backup flash_backup;
baro = flash_backup.flash_baro; 

Here the compiler says "invalid array assignment" but the arrays are defined ([90])?!?
This method with char[100] and
baro = atof(flash_backup.flash_baro)
works well.

I have a feeling that i thinking on the wrong end of the problem so that's why i like to ask if someone can enlight the maze a little bit for me..

C-style arrays are exceptions to many rules, for example, you cannot assign them. Try using std::array instead.

Alternatively, you could try using memcpy.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.