-
-
Nope, save-on-send still does not work for me on v1.94. I keep using v1.93.162, I am waiting and hoping the v1.95 will fix it. I can still save/load with save() and load(), but I cannot send the code with modules to be executed from flash, except with my own WebIDE plugin .
-
What do you mean no reaction ? Does your board freeze and become unresponsive to any command?
did you try reset() and load() after your save() ?
The save() work perfectly on my 8266 4mb board. It's only the save-on-send that doesnt.
Do you realize that in your code you do not call send() ?
For external modules, like ws, the code need to be uploaded too, for setBootCode to work. Have a look on the log of WebIDE to see how he send the module code too when you use upload button.
Try flashing a previous version of espruino, like 1.91, 1.92 or 1.93, maybe it will help -
Thanks again allObjects for all your tries, I appreciate.
I think it is not working because you didn't upload the FlashString.js module to the board yet. I can see it is not there in your log. The buttons to upload to flash are not supposed to show yet until he finds this module on the board, but for some reason they show up on yours, just a glitch. So when you use them, he complain about the absence of this module. (Uncaught Error: Module "FlashString" not found)
If it is not an ESP8266, you may also need to change the default address/size in FlashString.js to match your flash setup (line 28-31 and remove the 2 extra pages use line 48).
The sequence of action is :
1- have your module and FlashString.js in modules directory (what you did) - picture 1
2- upload FlashString.js to the board memory (it must show off as module in global[0xFF].modules and not with 3blocks of memory only). It seems you did not do this step. - picture 2, it takes 146block of memory
3- now you can see your flash pages (pict 3) and upload your module to flash (pict4)Here is the log :
step1 :_____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v93.162 Copyright 2016 G.Williams Espruino is Open Source. Our work is supported only by sales of official boards and donations: http://espruino.com/Donate Flash map 4MB:512/512, manuf 0xef chip 0x4016 >Flash:[] >MODULES:[] MEMORY:{"free":1651,"usage":49,"total":1700,"history":13} =undefined
step2 :
>process.memory(); ={ "free": 1517, "usage": 183, "total": 1700, "history": 176 } >E.getSizeOf(global["ÿ"].modules,1); =[ { "name": "Flash", "size": 3 }, { "name": "FlashString", "size": 146 } ]
step3 :
>Flash:[{"name":"DHT22non.js","size":858,"address":"f8010"},{"name":"IOData.js","size":3433,"address":"f9010"},{"name":"FlashStore.js","size":4028,"address":"fa014"},{"name":"WifiSync.js","size":1044,"address":"fc010"},{"name":"IOPlug.js","size":3936,"address":"fd010"},{"name":"IOServer.js","size":2475,"address":"fe010"},{"name":"IOLog.js","size":3777,"address":"ff00c"},{"free":4}] >MODULES:[{"name":"Flash","size":3},{"name":"FlashString","size":146}] MEMORY:{"free":1497,"usage":203,"total":1700,"history":184} =undefined >File uploaded to flash : Add.js >Flash:[{"name":"DHT22non.js","size":858,"address":"f8010"},{"name":"IOData.js","size":3433,"address":"f9010"},{"name":"FlashStore.js","size":4028,"address":"fa014"},{"name":"Add.js","size":639,"address":"fb00c"},{"name":"WifiSync.js","size":1044,"address":"fc010"},{"name":"IOPlug.js","size":3936,"address":"fd010"},{"name":"IOServer.js","size":2475,"address":"fe010"},{"name":"IOLog.js","size":3777,"address":"ff00c"},{"free":3}] >MODULES:[{"name":"Flash","size":3},{"name":"FlashString","size":146}] MEMORY:{"free":1497,"usage":203,"total":1700,"history":246} =undefined
In case it was not clear, to communicate with the flash, the plugin uses the FlashString.js module he find ON the board memory, not the one on the hard drive. Therefore, you need to upload it there first by placing it in the module folder of the hard drive and use the button. The plugin just minify and transfer the file to FlashString.js on board, that take care of the rest.
Yes, the plugin was made using tve module that is esp8266 oriented as you mention. That's why I posted in this section of the forum. But the plugin can work with any flash module that works the same way with save/load/(json)list, I was planning to extend it with another tab using FlashStore.js (I mentioned in first post), but this is still Esp8266. Anyone made a similar module yet for other platforms flash ? For me, it is worth have a unified plugin for flash, SD and so on, but, I have no SD, and truth is, I never got to understand completely the Project plugin code I made my plugin from, hence the little bugs here and there.
Honestly, I am quite surprised by the difficulty you meet to make it run. I realize it is one thing to use it on my setup, and another to make it run in other people's setup. I would sure appreciate to see it run somewhere else, but if that doesn't help you forget it. If it is not an ESP8266, the benefit is quite limited, I understand if you give up :) I can fix the bugs that you already found, if that really helps. Some days, I don't understand how people can program on esp8266 without using this plugin, memory is so small and javascript is so gluttonous. Other days, I realize I am the crazy one for wanting to use 44kb of modules, plus the rest 3mb for storing files and logs, and have free memory.
-
You are almost there. I never noticed that it ignores files ending with .min.js, it must be the way the project plugin was made. I'll have a look at that as well. If you try plain .js files, you have a 2 step left, to place the FlashString.js file in the modules directory, and to upload it to the board with the button with two arrows.
-
Thanks very much allObjects for trying, obviously I forgot to mention about the options, but you found it, yes you have to set a folder.
There is a bug that prevents the popup from opening when binary folder is empty, so put any file inside, until I fix it. The puzzle button is the one you want, the folder button is an old version that may not work.Once you have the window from puzzle button to open, it will still say "no flashstring found", that mean you need to transfer to the board with the button top right from flash or module tab.
Here's a snapshot of the application newly installed: -
Hi all,
I made this small WebIDE plug-in to use the plenty of flash pages of the ESP8266 and upload then execute easily modules there, and have more memory free for other use. I use it every day, as my programs always need more memory and getting bigger than the default space of 10kb. You can minify and transfer modules into pages, in one click, and then link them to be executed from flash, in another. As extra you can also load/unload modules direct to memory, etc. It mainly allows to use tve FlashString.js, without the hassle of manual commands and minification (mentioned in http://forum.espruino.com/conversations/290975/). Be careful, the execution from flash and use of E.memoryArea is restricted to the first mb, so you can use it only on the 44kb(11 pages) under 1mb. I use Wilberforce FlashStore module for the 3mb left (http://forum.espruino.com/conversations/283045/).My code is based on the Project plug-in, here is it (messily programmed I am afraid but works well).
https://github.com/popok75/Espruinuity/blob/master/Espruino-WebIDE/js/plugins/flashView.jsIt uses a modified version of tve FlashString.js . Here is this version : https://github.com/popok75/Espruinuity/blob/master/EspCode/project/modules/FlashString.js
also you may want the stand-alone loader : https://github.com/popok75/Espruinuity/blob/master/EspCode/project/modules/FlashStringLoader.js
You want FlashString.js to be in modules directory when you start, so that you can transfer it to memory and start using your flash.For installation, you can get my version of WebIDE from the github (fetched 2 month ago) or you just need the source of WebIDE, add the source of espruino-tools in the right directory, flashview.js in plugin directory, and insert the following statements at the right place (not sure they are all needed) : https://github.com/popok75/Espruinuity/search?utf8=%E2%9C%93&q=flashview&type=
Here is how I load them in the final program :
function loadFlashModules(mods,loader) { // load module and show mem usage var sm=0; for(var i=0;i<mods.length;i++){var mod=mods[i]; if(Modules.getCached().indexOf(mod)>-1) Modules.removeCached(mod); var m=require(loader).load(mod+".js"); if(!m) {print("Module not found in flash : "+mod);return false;} else { var s; s=process.memory().usage; Modules.addCached(mod,m); sm+=(process.memory().usage-s);print("Module in flash loaded: "+mod+" : "+(process.memory().usage-s)+" block mem usage");} } print("All Modules : "+sm+" block mem usage"); return true; } function init(){ l=loadFlashModules(["WifiSync","DHT22non","FlashStore","IOPlug","IOLog","IOData","IOServer"],"FlashStringLoader"); }
I hope you'll try it and tell me what you think.
-
@jinantha, did you try to switch qio to dio in espruino-tools command line ?
you can also try replugging after the erase
It is mentioned here recently, it helped me : http://forum.espruino.com/comments/13902968/ -
Happy to hear that. How to find such a free area ? What address should I look for ? All I know is that RAM starts at 0x20000000. Should I start to write there until something bad happens ?
The Uint8Array header seem to be 3 blocks long, even for short arrays. But apart from that, its store bytes 1:1 like you said. Thanks a lot, I will use that.
>var b=new Uint8Array(16);E.getSizeOf(b); =4 >var b=new Uint8Array(400);E.getSizeOf(b); // 28 = 3+400/16 =28 >var b=new Uint8Array(1024);E.getSizeOf(b); // 67 = 3+1024/16 =67 >var b=new Uint8Array(10000);E.getSizeOf(b); // 628 = 3+100000/16 =628
-
Hi,
Is it possible to read/write data directly in RAM at byte level with peek/poke ? I think of possibly storing more data in less memory than the limit of ~10bytes per byte with strings or typed arrays. It would be nice to be able to do a 1byte/byte data storage in ram like we do in flash.In this thread (http://forum.espruino.com/conversations/288002/), they use peek to write at stackEndAddress in memory with ARM. But except the end of the stack with arm, is there a way in other boards, e.g. ESP8266, to allocate an area of RAM and get it's address for poking freely and safely ?
Thanks,
-
-
-
@allObjects, Finally you was right. The bug came back, and went away when I used more setTimeOut as you suggested to break the function calls that pile too much. To me, it looks a lot like a lack of memory when piling too many local calls context. More than 10 in my case, i broke up in 5 and 5.
-
Ok, thanks,
Finally, the bug disappeared for good after removing this line and replacing with for loop : "var mp=tabarray.map(function(e) {print("upCr map",e); index++;print("index",index);e=jp(e); print("upCR map item "+index +" :",e);return e["name"]; })". Maybe map implementation has a problem, or the way I used it. I could not reproduce it in isolation, I still suspect of a call stack problem.
@Wilberforce, I realize that but, the problem is that the board does not freeze at a specific line but much later, like when I am reading the dht22 sensor.@allObjects, what do you call 'combination structures' ? I thought the problem was the cpu not the memory. What is so good about the pico ?
-
-
Hi all,
I started having this error lately on esp8266. It's not triggered by a particular line of code. My code is a bit large to be included here, it makes a data model and read from a sensor.
It looks like I am doing something that make the esp unstable, but the code continue running to some point where the esp is stressed then the crash happens. I tried another esp8266 board and with v1.94, no change. It's probably my code then. I would like to find the code part responsible for this instability. How to learn more about what happens ?Any idea how to debug this problem ? is an abuse of callstack a possible cause ?
Polypod
ets Jan 8 2013,rst cause:4, boot mode:(3,7) wdt reset load 0x40100000, len 2408, room 16 tail 8 chksum 0xe5 load 0x3ffe8000, len 776, room 0 tail 8 chksum 0x84 load 0x3ffe8310, len 632, room 0 tail 8 chksum 0xd8 csum 0xd8 2nd boot version : 1.6 SPI Speed : 80MHz SPI Mode : QIO SPI Flash Size & Map: 32Mbit(512KB+512KB) jump to run user1 @ 1000 rLoading 7436 bytes from flash...
-
-
Thanks allObjects,
This "ERROR: Prompt not detected - upload failed. Trying to recover...", rarely happen, most of the time, the board restart and say it loads, but nothing is really loaded, like in the output I show.I do not use internet. This is all the code I use, I even did a setBootCode("") before save on send, to be sure. The problem of v1.93 with "not connected to internet" without any code using internet, is mentioned also in the other thread http://forum.espruino.com/conversations/296431/.
Even the print("init") in my code is not executed, how can I catch an event to start my app ?
So you say possibly it's the print that is not working ? Where can the print go ? The same program works fine, prints correctly, when saved with save().
-
Hi,
I don't seem to be able to load with Save on Send of the web ide. save() works and load correctly, but with setBootCode looks like the load does not load anything. Sometimes it triggers "ERROR: Prompt not detected - upload failed. Trying to recover...".
For me, Save-on-send didn't work either on the v1.93, I get "Not connected to the internet", with and without load-as-function option (see http://forum.espruino.com/conversations/296431/). Until now, the only way to get this option working is with v1.93.162 I compiled (http://forum.espruino.com/conversations/305014/#comment13761399).Here is my code :
function start(){ pin=NodeMCU.D2; var dht22 = require("DHT22").connect(pin); var dht22_read_test = function() { dht22.read( function(a){ console.log("Temp is "+a.temp.toString()+ "C and RH is "+a.rh.toString()+"%"); }); }; setInterval(dht22_read_test,3000); print("started"); }; E.on("init",start); print("init");
Here is the result with v1.94 :
_____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v94 Copyright 2016 G.Williams Espruino is Open Source. Our work is supported only by sales of official boards and donations: http://espruino.com/Donate Flash map 4MB:512/512, manuf 0xef chip 0x4016 >Erasing Flash.................. Writing.... Compressed 25600 bytes to 113Loading 1130 bytes from flash... =undefined > =undefined >E.getSizeOf(global) =13 >E.getSizeOf(global,1) =[ { "name": "\xFF", "size": 16 }, { "name": "E", "size": 2 } ] >
Here is the result with 1.93.162:
_____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v93.162 Copyright 2016 G.Williams Espruino is Open Source. Our work is supported only by sales of official boards and donations: http://espruino.com/Donate Flash map 4MB:512/512, manuf 0xef chip 0x4016 >Erasing Flash..... Writing.... Loading 1124 bytes from flash... init started Temp is 26.1C and RH is 47.6% Temp is 26.2C and RH is 48.3%
-
-
Is there a way to use this feature and send modules "as functions" to flash one by one instead of all at once ?
The reason I ask is because I get an "out of memory" when sending more than 10k of cumulated modules this way, which is appreciably more than before this feature. When I set "upload as function" and "save on send", in the console I see all modules are sent at once in one line of "setBootCode(code)". Is it possible to call setBootCode multiple times without erasing previous code saved in flash?
I already found how to do something similar on esp822 using Flash module and setMemoryArea() in the other available flash areas (see this post :http://forum.espruino.com/conversations/290975/), but not in the area used by setBootCode. That would be useful for the other boards without additional flash memory.
-
Very nice feature, many thanks, the memory saving is huge. Now, how much memory per bytes of code do we need ? My esp8622 says out of memory above 10000 bytes of code.
The discussion on the problem running this feature on ESP8266 is solved here : http://forum.espruino.com/conversations/307523/
-
@PressAnyKey, how did you solve the "error: conflicting types for 'int32_t'" ?
I had the same, I changed the int32_t and uint32_t from long to int in c_types.h ( I used esp_iot_sdk_v1.5.0), I am not sure I did right, but it compiled, and surprise, the binary is working fine with today espruino code v1.93.162. here's the result :_____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v93.162 Copyright 2016 G.Williams Espruino is Open Source. Our work is supported only by sales of official boards and donations: http://espruino.com/Donate Flash map 4MB:512/512, manuf 0xef chip 0x4016
-
Hi again Robin,
I am making multiple independent modules(data logger, server, synchronize clock), that use wifi when connected. I also use only one instance of wifi module. But with only 1 listener, I have to go tell each module that now it is connected.
I dont see how the conversation "'STA or AP mode browser unable to connect to ESP8266-12'" is connected to my problem.If you find anything that may help, it will be welcome
Polypod
Big thanks, I'm only eager to use this new version which seems much faster. But on ESP8266, strangely, save() now erase 6 of the first free flash pages (only 1 on v1.94, 0 on v1.93), even when I send a short code. This leave available only 5 of them under 1mb, too few for my custom modules needs, still too big to be included with require and sent with the main code (not more than 10ko total). Aren't we supposed to be able to place code in these pages ?