{"id":19820436,"url":"https://github.com/yodaos-project/rt-node","last_synced_at":"2025-05-01T11:33:48.041Z","repository":{"id":37451151,"uuid":"216529158","full_name":"yodaos-project/rt-node","owner":"yodaos-project","description":"A JavaScript runtime library for RTOS.","archived":false,"fork":false,"pushed_at":"2019-12-11T16:21:39.000Z","size":4285,"stargazers_count":25,"open_issues_count":1,"forks_count":2,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-05-14T00:26:59.534Z","etag":null,"topics":["nodejs","rtos"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yodaos-project.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-21T09:28:08.000Z","updated_at":"2023-10-17T13:20:25.000Z","dependencies_parsed_at":"2022-08-19T09:11:31.443Z","dependency_job_id":null,"html_url":"https://github.com/yodaos-project/rt-node","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yodaos-project%2Frt-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yodaos-project%2Frt-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yodaos-project%2Frt-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yodaos-project%2Frt-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yodaos-project","download_url":"https://codeload.github.com/yodaos-project/rt-node/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224254590,"owners_count":17281177,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nodejs","rtos"],"created_at":"2024-11-12T10:23:18.477Z","updated_at":"2024-11-12T10:23:19.201Z","avatar_url":"https://github.com/yodaos-project.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rt-node\n[![License](https://img.shields.io/badge/licence-Apache%202.0-brightgreen.svg?style=flat)](LICENSE)\n\n`rt-node` is a lightweight JavaScript framework for RTOS, also support unix like systems for debugging.\n\nThe following runtime modules are built in:\n- timer\n- require\n- utils\n- console\n- N-API\n\nN-API is supported in order to be compatible with different embed JavaScript engines, the following N-API features are WIP:\n- thread safe function\n\n## Dependencies\n\n- [JerryScript](./deps/jerryscript), a lightweight JavaScript engine\n- [rv](./deps/rv), a tiny event loop library\n\n## JavaScript Sample\n\n`speaker.js`\n\n```javascript\n'use strict';\nclass Speaker {\n  constructor(content) {\n    this.content = content;\n  }\n  say() {\n    console.log(this.content);\n  }\n}\nmodule.exports = Speaker;\n```\n\n`app.js`\n\n```javascript\n'use strict';\nconst Speaker = require('speaker');\nconst speaker = new Speaker('hello world');\nsetTimeout(() =\u003e {\n  speaker.say();\n}, 3000);\n```\n\n## N-API Sample\n\n```javascript\n'use strict';\n// The curl module depends on libcurl, the source file is sample/unix/curl.c\nconst curl = require('curl');\nconst startTime = Date.now();\ncurl.get('http://www.example.com', (body) =\u003e {\n  console.log(`get body in ${Date.now() - startTime}ms`, body);\n});\n```\n\n## Build\n\nJavaScript sources are packaged in `src/rtnode-snapshots.c/h`, set `JS_ROOT` as your JavaScript sources root directory for cmake to package them, `app.js` is the entry of user code.\n\n`rtnode` use [CMake](https://cmake.org) to build library or samples. The easiest way to build is as follows:\n\n```shell\n$ cmake -B./build -H. -DJS_ROOT=Your_js_files_root_directory\n$ make -C./build -j8\n```\n\nThe above commands will generate `librtnode.a` in `./build` directory.\n\nFor cross compile, add the following flags:\n- CMAKE_C_COMPILER, full path for c compiler\n- CMAKE_SYSTEM_PROCESSOR, the name of the CPU CMake is building for\n- CMAKE_SYSTEM_NAME, set `Generic` to indicate cross compile\n\nHere is an example for `Xtensa` toolchain:\n\n```shell\n$ cmake -B./build-xtensa -H. \\\n  -DCMAKE_C_COMPILER=xtensa-esp32-elf-gcc \\\n  -DCMAKE_SYSTEM_PROCESSOR=xtensa \\\n  -DCMAKE_SYSTEM_NAME=Generic \\\n  -DJS_ROOT=Your_js_files_root_directory\n$ make -C./build-xtensa -j8\n```\n\n## Sample\n\nCurrently support unix and esp-idf build framework.\n\nFor unix like systems\n```shell\n$ cmake -B./build -H. -DSAMPLE=unix -DJS_ROOT=./samples -DJERRY_PROFILE=es2015-subset\n$ make -C./build\n$ ./build/rtnode-unix/rtnode-unix # run sample\n```\n\nFor esp-idf:\n```shell\n$ cmake -B./build-espidf -H. \\\n  -DCMAKE_C_COMPILER=xtensa-esp32-elf-gcc \\\n  -DCMAKE_SYSTEM_PROCESSOR=xtensa \\\n  -DCMAKE_SYSTEM_NAME=Generic \\\n  -DSAMPLE=esp-idf \\\n  -DJS_ROOT=./samples \\\n  -DJERRY_PROFILE=es2015-subset\n$ make -C./build-espidf -j8\n```\n\nThe esp-idf products will generate in `./build-espidf/rtnode-build`, then use `idf.py flash` to flash the binaries that you just built onto your ESP32 board. For more information, please refer to the [esp-idf document](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/#step-9-flash-onto-the-device).\n\n## LICENSE\n\n[Apache-2.0](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyodaos-project%2Frt-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyodaos-project%2Frt-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyodaos-project%2Frt-node/lists"}