Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Library:Zephyr

From ReverseEngineering.wiki
Library
On this wiki Facts · Code · Notes · Topics

Zephyr, the Linux Foundation's Apache-2.0 RTOS for microcontrollers: images print a 'Booting Zephyr OS build vX.Y.Z' banner, use MCUboot as the usual bootloader, and the repository's VERSION file gives the kernel version.

Identification

Zephyr's top-level VERSION file holds VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL, VERSION_TWEAK and EXTRAVERSION (4.5.0-rc2 at the pinned commit). Builds usually print a boot banner containing the string "Booting Zephyr OS build" followed by a version tag (checked in zephyr main: lib/os/Kconfig, symbol BOOT_BANNER_STRING, line 159-162, defaults to "Booting Zephyr OS build"; lib/os/boot_banner.c prints *** <that string> <version> *** through printk when CONFIG_BOOT_BANNER is set, adding " (delayed boot Nms)" when a boot delay is configured; the banner can be disabled or its string changed, so absence proves nothing). Typical strings in images: thread names like "main", "idle" and "sysworkq" (checked in zephyr main: kernel/init.c creates the main thread named "main" and the idle thread "idle", or "idle %02d" per CPU on SMP builds; kernel/system_work_q.c line 25 names the system work queue "sysworkq"), device-tree-derived names, and Kconfig-selected log module names. Zephyr applications are very often linked to start at an offset behind MCUboot: see Format:MCUboot image.

Kernel structures

struct k_thread (include/zephyr/kernel/thread.h line 258, zephyr commit a915b2f12675b48b16d56653ea145dcd8f20cbbf) starts with struct _thread_base base (wait-queue node, pended_on, user_options, prio and sched_locked bytes, thread_state; line 46) followed by the architecture's struct _callee_saved callee_saved, init_data and join_queue. Later fields exist only under Kconfig options: char name[CONFIG_THREAD_MAX_NAME_LEN] under CONFIG_THREAD_NAME (line 310), struct _thread_stack_info stack_info (start, size, delta) under CONFIG_THREAD_STACK_INFO (line 331), entry data and next_thread under CONFIG_THREAD_MONITOR. So offsets of name and stack_info depend on the build configuration.

Code & repositories

  • https://github.com/mcu-tools/mcuboot @ e19ad039b4864a2a49883c8279e4a24abbbcfe84 · license: Apache-2.0
    MCUboot bootloader; image.h defines the image header, flags and TLV types.
    Tested on: source read, not run: read · checked 2026-10-18; last activity 2026-10-16
  • https://github.com/zephyrproject-rtos/zephyr @ a915b2f12675b48b16d56653ea145dcd8f20cbbf · license: Apache-2.0
    Zephyr RTOS source (VERSION file, kernel structures).
    Tested on: source read, not run: read · checked 2026-10-18; last activity 2026-10-17

See also

Library:FreeRTOS, Platform:ARM Cortex-M