Repository navigation
Board detect: merge detection sources into fewer files - #381
Merged
Merged
Conversation
Merge the hand-written board detection sources into one detection file and one construction file per chip, plus a few shared files. Code is moved, not rewritten: function bodies, constants and conditional blocks are unchanged. Per chip: - ESP32: esp32_pico, atom_touch_pins and atom_touch fold into esp32_d0wdq6.inl; esp32_pico_construct into esp32_d0wdq6_construct.inl. - ESP32-S3: esp32s3/families and board_entries fold into esp32s3.inl; families_construct and cores3_construct into esp32s3_construct.inl. cores3.inl stays separate as esp32s3_cores3.inl. - ESP32-C5 / C6 / C61 / P4: the files under m5/esp32<chip>/ fold into esp32<chip>.inl and esp32<chip>_construct.inl. The per-chip subdirectories are removed. Each fragment is placed at the position where it was previously included. Shared files: - display_parts.inl moves into board_registry.inl. - member_selection.inl, prepare_steps.inl and spi_detector.inl fold into prepare.inl. - detect_class.hpp, dedicated_release_probe.hpp and i2c_bus_probe.hpp are combined as probe_types.hpp; detect_session.hpp moves into detect_types.hpp. Definition order changes (no behavioral change; none of the moved code adds overloads or depends on later declarations): - select_provisional_member now follows the transaction, runner and hardware probe definitions. Only later chip includes use it. - The former detect_class and i2c_bus_probe definitions now appear near the top of board_detect.hpp, before the dedicated-release, ops and detect type definitions. - The detect session functions now appear inside board_detect.hpp instead of after board_detect.inl. - display_parts_t is fully defined in board_registry.inl, so that file declares the lgfx IBus / Panel_Device / ILight / ITouch types it refers to. Kept separate on purpose: probe_hardware.inl (host tests replace it), transaction.inl and detector_runner.inl (the catalog tests load the runner on its own), detect_io / detect_io_default, ops, the package / integration pair, setup_sentinels.hpp, pmic_ops.hpp, construct_common.inl, and the C3 / H2 construction files. Add pragma once to the C6 and H2 construction includes. Update include paths in the host tests, the catalog source paths and the editor bundle. The P4 host test now compiles the whole construction include with minimal device type stubs instead of an abort-only CoreP4X stand-in; scenarios and assertions are unchanged.
Combine the generated <chip>_wiring.hpp and <chip>_specs.hpp into <chip>_board_data.hpp, keeping the declaration order of the previous pair (specs before wiring on ESP32, wiring before specs elsewhere). The detector-order headers stay separate. The generator reuses the wiring and specification renderers under one preamble. targets.json keeps the wiring_output and specs_output groups; the CLI writes them under the board-data name. "spec.js check" now rejects leftover wiring / specs headers. The two-translation-unit host check supplies the SPI host constants used by the included construction specifications. Generated headers under src/board_detect/m5/generated/ go from 25 to 19.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Board detection has not been released yet. Its sources were split into many small files (87 under
src/board_detect/, with a subdirectory per chip), which made one chip's detection hard to read in one place. This PR merges them back into fewer files: one detection file and one construction file per chip, plus a few shared files. 87 files become 54 and the per-chip subdirectories are removed.Code is moved, not rewritten. Function bodies, constants and conditional blocks are unchanged; only includes,
#pragma onceand a few forward declarations change. Detection results and startup behavior do not change.Hand-written sources (62 -> 35 files)
esp32_pico,atom_touch_pinsandatom_touchfold intoesp32_d0wdq6.inlfamiliesandboard_entriesfold intoesp32s3.inl; CoreS3 stays separate asesp32s3_cores3.inlm5/esp32<chip>/fold intoesp32<chip>.inlandesp32<chip>_construct.inldisplay_parts->board_registry.inl;member_selection,prepare_steps,spi_detector->prepare.inl;detect_class,dedicated_release_probe,i2c_bus_probe->probe_types.hpp;detect_session->detect_types.hppEach fragment is placed where it was previously included. Four definitions move earlier or later in the translation unit (listed in the first commit message); none of them changes overload resolution or depends on later declarations.
Kept separate on purpose:
probe_hardware.inl(host tests replace it),transaction.inl/detector_runner.inl(catalog tests load the runner alone),detect_io,ops, the package / integration pair,construct_common.inl, and the C3 / H2 construction files.Generated headers (25 -> 19 files)
<chip>_wiring.hppand<chip>_specs.hppare generated as one<chip>_board_data.hpp, keeping the previous declaration order. The detector-order headers stay separate.node cli/spec.js checkrejects leftover wiring / specs headers.Testing
develop, startup time unchangedtest/board_detect/run.sh(33 programs),extras/board_specnpm test(210 tests) andnpm run checkpass on each commit