{"id":21018148,"url":"https://github.com/slaff/sming-jerryscript","last_synced_at":"2025-12-27T11:11:00.894Z","repository":{"id":45234033,"uuid":"431815332","full_name":"slaff/Sming-jerryscript","owner":"slaff","description":null,"archived":false,"fork":false,"pushed_at":"2024-06-17T06:56:00.000Z","size":806,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-03-13T17:19:24.539Z","etag":null,"topics":["javascript","jerryscript","sming"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/slaff.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-25T11:10:09.000Z","updated_at":"2024-06-17T06:56:04.000Z","dependencies_parsed_at":"2024-06-11T09:46:20.071Z","dependency_job_id":"b0ec2380-3d27-47b4-afc8-77a4213fbfea","html_url":"https://github.com/slaff/Sming-jerryscript","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/slaff/Sming-jerryscript","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slaff%2FSming-jerryscript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slaff%2FSming-jerryscript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slaff%2FSming-jerryscript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slaff%2FSming-jerryscript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/slaff","download_url":"https://codeload.github.com/slaff/Sming-jerryscript/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slaff%2FSming-jerryscript/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28077916,"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","status":"online","status_checked_at":"2025-12-27T02:00:05.897Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["javascript","jerryscript","sming"],"created_at":"2024-11-19T10:23:49.109Z","updated_at":"2025-12-27T11:11:00.870Z","avatar_url":"https://github.com/slaff.png","language":"JavaScript","readme":"JerryScript\n===========\n\n.. highlight:: bash\n\nA JavaScript Virtual Machine based on JerryScript.\n\nIntroduction\n------------\n\nThis library allows running JavaScript in a sandbox on all architectures supported by Sming. \nThe library uses JerryScript as JavaScript Virtual Machine (VM).\n\n.. image:: jerryscript/docs/img/engines_high_level_design.png\n\nThe diagram above shows the interactions between the major components of JerryScript: Parser and VM. \nParser performs translation of input ECMAScript application into the byte-code. \nPrepared bytecode is executed by the Virtual Machine that performs interpretation.\nSource: `Official JerryScript site \u003chttps://github.com/jerryscript-project/jerryscript/blob/master/docs/04.INTERNALS.md\u003e`_.\n\nTo save space and be able to run JerryScript on an embedded device Sming compiles this library without a parser.\nThis means that the JavaScript files have to be compiled before landing on the device.\nSee the samples below to learn more.\n\nConsole messages\n----------------\n\nTwo external functions are made available for scripts to use:\n\n- ``print`` for normal console output (shown in AQUA)\n- ``alert`` for messages in debug mode (show in RED)\n\n\nVM integrity\n------------\n\nThe Jerryscript VM may encounter situations where it cannot continue execution, such as memory allocation failure\nor invalid bytecode.\n\nFatal errors cause engine execution to halt. It must be \"re-booted\" (in a virtual sense).\nThis requires application co-operation as scripts may need to be re-loaded, external functions re-registered, etc.\n\nIf intending to run unverified javascript it is especially important to guard all\ncalls into Jerryscript using the library exception handler:\n\n.. code-block:: c++\n\n   JS_TRY()\n   {\n      // Call into jerryscript engine\n   }\n   JS_CATCH()\n   {\n      // Engine has failed\n   }\n\nJS_TRY:\n   Place code here which sets up jerryscript values, etc. then calls into Jerryscript.\n   Data is allocated on local stack or in jerryscript engine.\n\n   DO NOT perform any system heap allocation here, such as creating or modifying `String`) objects.\n   If required, instantiate those above.\n\nJS_CATCH:\n   Jerryscript ust be re-initialised before any further calls.\n\n   - De-allocate any globally held jerryscript values\n   - Call JS::cleanup()\n   - Call JS::init() and any other necessary initialisation\n\n   It is recommended to provide a single function for both\n   initial jerryscript initialisation and re-initialisation.\n\nSee the ``Event_Jsvm`` sample for a demonstratation.\n\nNote that the VM uses own static heap (sized by :envvar:`JERRY_GLOBAL_HEAP_SIZE`) so main system heap is unaffected.\n\nWhen :envvar:`JERRY_ENABLE_DEBUG` is enabled it may not be possible to recover because VM objects may be left with\ninvalid reference counts, for example, which will cause :cpp:func:`Jerryscript::cleanup` to fail.\nApplications should generally be built with this setting disabled (the default).\n\n\nWatchdog\n--------\n\nSming is a single-threaded framework so requires co-operation to perform :doc:`multi-tasking \u003c/information/multitasking\u003e`.\nThis means javascript calls should be brief so as not to disrupt the system.\n\nIf a javascript call takes too long then the system watchdog will timeout and reset the system.\nThis is generally not helpful, so a separate watchdog is implemented for the Jerryscript virtual machine.\n\nBy default, the watchdog is disabled. To enable it, add a call during initialisation:\n\n.. code-block:: c++\n\n   // Enable the watchdog with a 100ms timeout (0 to disable it)\n   JS::Watchdog::setPeriod(100);\n\nNow, if a call takes more than 100ms then a fatal error will be thrown as discussed above.\n\nThe setting can be changed at any time and is unaffected by jerryscript engine resets.\n\n\nExternal Contexts\n-----------------\n\nBy default, a single, global VM context is created in which all code is loaded and executed.\nIf multiple javascript applications are running then if one fails it will take out all the others.\n\nEnabling the :envvar:`JERRY_EXTERNAL_CONTEXT` setting allows use of the :cpp:class:`JS::Context`\nclass to run multiple isolated instances. See the :sample:`Basic_Context` example for details.\n\n\nConfiguration variables\n-----------------------\n\n.. envvar:: JERRY_ENABLE_DEBUG\n\n   default: 0 (disabled)\n\n   Enable assertions and debug messages in jerryscript library.\n   Should be left disabled unless debugging the jerryscript engine itself.\n\n\n.. envvar:: JERRY_MEM_STATS\n\n   default: 1 (enabled)\n\n   Enable jerryscript heap memory tracking.\n\n\n.. envvar:: JERRY_ERROR_MESSAGES\n\n   default: 0 (disabled)\n\n   Enable text messages for common errors.\n   Consumes ~2K RAM on ESP8266.\n\n\n.. envvar:: JERRY_COMPACT_PROFILE\n\n   default: 1 (enabled)\n\n   Compact (minimal profile) compilation profile makes the JerryScript library smaller.\n\n   Set to 0 to use es.next profile.\n\n\n.. envvar:: JERRY_PARSER\n\n   default: 0 (disabled)\n\n   Enable to build library with javascript parser enabled.\n   Required for use of :cpp:func:`Jerryscript::eval` function.\n\n\n.. envvar:: JERRY_EXTERNAL_CONTEXT\n\n   default: 0 (disabled)\n\n   Enable this setting to make use of :cpp:class:`JS::Context` to run multiple isolated instances.\n\n\n.. envvar:: JERRY_GLOBAL_HEAP_SIZE\n\n   default: 1 (in KB)\n\n   Size of the jerryscript global heap in kilobytes. Increase as required.\n\n\n.. envvar:: JERRY_SNAPSHOT_TOOL\n\n   Read-only. Path to the snapshot compiler for use by applications.\n\n\n.. envvar:: APP_JS_SOURCE_DIR\n\n    default: undefined\n\n    Snap files can be created during the build stage by setting this variable in your project's component.mk file::\n\n        APP_JS_SOURCE_DIR := files\n\n    All ``.js`` files will be compiled into ``.snap`` files and written to :envvar:`APP_JS_SNAPDIR`.\n\n\n.. envvar:: APP_JS_SNAP_DIR\n\n    default: ``out/jerryscript``\n\n    Location to write generated .snap files.\n\n\n.. envvar:: APP_JS_SNAP_UPDATED\n\n    default: undefined\n\n    Set this if action required when snaps are updated, for example to rebuild SPIFFS image or update application.\n\n\n.. envvar:: JERRY_WEB_COMPILER\n\n    (read-only)\n\n    Location of pre-compiled web compiler. See ``Advanced-Jsvm`` sample for example usage.\n\n\nCredits\n-------\n\nThe initial work on the JerryScript library for Sming was done as part of the `U:Kit project \u003chttps://github.com/attachix/ukit\u003e`_. \n\n.. toctree::\n   :glob:\n\n   *\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslaff%2Fsming-jerryscript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fslaff%2Fsming-jerryscript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslaff%2Fsming-jerryscript/lists"}