override a Zephyr sensor driver

I like to override a Zephyr sensor driver with an out of tree driver with the same name and vendor. (Background the driver has a bug in I2C that needs to be solved).

I copied all relevant files to the out of tree project but now it gives the error below.

devicetree error: both OutOfTreeProject/dts/bindings\sensor\st,lis2dw12-i2c.yaml and C:/ncs/v2.5.2/zephyr/dts/bindings\sensor\st,lis2dw12-i2c.yaml have 'compatible: st,lis2dw12' and 'on-bus: i2c'

What’s the way to override an existing Zephyr driver in an out of tree project?

Parents
  • Hi,

    What’s the way to override an existing Zephyr driver in an out of tree project?

    You can also refer to this discussion w.r.t a similar question  Recognizing out of tree device driver bindings for mcuboot child image. (albeit this touches upon how to make mcuboot recognize an out of tree driver) as well as this case Out-of-tree driver - Zephyr (freestanding app) which has a solution for how to do this based on the Zephyr discord support forum

    But in general there are two points I would like to make you aware of:

    1. If you overwrite the existing device drives with patches of your you will need to make sure you maintain these changes in your own zephyr fork while developing, which is ok to do but you need to make sure you do this if you ever intend on migrating between versions
    2. Instead I would recommend that you create a new device based on the existing files with a different name that you instead import as your own device.

    Let me know if this answers your questions 

    Kind regards,
    Andreas

Reply
  • Hi,

    What’s the way to override an existing Zephyr driver in an out of tree project?

    You can also refer to this discussion w.r.t a similar question  Recognizing out of tree device driver bindings for mcuboot child image. (albeit this touches upon how to make mcuboot recognize an out of tree driver) as well as this case Out-of-tree driver - Zephyr (freestanding app) which has a solution for how to do this based on the Zephyr discord support forum

    But in general there are two points I would like to make you aware of:

    1. If you overwrite the existing device drives with patches of your you will need to make sure you maintain these changes in your own zephyr fork while developing, which is ok to do but you need to make sure you do this if you ever intend on migrating between versions
    2. Instead I would recommend that you create a new device based on the existing files with a different name that you instead import as your own device.

    Let me know if this answers your questions 

    Kind regards,
    Andreas

Children
No Data
Related