Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

Commit

Permalink
v1.7.2 to use auto LittleFS size
Browse files Browse the repository at this point in the history
### Releases v1.7.2

1. Back to using auto LittleFS size to fix bug and to permit 8 LittleFS files instead of 4 in previous release. There is a bug somewhere in the [`ArduinoCore-mbed mbed_portenta core`](https://github.com/arduino/ArduinoCore-mbed) and we have to live with it.
  • Loading branch information
khoih-prog committed Sep 14, 2021
1 parent 1c95a08 commit 67ae452
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 117 deletions.
170 changes: 86 additions & 84 deletions README.md

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
## Table of Contents

* [Changelog](#changelog)
* [Releases v1.7.2](#releases-v172)
* [Releases v1.7.1](#releases-v171)
* [Major Releases v1.7.0](#major-releases-v170)
* [Major Releases v1.6.0](#major-releases-v160)
Expand All @@ -27,6 +28,10 @@

## Changelog

### Releases v1.7.2

1. Back to using auto LittleFS size to fix bug and to permit 8 LittleFS files instead of 4 in previous release. There is a bug somewhere in the [`ArduinoCore-mbed mbed_portenta core`](https://github.com/arduino/ArduinoCore-mbed) and we have to live with it.

### Releases v1.7.1

1. Change the default and minimum LITTLEFS_PORTENTA_H7_SIZE_KB to 1024KB, instead at maximum available size. This is done to avoid the cases where the code size is larger, and LittleFS size has to be changed, reformatted, leading to data loss.
Expand Down
3 changes: 2 additions & 1 deletion examples/minimal/minimal.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

Built by Khoi Hoang https://github.com/khoih-prog/MultiResetDetector_Generic
Licensed under MIT license
Version: 1.7.1
Version: 1.7.2

Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -25,6 +25,7 @@
1.6.0 K Hoang 29/08/2021 Add support to MBED Nano_33_BLE, Nano_33_BLE_Sense, etc. using LittleFS
1.7.0 K Hoang 10/09/2021 Add support to MBED Portenta_H7 using LittleFS
1.7.1 K Hoang 13/09/2021 Select fix LittleFS size of 1024KB
1.7.2 K Hoang 14/09/2021 Back to using auto LittleFS to fix bug
*****************************************************************************************************************************/
/****************************************************************************************************************************
This example will open a configuration portal when the reset button is pressed twice.
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "MultiResetDetector_Generic",
"version": "1.7.1",
"version": "1.7.2",
"keywords": "device, control, flashstorage-samd, flashstorage-stm32, nano-rp2040-connect, nano-33-ble, samd, stm32, nRF52, portenta-h7, rp2040, multi-reset, flashstorage, mbed-portenta, portenta-h7, portentah7, dueflashstorage, littlefs, spiffs, mbed-portenta, teensy, sam-due, mbed, rpi-pico, raspberry-pico, flashstorage-rtl8720, eeprom, reset, detector, data",
"description": "Library to detect a multi reset, using EEPROM, DueFlashStorage, FlashStorage_SAMD, FlashStorage_RTL8720, FlashStorage_STM32 or LittleFS/InternalFS. For AVR, Teensy, SAM DUE, SAMD, STM32F/L/H/G/WB/MP1, nRF52, RP2040-based Nano_RP2040_Connect, RASPBERRY_PI_PICO, RTL8720DN, MBED nRF52840-based Nano_33_BLE, Portenta_H7, etc. boards. Now using efficient FlashStorage_STM32 library and supporting new RP2040-based Nano_RP2040_Connect, RASPBERRY_PI_PICO and STM32 core v2.0.0",
"authors":
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=MultiResetDetector_Generic
version=1.7.1
version=1.7.2
author=Khoi Hoang
maintainer=Khoi Hoang <khoih.prog@gmail.com>
license=MIT
Expand Down
4 changes: 2 additions & 2 deletions platformio/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ upload_speed = 921600
lib_deps =
; PlatformIO 4.x
; FlashStorage_STM32@>=1.1.0
; FlashStorage_SAMD@>=1.1.0
; FlashStorage_SAMD@>=1.2.0
; FlashStorage_RTL8720@>=1.0.0
; PlatformIO 5.x
; khoih.prog/FlashStorage_STM32@>=1.1.0
; khoih.prog/FlashStorage_SAMD@>=1.1.0
; khoih.prog/FlashStorage_SAMD@>=1.2.0
; khoih.prog/FlashStorage_RTL8720@>=1.0.0

build_flags =
Expand Down
34 changes: 7 additions & 27 deletions src/MultiResetDetector_Generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/MultiResetDetector_Generic
Licensed under MIT license

Version: 1.7.1
Version: 1.7.2

Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -26,14 +26,15 @@
1.6.0 K Hoang 29/08/2021 Add support to MBED Nano_33_BLE, Nano_33_BLE_Sense, etc. using LittleFS
1.7.0 K Hoang 10/09/2021 Add support to MBED Portenta_H7 using LittleFS
1.7.1 K Hoang 13/09/2021 Select fix LittleFS size of 1024KB
1.7.2 K Hoang 14/09/2021 Back to using auto LittleFS to fix bug
************************************************************************************************************************************/

#pragma once

#ifndef MultiResetDetector_Generic_H
#define MultiResetDetector_Generic_H

#define MULTIRESETDETECTOR_GENERIC_VERSION "MultiResetDetector_Generic v1.7.1"
#define MULTIRESETDETECTOR_GENERIC_VERSION "MultiResetDetector_Generic v1.7.2"

#if ( defined(ESP32) || defined(ESP8266) )
#error Please use ESP_MultiResetDetector library (https://github.com/khoih-prog/ESP_MultiResetDetector) for ESP8266 and ESP32!
Expand Down Expand Up @@ -377,15 +378,6 @@
#include "BlockDevice.h"

#include "mbed_portenta/FlashIAPLimits.h"

#if !defined(LITTLEFS_PORTENTA_H7_SIZE_KB)
#define LITTLEFS_PORTENTA_H7_SIZE_KB 1024
#warning Force LITTLEFS_PORTENTA_H7_SIZE_KB to 1024 (KB)
#elif (LITTLEFS_PORTENTA_H7_SIZE_KB < 1024)
#undef LITTLEFS_PORTENTA_H7_SIZE_KB
#define LITTLEFS_PORTENTA_H7_SIZE_KB 1024
#warning Correct LITTLEFS_PORTENTA_H7_SIZE_KB to 1024 (KB)
#endif

#if !defined(FORCE_REFORMAT)
#define FORCE_REFORMAT false
Expand Down Expand Up @@ -641,24 +633,12 @@ class MultiResetDetector_Generic
// Get limits of the the internal flash of the microcontroller
_flashIAPLimits = getFlashIAPLimits();

if (_flashIAPLimits.available_size < LITTLEFS_PORTENTA_H7_SIZE_KB * 1024)
{
#if (MRD_GENERIC_DEBUG)
Serial.print("Too small Max LittleFS size (KB) = "); Serial.println(_flashIAPLimits.available_size / 1024.0);
#endif
return;
}

uint32_t deltaSize = _flashIAPLimits.available_size - LITTLEFS_PORTENTA_H7_SIZE_KB * 1024;

Serial.print("Flash Size: (KB) = "); Serial.println(_flashIAPLimits.flash_size / 1024.0);
Serial.print("FlashIAP Start Address: 0x"); Serial.println(_flashIAPLimits.start_address, HEX);
Serial.print("New FlashIAP Start Address: 0x"); Serial.println(_flashIAPLimits.start_address + deltaSize, HEX);
Serial.print("Max FlashIAP Size (KB): "); Serial.println(_flashIAPLimits.available_size / 1024.0);
Serial.print("Current FlashIAP Size(KB): "); Serial.println(LITTLEFS_PORTENTA_H7_SIZE_KB);

blockDevicePtr = new FlashIAPBlockDevice(_flashIAPLimits.start_address + deltaSize, LITTLEFS_PORTENTA_H7_SIZE_KB * 1024);
Serial.print("FlashIAP Start Address: = 0x"); Serial.println(_flashIAPLimits.start_address, HEX);
Serial.print("LittleFS size (KB) = "); Serial.println(_flashIAPLimits.available_size / 1024.0);

blockDevicePtr = new FlashIAPBlockDevice(_flashIAPLimits.start_address, _flashIAPLimits.available_size);

if (!blockDevicePtr)
{
#if (MRD_GENERIC_DEBUG)
Expand Down
3 changes: 2 additions & 1 deletion src/mbed_portenta/FlashIAPLimits.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/MultiResetDetector_Generic
Licensed under MIT license

Version: 1.7.1
Version: 1.7.2

Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -27,6 +27,7 @@
1.6.0 K Hoang 29/08/2021 Add support to MBED Nano_33_BLE, Nano_33_BLE_Sense, etc. using LittleFS
1.7.0 K Hoang 10/09/2021 Add support to MBED Portenta_H7 using LittleFS
1.7.1 K Hoang 13/09/2021 Select fix LittleFS size of 1024KB
1.7.2 K Hoang 14/09/2021 Back to using auto LittleFS to fix bug
*****************************************************************************************************************************/

#pragma once
Expand Down

0 comments on commit 67ae452

Please sign in to comment.