-
• #2
The main reason is that with a 4MB board it is possible to use a 4MB:1024/1024 flash map.
With this map type a max flash size of 962560 byte and 16 pages to save code is defined.
This flash areas are free to use:
_____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v95.3469 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:1024/1024, manuf 0xe0 chip 0x4016 >require("ESP8266").getFreeFlash() =[ { "addr": 2097152, "length": 1048576 }, { "addr": 3145728, "length": 262144 }, { "addr": 3407872, "length": 262144 }, { "addr": 3670016, "length": 262144 }, { "addr": 3932160, "length": 262144 } ]
-
• #3
Thanks @MaBe for your reply, Things are ... more confusing now :P
Do I understand correctly, there is 3 different builds for esp8266 ?1 / build 8266
found here : http://www.espruino.com/binaries/espruino_1v95_esp8266/. I guess it's the one decribed by this file : https://github.com/espruino/Espruino/blob/master/boards/ESP8266_BOARD.py. Has a 1700 vars and no Graphics. Available free flash total is 3mb+40kb, the 40kb are under 1mb usable to run modules from flash with E.memoryArea(). This is the build I usually use, with no problem. I install it with :python esptool.py --port COM20 --baud 115200 erase_flash python esptool.py --port COM20 --baud 115200 write_flash --flash_freq 40m --flash_mode dio --flash_size 32m 0x0000 boot_v1.6.bin 0x1000 espruino_esp8266_user1.bin 0x3FC000 esp_init_data_default.bin 0x3FE000 blank.bin
and get
_____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v95.20 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 0xef chip 0x4016 >process.memory() ={ "free": 1677, "usage": 23, "total": 1700, "history": 0, "gc": 0, "gctime": 1.352 } >require("Flash").getFree() =[ { "addr": 487424, "length": 4096 }, { "addr": 524288, "length": 4096 }, { "addr": 1011712, "length": 36864 }, { "addr": 1048576, "length": 3129344 } ]
2 / build 8266 4mb
found here : http://www.espruino.com/binaries/espruino_1v95_esp8266_4mb/. I guess it's the one decribed by this file : https://github.com/espruino/Espruino/blob/master/boards/ESP8266_4MB.py. Has a 1600 vars and Graphics.
I install it with the exact same command line, maybe it is not correct ? I get a very similar result, except that when I store something in the 6 first flash pages, it get erased on save(). Any idea why ?_____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v95.20 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 0xef chip 0x4016 >process.memory() ={ "free": 1572, "usage": 28, "total": 1600, "history": 0, "gc": 0, "gctime": 1.726 } >require("Flash").getFree() =[ { "addr": 487424, "length": 4096 }, { "addr": 524288, "length": 4096 }, { "addr": 1011712, "length": 36864 }, { "addr": 1048576, "length": 3129344 } ] >Graphics =function () { [native code] }
3 / build 8266 4mb combined found here : http://www.espruino.com/binaries/espruino_1v95_esp8266_4mb_combined_4096.bin. I think it's the one you are referring to. is it described somewhere ? It has 1700 vars, no Graphics. I used the "4mb-c1" you posted in the other thread, and it worked perfectly. I understand the flash available is only the last 2MB, so not possible to have modules running from flash.
python esptool.py --port COM20 --baud 115200 write_flash --flash_freq 80m --flash_mode dio --flash_size 4MB-c1 0x0000 boot_v1.6.bin 0x1000 espruino_esp8266_user1.bin 0x3FC000 esp_init_data_default.bin 0x3FE000 blank.bin
(updated following)
_____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v95.20 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:1024/1024, manuf 0xc8 chip 0x4016 >process.memory() ={ "free": 1672, "usage": 28, "total": 1700, "history": 0, "gc": 0, "gctime": 1.358 } >require("Flash").getFree() =[ { "addr": 2097152, "length": 1048576 }, { "addr": 3145728, "length": 262144 }, { "addr": 3407872, "length": 262144 }, { "addr": 3670016, "length": 262144 }, { "addr": 3932160, "length": 262144 } ]
For this version, you mention 16 pages of saved code available, that's 64kb. How is it possible to store as much code in them ? If I use the WebIDE, the board throw a UNFINISHED STRING when the transfer reach 10kb. I guess there is no memory for larger transfer. Is there another way ?
_____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v95.20 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:1024/1024, manuf 0xc8 chip 0x4016 >Uncaught SyntaxError: Got UNFINISHED STRING expected EOF at line 1 col 15 E.setBootCode("Modules.removeAllCached(),Modules.addCached('... ^ New interpreter error: LOW_MEMORY,MEMORY >
-
• #4
Espruino offers these two builds for esp8266 to download:
can be used by all esp8266 boards, ESP01 upto ESP13
uses a flash map 512/512
can only be used by boards with min 4MB flash like ESP12
uses a flash map 1024/1024
and GRAPHICS
Check README_flash.txt how to use esptool.py for different flash sizes ( 4MB 1024/1024 note is waiting for commit)
Not sure if E.setBootCode is the best way in this case
Add the initial parts in
E.init()
, upload the code and then typesave();
-
• #5
Thanks again Mabe, for your reply. I made a copy/paste mistake earlier, now it's updated.
The esp8266 4mb not combined version (found here) get me :
_____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v95.20 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 0xef chip 0x4016 >
It says 512/512. Is it the first or the second build ?
Using the 4mb combined, from the WebIDE, I managed to upload 16kb of code, 4kb by 4kb, and the total took 1300 blocks, and it can't be saved with save(), too big :
> _____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v95.20 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:1024/1024, manuf 0xc8 chip 0x4016 > process.memory() ={ "free": 360, "usage": 1340, "total": 1700, "history": 358, "gc": 0, "gctime": 1.351 } >save() =undefined Erasing Flash..... Writing.................. ERROR: Too big to save to flash (15900 vs 12284 bytes) Deleting command history and trying again... Erasing Flash..... Writing..................
I fail to grasp the rationale behind these 16 pages for saved code and how are we supposed to fill them. Ok, I can fill 12kb of the 64kb reserved for saving code. Is there a way to use the resting 52kb ? is there a way to execute them from flash (like with save-on-send/E.memoryArea) ?
-
• #6
It says 512/512. Is it the first or the second build ?
Yes, correct with setting from ESP8266_BOARD.py
Note: save() will compress the code and then write to flash
What about Minification?
Hmm, are you sure process.memory() is the correct output, because it say
"total": 1700
What about your heap size?
>process.memory(); ={ "free": 1562, "usage": 38, "total": 1600, "history": 20, "gc": 18, "gctime": 1.722 } >require("ESP8266").getState(); ={ "sdkVersion": "2.0.0(656edbf)", "cpuFrequency": 160, "freeHeap": 10936, "maxCon": 10, "flashMap": "4MB:1024/1024", "flashKB": 4096, "flashChip": "0xe0 0x4016" } >
As more vars you configure as less heap memory you have :-)
So with GRAPHICS and 1600 var get "freeHeap": 10936 to work with.
-
• #7
It was 16kb of minified code I uploaded and tried to save.
This is the output I get from the "4mb combined", 1700 blocks and no graphics:
_____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v95.20 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:1024/1024, manuf 0xc8 chip 0x4016 >process.memory() ={ "free": 1677, "usage": 23, "total": 1700, "history": 0, "gc": 0, "gctime": 1.352 } >require("ESP8266").getState(); ={ "sdkVersion": "2.0.0(5a875ba)", "cpuFrequency": 160, "freeHeap": 9728, "maxCon": 10, "flashMap": "4MB:1024/1024", "flashKB": 4096, "flashChip": "0xc8 0x4016" } >Graphics Uncaught ReferenceError: "Graphics" is not defined >require("Flash").getFree() =[ { "addr": 2097152, "length": 1048576 }, { "addr": 3145728, "length": 262144 }, { "addr": 3407872, "length": 262144 }, { "addr": 3670016, "length": 262144 }, { "addr": 3932160, "length": 262144 } ]
-
• #9
Thanks a lot Mabe for all your replies. I learned a few things, but honestly, I still feel a bit lost between builds, flash maps, etc.
My context, my current project actually run on my esp12-4mb with the basic 512/512 build. I use 8 modules, executed from flash, with FlashString (http://forum.espruino.com/conversations/290975/) and it's homemade IDE plugin (http://forum.espruino.com/conversations/313069/). I was trying to figure out if I can run it also on other configurations/builds of esp8266, and how to save and execute code from flash in these.It seems there is 1700 blocks no graphics in the 4mb combined build from http://www.espruino.com/binaries/espruino_1v95_esp8266_4mb_combined_4096.bin.
_____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v95.20 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:1024/1024, manuf 0xc8 chip 0x4016 >process.memory() ={ "free": 1672, "usage": 28, "total": 1700, "history": 0, "gc": 0, "gctime": 1.357 } >var g = Graphics.createArrayBuffer(8,8,8); Uncaught ReferenceError: "Graphics" is not defined at line 1 col 17 var g = Graphics.createArrayBuffer(8,8,8); ^ >
-
• #10
1v95.20 Copyright 2017 G.Williams
This is how the release 1v95 looks like:
_____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| 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:1024/1024, manuf 0xe0 chip 0x4016 >process.env ={ "VERSION": "1v95", "BUILD_DATE": "Dec 15 2017", "BUILD_TIME": "12:59:13", "GIT_COMMIT": "da2dc33d46082cc1d3b28092995123a8a6a24175", "BOARD": "ESP8266_4MB", "CHIP": "ESP8266", "CHIP_FAMILY": "ESP8266", "FLASH": 0, "RAM": 81920, "SERIAL": "5ccf7fc1-120b", "CONSOLE": "Serial1", "EXPORTS": { "jsvLock": 1075854228, "jsvLockAgainSafe": 1075854316, "jsvUnLock": 1075854940, "jsvSkipName": 1075864796, "jsvMathsOp": 1075871204, "jsvMathsOpSkipNames": 1075872992, "jsvNewFromFloat": 1075862156, "jsvNewFromInteger": 1075862040, "jsvNewFromString": 1075861816, "jsvNewFromBool": 1075862124, "jsvGetFloat": 1075868928, "jsvGetInteger": 1075864092, "jsvGetBool": 1075869304, "jspeiFindInScopes": 1075887224, "jspReplaceWith": 1075886908, "jspeFunctionCall": 1075898260, "jspGetNamedVariable": 1075889136, "jspGetNamedField": 1075889580, "jspGetVarNamedField": 1075889712, "jsvNewWithFlags": 1075861420 } } >process.memory() ={ "free": 1562, "usage": 38, "total": 1600, "history": 10, "gc": 35, "gctime": 1.712 } >var g = Graphics.createArrayBuffer(8,8,8); =Graphics { "buffer": new ArrayBuffer(64) }
Hi,
I have a esp8266 board with 4mb. I can safely run both of these versions right ?
I know there is a difference between these two configurations of firmware. The 4MB version has additional graphics library, but only 1600 jsvars (and not 1700). This is defined by these files :
https://github.com/espruino/Espruino/blob/master/boards/ESP8266_BOARD.py
https://github.com/espruino/Espruino/blob/master/boards/ESP8266_4MB.py
But why does the code save at a different place ? The 4MB version saved code use 16 pages of flash (64kb) instead of 3 (kb), but the board still cannot take more than 10kb at once, when I use the WebIDE. Is there a way to use these pages in the _4mb firmware ?
In the 4MB version, save() erase the 6 first pages returned by require("Flash").getFree(), I use for my custom modules to run from flash. Possibly caused by the 16pages of flash erased. But I don't understand, are they free to use or not ?