Skip to content

How to disable Auto-detection of flash size when compiling from Arduino? #5671

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
eddieespinal opened this issue Sep 14, 2021 · 2 comments
Closed

Comments

@eddieespinal
Copy link
Contributor

Make your question, not a Statement, inclusive. Include all pertinent information:

What you are trying to do?

I'm trying to compile the ATMegaZero ESP32-S2 board but I'm getting an error about Flash size not being supported. The thing is that the ATMegaZero comes with 32MB flash memory but we are using 16MB at the moment due to this limitation. This used to work before but now it's doing some auto-detection and ignoring the flash size entry in my configuration file.

esptool.py v3.1
Serial port /dev/cu.usbmodem01
Connecting...
Chip is ESP32-S2
Features: WiFi, ADC and temperature sensor calibration in BLK2 of efuse
Crystal is 40MHz
MAC: 7c:df:a1:4a:12:8c
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Auto-detected Flash size: 32MB
Flash will be erased from 0x0000e000 to 0x0000ffff...
Flash will be erased from 0x00001000 to 0x00006fff...
Flash will be erased from 0x00010000 to 0x00046fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x002d0000 to 0x002effff...
Compressed 8192 bytes to 47...
Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 717.4 kbit/s)...
Hash of data verified.

A fatal error occurred: Flash size '32MB' is not supported by this chip type. Supported sizes: 1MB, 2MB, 4MB, 8MB, 16MB
A fatal error occurred: Flash size '32MB' is not supported by this chip type. Supported sizes: 1MB, 2MB, 4MB, 8MB, 16MB

Hardware:

Board: ATMegaZero ESP32-S2
Core Installation version: ?1.0.0? ?1.0.1-rc4? ?1.0.1? ?1.0.1-git? ?1.0.2? ?1.0.3?
IDE name: Arduino IDE
Flash Frequency: 40Mhz
PSRAM enabled: yes
Upload Speed: 115200
Computer OS: Mac OSX

Debug Messages:

Enable Core debug level: Debug on tools menu of Arduino IDE, then put the serial output here 

A fatal error occurred: Flash size '32MB' is not supported by this chip type. Supported sizes: 1MB, 2MB, 4MB, 8MB, 16MB

Screen Shot 2021-09-14 at 8 26 33 AM

@eddieespinal
Copy link
Contributor Author

I figured it out. I wonder if this can be modified to be like this?

tools.esptool_py.upload.pattern_args=--chip {build.mcu} --port "{serial.port}" --baud {upload.speed} {upload.flags} --before default_reset --after hard_reset write_flash -z --flash_mode {build.flash_mode} --flash_freq {build.flash_freq} --flash_size {build.flash_size} 0xe000 "{runtime.platform.path}/tools/partitions/boot_app0.bin" {build.bootloader_addr} "{build.path}/{build.project_name}.bootloader.bin" 0x10000 "{build.path}/{build.project_name}.bin" 0x8000 "{build.path}/{build.project_name}.partitions.bin" {upload.extra_flags}

instead of

tools.esptool_py.upload.pattern_args=--chip {build.mcu} --port "{serial.port}" --baud {upload.speed} {upload.flags} --before default_reset --after hard_reset write_flash -z --flash_mode {build.flash_mode} --flash_freq {build.flash_freq} --flash_size detect 0xe000 "{runtime.platform.path}/tools/partitions/boot_app0.bin" {build.bootloader_addr} "{build.path}/{build.project_name}.bootloader.bin" 0x10000 "{build.path}/{build.project_name}.bin" 0x8000 "{build.path}/{build.project_name}.partitions.bin" {upload.extra_flags}

The issue I'm having is in this flag flash_size detect but that doesn't work for my board because this board comes with 32MB of flash and that's not supported yet. Can we change it to be flash_size {build.flash_size}?

@eddieespinal
Copy link
Contributor Author

I fixed the issue and created a PR for it.
#5673

I'm going to close it as this PR will fix it. Thanks.

touchgadget pushed a commit to touchgadget/arduino-esp32 that referenced this issue Sep 28, 2021
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