mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-25 16:51:16 +08:00
refactor(platforms/nuttx): remove dead PX4_I2C_BUS_MTD board define (#28167)
* refactor(platforms/nuttx): remove dead PX4_I2C_BUS_MTD board define
The macro's value has been unused since the MTD manifest refactor
(68ab736b1 "Refactor mtd to make available to board startup"), which made
the board manifest the source of truth for the EEPROM bus and address:
at24xxx_attach() derives the bus from PX4_I2C_DEVID_BUS(instance.devid).
All that survived was a presence check that silently degraded a former
compile-time #error into a runtime failure.
Because the value stopped mattering, it drifted freely. Eleven boards
carry "4,5", which is not even a usable bus number, and several boards
disagree with their own manifest (fmu-v5x declares 4,5 against actual
buses 3 and 4; fmu-v6xrt declares 1 against 3 and 6; 7-nano declares 1
against 4). crazyflie21 defines it with no MTD manifest at all.
Guard at24xxx_attach() on CONFIG_I2C instead, which is the condition the
code actually depends on and matches how the neighbouring ramtron_attach()
guards on CONFIG_MTD_RAMTRON.
Assisted-by: Claude:claude-opus-5[1m]
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
* fix(platforms/nuttx): guard at24xxx_attach on CONFIG_MTD
CONFIG_I2C is too broad: nearly every board enables I2C, including those
without MTD. Compiling the real at24xxx_attach body kept the mtd_partition
/ register_mtddriver / ftl_initialize path live, so boards without
CONFIG_MTD failed to link.
CONFIG_MTD is the NuttX flag that actually enables that infrastructure
(and is set on every board with an I2C EEPROM manifest). CONFIG_MTD_AT24XX
is not suitable: only crazyflie sets it; FMU boards use px4_24xxxx_mtd.c
and deliberately omit the NuttX AT24 driver.
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
---------
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
This commit is contained in:
1 parent
ae5ebc8a80
commit
1c5db5ff65
21 files changed
+2
-55
No files matched your search
@@ -469,9 +469,6 @@
|
||||
|
||||
#define BOARD_ENABLE_CONSOLE_BUFFER
|
||||
|
||||
#define PX4_I2C_BUS_MTD 4,5
|
||||
|
||||
|
||||
#define BOARD_NUM_IO_TIMERS 5
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
@@ -451,9 +451,6 @@
|
||||
|
||||
#define BOARD_ENABLE_CONSOLE_BUFFER
|
||||
|
||||
#define PX4_I2C_BUS_MTD 4,5
|
||||
|
||||
|
||||
#define BOARD_NUM_IO_TIMERS 4
|
||||
#define BOARD_SPIX_SYNC_FREQ 32000
|
||||
|
||||
|
||||
@@ -478,9 +478,6 @@
|
||||
|
||||
#define BOARD_ENABLE_CONSOLE_BUFFER
|
||||
|
||||
#define PX4_I2C_BUS_MTD 4,5
|
||||
|
||||
|
||||
#define BOARD_NUM_IO_TIMERS 4
|
||||
#define BOARD_SPIX_SYNC_FREQ 32000
|
||||
|
||||
|
||||
@@ -84,8 +84,6 @@
|
||||
* Note that these are unshifted addresses.
|
||||
*/
|
||||
#define BOARD_MTD_NUM_EEPROM 1 /* MTD: imu_eeprom */
|
||||
#define PX4_I2C_BUS_MTD 4
|
||||
|
||||
|
||||
/* CAN */
|
||||
#define UAVCAN_NUM_IFACES_RUNTIME 1
|
||||
|
||||
@@ -470,9 +470,6 @@
|
||||
|
||||
#define BOARD_ENABLE_CONSOLE_BUFFER
|
||||
|
||||
#define PX4_I2C_BUS_MTD 4,5
|
||||
|
||||
|
||||
#define BOARD_NUM_IO_TIMERS 4
|
||||
|
||||
/* No CDCACM driver for this board, so this is manually defined for version.c
|
||||
|
||||
@@ -91,8 +91,6 @@
|
||||
#define PX4_I2C_BUS_ONBOARD_HZ 400000
|
||||
#define PX4_I2C_BUS_EXPANSION_HZ 400000
|
||||
|
||||
#define PX4_I2C_BUS_MTD 1
|
||||
|
||||
#define BOARD_NUMBER_I2C_BUSES 3
|
||||
#define BOARD_I2C_BUS_CLOCK_INIT {PX4_I2C_BUS_ONBOARD_HZ, 100000, PX4_I2C_BUS_EXPANSION_HZ}
|
||||
|
||||
|
||||
@@ -92,8 +92,6 @@
|
||||
#define PX4_I2C_BUS_ONBOARD_HZ 400000
|
||||
#define PX4_I2C_BUS_EXPANSION_HZ 400000
|
||||
|
||||
#define PX4_I2C_BUS_MTD 1
|
||||
|
||||
#define BOARD_NUMBER_I2C_BUSES 3
|
||||
#define BOARD_I2C_BUS_CLOCK_INIT {PX4_I2C_BUS_ONBOARD_HZ, 400000, PX4_I2C_BUS_EXPANSION_HZ}
|
||||
|
||||
|
||||
@@ -357,9 +357,6 @@
|
||||
|
||||
#define BOARD_ENABLE_CONSOLE_BUFFER
|
||||
|
||||
#define PX4_I2C_BUS_MTD 1
|
||||
|
||||
|
||||
#define BOARD_NUM_IO_TIMERS 6
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
@@ -480,9 +480,6 @@
|
||||
|
||||
#define BOARD_ENABLE_CONSOLE_BUFFER
|
||||
|
||||
#define PX4_I2C_BUS_MTD 4,5
|
||||
|
||||
|
||||
#define BOARD_NUM_IO_TIMERS 5
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
@@ -447,9 +447,6 @@
|
||||
|
||||
#define BOARD_ENABLE_CONSOLE_BUFFER
|
||||
|
||||
#define PX4_I2C_BUS_MTD 4,5
|
||||
|
||||
|
||||
#define BOARD_NUM_IO_TIMERS 5
|
||||
#define BOARD_SPI_BUS_MAX_BUS_ITEMS 5
|
||||
|
||||
|
||||
@@ -450,9 +450,6 @@
|
||||
|
||||
#define BOARD_ENABLE_CONSOLE_BUFFER
|
||||
|
||||
#define PX4_I2C_BUS_MTD 4
|
||||
|
||||
|
||||
#define BOARD_NUM_IO_TIMERS 5
|
||||
#define BOARD_SPI_BUS_MAX_BUS_ITEMS 5
|
||||
|
||||
|
||||
@@ -453,9 +453,6 @@
|
||||
|
||||
#define BOARD_ENABLE_CONSOLE_BUFFER
|
||||
|
||||
#define PX4_I2C_BUS_MTD 4
|
||||
|
||||
|
||||
#define BOARD_NUM_IO_TIMERS 5
|
||||
#define BOARD_SPI_BUS_MAX_BUS_ITEMS 5
|
||||
|
||||
|
||||
@@ -81,8 +81,6 @@ __BEGIN_DECLS
|
||||
#define PX4_I2C_BUS_ONBOARD_HZ 400000
|
||||
#define PX4_I2C_BUS_EXPANSION_HZ 400000
|
||||
|
||||
#define PX4_I2C_BUS_MTD 1
|
||||
|
||||
#define BOARD_NUMBER_I2C_BUSES 2
|
||||
|
||||
/* Timer I/O PWM and capture */
|
||||
|
||||
@@ -436,9 +436,6 @@
|
||||
|
||||
#define BOARD_NUM_IO_TIMERS 5
|
||||
|
||||
|
||||
#define PX4_I2C_BUS_MTD 4,5
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/****************************************************************************************************
|
||||
|
||||
@@ -273,8 +273,6 @@
|
||||
|
||||
#define BOARD_ENABLE_CONSOLE_BUFFER
|
||||
|
||||
#define PX4_I2C_BUS_MTD 4,5
|
||||
|
||||
#define BOARD_OVERRIDE_I2C_DEVICE_EXTERNAL
|
||||
|
||||
|
||||
|
||||
@@ -471,9 +471,6 @@
|
||||
|
||||
#define BOARD_ENABLE_CONSOLE_BUFFER
|
||||
|
||||
#define PX4_I2C_BUS_MTD 4,5
|
||||
|
||||
|
||||
#define BOARD_NUM_IO_TIMERS 5
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
@@ -609,7 +609,6 @@
|
||||
}
|
||||
|
||||
#define BOARD_ENABLE_CONSOLE_BUFFER
|
||||
#define PX4_I2C_BUS_MTD 1
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
||||
@@ -356,9 +356,6 @@
|
||||
|
||||
#define BOARD_NUM_IO_TIMERS 5
|
||||
|
||||
|
||||
#define PX4_I2C_BUS_MTD 4,5
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/****************************************************************************************************
|
||||
|
||||
@@ -434,9 +434,6 @@
|
||||
|
||||
#define BOARD_ENABLE_CONSOLE_BUFFER
|
||||
|
||||
#define PX4_I2C_BUS_MTD 4,5
|
||||
|
||||
|
||||
#define BOARD_NUM_IO_TIMERS 5
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
@@ -470,9 +470,6 @@
|
||||
|
||||
#define BOARD_ENABLE_CONSOLE_BUFFER
|
||||
|
||||
#define PX4_I2C_BUS_MTD 4,5
|
||||
|
||||
|
||||
#define BOARD_NUM_IO_TIMERS 5
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
@@ -167,8 +167,8 @@ static int spi_nor_attach(mtd_instance_s &instance, uint32_t spi_speed_hz)
|
||||
|
||||
static int at24xxx_attach(mtd_instance_s &instance)
|
||||
{
|
||||
#if !defined(PX4_I2C_BUS_MTD)
|
||||
PX4_ERR("Misconfiguration PX4_I2C_BUS_MTD not set");
|
||||
#if !defined(CONFIG_MTD)
|
||||
PX4_ERR("Misconfiguration CONFIG_MTD not set");
|
||||
return -ENXIO;
|
||||
#else
|
||||
|
||||
|
||||
Reference in new issue
Block a user