-
• #2
Espruino write on start:
> _____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v95 Copyright 2017 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 0xe0 chip 0x4016
-
• #3
Yes, that's what you'd expect.
Turn off
Save on send
and you may well be able to manage more.edit: it's something that'll hopefully change soon, but right now you need to load your code into RAM in one go before writing it to flash.
-
• #4
thanks Gordon, the file success send, but if i want save it - i have error:
>save() =undefined Erasing Flash..... Writing............................ ERROR: Too big to save to flash (26151 vs 12284 bytes) Deleting command history and trying again... Erasing Flash..... Writing...................... ERROR: Tooàþ 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 Disconnected
esp12 have 4mb flash memory, why it's say what i have 12284 bytes?
-
• #5
thanks, I have one more question, did not notice the "Reply" button
-
• #6
The esp8266 has limited ram, and only 12k is left after the interpreter and operating system.
If you minimize the code before uploading, you may be able to get it to fit.
What is the code you are trying to load? It seems quite large.
-
• #7
Code here, it's management of climate monitoring via telegram api, at this moment - work wine, but i want keep subscribers and notify them when necessary.
At this moment free space in esp for additional methods is end, and i dont have idea how to fix it.
Here MaBe proposes to use "eval" and keep code inside unused flash memory:
>require('Flash').getFree() =[ { "addr": 487424, "length": 4096 }, { "addr": 524288, "length": 4096 }, { "addr": 1011712, "length": 36864 }, { "addr": 1048576, "length": 3129344 } ]
is it real for me?
-
• #8
Flash map 4MB:512/512, manuf 0xe0 chip 0x4016
You have a ESP8266 with a 4MB flash, but flashed firmware for a ESP 01 512K.
Check ESP8266 page, section Build Content
-
• #9
ok, i apologize for the stupid questions and thank you for the explanation.
Спасибо, товарищи!
-
• #10
So is there a way to get around the 10k source code size limit?
-
• #11
On 1v96 firmware and later, yes. You can use
require("Storage").write
to create a large file called".bootcde"
, and can then write the data in chunks (see the example).Ideally it'd be something built into the IDE but I haven't got around to that yet.
-
• #12
Excellent! Is there anyway you could link to the example? I did a little searching but didn't see how to write executable code using the .write() command
-
• #13
http://www.espruino.com/Reference#l_Storage_write - it's linked from
require("Storage").write
but is hard to see -
• #14
Just to add - so what you want to do is make a bit of code that takes your JS file and splits it up into ~1kB chunks, then creates a bunch of
.write
calls one after the other with the correct offsets. The very first one needs to have the file's length in it. -
• #15
I saw that...I was hoping for an example of saving an entire javascript program into storage and then loading it and executing it. Would I create a helper program to save the .js file as a really long string then onInit() read it back out and then somehow execute the string as Javascript?
Edit: I think I'm on the same page as you now....I will try playing with that tonight.
-
• #16
Ok, I've just changed the Web IDE so
Save on Send
now does it properly if it detects 1v96. If you use the latest from GitHub: https://github.com/espruino/EspruinoWebIDEOr use the command-line tools with
npm install espruino
then you should get something that works. -
• #17
Thanks! That seems to have done the trick!...I'm not sure how much more stuff I can stuff into it; but I should be able to finish a nice demo program that shows the capabilities of this board.
-
• #18
Which board are you using? If it's the ESP8266_4MB it looks like you can put about 200kB's worth of code in there!
-
• #19
I'm using this ESP8266_4MB board with battery and oled screen . I am able to install my codebase with basic minification on, but get Low memory messages. I guess I will have to optimise a bit.
I plan to give these out at my schools summer STEM camp. Bought in bulk we can get it to around $10 a student with a battery and 3d print the case. I am writing a comprehensive demo to show them what they can do. It also makes sure I understand the platform; so I can answer questions. I just picked up JavaScript recently (Fitbit Ionic Development), so I am still getting comfortable with the language. I'll attach my demo so far.
1 Attachment
-
• #20
Wow, I'm surprised that kills your memory.
One thing I'd say is if it doesn't have to be super fast, make a function
getBootImg
that returns the structure. That way the image will stay in flash, but will only be loaded into RAM just in time to be displayed and will then be unloaded again. -
• #21
I'll try that.
Here is the response from my device on load:
____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |____|___| _|_| |___|_|_|_|___| |_| espruino.com 1v96.5 (c) 2018 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:1024/1024, manuf 0xc8 chip 0x4016 > =undefined Loading 14495 bytes from flash... Execution Interrupted during event processing. New interpreter error: LOW_MEMORY,MEMORY
On Boot:
>process.memory() ={ "free": 603, "usage": 997, "total": 1600, "history": 1, "gc": 485, "gctime": 2.459 }
On connect to wifi:
>process.memory() ={ "free": 624, "usage": 976, "total": 1600, "history": 4, "gc": 73, "gctime": 2.527 } >process.memory()
On start of ball bounce demo:
={ "free": 611, "usage": 989, "total": 1600, "history": 4, "gc": 146, "gctime": 2.581 } >
-
• #22
The other option you have is to have a bootstrap script that you run first, that saves the large btoa image as an array into with Storage.write. This can be run once to save the data, and then the main script just pulls a reference to this in flash and won’t consume any valuable ram.
-
• #23
Another option is to build a custom firmware that compiles in the SSD1306 and graphical_menu as js sources, then these modules will be in flash instead of ram...
-
• #24
Interesting...Saving the image to flash is definitely something that would be easy. I'm not sure if I want to build a custom image; since I would then have to keep parity with the official branch after I distribute them to the kids.
-
• #25
Actually what happens if you turn on
Modules uploaded as functions
inCommunications
?@Wilberforce do you see any reason I shouldn't just remove the option and turn it on automatically for boards with firmware 1v90 and later? That'd save a whole bunch of memory.
hi, i use espruino_1v95, and if u upload file > 10kb - i have error:
if i send file <10kb - it's ok, maybe I'm doing something wrong?
process.memory() print:
and process.memory(), with file almost 10 kb in size