nuttx icon indicating copy to clipboard operation
nuttx copied to clipboard

Common Driver Initialization

Open patacongo opened this issue 5 years ago • 3 comments

There are several implementations of up_initialize(), at least one per architecture. Each of these initializtion files is very similar; each initializes the same set of common drivers under the drivers/ directory.

This common logic should be captured in common logic perhaps at /drivers/init. The common driver initialization should be removed from architecture-specific up_initialize() and replaces with calls to drvr_early_initialize() and drvr_last_initialize() in new files under /drivers/init.

patacongo avatar May 26 '20 16:05 patacongo

Hello @patacongo, is this still a valid issue? If so, I would like to try helping with.

dalprahcd avatar Feb 03 '24 21:02 dalprahcd

@dalprahcd some suggestion was done recently, you can reference the code here: https://github.com/apache/nuttx/blob/master/drivers/drivers_initialize.c

xiaoxiang781216 avatar Feb 16 '24 06:02 xiaoxiang781216

@xiaoxiang781216 since there is a common file to initialize all the drivers, is this issue closed then? Because checking the following architectures looks like there is no much duplication at up_intialize.

https://github.com/apache/nuttx/blob/42dad89211f2d34f62c103a7647bd64e466a0215/arch/avr/src/common/avr_initialize.c#L125 https://github.com/apache/nuttx/blob/42dad89211f2d34f62c103a7647bd64e466a0215/arch/arm/src/common/arm_initialize.c#L98 https://github.com/apache/nuttx/blob/42dad89211f2d34f62c103a7647bd64e466a0215/arch/risc-v/src/common/riscv_initialize.c#L88 https://github.com/apache/nuttx/blob/42dad89211f2d34f62c103a7647bd64e466a0215/arch/xtensa/src/common/xtensa_initialize.c#L101

dalprahcd avatar Feb 17 '24 10:02 dalprahcd