-
Notifications
You must be signed in to change notification settings - Fork 15
Description
TODO
- bluetooth
- bootloader
- partition
- lwip
- peripherals (led, gpio, adc, uart, etc...)
- netif
- mqtt
- wifi
- http
- tls (mbedtls)
- freertos (tasks, queue, semaphore, etc...)
- pthread
mini-FAQ
So Zig can read C headers. Why manual wrappers?
Indeed @cImport/@cInclude doesn't access C types directly, but it converts to zig binding automatically (like binding-rs).
However, there have been some limits to support at the moment, in particular when converting macros (difficult to parse).
One example is ESP_LOGx, which has been done manually, since the original version provided in esp_log.h has become untranslatable.
see: zig doc - @cImport vs translate-c
So why not use microzig to make the project fully zig-written?
I am currently using zig v0.12.0-dev (nightly/master) and the microzig project does not support this version yet.
see: ZigEmbeddedGroup/microzig#178
The use of regz (svd converter) will also need to be evaluated, since it is under development and not all peripherals are guaranteed during translation.
see: ZigEmbeddedGroup/microzig#180
Why did you add C++ example using Zig?
Isn't it clear?
Okay, so instead of using crosstool-NG you switch to zig c++/clang++, but only with libc++ (LLVM C++ ABI) and not libstdc++ (GNU C++ ABI).
However, the final binary will still be compiled via cmake with crosstool-NG and libgcc (compiler ABI), not compiler-rt (compiler ABI).
see: kubo39/esp32-resource#1
Note: Zig (the toolchain) doesn't just prefer its own language!