Custom OOT AMS TMF882X driver - multiple definition of `__device_dts_ord_xx'

Hi everyone,

I am currently trying to implement a new OOT driver for a ToF sensor made by AMS, the TMF882X.

I have made a kind of skeleton driver based on another one (Sensirion SCD4X).

While compiling my driver i get the following error which I cannot track down and find the cause of it.

It seems that there's multiple definitions during linking of my driver.

I could not find much while searching online

I've also posted all my source files for the driver.

Any help would be greatly appreciated.

tmf882x_testing.rar

Parents
  • To understand which node is connected to node 94 in the multiple definition of __device_dts_ord_94 you can check your build folder build\zephyr\include\generated\devicetree_generated.h. 

    In my build it shows like this

     *   94  /soc/peripheral@50000000/mutex@30000
     *   95  /soc/peripheral@50000000/nfct@2d000

    Then I know that it is mutex definition in the dts file that is defined multiple times in my project. Find out which node is connected in your dts definition.

    Regarding the other multiple definition of log_const_TMF882X, this has to be something specific to your build. As I do not see this in our default SDK definitions.

  • Hi Susheel,

    Thanks for the reply.

    I cannot find the "devicetree_generated.h" file which you suggested me to check.

    As for the log error it points to the log definition of the drivers module

    I also have to mention that I am building with with zephyr 1.9.1

  • I am not sure why you are developing any project with such an old SDK. I strongly recommend you to use latest nRF Connect SDK for your product development.

    DorianN said:
    I also have to mention that I am building with with zephyr 1.9.1

    In this case you need to look into deviceree_unfixed.h

Reply Children
  • We are using 1.9 due some existing old code.
    I will try another newer version and let you know.
    Thanks for the help Susheel.

  • No problem, The multiple definition issue you have might still exist with the new SDK. It seems like there is something in your .dts or .overlay file that has multiple nodes. Please let me know when you have moved to newer SDK and send me the project if it does not get fixed.

  • Will do!
    BTW I have uploaded my dts (and driver stubs) in a zip file.
    Don't know if you had a look there or not.
    Maybe there could be something to make the issue clearer.

    Thanks Slight smile

  • Hey Susheel,

    So I tried with the latest SDK 2.4.2 but still the same issue.
    I will sill keep looking into it.
    I am also including the whole project as you requested.
    Maybe there's something there which I cannot see at the moment.


    testing_tmf882x.rar

  • Hello Dorian,

    I have checked your project.

    Directly building for the NRF53DK, I would see the same error as you have mentioned (multiple definitions of log module and __device_ord_134, both of which are pointing to the TMF882X).

    I could see that the source files are referred two times (one time in the main CMakeLists.txt and the other time within the CMakeLists.txt of the respective driver folder). So, I commented out 4 lines from the CMakeLists.txt:

    Line 15 #FILE(GLOB scd4x_drv scd4x_oot_driver/drivers/sensor/scd4x/*.c)
    Line 16 #FILE(GLOB tmf882x_drv tmf882x_oot_driver/drivers/sensor/tmf882x/*.c)
    
    Line 18 #target_sources(app PRIVATE ${scd4x_drv})
    Line 19 #target_sources(app PRIVATE ${tmf882x_drv})

    Now that error is removed but a new error appears. 

    This time the error is related to the __device_ord_133 which is the other sensor.

    I do not think that this is an overlay issue. I have removed your source code from the main and can access TFM sensor as below (it builds correctly).

    However, I do get error when I try to use the other sensor. I think this is some issue in your implementation. I would suggest you to look at zephyr out-of-tree driver example (I think that is within example-application sample) and revise your implementation etc.

    BR, Naeem

Related