Just retested experiments with native strings and it works as expected now.
var s;
var s2;
var s3="native string";
var s4;
function test(){
s=atob("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
s2="Hello";
s4="This is a longer string";
}
test()
after uploading this file to storage and running it s,s3,s4 are native strings pointing to internal flash. s2 is not as it is too short.
However Inline C code upload does not work, the atob call there is not parsed properly, even this line does not work
Another thing is that even if it worked the native string in flash produced by atob is not aligned so even if the code had no global variables it is still not executable as is. E.toFlatString() helps with that and moves code to RAM like it was before.
Too bad there is probably no easy way to align the native string in flash as quite a lot of inline C code don't use global variables so could in theory run directly from internal flash (when it is nrf52 internal flash, not SPI flash).
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Just retested experiments with native strings and it works as expected now.
after uploading this file to storage and running it
s,s3,s4
are native strings pointing to internal flash.s2
is not as it is too short.However Inline C code upload does not work, the
atob
call there is not parsed properly, even this line does not workI get
I tried to reload https://www.espruino.com/ide/ but it does not help.
Another thing is that even if it worked the native string in flash produced by
atob
is not aligned so even if the code had no global variables it is still not executable as is.E.toFlatString()
helps with that and moves code to RAM like it was before.Too bad there is probably no easy way to align the native string in flash as quite a lot of inline C code don't use global variables so could in theory run directly from internal flash (when it is nrf52 internal flash, not SPI flash).