Multiple definition errors when trying to migrate code from toolchain 1.7.1 to 1.9.1

It's early in the build so it's only building Zephyr and other low level drivers and it's erroring due to "multiple definition" of the same function name. If I search for these function names, I can see many modules with the same name. I don't run into this problem building from toolchain 1.8.0 and below. The nrf_rtc_timer.c has header files that expose the other definitions in the same file. Tried to debug it but gave up because I was going to deep down the rabbit hole. Not sure what to do at this point.

My prj.conf

Parents
  • Hello Howard and Aleksa,

    I haven't managed to reproduce your exact error message, though I do also see errors when trying to run CMake with your configurations. It seems that some of your configurations are outdated, for instance: CONFIG_AT_CMD and CONFIG_AT_NOTIF. For an overview of configurations available on different versions, you can check out the KConfig reference here. Are you getting your project to run with CONFIG_LTE_LOG_LEVEL_DBG on NCS 1.7.1?

    Could you also tell me more about your project? Is it maybe based on any sample in particular, so that I can have an easier way of trying to reproduce your issues?

    Regards,

    Elfving

  • My project does use CONFIG_AT_CMD and CONFIG_AT_NOTIF but I did have to comment these out when trying to build under toolchain 1.9.1. Forgot to do that when posting my proj.conf file. I made that change above.

    My project under 1.7.1 does build and run with CONFIG_LTE_LOG_LEVEL_DBG but it's in my autoconf.h by default.

    I did a test where I compiled an empty main() function with all my proj.conf settings commented out and my cmakelists.txt only referencing the main.c for compile and it still errored with "multiple definition".

  • I am not sure about that. Obviously these two definitions shouldn't be allowed to be active at the same time. 

    File nrf/subsys/spm/Kconfig has been changed between ncs v1.6.1(from which I'm migrating) and v1.9.1. 

    When I build any of your samples, and I check libdrivers__timer.a for symbols, I find that  these three functions are all defined in nrf_rtc_timer.c. Which means that in our case, cortex_m_systick.c shouldn't be built as a part of this library. Obviously the two CONFIGs are the issue. 

    What I've done as a workaround for now is to edit nrf/subsys/spm/Kconfig, so that the CORTEX_M_SYSTICK works like this:




  • Is the local Kconfig file how you would override settings in the Kconfig in nrf/subsys/spm?

  • I've done it directly in he nrf/subsys/spm/Kconfig. But it's not an optimal solution unless you make your own fork of the nrf repo. Even then, this is just a temporary fix. 

  • Thank you for debugging this! I'm still cutting my teeth on Zephyr and wouldn't have even known to look there. I've been unclear as to the roll of the Kconfig file but this has shed some light on the subject.

    I'll give this a try and report back.

  • Your above fix did allow me to get past the point that would otherwise error. Now I would have to fix my code due to changes in 1.9.1 vs 1.7.1. Awesome!

Reply Children
  • I faced the same problem in my application software and managed to solve it today. Here is how

    - Compilation is failed for SPM, prj.conf for SPM build needs to be updated
    - Add `child_image/spm/prj.conf` in your application project
    - Make sure to have `CONFIG_CORTEX_M_SYSTICK=n` in it with all the basic configuration for spm (you can find the nrf-sdk mainline repo a sample prj,conf for spm)

  • Hello again, and thanks for your patience on this issue during the Easter vacation.

    Did the solution presented by Aleksa and Parthitce work for you? If not, I am still unable to reproduce the issue.

    Could you send me your project? 

    GameCodingNinja said:
    I did a test where I compiled an empty main() function with all my proj.conf settings commented out and my cmakelists.txt only referencing the main.c for compile and it still errored with "multiple definition".

    So this is also the case with eg. the basic Hello World example in 1.9.1 for you?

    Regards,

    Elfving

  • Aleksa's solution did work for me. I have not tried Parthitce solution yet. Have not tried the Hello World example.

  • thank u all guys that helping other to solve their problems, i have same problem but i can't find nrf/subsys/spm/Kconfig i use vscode with nrfconnect extention i remove systick in device tree and other rtc and solved this problem for me hope worked for someone else too