Skip to content
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

Program size check does not respect board_upload.maximum_size from platformio.ini #313

Open
einglis opened this issue Jan 7, 2024 · 0 comments

Comments

@einglis
Copy link

einglis commented Jan 7, 2024

I'm building firmware for the Sonoff Basic device and it supports OTA updates. As a result it's important that the firmware isn't larger than half the total flash size.

Using board_build.ldscript = eagle.flash.1m64.ld I can influence the available space, as shown by post-build the size check:

Flash: [======    ]  58.7% (used 563013 bytes from 958448 bytes)

But:

  • This value is not the same as in sonoff_basic.json: "upload": { ... "maximum_size": 1048576, and
  • This value does not respect attempts to override it in platformio.ini: board_upload.maximum_size = 500000

What is happening is that in .platformio/platforms/espressif8266/builder/main.py, this action:

env.VerboseAction(
      lambda source, target, env: _update_max_upload_size(env),
      "Retrieving maximum program size $SOURCE"))

parses the .ld file and extracts the true flash size from this line:

  irom0_0_seg :                         org = 0x40201010, len = 0xe9ff0

but that all happens well after the user scripting stage. Without editing the .ld file, I can't see how to avoid this behaviour, and I don't want to do that anyway because:

  • It's not maintainable
  • It might have side effects I'm not aware of

One resolution would be for _update_max_upload_size to use the minimum of the current/scripted value (if non-zero) and the parsed value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant