Skip to content

fix(build): allow kalimba board to configure, drop dead duplicate dispatch - #48

Open
HoneyTyagii wants to merge 1 commit into
embeddedos-org:masterfrom
HoneyTyagii:fix/kalimba-board-dispatch
Open

fix(build): allow kalimba board to configure, drop dead duplicate dispatch#48
HoneyTyagii wants to merge 1 commit into
embeddedos-org:masterfrom
HoneyTyagii:fix/kalimba-board-dispatch

Conversation

@HoneyTyagii

Copy link
Copy Markdown

Summary

Selecting -DEBLDR_BOARD=kalimba always failed at configure time with Unknown board: kalimba, even though boards/kalimba/ exists and the branch had already registered the port. The cause was a stray message(FATAL_ERROR ...) sitting inside the kalimba branch of the board dispatch in CMakeLists.txt. The same region also contained a full second copy of the board dispatch (cortex_m3 through kalimba) that was unreachable dead code.

This PR fixes the dispatch and adds a configure-only regression check.

Type of Change

  • feat: New feature
  • fix: Bug fix
  • docs: Documentation only
  • style: Formatting, no code change
  • refactor: Code restructuring without behavior change
  • test: Add or fix tests
  • build: Build system or dependency changes
  • ci: CI/CD pipeline changes
  • perf: Performance improvement

Changes

  • CMakeLists.txt: remove the misplaced message(FATAL_ERROR "Unknown board: ...") from inside the kalimba branch, and delete the duplicate, unreachable dispatch block that followed it. The result is a single dispatch chain in which each of the 83 board ports is matched exactly once, terminated by the intended else() fallback that rejects unknown board names.
  • scripts/check_board_config.sh: new configure-only regression check. It asserts that every board directory under boards/ configures successfully with -DEBLDR_BOARD=<name>, and that an unknown board name is still rejected with a fatal error. No cross toolchains are required (configure only, no compilation).

Testing

  • Unit tests pass (ctest --test-dir build --output-on-failure)
  • Integration tests pass
  • Manual testing performed
  • New tests added for new functionality

Verification performed (CMake 4.4.2, GCC 16.2.1, Linux x86_64 host build):

  • Before the fix: cmake -DEBLDR_BOARD=kalimba aborts with CMake Error ... Unknown board: kalimba.
  • After the fix: cmake -DEBLDR_BOARD=kalimba configures cleanly, and cmake --build <dir> --target board_kalimba compiles the port.
  • All 83 boards under boards/ configure successfully (checked one by one).
  • An unknown board (-DEBLDR_BOARD=does_not_exist) is still rejected with the fatal Unknown board error.
  • scripts/check_board_config.sh reports RESULT: FAIL on unmodified master (it catches the kalimba regression) and RESULT: PASS with this PR applied.
  • Native host build with -DEBLDR_BUILD_TESTS=ON and ctest give the same result as master: all tests pass except the pre-existing test_recovery link failure (undefined eos_boot_log_* symbols), which exists on master independently of this change and is addressed by separate open PRs.

Pre-Submission Checklist

  • Code compiles without warnings (-Wall -Wextra -Werror for C)
  • All existing tests pass
  • New tests added for new functionality
  • Documentation updated if API changed
  • Commit messages follow the type(scope): description convention
  • Branch is rebased on latest master

Related Issues

N/A. No open issue tracks this; found while exploring the codebase.

Screenshots / Logs

Reproduction on master:

$ cmake -B build -DEBLDR_BOARD=kalimba
--   Board port: kalimba
CMake Error at CMakeLists.txt:320 (message):
  Unknown board: kalimba.  See boards/ directory for available ports.
-- Configuring incomplete, errors occurred!

After the fix:

$ cmake -B build -DEBLDR_BOARD=kalimba
-- Configuring done
-- Generating done
$ scripts/check_board_config.sh
  ...
  kalimba              OK
  ...
  unknown board        OK (rejected as expected)
RESULT: PASS

Additional Notes

  • No board behavior or public API changes; this only repairs the configure-time dispatch and removes dead code.
  • The removed duplicate block was a strict subset of the first dispatch chain (verified: every branch it contained already appears earlier), so deleting it changes no reachable behavior.
  • scripts/check_board_config.sh is ready to be wired into CI (for example the lint/host job in .github/workflows/build.yml) if maintainers want it to run automatically; I left that out to keep this change minimal.

…patch

The board dispatch chain contained a stray message(FATAL_ERROR) inside the
kalimba branch, so selecting -DEBLDR_BOARD=kalimba always aborted configure
with 'Unknown board: kalimba' even though the port exists and had just been
registered. The same block also carried a full second copy of the board
dispatch (cortex_m3 .. kalimba) that was unreachable dead code, since every
name in it already matched an earlier branch.

Remove the misplaced FATAL_ERROR and the duplicate branch block, leaving a
single dispatch chain where each of the 83 board ports is matched exactly
once, followed by the intended else() fallback for unknown boards.

Add scripts/check_board_config.sh, a configure-only regression check that
asserts every board under boards/ configures and that an unknown board name
is still rejected.
Copilot AI lite review requested due to automatic review settings August 26, 2026 17:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

2 participants