The code above is just copy/pasted out of an object file generated by GCC. It takes a 64 bit int and adds 2 to it.
The function a that got created can be used just like any normal function:
>a(0)
=2
>[1,2,3,4].map(a)
=[3,4,5,6]
So who wants to make a Thumb assembler written in JavaScript? :) Could be a fun project...
I actually got TCC (the Tiny C compiler) compiled into JavaScript with Emscriptem (so it could have run on the Web IDE), but unfortunately I can't get the code it produces to run on the Cortex M3.
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.
Is now a reality! (As of 1v60, or git commit a92ea2e529588c6f86cf268ff227438167052843)
The code above is just copy/pasted out of an object file generated by GCC. It takes a 64 bit int and adds 2 to it.
The function
a
that got created can be used just like any normal function:So who wants to make a Thumb assembler written in JavaScript? :) Could be a fun project...
I actually got TCC (the Tiny C compiler) compiled into JavaScript with Emscriptem (so it could have run on the Web IDE), but unfortunately I can't get the code it produces to run on the Cortex M3.