{"id":13720202,"url":"https://github.com/svenssonjoel/Sense-VM","last_synced_at":"2025-05-07T12:30:54.901Z","repository":{"id":67624642,"uuid":"278055791","full_name":"svenssonjoel/Sense-VM","owner":"svenssonjoel","description":"Sense-VM has changed name to SynchronVM and is available in a new repository https://github.com/SynchronVM/SynchronVM","archived":false,"fork":false,"pushed_at":"2022-05-14T06:37:05.000Z","size":24861,"stargazers_count":5,"open_issues_count":19,"forks_count":1,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-06T08:11:13.368Z","etag":null,"topics":["bytecode","categorical-abstract-machine","chibios","concurrency","concurrent-ml","iot","nrf52","stm32f4","virtual-machine","zephyr-rtos"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/svenssonjoel.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-07-08T10:09:19.000Z","updated_at":"2023-09-04T04:39:57.000Z","dependencies_parsed_at":"2023-03-11T02:05:02.428Z","dependency_job_id":null,"html_url":"https://github.com/svenssonjoel/Sense-VM","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svenssonjoel%2FSense-VM","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svenssonjoel%2FSense-VM/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svenssonjoel%2FSense-VM/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svenssonjoel%2FSense-VM/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/svenssonjoel","download_url":"https://codeload.github.com/svenssonjoel/Sense-VM/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252876320,"owners_count":21818163,"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":["bytecode","categorical-abstract-machine","chibios","concurrency","concurrent-ml","iot","nrf52","stm32f4","virtual-machine","zephyr-rtos"],"created_at":"2024-08-03T01:01:00.937Z","updated_at":"2025-05-07T12:30:52.730Z","avatar_url":"https://github.com/svenssonjoel.png","language":"C","funding_links":[],"categories":["Libraries"],"sub_categories":["Application frameworks"],"readme":"# **NOTE**\n\nSense-VM has changed name to SynchronVM and is available in a new\nrepository [here](https://github.com/SynchronVM/SynchronVM).\n\n\n# Sense-VM\n\n\u003cimg src=\"https://raw.githubusercontent.com/svenssonjoel/Sense-VM/master/logo/bergsget_blue_small.png\" width=\"200\" height=\"250\" /\u003e\n\nSense-VM is a bytecode-vm for microcontrollers such as STM32, and\nNRF52. Sense-VM is based on the Categorical Abstract Machine but is augmented\nto support Concurrent ML style concurrency.\n\n## MPLR 2021 paper snapshot\n\n[V0.1.0](https://github.com/svenssonjoel/Sense-VM/releases/tag/v0.1.0)\n\n\n## Building the compiler\n\nThe compiler is implemented in Haskell and uses the stack build\nsystem ([get stack](https://docs.haskellstack.org/en/stable/README/)).\nGo to the `frontend/CamIoT` directory and issue the command:\n\n```\nstack build\n```\n\nThe command above builds an executable called `camiotc` somewhere\nunder the `.stack-work` directory that the `stack` tool generates.\n\nTo install the binary to `$HOME/.local/bin` issue the command:\n\n```\nstack install\n```\n\n## Using the camiotc compiler\n\n`camiotc` takes one or more arguments one of which should be a source file.\nFor example, to compile one of the example programs under `testcases` do:\n\n```\ncamiotc testcases/good11.cam \n```\n\nThe output of this command should be:\n\n```\ncompiling file `testcases/good11.cam` to output `out.svm`\n```\n\nAlternatively a specific output file can be specified using the `-o` parameter:\n\n```\ncamiotc testcases/good11.cam -o good11.svm\n```\n\nand the output should be:\n\n```\ncompiling file `testcases/good11.cam` to output `good11.svm`\n```\n\n# Examples \n\nExamples are located in the `examples` directory and are set up to\nbuild together with ChibiOS 20.3.3. Your copy of the Chibios source\ncode should be located at position `../../../ChibiOS_20.3.3` relative\nto a given example directory. \n\n## The `button_blinky` example\n\nThe `button_blinky` example consists of the following files: \n\n```\n.\n├── button_blinky.cam\n├── Makefile\n├── src-chibios\n│   ├── chconf.h\n│   ├── flash.sh\n│   ├── halconf.h\n│   ├── Makefile\n│   ├── mcuconf.h\n│   └── stm32f407g.cfg\n├── svm_chibios_conf.h\n└── vm-conf.h\n```\n\n - `button_blinky.cam` is the source code of the example program.\n - `Makefile` compiles the example to bytecode and compiles the\n   virtual machine with the specifications provided in `svm_chibios_conf.h` and `vm-conf.h`\n - The `src-chibios` directory contains files related to the configuration of ChibiOS.\n - `svm_chibios_conf.h` contains information related to peripherals on the target board. \n - `vm-conf` contains specification of virtual machine parameters. \n\nThe `svm_chibios_conf.h` contains microcontroller and board specific\nmappings of hardware (pins/peripherals) to concepts known to SenseVM. \n\n``` C\n#ifndef SVM_CHIBIOS_CONF_H_\n#define SVM_CHIBIOS_CONF_H_\n\n#define LED0_GPIO GPIOD\n#define LED0_PIN  13\n#define LED0_MODE PAL_MODE_OUTPUT_PUSHPULL | PAL_STM32_OSPEED_HIGHEST\n\n#define LED1_GPIO GPIOD\n#define LED1_PIN  12\n#define LED1_MODE PAL_MODE_OUTPUT_PUSHPULL | PAL_STM32_OSPEED_HIGHEST\n\n#define BUTTON0_GPIO GPIOA\n#define BUTTON0_PIN  0\n#define BUTTON0_MODE PAL_MODE_INPUT\n#define BUTTON0_EVENT_MODE PAL_EVENT_MODE_BOTH_EDGES\n\n#define SYS_TIMER  5 /*select tim5 for system time*/\n\n#endif \n```\n\n`vm-conf` contains configuration of the virtual machine. Below is an excerpt from this file.\n\n``` C\n#define VMC_CONTAINER_1_HEAP_SIZE_BYTES       2048\n#define VMC_CONTAINER_1_BYTECODE_FILE         \"button_blinky.svm\"\n#define VMC_CONTAINER_1_STACK_SIZE_BYTES      1024\n#define VMC_CONTAINER_1_ARRAY_MEM_SIZE_BYTES  0\n\n#define VMC_CONTAINER_1_USE_BUTTON_0          1\n#define VMC_CONTAINER_1_USE_LED_0             1\n```\n\nTo build the example run `make` in the example directory. This relies\non ChibiOS 20.3.3 being in the right location and that you have cross\ncompilation tools installed ([Get'em\nhere](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads)). It\nalso requires that you have built and \"installed\" the camiotc compiler\nusing the instructions above.\n\nThe examples are set up to run on STM32F4-Discovery (the stm32f407 model) and\nto be flashed using [OpenOCD](https://openocd.org/). To flash a Discovery board, \nconnect the programming interface USB cable and run `make flash`.\n\nAfter flashing, the program will immediately start running on the board. Currently some \ndebug information will be printed over the USB interface (the USB port on the oposite end \nto the programming interface on the discovery board).\n\n### What about Zephyr??!?!\n\nSenseVM can be built on top of ChibiOS or ZephyrOS, currently the\n\"user friendly\" examples are just set up to use ChibiOS. There is no\nreal reason for this other than it is what we had time to do first. \n\nExamples on top of ZephyrOS will appear when time allows. \n\n# About\n\nFirst commit 8 July 2020.\n\n## Papers on SenseVM\n\n[Higher-Order Concurrency for Microcontroller](https://abhiroop.github.io/pubs/sensevm_mplr.pdf) - MPLR '21\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsvenssonjoel%2FSense-VM","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsvenssonjoel%2FSense-VM","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsvenssonjoel%2FSense-VM/lists"}