Espruino speed improvements - compiled JavaScript?

Posted on
Page
of 3
First Prev
/ 3
  • Don't feel a 'Tschumpuhung'... things are already quite voluminous and move so fast: solutions and new things appear quicker and more often than you (re)start and (re)stop the IDE...

  • @Gordon
    Ok, it seems that 1v77 works properly now...

    Thanks

    @allObjects
    Really? ;-)

  • Hi,
    How can I extract the compiled function from the board to save it and use it in future without repeated compiling? Is it possible?
    Unfortunately I have not understood at all, how I can compile a function myself :-(

  • You could step back in the command history (up-arrow on left hand side) to find the code that was sent, and could copy that...

    At some point I'll post some code up to allow you to manually compile C functions with Linux+GCC.

  • Ok, I have extracted a code of simple function from the board. But the procedure is not very transparent... And how will it look for more complex function?..

    But how can I compile a JS code for Espruino by myself?

  • It'll look the same for a more complex function - there'll just be a bigger string of characters.

    To compile it yourself you'd have to check out https://github.com/gfwilliams/EspruinoCompiler and run your own server.

    However I'm not quite sure why you can't just use the Web IDE (or command-line tools) to compile and upload code yourself? The compiled code will only work with the version of Espruino it was compiled for, so if you update you'll have to change everything.

  • Unfortunately I have an internet connection not always... And fact that I must compile a code again for new Espruino version is not a good thing.

    Say please is it possible to run a compiled code from controller's flash? I'd like to save compiled functions to STM32's flash by STM32F1 FLASH MEMORY MODULE and call them from there. Or do the compiled code works from RAM only?

  • Yes, you can manually save them to flash - but you'll still have to recompile them every time you update the firmware.

    To save them to flash, you'd have to copy the atob(...) line, save it somewhere with the flash module, and then change the E.nativeCall(addr, sig, data) line to E.nativeCall(address_in_flash+1, sig).

    You can even save them to an SD card if you want. I posted about it here

    But I don't really see what that gets you given the need to recompile. If you don't have an internet connection, download and set up http://github.com/gfwilliams/EspruinoCo­mpiler on your computer, then point the Web IDE at it. It'll then dynamically compile your code on your own PC.

  • Yes, it looks like I thought

    To save code to SD card is a good thing too, but it requires RAM for code that must be loaded. And if I have saved a code to controller's flash I can run it directly withoud loading to memory. Isn't that so?

    Ok, I will probe to compile by myself.

  • And if I have saved a code to controller's flash I can run it directly without loading to memory. Isn't that so?

    Yes, that's right. However compiled code really won't take that much of your memory.

  • I cannot run node server.js :-( It writes "Error: Cannot find module 'acorn' ". Where can I load it from?

  • sudo npm install acorn -g

    You might need to do that with some other modules too.

  • I understand nothing...

    I have installed acorn module like you had said, it has written that it was installed in a folder that I have set in system variable path, but node doesn't see it and writes: "Error: cannot find module 'accorn'".

    What do I not correct?

  • I have no idea I'm afraid - it worked when I did it...

  • Very interesting...

  • I had copied the node_modules with installed acorn from the npm's folder to catalog ..\EspruinoCompiler-master.

    The error went away, the server runs (in browser at the address localhost:32766, I see the the message Espruino compilation server), but compiling isn't performed :-( The function is sended to Espruino as javascript code, not as native code

  • Did you change the address that's in the Web IDE's settings?

    Also, you'll have to have installed GCC for ARM...

  • Yes, sure. I have changed the Javascript Compiler address in Web IDE.

    The GCC for ARM is installed, but I have no idea how it must be attached to JS Compiler. I think problem is that JS Compiler doesn't see the GCC...

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Espruino speed improvements - compiled JavaScript?

Posted by Avatar for Gordon @Gordon

Actions