Prerequisites
Start with Set Up Thru DevKit, then install the C SDK surfaces with:~/.thru/sdk/c and the toolchain under ~/.thru/sdk/toolchain.
Verify the installed layout
riscv64-unknown-elf- or riscv64-none-elf-, so either compiler prefix is valid.
Main build entrypoint
The installed downstream build hook isthru_c_program.mk.
Its job is to:
- require
THRU_C_SDK_DIR - add SDK include paths through
CPPFLAGS - add SDK library paths through
LDFLAGS - include machine and config files for the Thru VM toolchain
Minimal GNUmakefile
Minimal Local.mk
What THRU_C_SDK_DIR should point to
Point it at the installed SDK root that contains:
thru_c_program.mkinclude/lib/config/
Project layout that works well
Build-system guidance
| Need | Recommendation |
|---|---|
| One or two small programs | Keep a single GNUmakefile plus per-directory Local.mk files. |
| Multiple example binaries | Add more make-bin calls in Local.mk. |
| SDK extras | Use SDK_EXTRAS when you intentionally want extra configuration layers. |
Expected build output
For the standard downstream project layout used in the C guide, the built binary lands under:Notes
- The docs page is the right place to learn the installed entrypoint. The repo-local
sdks/c/setup.shis not the end-user install path you should default to. - If a task is “build a downstream program,” start with
thru_c_program.mk, not the SDK’s internalGNUmakefile.