To load modules automatically at boot or reset, use the following:
// Copyright (c) 2015 Thorsten von Eicken. MIT License E.setBootCode( "(function(){" + "var FL=require('Flash');var FR=FL.getFree()[2];var FB=FR.addr;var FS=4096;" + "var FN=FR.length/FS;var FO=1075838976;" + "for(var c=0;c<FN;c++){" + "var b=FB+c*FS;var a=FL.read(4,b);var d=a[0]<<2;var e=b+4+d;var f=a[1]<<4;" + "if(a[0]==0||a[1]==0||a[2]!=165||a[3]!=195){" + "console.log(' nothing at',b.toString(16));continue;}" + "var g=E.toString(FL.read(d,b+4)).trim();" + "console.log(' memoryArea',e.toString(16),f,g)," + "Modules.addCached(g,E.memoryArea(FO+e,f));" + "}"+ "})();", true);
it uses no JSvars itself once executed. Caveat: currently boot code doesn't work on the esp8266 due to https://github.com/espruino/Espruino/issues/891
@tve started
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.
To load modules automatically at boot or reset, use the following:
it uses no JSvars itself once executed. Caveat: currently boot code doesn't work on the esp8266 due to https://github.com/espruino/Espruino/issues/891