{"id":18729056,"url":"https://github.com/lichtso/riscv-llvm-templates","last_synced_at":"2025-04-12T16:33:30.421Z","repository":{"id":151645399,"uuid":"158721224","full_name":"Lichtso/riscv-llvm-templates","owner":"Lichtso","description":"Code templates to get started experimenting with the RISC-V LLVM toolchain","archived":false,"fork":false,"pushed_at":"2018-11-25T08:39:47.000Z","size":5,"stargazers_count":13,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-26T11:21:14.544Z","etag":null,"topics":["code-templates","llvm","risc-v","riscv"],"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/Lichtso.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-22T15:49:28.000Z","updated_at":"2024-09-02T13:16:44.000Z","dependencies_parsed_at":"2023-07-20T21:04:18.287Z","dependency_job_id":null,"html_url":"https://github.com/Lichtso/riscv-llvm-templates","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/Lichtso%2Friscv-llvm-templates","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lichtso%2Friscv-llvm-templates/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lichtso%2Friscv-llvm-templates/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lichtso%2Friscv-llvm-templates/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lichtso","download_url":"https://codeload.github.com/Lichtso/riscv-llvm-templates/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248596732,"owners_count":21130754,"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":["code-templates","llvm","risc-v","riscv"],"created_at":"2024-11-07T14:25:31.828Z","updated_at":"2025-04-12T16:33:30.415Z","avatar_url":"https://github.com/Lichtso.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RISC-V LLVM Templates\nThis repo is similar to [riscv-probe](https://github.com/michaeljclark/riscv-probe) but utilizes the LLVM toolchain instead of the GNU toolchain.\n\n## Contains\n- Makefile\n    - LLVM invocations\n- Linker Script\n    - Virtual memory map\n    - Layout of the executable\n- Assembly\n    - Setting the stack pointer\n    - Calling main()\n    - Calling exit()\n- C\n    - Minimal host / target interface\n    - Classical \"Hello World!\"\n\n## Usage\nSet the LLVM and RISCV environment variables if you haven't installed the prerequisites at their defaults.\n- `make` to build all targets\n- `make clean` to delete all targets\n- To show the targets disassembly, sections, symbols, etc:\n    - `make dump.spike`\n    - `make dump.rv8`\n- To run it:\n    - `make run.spike`\n    - `make run.qemu`\n    - `make run.rv8`\n\n## Prerequisites\nYou will need this repo, the llvm toolchain compiled with the experimental RISC-V target and at least one of the three simulators / emulators listed below.\n\n### LLVM\n```\ngit clone https://git.llvm.org/git/llvm.git\ncd llvm/tools\ngit clone https://git.llvm.org/git/clang.git\ngit clone https://git.llvm.org/git/lld.git\ncd ../..\nmv llvm llvmSrc\nmkdir llvm\ncd llvm\ncmake -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=\"RISCV\" -DLLVM_LINK_LLVM_DYLIB=ON ../llvmSrc/\nmake -j8 clang llc lld llvm-objdump llvm-readobj\n```\n\n### Simulators / Emulators\n- Spike\n    - [device tree compiler](https://github.com/dgibson/dtc)\n    - [frontend server](https://github.com/riscv/riscv-fesvr)\n    - [isa simulator](https://github.com/riscv/riscv-isa-sim)\n- [qemu](https://github.com/riscv/riscv-qemu.git)\n- [rv8](https://github.com/rv8-io/rv8)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flichtso%2Friscv-llvm-templates","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flichtso%2Friscv-llvm-templates","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flichtso%2Friscv-llvm-templates/lists"}