Chapter 12

Languages, libraries, formats, and build tools

This chapter is a reference to the tools that turn source code into a running program and to the libraries and formats that programs in this area commonly use. It begins with the build: cross-compilation §12.1 for a processor other than the one that runs the compiler; the toolchain §12.2 of compiler, assembler and linker §12.4; compiler flags §12.3; linker scripts §12.5, which place code and data at chosen addresses; the ELF §12.6 (Executable and Linking Format) and Intel HEX §12.7 file formats; symbol tables §12.8 and debugging information §12.9; link-time optimization §12.10 and dead-code elimination §12.11; and the build tools CMake §12.12, Ninja §12.13 and Make, together with West §12.15, the command-line tool of the Zephyr real-time operating system §6.33, and the Zephyr software development kit §12.16. It continues with compilers, C libraries for small devices, a cryptography library, and the Linux Bluetooth software with the message bus through which programs talk to it.

The second half covers Python §12.23, the language of most host-side tools in this area: virtual environments §12.24; the data formats YAML (YAML Ain’t Markup Language), JSON §12.26 (JavaScript Object Notation), JSON Schema §12.27 and canonical JSON §12.28; libraries for numerical work, plotting and testing, including parallel test runs and property-based testing §10.7; libraries that disassemble machine code, read ELF files and open serial ports; and the standard modules for command-line arguments, binary layouts, file paths, child processes, file locks, terminals, waiting on several inputs at once, regular expressions §12.44, data classes and type hints §12.46. The final entries explain what lies beneath every compiled program: the native application binary interface §12.47, the encodings of Unicode §12.48 text, how an operating system loads an ELF file into a running process, and how relocation §12.50 turns a symbolic reference into exact encoded bits.

In this chapter

  1. 12.1 Cross-compilation
  2. 12.2 Toolchain
  3. 12.3 Compiler flag
  4. 12.4 Linker
  5. 12.5 Linker script
  6. 12.6 ELF
  7. 12.7 Intel HEX
  8. 12.8 Symbol table
  9. 12.9 Debug information (DWARF)
  10. 12.10 Link-time optimization (LTO)
  11. 12.11 Dead-code elimination
  12. 12.12 CMake
  13. 12.13 Ninja
  14. 12.14 Make
  15. 12.15 West
  16. 12.16 Zephyr SDK
  17. 12.17 GCC and Clang
  18. 12.18 LLVM
  19. 12.19 Newlib and Picolibc
  20. 12.20 Mbed TLS
  21. 12.21 BlueZ
  22. 12.22 D-Bus
  23. 12.23 Python
  24. 12.24 Virtual environment
  25. 12.25 PyYAML
  26. 12.26 JSON
  27. 12.27 JSON Schema
  28. 12.28 Canonical JSON
  29. 12.29 NumPy
  30. 12.30 Matplotlib
  31. 12.31 pytest
  32. 12.32 pytest-xdist
  33. 12.33 Hypothesis library
  34. 12.34 Capstone
  35. 12.35 pyelftools
  36. 12.36 pyserial
  37. 12.37 argparse
  38. 12.38 struct module
  39. 12.39 pathlib
  40. 12.40 subprocess
  41. 12.41 fcntl and advisory locking
  42. 12.42 termios and tty
  43. 12.43 select and polling
  44. 12.44 Regular expression
  45. 12.45 Dataclass
  46. 12.46 Type hint and Protocol
  47. 12.47 Native application binary interface (ABI)
  48. 12.48 Unicode code points, scalar values, code units, and byte encodings
  49. 12.49 Program loading: from an ELF file to a running native process
  50. 12.50 Relocation: turning a symbolic reference into exact encoded bits