This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Error: Symbol multiply defined

Hi everyone,

I am trying to implement my device with nus service. Both nus client and server role on the same device, similar to the official example of  "relay".

But when I generated the hex.file, the error came like this:

.\_build\nrf52832_xxaa.axf: Error: L6200E: Symbol m_nrf_log_ble_nus_logs_data_const multiply defined (by ble_nus.o and ble_nus_c.o).
.\_build\nrf52832_xxaa.axf: Error: L6200E: Symbol m_nrf_log_ble_nus_logs_data_dynamic multiply defined (by ble_nus.o and ble_nus_c.o).

I changed the NRF_LOG_MODULE_NAME at the "ble_nus_c" sources files to solve the error but it had a fatal error when I ran the program on the device.

The fatal error should locate at the initialization of nus client and service. 

Any advice would help a lot.

Thanks in advance.

Duncan

Parents
  • Hi,

    This issue should have been fixed by using ble_nus_c as log module name, which is done in SDK 15.2 and newer. This should fix the issue. Which SDK version are you using?

    After fixing this issue you write that you get a different error, which I guess is where you should focus now. However, you do not write any information that could help identify that problem. Note that you typically find details of such errors by using a debug build (define DEBUG for the project or just select Debug from the build configuration drop-down if you are using SES). Then you should see the file name, like number and error code printed in the RTT log.

  • I am currently using SDK 15.0. I tried to use KEIL's debug function to locate the problem but it always has an error of "no finding any J-LINK device" even when connecting the nrf52 DK. Since you mention I could see the error number or code in the RTT log, can you tell me how to do it ("debug build")? 

    Thank you, Einar.

  • Hi,

    Since you get "no finding any J-LINK device" I wonder: are you even able to program the device? How do you do that?

    Assuming you got the J-Link connection working: To debug with Keil you should disable optimization (set "Level 0 (-O0)"), and add "DEBUG" to the Preprocessor symbols list. See screenshot with arrows:

  • Thing is a little weird. I couldn't use the load function in the Keil because of that "no J-link detected " so I use the nRFgo Studio to program my device. Anyway, I debug the code according to your configuration and get more details about the fatal error.

    Here is the picture:

    Would the error happen because the nus_c and nus are using the same memory address for their attributes? 

    Thank you very much.

    Duncan

  • Hi Duncan,

    This tells us that the error is returned by sd_ble_uuid_vs_add(), and looking at the API documentation it is stated that NRF_ERROR_NO_MEM is returned if there are no more free slots for VS UUIDs. This can be fixed by increasing NRF_SDH_BLE_VS_UUID_COUNT in your projects sdk_config.h. In this case the same VS UUID is added by both the NUS client and server implementations, so you could also just comment out the call to sd_ble_uuid_vs_add() in the last of them service you initialize (ble_nus_c).

Reply
  • Hi Duncan,

    This tells us that the error is returned by sd_ble_uuid_vs_add(), and looking at the API documentation it is stated that NRF_ERROR_NO_MEM is returned if there are no more free slots for VS UUIDs. This can be fixed by increasing NRF_SDH_BLE_VS_UUID_COUNT in your projects sdk_config.h. In this case the same VS UUID is added by both the NUS client and server implementations, so you could also just comment out the call to sd_ble_uuid_vs_add() in the last of them service you initialize (ble_nus_c).

Children
  • Great. I solved the problems by changing the NRF_SDH_BLE_VS_UUID_COUNT from 0 to 1 and editing the RAM. Thank you very much!!! 

    I have one more question, how did you locate the error is returned by sd_ble_uuis_vs_add() by knowing "error 4"? Are there any materials for reference? 

  • Hi,

    I am glad to hear you got it working.

    Duncan Xu said:
    I have one more question, how did you locate the error is returned by sd_ble_uuis_vs_add() by knowing "error 4"? Are there any materials for reference? 

    The error codes not just random numbers. There is a hierarchy of errors, but error 4 is a generic error that is defined in components\drivers_nrf\nrf_soc_nosd\nrf_error.h as NRF_ERROR_NO_MEM. This hints at what the problem could be, and then you can either look at the documentation for the function that returned it or dig into the code. In this case you can see the following description for NRF_ERROR_NO_MEM in the API documentation for  sd_ble_uuid_vs_add():

    NRF_ERROR_NO_MEM: If there are no more free slots for VS UUIDs.

Related