design icon indicating copy to clipboard operation
design copied to clipboard

Wasm on Bare Metal ABIs (was: Wasm Cards)

Open SoniEx2 opened this issue 5 years ago • 2 comments
trafficstars

~~We have Java Cards but what if we had Wasm Cards as well? unfortunately it would be a lot easier with a 16-bit format instead of the 32-bit and 64-bit formats we have.~~

There should be a 16-bit wasm format, as well as wasm formats for "directly on the metal" where the whole address space is exposed, there's no MMU, there are no bound checks on memory, and wasm stack is shared with LLVM stack. Additionally, memory layout must be specified at compilation time.

This would be useful for:

  • a wasm equivalent of java cards
  • wasm on z80
  • wasm on 68k/amiga (with uhh "hacks", see https://github.com/WebAssembly/wabt/pull/1557)
  • etc

It'll need to handle bank switching and ROM somehow.

SoniEx2 avatar Sep 12 '20 21:09 SoniEx2

While working on Wasm3, we were able to run WASM on systems with 16KB RAM and 128KB Flash memory. And even on ATmega1284. Personally, I wouldn't vote for introducing any of the suggested changes, but there are some other useful ideas, already discussed in other tickets/proposals. Let me collect them and post here.

vshymanskyy avatar Dec 09 '20 05:12 vshymanskyy

Things to read (at least):

  • Improve support of embedded systems with limited RAM https://github.com/AssemblyScript/assemblyscript/issues/1089
  • Embedded devices: i8/i16 and memory pages less than 64KiB https://github.com/WebAssembly/spec/issues/899
  • Supporting smaller memory pages https://github.com/ewasm/design/issues/161
  • bulk-memory-operations. Expected to be used for large sizes? https://github.com/WebAssembly/bulk-memory-operations/issues/1

vshymanskyy avatar Dec 09 '20 20:12 vshymanskyy