BW16 2MB Flash Capability

Hello Everyone! I am new to BW16 development but have experienced a problem and I can’t seem to troubleshoot around it. I would really appreciate any help! I have the 2MB variant(JLCPCB gave me the wrong one) and my current firmware size is just under 1mb. When I pass 1041148 bytes and increment up to 1045244 bytes my firmware crashes on reset or power cycle(the first opening everything works fine). Please feel free to ask any additional questions you may have. Thanks!

Normally BW16 firmware uses about 700KB of flash. Are you using PROGMEM data and FlashMemory library at the same time?

Thank you for your response but sadly I’m not using PROGMEM at all - only the FlashMemory library for runtime data storage. My
flash storage allocates approximately 40KB total: 4KB for WiFi credentials, 4KB for device settings, and 32KB for profiles (4 slots × 8KB each). The code size difference from the 700KB baseline is probably due to my application logic, libraries (MQTT, BLE, WebSocket), and string literals.

As i do not know how you initialized your FlashMemory base address, my assumption is your defined FlashMemory base address overlaps with the program code. When you call FlashMemory.begin(), make sure you defined memory address that is not occupied by program code. The example FlashMemory code defined base address at 0x00100000, which is 1,048,576
th byte, which is really close to your firmware size (1,045,244 byte). You may define safer base address like 0x124F80, which is positioned at 1,200,000 th byte.

So I just got a response back from the Ameba Team and they said:
“We use a/b seamless system updates, so you can only use about half capacity of flash chip”, meaning my 2MB board only has 1MB of usable flash and I was exceeding that. Thank you Nethercap_dev for your support! I was able to get this answer by reaching out to them via WeChat(I am developing for commercial use so that might have been why they set me up with a technician fast).

I am glad you get support from Ameba Team. Just curious, are you using official SDK or Arduino?

I’m building on Arduino IDE with this as my board URL:
https://github.com/ambiot/ambd_arduino/raw/master/Arduino_package/package_realtek_amebad_index.json