Skip to content

refactor(platform): separate SoC integration and shared IP drivers - #36

Merged
VectorQiu merged 2 commits into
mainfrom
refactor/soc-ip-layout
Oct 26, 2026
Merged

VectorQiu merged 2 commits into
mainfrom
refactor/soc-ip-layout

Conversation

@VectorQiu

@VectorQiu VectorQiu commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Hardware configuration policy and reusable peripheral implementations were distributed across generic tools and SoC folders. This change places exact chip policy in soc/<vendor>/<family>/configure/ and reviewed shared implementations in drivers/<class>/<reviewed-ip>/. Cortex-M mechanisms remain in arch/arm/cortex_m; CMake remains the source graph, and TOML still resolves through the typed IR into a static factory.

All seven MCU Flash geometries now derive from canonical SoC facts. The typed controller integration record references existing resource, IRQ, DMA, clock and pin records; selected F407 SPI and secondary-controller consumers use those records. SoC hooks own family policy. Selected G474/H743/U575 I2C V2 and F103/GD303 UART DMA implementations separate readonly configuration from mutable state while preserving borrowing, retained failure, shared operations and direct IRQ dispatch. SDK closure, diagnostics, bilingual guidance and architecture diagrams follow these boundaries.

Evidence is bound to clean platform commit 92e669233957a2e450a528394e8f4dd0794c7049, tree 6e38d4c43d59330a0a9a9b7cac21f591d9c2719f:

  • Ordinary complete-index hooks passed: 3,247 tool tests and 352 GoogleTest programs / 6,396 cases, with no skips. Strict English/Chinese documentation builds also passed.
  • The maintained 159-stage software plan has two explicit execution segments. A completed its first 90 stages, including all four complete Native modes, before the execution environment restarted during tidy. A retains its original running report and incomplete tidy evidence. Source, dependencies and recorded tool identities were checked after restart.
  • B completed all unchanged remaining 69 stages in a fresh output directory, with executed_passed, clean equal source before/after and complete 865-context runs for both tidy and cppcheck. The exact original 159 stages are covered by A90 + B69. Its final report SHA-256 is f8ecf185eadbef7e33d7a667366da7de34241ce243a5d417b5b453ae3bb99694. The segments are not represented as one uninterrupted passing run; no successful test report substitutes for a new execution.
  • R45 passed on the same-P relocated source SDK: 50 independent consumers, 202 recorded commands and 37 selected images. Consumer source/include boundaries and artifact identities were checked.
  • R42 passed on clean external examples commit 0f15022e4d5f5c51991b134d0b9d6082dcf88de9: complete local_ci --scope all, 98 commands, 80 tool tests, 15 Native CTest entries / 69 Google cases, 16 ARM presets, and the installed-SDK Native consumer. These counts overlap ordinary hook coverage and are not added together. The pin update is nexus-examples#15.
  • R48's declared offline reproduction completed two independent clean, network-disabled builds with identical ELF/BIN bytes. This is the recorded configuration's reproduction evidence; the completed candidate seal and verification bind these exact reproduced bytes.
  • R46 passed all 11 clean-P strict comparisons with independent review. I2C actual RAM decreased 16–24 B and UART RAM decreased 48 B per selected configuration. Actual total Flash deltas were -4/+40/+64 B for the three I2C configurations and +168 to +392 B for eight UART configurations. Code, readonly configuration and path/alignment contributions are recorded separately; path shortening is not credited as an architectural gain. Duplex DMA IRQ local software frames increased 16→24 B; static MSP reservation is unchanged, and this is separate from static RAM. Development measurements do not establish cycle timing, WCET or a general performance improvement.
  • R48 completed candidate sealing and verification with all six required scopes: host contracts, ARM linking, resource budget, source SDK, reproducibility and HIL tooling. The portable candidate contains 6,401 files, archive size 433,850,915 bytes, SHA-256 7f89e8ec33a543e150e7165a3e4252aa11a96d62fe5d3187a9b0d4791aa618b4. It is a software-qualified candidate; physical status remains not_executed.

At the recorded GitHub observation, all 36 platform check runs were successful. Fourteen CodeQL comment threads remain unresolved. Their existing read-only review found no confirmed production dangling binding or dead UART initialization, and retained nonblocking cleanup findings; this is not a claim that every alert is a false positive or that the source has zero alerts.

Physical HIL remains not_executed. Native models and ARM linking/resource checks do not establish board wiring, timing, electrical behavior or power-loss safety.

