# Picolibc for Hexagon: User Guide **Document:** 80-N2040-103 This guide is for application developers who want to compile programs against picolibc using the Hexagon toolchain. It covers compilation flags, linker scripts, runtime environments, and worked examples. ## Documents | Document | What it covers | | --- | --- | | [Getting Started](https://docs.qualcomm.com/doc/80-N3040-23/topic/getting-started.html) | Minimal compile + run from zero — prerequisites, hello world, toolchain verification | | [H2 + Picolibc](https://docs.qualcomm.com/doc/80-N3040-23/topic/picolibc-h2.html) | Compiling for the H2 hypervisor target, heap/stack config, TLS, memory layout | | [Bare-Metal + Picolibc](https://docs.qualcomm.com/doc/80-N3040-23/topic/picolibc-baremetal.html) | Compiling for bare-metal Hexagon targets (no OS, QEMU semihosting) | | [Semihosting](https://docs.qualcomm.com/doc/80-N3040-23/topic/semihosting.html) | TRAP0 interface, syscall opcodes, file I/O, QEMU integration | ## Which guide do I need? Are you running under H2 hypervisor? Yes → picolibc-h2.md No → Is there a host debugger/QEMU to talk to? Yes → picolibc-baremetal.md (semihosting section) No → picolibc-baremetal.md (no-semihosting / stub I/O section) Copy to clipboard ## Key flags at a glance All picolibc compilations share two mandatory flags: --target=hexagon-unknown--elf # selects the target ABI and sysroot --cstdlib=picolibc # selects picolibc instead of the default libc Copy to clipboard The `` field distinguishes the runtime environment: | `` value | Runtime | Use when | | --- | --- | --- | | `h2` | H2 hypervisor | Running on H2 (simulator or hardware with H2) | | `none` | bare-metal | No OS; semihosting via QEMU or stub I/O | Last Published: Oct 06, 2026 [Previous Topic Picolibc User Guide](https://docs.qualcomm.com/bundle/publicresource/80-N3040-23/topics/index_80-n2040-103_picolibc_user_guide.md) [Next Topic Getting Started with Picolibc on Hexagon](https://docs.qualcomm.com/bundle/publicresource/80-N3040-23/topics/getting-started.md)