-
Notifications
You must be signed in to change notification settings - Fork 37
Internal
Minkyu Lee edited this page Mar 15, 2022
·
6 revisions
Kaluma has a layered architecture as below:
+----------------------------------+
| Builtin JS Modules | # event, i2c, pwm, spi, uart, ... (src/modules/*)
+----------------------------------+
| Core Runtime | # Event I/O, JavaScript Engine, REPL, ... (src/*.c)
+----------------------------------+
| Hardware Neutral Interface | # system.h, gpio.h, uart.h, ... (include/port/*.h)
+----------------------------------+
| Hardware Specific Implementation | # system.c, gpio.c, uart.c, ... (targets/*)
+----------------------------------+
lib/ # External libraries
include/ # C headers
└─ port # Hardware neutral interfaces
src/ # C implementations
├─ gen # Generated source files (DOT NOT EDIT)
└─ modules # JavaScript builtin modules
└─ <module>
targets/ # Target implementations
└─ <target>/ # A specific target (e.g. rp2, stm32, esp32, ...)
├─ include/ # header files
├─ src/ # Implementations of include/port/*.h
├─ boards/ # Supported boards of the target
│ └─ <board>/ # A specific board (e.g. pico)
└─ target.cmake # CMake for the target
tools/ # Build tools
To port to a new hardware, HNI (Hardware neutral interfaces - /include/port/*.h
) should be implemented.
- Create a folder in
targets/<target-name>
(e.g.targets/esp32
). - Implement all header files in
include/port/*.h
intotargets/<target-name>/src/*.c
. - Create a board folder in
targets/<target-name>/boards/<board-name>
. - Add
board.h
andboard.js
into the board folder. - Create a CMAKE file
target.cmake
for the target. - Put required libraries in
lib
if any.
src/main.c
is the entry point.