-
-
-
-
Hi Gordon
this works:
Modules.addCached('SM',''):
When i call addCached inside a switch statement like this:
var totest='exp'; switch(totest) { case 'exp': Modules.addCached('SM',''); break; case 'nxt': break; } Uncaught SyntaxError: BREAK statement outside of SWITCH, FOR or WHILE loop at line 1 col 52 ...Modules.addCached('SM','');break;case'nxt':break;} ^
-
-
-
-
-
-
-
Sorry have troubles formatting it as code.
The output running above code is:
_____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v81.149 Copyright 2015 G.Williams >echo(0); { "addr": 134610944, "length": 131072 } LEN:256 Nr.1, at 134740992 Nr.2, at 134741248 Nr.3, at 134741504 Nr.4, at 134741760
Freeze. Have to unplug/plug it back to recover.
Sacha
-
Hi Gordon,
Running this code:
// Flashtest function gen_256() { var i; var str=''; for(i=0;i<256;i++) { str+='X'; } return(str); } var bytes256=gen_256(); var f = require("Flash"); var freeFlash = process.memory().flash_start + 511*1024; console.log(f.getPage(freeFlash)); console.log('LEN:'+bytes256.length); f.erasePage(freeFlash); console.log('Nr.1, at '+freeFlash); f.write(bytes256, freeFlash); freeFlash+=256; console.log('Nr.2, at '+freeFlash); f.write(bytes256, freeFlash); freeFlash+=256; console.log('Nr.3, at '+freeFlash); f.write(bytes256, freeFlash); freeFlash+=256; console.log('Nr.4, at '+freeFlash); f.write(bytes256, freeFlash); freeFlash+=256; console.log('Nr.5, at '+freeFlash); f.write(bytes256, freeFlash); freeFlash+=256; console.log('Nr.6, at '+freeFlash); f.write(bytes256, freeFlash); freeFlash+=256; console.log('Nr.7, at '+freeFlash); f.write(bytes256, freeFlash);
-
-
-
Hi Gordon
Thanks for your answer. Now i do have some problems with the extra flashmemory. I've wrote 5 junks of 256 bytes. The first ones passed successfull. But then the pico freezed. I have to isolate the code to reproduce it.
Another question. Is your example above using memory at process.memory().flash_code_start save ? Can i start using the 16kb there ?
"flash_code_start" is not documented here:
http://www.espruino.com/Reference#l_process_memory
Many thanks
Sacha -
-
Hi Gorden
Thanks for the new LZ4 Version. It worked:save();
=undefined
Erasing Flash.....
Writing............................................
Compressed 81600 bytes to 42825
Checking...
Done!={ "free": 3040, "usage": 2060, "total": 5100, "history": 1270,
"stackEndAddress": 536958392, "flash_start": 134217728, "flash_binary_end": 320920, "flash_code_start": 134234112, "flash_length": 393216 }There seems to be a lot of potential in the compressen method. Maybe there is even a better method in the future.
Is there some documentation with hints how to reduce space ? I.e. use UintArray not strings etc.
Many thanks
Sacha
-
-
-
-
-
I've used Module.addCached successfull. Moved it temporarly out of the switch/case statment within a function. It's better than using eval. I can allways see and manage the loaded modules.
My prototype is now able to load and replace modules via xbee without interupting or reset the pico. Very nice!