Skip to content

Internal

Minkyu Lee edited this page Oct 14, 2018 · 6 revisions

Project Internal

Overall architecture

Kameleon has a layered architecture like 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/boards/*)
+----------------------------------+

Repository structure

+ deps              # Dependencies
+ include           # C Headers
  + port            # Hardware neutral interfaces
+ src               # C Implementations
  + gen             # Generated source files (DOT NOT EDIT)
  + modules         # JavaScript native modules
    + <module>      
+ targets           # Hardware specific implementations
  + boards          # Specific hardware boards
    + <target>
  + shared          # Libraries shared by hardware targets
    + drivers       # Hardware specific drivers
    + middlewares   # Middlewares
+ tools             # Build tools

Porting to a new hardware

To port to a new hardware, HNI (Hardware neutral interfaces - /include/port/*.h) should be implemented.

  1. Create a folder in targets/boards (e.g. esp32).
  2. Implement all header files in include/port/*.h.
  3. Create a makefile Make.def.
  4. Place driver libraries in targets/drivers if needed.

Entry point

src/main.c is the entry point.

Clone this wiki locally