-
• #2
How 'bricked' they are? you cannot access Espruino console over serial or bluetooth - wherever the active console is? You cannot press ctrl+c on the console (left side in web ide or over serial teminal) to get debug prompt
debug>
? see https://www.espruino.com/DebuggerIf you can break into debugger after startup to see the
debug>
prompt then your running code is stopped and you could hopefully runprint require("Storage").eraseAll()
from debugger to clear the storage.With serial console it may be easier - reset or poweron the module with serial already open and immediately try ctr+c
-
• #3
If you have a
MDBT42Q Breakout
- remove power
- press button
- power up
- release button when red led is switched off
this procedure will startup the firmware without loading your code and give you the possibility to connect and remove the code.
- remove power
-
• #4
Oh, maybe that will work too when there is original espruino bootloader which clears it before jumping into Espruino?
Otherwise when BTN1 is held at startup time the code is skipped except the code marked as "flash always", that one still runs even with button held. This was confimed by some unlucky guys and is also described here https://www.espruino.com/Saving - Boot Process - holding button is exactly like running reset() (sets
hasBeenReset
) so .bootrst still runs. -
• #5
First of it turns out the webIDE had gotten it self in some state, closing the browser and opening it again allowed me to connect and get a prompt, at least long enough to run reset() to clear out the bad code.
So at least one of the modules are now running again, will check on the other one later.I have now installed the chrome app, and that seam to be more stable and works better.
-
• #6
so you can run
require("Storage").eraseAll()
that will clear everything - the.bootrst
one and also one possibly created by runningsave()
-
• #7
Tried it, this is the output..
>require("Storage").eraseAll() =undefined Uncaught SyntaxError: Got [ERASED] expected EOF at line 1 col 1 [ERASED]... ^ in function called from system Uncaught SyntaxError: Got [ERASED] expected EOF at line 1 col 1 [ERASED]... ^ in function called from system Uncaught SyntaxError: Got [ERASED] expected EOF at line 1 col 1 [ERASED]... ^
And it goes on and on like that.
-
• #8
well yes, so just reboot/powercycle it, if you had code running from flash this was all erased at the point of calling eraseAll so code inside setWatch, setInterval is suddenly hitting empty flash where it expected javascript program to be
-
• #9
what is the result of
require("Storage").list()
-
• #10
here is the information about startpoint and size of the save code
maybe you can use the flash lib to clear the pages
-
• #11
you shouldn't need to, that's what Storage.eraseAll does
-
• #12
As @fanoush says,
require("Storage").eraseAll()
will get rid of everything - but if you had stuff in RAM then that will still run, and if it references stuff that was in flash you'll get theGot [ERASED] expected EOF
error - a simple reboot will fix it permanently.The easiest fix for that is actually just to do this to clear the device:
require("Storage").eraseAll();reset()
So, after a lot of debugging I have now realised how the "Flash (always)" works and what a "reset()" actually means. It's not a reset or reboot, it's a system clear. And my broken code is now written with "Flash (always)" so my two dev modules are now bricked.
So how do I get them back? A DFU update does nothing.
Is there any other way to program the module and clear the flash???