2. PIC32MZ
PIC32MZ is a MIPS
architecture MCU of Microchip
• 2 MB flash memory (program
memory);
• 512 KB built-in RAM (data
memory);
• MIPS MicroAptiv™ core, 200
MHz
3. LING: porting
https://github.com/EarlGray/ling
• LING core without libraries: 36 kloc of C code;
• Different toolchain: xc32-gcc; we have to flash an IHEX
image to a microcontroller to run the VM or to simulate
PIC32 using MPLABX IDE tools.
• the xc32 toolchain and its header files
do not support C99 properly;
moved to C89 (mostly correcting
variable declarations in for clauses);
4. LING: porting
• Platform-specific parts have already been separated in
LING code (mostly), but the core code still needed some
adjusting like #ifdef-ing LWIP calls and changing C99
code to C89;
• The platform-specific code has been mostly rewritten
(~600 loc);
• There are numerous stubs at the moment: fake timers,
bif_not_implemented for regular expression
BIFs, stubs for MD5 and SHA BIFs;
domain_poweroff() just hangs
the processor; there are fake Nettle
and LWIP headers to get the VM
compiled.
5. LING: I/O
• MPLABX debug output support is unstable (it works for
some PIC32 models and does not for others), can’t be
used in a simulator);
• Initially used a ring buffer in memory for logging +
debugger;
• we have an UART driver now for debug output;
thanks a lot to Serge Vakulenko’s
work on PIC32 emulation in Qemu
and his LiteBSD source code;
7. LING: our plans
• Making it work properly: real timers, I/O, power
management, crypto; improving GC for PIC32;
• support for Erlang stdlib and loadable LING modules; 9p;
• optimizing memory usage; at the moment:
Data RAM: 46 memory pages used at startup out of 128;
Program RAM: 1.1 MB out of 2 MB;
• A testbed for driver construction in Erlang;
• An Ethernet driver in Erlang;