Skip to content

Add CI/CD pipeline and fix semihosting exit#2

Merged
jserv merged 1 commit into
mainfrom
cicd
Mar 23, 2026
Merged

Add CI/CD pipeline and fix semihosting exit#2
jserv merged 1 commit into
mainfrom
cicd

Conversation

@jserv
Copy link
Copy Markdown
Contributor

@jserv jserv commented Mar 23, 2026

Build system:

  • Split check target into Arm Cortex-M (clean-build + baked flags) and POSIX (env var override at runtime) variants with shared test loop
  • Add stale-clone guards before git clone in RTOS and Kconfig recipes
  • Handle root-owned build artifacts in clean-build and distclean via sudo fallback when unprivileged rm fails
  • Bump Cortex-M CHECK_TIMEOUT from 30 to 120 for slow CI runners
  • Make defconfigs fully explicit with all config options listed

Semihosting exit:

  • Add tm_semihosting_exit() in tm_putchar.c: direct ARM SYS_EXIT (0x18) via bkpt, bypassing newlib _exit() which pulls in __sinit and file I/O that depend on initialise_monitor_handles (omitted by -nostartfiles)
  • Replace _exit() calls with tm_semihosting_exit() in tm_report.c
  • Guard <unistd.h> include behind #ifndef TM_SEMIHOSTING

QEMU runner (scripts/qemu-run.sh):

  • Replace timeout(1)/gtimeout with shell-managed watchdog to avoid false timeout reports from wrappers that mis-handle semihosting exit
  • Redirect watchdog subshell stdout/stderr to /dev/null so $() capture in the Makefile check loop does not block for the full sleep duration
  • Add cleanup trap (EXIT/INT/TERM) with proper signal handler split to prevent double-invocation and orphaned child processes
  • Use mktemp sentinel file for timeout detection instead of signal codes, avoiding PID-reuse and external-kill misclassification

CI (.github/workflows/main.yml):

  • coding-style: clang-format-20 for C, shfmt for shell scripts, trailing-newline check; PR-mode diffs only changed files
  • posix-tests: 2x2 matrix (ThreadX/FreeRTOS x Ubuntu/macOS)
  • cortex-m-tests: ThreadX and FreeRTOS under QEMU mps2-an385
  • sanitizers: ASan+UBSan on POSIX builds (runs after posix-tests)

Build system:
- Split check target into Arm Cortex-M (clean-build + baked flags) and
  POSIX (env var override at runtime) variants with shared test loop
- Add stale-clone guards before git clone in RTOS and Kconfig recipes
- Handle root-owned build artifacts in clean-build and distclean via
  sudo fallback when unprivileged rm fails
- Bump Cortex-M CHECK_TIMEOUT from 30 to 120 for slow CI runners
- Make defconfigs fully explicit with all config options listed

Semihosting exit:
- Add tm_semihosting_exit() in tm_putchar.c: direct ARM SYS_EXIT
  (0x18) via bkpt, bypassing newlib _exit() which pulls in __sinit
  and file I/O that depend on initialise_monitor_handles (omitted
  by -nostartfiles)
- Replace _exit() calls with tm_semihosting_exit() in tm_report.c
- Guard <unistd.h> include behind #ifndef TM_SEMIHOSTING

QEMU runner (scripts/qemu-run.sh):
- Replace timeout(1)/gtimeout with shell-managed watchdog to avoid false
  timeout reports from wrappers that mis-handle semihosting exit
- Redirect watchdog subshell stdout/stderr to /dev/null so $() capture
  in the Makefile check loop does not block for the full sleep duration
- Add cleanup trap (EXIT/INT/TERM) with proper signal handler split to
  prevent double-invocation and orphaned child processes
- Use mktemp sentinel file for timeout detection instead of signal
  codes, avoiding PID-reuse and external-kill misclassification

CI (.github/workflows/main.yml):
- coding-style: clang-format-20 for C, shfmt for shell scripts,
  trailing-newline check; PR-mode diffs only changed files
- posix-tests: 2x2 matrix (ThreadX/FreeRTOS x Ubuntu/macOS)
- cortex-m-tests: ThreadX and FreeRTOS under QEMU mps2-an385
- sanitizers: ASan+UBSan on POSIX builds (runs after posix-tests)
@jserv jserv merged commit 9434c1d into main Mar 23, 2026
11 checks passed
@jserv jserv deleted the cicd branch March 23, 2026 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant