Skip to content

STM32F407 - Flash Size issue #223

Closed
Closed

Description

@gcharles81

Hello I have been using this great library for OTA over Wifi of my project using STM32F407VE mcu with 512kb of flash.

Everything was working fine for months but now as my code evolves the .bin file is getting large and 155kb in size and with this size the update will be halted with serial message "There is not enough space to store the update. Can't continue with update."

After that I have updated the MCU from STM32F407VE 512KB to STM32F407VG 1Mb but the issue still happen , can it be the Internalstorage class is calculating the available space wrong for the STM32F407VG ?

STM32F407VE compilation details - firmware uses of Flash: [=== ] 30.2% (used 158208 bytes from 524288 bytes)
image

STM32F407VG compilation details - firmware uses of Flash: [== ] 15.1% (used 158208 bytes from 1048576 bytes)
image

Activity

  1. JAndrassy commented on Oct 24, 2023

    @JAndrassy
    Owner

    The F4 flash is split into sectors. 0 to 3 are 16 kB, 4 is 64 kB and the rest are 128 kB.
    ArduinoOTA is set to store the update starting from sector 5. (half of a 512kB flash).

    You can change the sector to use with define OTA_STORAGE_STM32_SECTOR in boards.local.txt

    Create a file boards.local.txt next to boards.txt file in hardware package. There you can set build.extra_flags for individual boards, like this:

    GenF4.menu.pnum.DIYMORE_F407VGT.build.extra_flags=-DOTA_STORAGE_STM32_SECTOR=8 
    
  2. gcharles81 commented on Oct 24, 2023

    @gcharles81
    Author

    file in hardware package. There you can set build.extra_flags for individual boards, like this:

    Thank you for the answer and the hint but its too complex to do that I do not know the exact locations where the board.txt files are very difficult to find out what exactly I have to do

    I tried to change the sector from 5 to 8 in InternalStorageSTM32.cpp as per below image but I got the same error as not enough space Thanks for the help so far , any other possible causes ?
    image

    Also If I leave the sector set to 5 as original and I include the below serial print statement for InternalStorage.maxSize I get the Flash size of 131 kb so it seems that the bootloader is 381 kb is that possible ?

    uint32_t test = InternalStorage.maxSize();
    

    Serial.print("FLASH Size kb= ");
    Serial.println(test);

    "Serial print from terminal " - FLASH Size kb= 131072

  3. JAndrassy commented on Oct 25, 2023

    @JAndrassy
    Owner

    C:\Users\user\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0

    maxsize is the space for the sketch. sector 5 starts at 128 kB so it is 131072 bytes in sector 0 to 4

    (128 kB is 131072 bytes)

  4. gcharles81 commented on Oct 26, 2023

    @gcharles81
    Author

    Hello I created the board.local.txt file but I still have the same issue that not enough space is available

    image

    image

  5. JAndrassy commented on Oct 27, 2023

    @JAndrassy
    Owner

    did you restart the IDE?

  6. gcharles81 commented on Oct 27, 2023

    @gcharles81
    Author

    Yes have restarted platformio multiple times ,

  7. JAndrassy commented on Oct 27, 2023

    @JAndrassy
    Owner

    PlatformIO? maybe it has the boards package somewhere else or it doesn't process local.txt files

  8. gcharles81 commented on Oct 27, 2023

    @gcharles81
    Author

    Thanks for all your help I managed to get it working by adding -DOTA_STORAGE_STM32_SECTOR=9 as a build flag in platformio.ini i attached below for anyone as a reference in future
    image

  9. JAndrassy commented on Oct 27, 2023

    @JAndrassy
    Owner

    so yes, Arduino doesn't have a project configuration file. that is better in plaformio

  10. Repository owner locked and limited conversation to collaborators on Oct 27, 2023
  11. converted this issue into a discussion #224 on Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions