Fix multiple issues with reported flash memory usage:

- Remove unused next_free_memory=BigBuf_get_addr()
- Fix size retrieval of compressed data section
  by chance the corrupted value was > than correct value so
  decompression was taking place, but was returning an error
  instead of the decompressed size
- Fix reporting of compressed size into common_area
  returned value of LZ4_decompress_safe is the decompressed size
  while we needed to report the compressed size
- Fix common_area late initialization
  common_area was initialized (and zeroed) after
  uncompress_data_section() had reported the compressed size
  in common_area, so compressed size was erased

Compressed size is used in the computation of the used and available
flash memory, which is now correct
(it was wrongly telling about 6kb were free while they weren't).
This commit is contained in:
Philippe Teuwen 2020-11-05 00:59:32 +01:00
commit e750481d12
2 changed files with 11 additions and 12 deletions

View file

@ -2299,14 +2299,6 @@ void __attribute__((noreturn)) AppMain(void) {
*p = 0xdeadbeef;
}
if (common_area.magic != COMMON_AREA_MAGIC || common_area.version != 1) {
/* Initialize common area */
memset(&common_area, 0, sizeof(common_area));
common_area.magic = COMMON_AREA_MAGIC;
common_area.version = 1;
}
common_area.flags.osimage_present = 1;
LEDsoff();
// The FPGA gets its clock from us from PCK0 output, so set that up.