Z-Code - Overview
Z-Code is a C++ framework for programming microcontrollers. Think industrial grade Arduino.
It is designed to support any microcontroller you can implement the Hardware Abstraction Layer for.
Z-Code C++ is stripped down to bare essentials and code written for microcontrollers does not support RTTI or exceptions. What is left however, makes for a very powerful tool in its simplicity and flexibility.
Most of the existing Arduino libraries can be ported to Z-Code with little or almost no work at all, except in cases where there’s direct dependency on specific Atmel MCU features.
Z-Code comes with HAL implemented for QEMU ARM emulator and NXP LPC13xx line of microcontrollers.
hello world code that runs on QEMU may look like this:
#include <zprint>
#include <cstdint>
#include <climits>
// qemu RESET code to stop execution
extern "C" void CPU_RESET();
// qemu print helpers
extern "C" int _write (int fd, char *ptr, int len);
int iowrite(char c) {return _write(0, &c, 1);}
class MyPrint : public ZPrint
{
public:
MyPrint(){};
size_t write(uint8_t c)
{
iowrite(c);
return 1;
}
};
MyPrint myPrint;
void setup()
{
myPrint.println("Hello there from Z-Code!");
CPU_RESET();
}
void loop()
{
// empty loop
return;
}
For more details, checkout the Git repo.