Skip to content

Decreasing SPIFFS partition size by 4 bytes to workaround issue #7467 #7472

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

CoryCharlton
Copy link

Description of Change

Decreasing SPIFFS partition size by 1KB to workaround issue #7467

Tests scenarios

Tested with PIO using Arduino Core v2.0.5 using an Unexpected Maker FeatherS3

Related links

Works around #7467

@CLAassistant
Copy link

CLAassistant commented Nov 14, 2022

CLA assistant check
All committers have signed the CLA.

@CoryCharlton CoryCharlton changed the title Decreasing SPIFFS partition size by 1KB to workaround issue #7467 Decreasing SPIFFS partition size by 4 bytes to workaround issue #7467 Nov 14, 2022
@VojtechBartoska VojtechBartoska added this to the 2.0.6 milestone Nov 16, 2022
@VojtechBartoska VojtechBartoska added the Resolution: Awaiting response Waiting for response of author label Nov 16, 2022
@BlueAndi
Copy link
Contributor

@SuGlider, @CoryCharlton The 4 byte less corresponds in a filesystem which is not 4 k aligned. Did you try an OTA update of the filesystem?

if(size == UPDATE_SIZE_UNKNOWN){
size = _partition->size;
} else if(size > _partition->size){
_error = UPDATE_ERROR_SIZE;
log_e("too large %u > %u", size, _partition->size);
return false;

bool block_erase = (_size - _progress >= SPI_FLASH_BLOCK_SIZE) && (offset % SPI_FLASH_BLOCK_SIZE == 0); // if it's the block boundary, than erase the whole block from here
bool part_head_sectors = _partition->address % SPI_FLASH_BLOCK_SIZE && offset < (_partition->address / SPI_FLASH_BLOCK_SIZE + 1) * SPI_FLASH_BLOCK_SIZE; // sector belong to unaligned partition heading block
bool part_tail_sectors = offset >= (_partition->address + _size) / SPI_FLASH_BLOCK_SIZE * SPI_FLASH_BLOCK_SIZE; // sector belong to unaligned partition tailing block
if (block_erase || part_head_sectors || part_tail_sectors){
if(!ESP.partitionEraseRange(_partition, _progress, block_erase ? SPI_FLASH_BLOCK_SIZE : SPI_FLASH_SEC_SIZE)){
_abort(UPDATE_ERROR_ERASE);
return false;
}
}

#define SPI_FLASH_BLOCK_SIZE (SPI_SECTORS_PER_BLOCK*SPI_FLASH_SEC_SIZE)

Means this must be considered:

#define SPI_FLASH_SEC_SIZE  4096    /**< SPI Flash sector size */

@SuGlider SuGlider modified the milestones: 2.0.6, 2.0.7 Dec 21, 2022
@Jason2866
Copy link
Collaborator

Is this still needed with the change/fix of esptool commit? https://github.com/espressif/esptool/tree/21e59148e73e384947327a0883a753685e03d143

@SuGlider
Copy link
Collaborator

SuGlider commented Jan 5, 2023

Is this still needed with the change/fix of esptool commit? https://github.com/espressif/esptool/tree/21e59148e73e384947327a0883a753685e03d143

I think that it may have fixed the issue reported by @CoryCharlton
@CoryCharlton - could you please test the latest version of esptool to check if the issue you reported is solved?
Thanks.

@SuGlider
Copy link
Collaborator

SuGlider commented Jan 5, 2023

@me-no-dev - not sure how this fix to esptool may be reflected into the Arduino Core tools.
Would it be necessary to update some files?

@me-no-dev
Copy link
Member

@SuGlider this fix needs to be released from esptool team and then we can try to update it for Arduino

@Jason2866
Copy link
Collaborator

@me-no-dev Not using Arduino IDE so maybe a total dumb question. Why not using esptool.py directly? You are using in Arduino Lib Builder components from latest master branch to build the libs. Why not doing for esptool.py too?

@CoryCharlton
Copy link
Author

I think that it may have fixed the issue reported by @CoryCharlton
@CoryCharlton - could you please test the latest version of esptool to check if the issue you reported is solved?
Thanks.

Confirmed that this change resolves the issue. Closing this PR and will close the issue.

@CoryCharlton CoryCharlton deleted the workaround_issue_7467 branch January 6, 2023 21:17
@me-no-dev
Copy link
Member

@me-no-dev Not using Arduino IDE so maybe a total dumb question. Why not using esptool.py directly? You are using in Arduino Lib Builder components from latest master branch to build the libs. Why not doing for esptool.py too?

we pull esptool when released (or when it's necessary), but in this case, the change that fixes this issue is not part of any released esptool yet. We can not use the one in ESP-IDF, because for Windows and Mac we need the compiled versions (which are part of the releases of esptool)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Awaiting response Waiting for response of author
Projects
Development

Successfully merging this pull request may close these issues.

7 participants