The ChibiOS I2Cv4 LLD (used on STM32G0/G4/C0/U0/U3/H5/L4+) uses a
single DMA channel per I2C peripheral, shared between TX and RX,
configured via STM32_I2C_I2Cx_DMA_CHANNEL. The previous code
emitted the separate STM32_I2C_I2Cx_RX/TX_DMA_STREAM defines used
by I2Cv2/I2Cv3, which no longer satisfy the I2Cv4 driver.
Detect I2Cv4 MCUs from CHIBIOS_PLATFORM_MK, allocate a single DMA
channel per I2C peripheral in dma_resolver.py (no _RX/_TX split),
and generate HAL_I2Cn_CONFIG entries that feed the single channel
into the shared DMA slot with SHARED_DMA_NONE as the partner.
Also replace the unconditional STM32_I2C_USE_I2Cn TRUE lines in
stm32g4_mcuconf.h with #ifndef-guarded defaults to FALSE, so
boards only enable the I2C peripherals their hwdef actually uses.
Without this, the I2Cv4 driver demanded DMA channels for every
I2C peripheral on every G4 board regardless of pin usage.
The ROMFS / ROMFS_WILDCARD / ROMFS_DIRECTORY hwdef keywords were
previously only understood by the ChibiOS hwdef parser, which has
duplicated implementations of romfs_add / romfs_wildcard / romfs_add_dir
and a write_ROMFS step that publishes env_vars['ROMFS_FILES']. Lift
all of that into the base HWDef class so any HAL with a hwdef parser
(SITL, future HALs) gets ROMFS handling for free.
- Base hwdef.py owns self.romfs, the romfs_*() methods, the
ROMFS / ROMFS_WILDCARD / ROMFS_DIRECTORY process_line cases,
the undef ROMFS handler, and write_ROMFS(); base run() calls
write_ROMFS() at the end so subclasses that don't override run()
publish ROMFS automatically.
- ChibiOS keeps a thin romfs_add_dir() override solely for its
bootloader-build no-op guard; everything else is inherited.
No behaviour change for ChibiOS boards.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
e.g.:
./Tools/autotest/vehicle_test_suite.py:8607:89: B006 Do not use mutable data structures for argument defaults. They are created during function definition time. All calls to the function reuse this one instance of that data structure, persisting changes between them.
Don't get its path unless we are about to generate it to avoid an
inaccurate list of generated files. Do this by keeping track of the path
in a variable instead of checking for the result on the filesystem.
This is somewhat strange and mixed in with the romfs file and
AP_Param.cpp, to disentangle later...
This will allow waf to avoid cleaning them and avoid unnecessary
regenerations.
Some slight changes to centralize the use of the output directory are
also performed.
Read from the passed in variable instead of the global args object. By
default the variable is set to the args object's contents so there is no
change in behavior.
Note that much of this logic is fishy and/or wrong; that is preserved
and left to be fixed another day.
keeps these out of the main codebase which is nice, but also means we can catch these at configure-time rather than build time, which means CI will catch them