Files
Jacob Dahl 39eae27610 fix(uavcan): apply UAVCAN_BITRATE on FlexCAN again, size uavcan/TTY work queues for NuttX 12 (#28509)
* fix(uavcan): apply UAVCAN_BITRATE on FlexCAN again

58dfff0de7 turned the SIOCSCANBITRATE path off for i.MX RT, S32K and Kinetis,
which is every board in the tree that builds SocketCAN, so UAVCAN_BITRATE
stopped doing anything at all. It was written before db6f7ec304, and the crash
it works around is that commit's bug: the driver reports bit/s on NuttX 12 and
the caller still divided by 1000, so a 1 Mbit/s board asked its controller for
1000 bit/s on every boot.

Benched on an ARK FMU-v6XRT with the gate removed: 1 Mbit/s -> 500 kbit/s ->
1 Mbit/s round-trips with both DroneCAN nodes coming back OPERAT, buses
error-active, no fault. Requesting a rate the controller cannot reach is also
survivable now -- it is reported and the configured rate is kept, where before
a negative return from here made CanDriver::init() give up and DroneCAN never
started.

The %u for a uint32_t is fixed as well; nothing compiled this branch while the
gate was in place.

* fix(work_queue): size the uavcan and TTY work queues for NuttX 12

NuttX 12.12 costs a few hundred bytes of stack on the paths that go through
the file layer, and that is more than these two defaults left spare. Measured
against the same PX4 tree on 10.3.0:

  wq:uavcan  2860/3728 -> 3184/3736  (ARK FMU-v6X, two DroneCAN GNSS nodes)
  wq:ttyS4   1088/1704 -> 1432/1712  (ARK FMU-v6XRT, crsf_rc)

load_mon reports wq:ttyS4 low on stack with 280 bytes left, and wq:uavcan sits
at 85 % of its own. 4096 and 2048 restore the margin the 10.3.0 figures had.
2026-09-03 12:31:07 -07:00

332 lines
7.0 KiB
Plaintext

#
# Work Queue Configuration
#
menu "Work Queue Configuration"
config WQ_RATE_CTRL_STACKSIZE
int "Stack size for wq:rate_ctrl"
default 3150
range 1000 10000
help
Sets the stack size in bytes for the rate_ctrl work queue.
config WQ_RATE_CTRL_PRIORITY
int "Relative priority for wq:rate_ctrl"
default 0
range -255 0
help
Sets the relative priority for the rate_ctrl work queue.
menu "SPI Bus Work Queues"
config WQ_SPI_STACKSIZE
int "Stack size for SPI work queues"
default 2392
range 1000 10000
help
Sets the stack size for all SPI work queues (SPI0-SPI6).
config WQ_SPI0_PRIORITY
int "Relative priority for wq:SPI0"
default -1
range -255 0
help
Sets the relative priority for the SPI0 work queue.
config WQ_SPI1_PRIORITY
int "Relative priority for wq:SPI1"
default -2
range -255 0
help
Sets the relative priority for the SPI1 work queue.
config WQ_SPI2_PRIORITY
int "Relative priority for wq:SPI2"
default -3
range -255 0
help
Sets the relative priority for the SPI2 work queue.
config WQ_SPI3_PRIORITY
int "Relative priority for wq:SPI3"
default -4
range -255 0
help
Sets the relative priority for the SPI3 work queue.
config WQ_SPI4_PRIORITY
int "Relative priority for wq:SPI4"
default -5
range -255 0
help
Sets the relative priority for the SPI4 work queue.
config WQ_SPI5_PRIORITY
int "Relative priority for wq:SPI5"
default -6
range -255 0
help
Sets the relative priority for the SPI5 work queue.
config WQ_SPI6_PRIORITY
int "Relative priority for wq:SPI6"
default -7
range -255 0
help
Sets the relative priority for the SPI6 work queue.
endmenu # SPI Bus Work Queues
menu "I2C Bus Work Queues"
config WQ_I2C_STACKSIZE
int "Stack size for I2C work queues"
default 2336
range 1000 10000
help
Sets the stack size for all I2C work queues (I2C0-I2C4).
config WQ_I2C0_PRIORITY
int "Relative priority for wq:I2C0"
default -8
range -255 0
help
Sets the relative priority for the I2C0 work queue.
config WQ_I2C1_PRIORITY
int "Relative priority for wq:I2C1"
default -9
range -255 0
help
Sets the relative priority for the I2C1 work queue.
config WQ_I2C2_PRIORITY
int "Relative priority for wq:I2C2"
default -10
range -255 0
help
Sets the relative priority for the I2C2 work queue.
config WQ_I2C3_PRIORITY
int "Relative priority for wq:I2C3"
default -11
range -255 0
help
Sets the relative priority for the I2C3 work queue.
config WQ_I2C4_PRIORITY
int "Relative priority for wq:I2C4"
default -12
range -255 0
help
Sets the relative priority for the I2C4 work queue.
endmenu # I2C Bus Work Queues
config WQ_NAV_AND_CONTROLLERS_STACKSIZE
int "Stack size for nav_and_controllers"
default 2240
range 1000 10000
help
Sets the stack size for the nav_and_controllers work queue.
config WQ_NAV_AND_CONTROLLERS_PRIORITY
int "Relative priority for nav_and_controllers"
default -13
range -255 0
help
Sets the relative priority for the nav_and_controllers work queue.
config WQ_VTE_STACKSIZE
int "Stack size for vte"
default 6000
range 1000 10000
help
Sets the stack size for the vte work queue.
config WQ_VTE_PRIORITY
int "Relative priority for vte"
default -14
range -255 0
help
Sets the relative priority for the vte work queue.
menu "INS Work Queues"
config WQ_INS_STACKSIZE
int "Stack size for INS work queues"
default 6000
range 1000 10000
help
Sets the stack size for all INS work queues (INS0-INS3).
config WQ_INS0_PRIORITY
int "Relative priority for wq:INS0"
default -14
range -255 0
help
Sets the relative priority for the INS0 work queue.
config WQ_INS1_PRIORITY
int "Relative priority for wq:INS1"
default -15
range -255 0
help
Sets the relative priority for the INS1 work queue.
config WQ_INS2_PRIORITY
int "Relative priority for wq:INS2"
default -16
range -255 0
help
Sets the relative priority for the INS2 work queue.
config WQ_INS3_PRIORITY
int "Relative priority for wq:INS3"
default -17
range -255 0
help
Sets the relative priority for the INS3 work queue.
endmenu # INS Work Queues
config WQ_HP_DEFAULT_STACKSIZE
int "Stack size for hp_default"
default 2800
range 1000 10000
help
Sets the stack size for the hp_default work queue.
config WQ_HP_DEFAULT_PRIORITY
int "Relative priority for hp_default"
default -18
range -255 0
help
Sets the relative priority for the hp_default work queue.
config WQ_UAVCAN_STACKSIZE
int "Stack size for uavcan"
default 4096
range 1000 10000
help
Sets the stack size for the uavcan work queue.
config WQ_UAVCAN_PRIORITY
int "Relative priority for wq:uavcan"
default -19
range -255 0
help
Sets the relative priority for the uavcan work queue.
menu "TTY Bus Work Queues"
config WQ_TTY_STACKSIZE
int "Stack size for TTY work queues"
default 2048
range 1000 10000
help
Sets the stack size for all TTY work queues.
config WQ_TTY_S0_PRIORITY
int "Relative priority for wq:ttyS0"
default -21
range -255 0
help
Sets the relative priority for the ttyS0 work queue.
config WQ_TTY_S1_PRIORITY
int "Relative priority for wq:ttyS1"
default -22
range -255 0
help
Sets the relative priority for the ttyS1 work queue.
config WQ_TTY_S2_PRIORITY
int "Relative priority for wq:ttyS2"
default -23
range -255 0
help
Sets the relative priority for the ttyS2 work queue.
config WQ_TTY_S3_PRIORITY
int "Relative priority for wq:ttyS3"
default -24
range -255 0
help
Sets the relative priority for the ttyS3 work queue.
config WQ_TTY_S4_PRIORITY
int "Relative priority for wq:ttyS4"
default -25
range -255 0
help
Sets the relative priority for the ttyS4 work queue.
config WQ_TTY_S5_PRIORITY
int "Relative priority for wq:ttyS5"
default -26
range -255 0
help
Sets the relative priority for the ttyS5 work queue.
config WQ_TTY_S6_PRIORITY
int "Relative priority for wq:ttyS6"
default -27
range -255 0
help
Sets the relative priority for the ttyS6 work queue.
config WQ_TTY_S7_PRIORITY
int "Relative priority for wq:ttyS7"
default -28
range -255 0
help
Sets the relative priority for the ttyS7 work queue.
config WQ_TTY_S8_PRIORITY
int "Relative priority for wq:ttyS8"
default -29
range -255 0
help
Sets the relative priority for the ttyS8 work queue.
config WQ_TTY_S9_PRIORITY
int "Relative priority for wq:ttyS9"
default -30
range -255 0
help
Sets the relative priority for the ttyS9 work queue.
config WQ_TTY_ACM0_PRIORITY
int "Relative priority for wq:ttyACM0"
default -31
range -255 0
help
Sets the relative priority for the ttyACM0 work queue.
config WQ_TTY_UNKNOWN_PRIORITY
int "Relative priority for wq:ttyUnknown"
default -32
range -255 0
help
Sets the relative priority for the ttyUnknown work queue.
endmenu # TTY Bus Work Queues
config WQ_LP_DEFAULT_STACKSIZE
int "Stack size for lp_default"
default 3500
range 1000 10000
help
Sets the stack size for the lp_default work queue.
config WQ_LP_DEFAULT_PRIORITY
int "Relative priority for wq:lp_default"
default -50
range -255 0
help
Sets the relative priority for the lp_default work queue.
endmenu # Work Queue Configuration