Particle cli: Error writing firmware: could not parse firmware.bin: Attempt to access memory outside buffer bounds

Hi I have a Boron LTE, and since i am outside the US, i am switching it from the default MFF2 sim to the SIM slot. I’ve copied the standard CPP provided in the docs, compiled it and trying to flash it via the CLI.

It worked perfectly fine the first few times but now all of a sudden it is throwing this error

Error writing firmware: could not parse firmware.bin: Attempt to access memory outside buffer bounds

i can flash Tinker without an issue, so not sure why this firmware is failing (where it has previously worked). The firmware.bin is created, so compiling works ok just flashing fails.

The error itself reminds me of a node.js error, but i may be mistaken here.

(for what its worth the sim i have has a number of available APNs, hence I am changing the firmware a few times)

Could you try checking the binary with the following?:

particle binary inspect firmware.bin

https://docs.particle.io/reference/developer-tools/cli/#particle-binary-inspect-file-bin

1 Like

thanks @nrobinson2000 - see below

$ particle binary inspect firmware.bin 
particle-cli v2.2.0

! A newer version (2.3.0) of particle-cli is available.
! Upgrade now by running: particle update-cli

Could not parse firmware.bin: Attempt to access memory outside buffer bounds
$ particle update-cli
Updating CLI... done. Updated 1 package.
$ particle binary inspect firmware.bin 
Could not parse firmware.bin: Attempt to access memory outside buffer bounds
$ particle compile boron 3rdPartySIM.cpp --saveTo firmware.bin

Compiling code for boron

Including:
    3rdPartySIM.cpp
attempting to compile firmware 
downloading binary from: /v1/binaries/5e82ecbc5d1b080001b683ec
saving to: firmware.bin
Memory use: 
   text	   data	    bss	    dec	    hex	filename
   5900	    108	   1116	   7124	   1bd4	/workspace/target/workspace.elf

Compile succeeded.
Saved firmware to: firmware.bin
$ particle binary inspect firmware.bin 
firmware.bin
 CRC is ok (80c1a4b7)
 Compiled for boron
 This is an application module number 1 at version 6
 It depends on a system module number 1 at version 1502
$ particle flash --usb firmware.bin 

Flash success!

so, working ok now - i guess the particle cli update was required. Which is interesting, as I checked my notes and I had updated CLI .

cheers!

2 Likes

does anyone know if this was an issue with a version of the CLI and what caused it?