Recoverable delivery artifacts are retained in the shared workspace: nexus-examples/build/platform-candidate-92e669233957/completion-2/candidate-portable.json identifies the portable candidate; the R42/R45 compact archive is sdk-examples-validation-evidence.tar.gz (SHA-256 2d8ef5bf109ddb5c1d079c9c6b9b0ca0de9768649c065e63192bc7bd72f09510). Exact per-configuration costs are in nexus/build/quality/soc-ip-final-p-92e669233957/final-cost-summary.json. These paths describe local retained artifacts, not GitHub-hosted release assets.

Move maintained SoC adapters beside hardware facts and shared register
engines into private drivers. Preserve static factories, selected CMake
compilation contexts and all existing configuration test identities.

Close migrated input, SDK-private-header, static-analysis and target-local
lifecycle evidence boundaries with executed RED/GREEN regressions.
Document the layout in both languages and retain the R01-R48 task ledger.

Validation: 136 baseline assemblies have no effective configuration change;
17 focused CTest programs / 267 Google cases pass; full commit gates run
on this staged tree. Physical HIL remains not executed.
import preflight
import gpio_phase
from tools.configure.providers.common import mode_traits
from tools.configure import can, usb_device, ethernet, timer_advanced, secondary_controllers, preflight, gpio_phase
Comment thread tools/configure/cpu.py
sys.path.insert(0, str(Path(__file__).resolve().parents[2]))

from tools.configure import kernel, metadata, factory, sdk
from tools.configure.ir import CpuProfileIR, freeze, thaw
except ImportError:
from providers.common import fail
from memory import dma_regions
from tools.configure.providers.common import fail
from providers.common import fail
from memory import dma_regions
from tools.configure.providers.common import fail
from tools.configure.memory import dma_regions
Comment on lines +32 to +33
self.assertTrue({"vendor", "source_directory",
"configuration_directory"} <= fields)
from providers import common, maintained
from tools.configure import configure as gate
from tools.configure import selection
from tools.configure.providers import common, maintained
Resolve exact part geometry and selected controller integration from canonical
facts and typed resource plans. Colocate reviewed hardware policies with each
SoC and keep common generators responsible for shared assembly mechanisms.

Separate immutable I2C and UART configuration from BSS runtime state, and move
selected cold initialization into concrete SoC functions with retained-failure
recovery. Preserve public typed factory interfaces and direct IRQ dispatch.

Cover fact admission, input closure, aliases, retained state, standalone Flash
geometry, SDK payloads and Runtime boundaries with regression contracts. Update
bilingual architecture and porting documentation with measured RAM/Flash costs.
def selected_preflight(result, *, dma_conditions=None):
"""Cold GPIO/byte-UART profiles keep family-specific banks and SDK hooks."""
hook = 'U575'
gate_register = 'APB2ENR'
"""Cold GPIO/byte-UART profiles keep family-specific banks and SDK hooks."""
hook = 'U575'
gate_register = 'APB2ENR'
uart = 'USART1'
gate_register = 'APB2ENR'
uart = 'USART1'
mux_register = 'CCIPR1'
mux = 'RCC_CCIPR1_USART1SEL'
if region["id"] == "sram")
memory["size"] = 65536
source = bindings.emit(result)[1]
self.assertTrue("{ 0x20000000u, 65536u," in source)
@VectorQiu VectorQiu changed the title refactor: colocate SoC configuration and shared IP drivers refactor(platform): separate SoC integration and shared IP drivers Oct 26, 2026
overlap(config, sizeof(*config), (const void*)config->reset,
sizeof(*config->reset)))
return NX_ERROR_INVALID;
p->config = config;
state->uart.receive = &state->receive;
state->uart.rx_capacity = 0U;
config.profile = NX_UART_RX_BLOCKS;
config.receive = &state->receive;
DuplexState state = {}, other = {};
ConfigureDuplex(&state);
state.uart.receive = &other.receive;
config.receive = &other.receive;
return config == NULL || config->profile != NX_UART_RX_BLOCKS ||
(config->receive->stream == NULL && !config->receive->filling);
}
static nx_result_t initialize(nx_uart_v1_dma_state_t* s,
@VectorQiu
VectorQiu marked this pull request as ready for review October 26, 2026 23:34
@VectorQiu
VectorQiu merged commit c79fd96 into main Oct 26, 2026
36 checks passed
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