{"id":13472641,"url":"https://github.com/sunfishcode/hello-embedded","last_synced_at":"2025-04-15T22:30:57.161Z","repository":{"id":222920007,"uuid":"758739220","full_name":"sunfishcode/hello-embedded","owner":"sunfishcode","description":"Hello Embedded!","archived":false,"fork":false,"pushed_at":"2024-02-29T21:50:50.000Z","size":79,"stargazers_count":23,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-13T10:55:00.235Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/sunfishcode.png","metadata":{"files":{"readme":"README.md","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":"2024-02-17T00:40:05.000Z","updated_at":"2024-12-01T05:10:01.000Z","dependencies_parsed_at":"2024-10-20T11:17:45.881Z","dependency_job_id":null,"html_url":"https://github.com/sunfishcode/hello-embedded","commit_stats":{"total_commits":17,"total_committers":1,"mean_commits":17.0,"dds":0.0,"last_synced_commit":"d6ccd9c5bf1fe487c019c6e80ce19da6e0800742"},"previous_names":["sunfishcode/hello-embedded"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunfishcode%2Fhello-embedded","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunfishcode%2Fhello-embedded/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunfishcode%2Fhello-embedded/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunfishcode%2Fhello-embedded/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sunfishcode","download_url":"https://codeload.github.com/sunfishcode/hello-embedded/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249165904,"owners_count":21223345,"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":[],"created_at":"2024-07-31T16:00:56.577Z","updated_at":"2025-04-15T22:30:56.771Z","avatar_url":"https://github.com/sunfishcode.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# Hello Embedded! 👋\n\nThis repository contains a sketch of an embedded API described in [Wit],\nand a simple example Wasm application that builds with it that blinks\nan LED, and a Wasmtime-based simulator that can run it. This is a super\nearly demo, and hasn't been optimized at all for code size yet. Its\npurpose right now is to start some discussions.\n\n[Wit]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/WIT.md\n\n## The Wits\n\nThe API is described in Wit interfaces in the wit directory, and is based off\nof the [embedded-hal] API.\n\n## The guest\n\nThe example application is in the guest directory. Building it currently\nrequires [cargo component 0.8]. Build with `cargo component build`.\n\n[cargo component 0.8]: https://github.com/bytecodealliance/cargo-component/releases/tag/v0.8.0\n\n```sh\n$ cd guest\n$ cargo component build --release\n[...]\n$ cd ..\n```\n\nThat produces a component in `guest/target/wasm32-wasi/release/hello_embedded.wasm`.\nWe can examine it with `wasm-tools`:\n\n```sh\n$ wasm-tools component wit guest/target/wasm32-wasi/release/hello_embedded.wasm\npackage root:component;\n\nworld root {\n  import sketch:embedded/delay@0.0.0;\n  import sketch:embedded/digital@0.0.0;\n\n  export sketch:embedded/run@0.0.0;\n}\n```\n\nHere we can see it's exporting the `run` interface, which has the `run`\nentrypoint function, and importing the `digital` and `delay` and interfaces,\nwhich it uses to set the led and control its speed, respectively.\n\n## The host simulator\n\nOnce the guest is built, it can be run in the host simulator:\n```sh\n$ cd host\n$ cargo run\n[...]\n```\n\n```\n   💡\n```\n```\n    \n```\n```\n   💡\n```\n```\n    \n```\n```\n   💡\n```\n...\n\n## The Linux host\n\n⚠ The following is *entirely untested* at this time!!! ⚠\n\nIf you can run this on a Linux board with a GPIO pin 0 wired up to\nan LED, and if luck smiles on us, this should run the guest which\nshould make that LED blink:\n\n```sh\n$ cd linux-host\n$ cargo run\n[...]\n```\n\n## Bonus points\n\nThis example also demonstrates [Typed Main]. The `run` function takes\ntwo handle arguments, providing the component with exactly what it\nneeds.\n\n[Typed Main]: https://sunfishcode.github.io/typed-main-wasi-presentation/chapter_1.html\n\n[embedded-hal]: https://docs.rs/embedded-hal/latest/embedded_hal/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunfishcode%2Fhello-embedded","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsunfishcode%2Fhello-embedded","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunfishcode%2Fhello-embedded/lists"}