This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2642R: Linker error when trying to use ECDSA driver

Part Number: CC2642R

Hello,

I am attempting to use ECDSA in my code. I am starting from the sample code in ti/drivers/ECDSA.h. However I am getting a linker error when making a call to ECDSA_sign():

"Error[Li006]: duplicate definitions for "ECDSA_sign"; in "C:\BSN\Sardeen\sardeen_ble_cc2642\Sardeen_Ble_LaunchPad_Debug\Obj\ECDSACC26X2.o", and "C:\BSN\Sardeen\sardeen_ble_cc2642\BLE_Stack\source\ti\ble5stack\libraries\cc26x2r1\ble_r2.symbols"

I am using IAR for ARM 8.32.2 and SDK 3.40.00.02. I saw on the forums that someone had a similar problem 2 years ago and that it would be fixed in a future version of the SDK: https://e2e.ti.com/support/wireless-connectivity/bluetooth/f/538/t/669469. I used the solution mentioned there (i.e. I renamed ECDSA_sign to ECDSA_sign_mod in ECDSA.h and ECDSACC26X2.c, and I added ECDSACC26X2.c to my project).

My questions are:

  1. Has this linker issue mentioned in the other post been fixed in SDK 3.40.00.02? 
  2. If the error has not yet been fixed, should I be using the same workaround presented in the other post (i.e. changing the ECDSA_sign function in ECDSACC26X2.c and ECDSA.h to ECDSA_sign_mod and calling ECDSA_sign_mod)?

Thanks,

Keron

  • Hi,

    1- I assume the issue has been fixed at one point but it would be interesting to see what is causing this one. Can you tel me from which project you started? (i.e. which TI examples did you import in IAR?). Can you also confirm you are only using some files coming from the SDK 3.40?

    2- The workaround you found is perfectly valid. If it is not clear to you, you basically force the linker to link the function in ROM.

    Best regards,

  • Hi Clément,

    1. Unfortunately it seems that this issue has still not been fixed in SDK 3.40.00.02. I am starting from the simple_peripheral_app project included with the TI examples and I simply added my ECDSA driver code to it (using the example code in ti/drivers/ECDSA.h). I am only using files coming from SDK 3.40.
    2. When I use the workaround from the aforementioned post, the ECDSA signing operation actually doesn't work. It works if I call ECDSA_sign_mod(), which is defined in ti/drivers/ecdsa/ECDSACC26X2.c (after renaming ECDSA_sign to ECDSA_sign_mod in that file). But after using the workaround, if I call ECDSA_sign instead of ECDSA_sign_mod, I get a HardFault exception. I'd prefer to use the ROM-defined ECDSA_sign function to save flash space. Any thoughts? The HardFault generates this information in the Terminal I/O:

    "usFault: IMPRECISERR: Delayed Bus Fault, exact addr unknown, address: e000ed38

    Exception occurred in background thread at PC = 0x1000cb1e.
    Core 0: Exception occurred in ThreadType_Task.
    Task name: {unknown-instance-name}, handle: 0x2000a8ec.
    Task stack base: 0x2000a940.
    Task stack size: 0x3f8.
    R0 = 0x00000008 R8 = 0x2000ab80
    R1 = 0x100257d4 R9 = 0x2000ac70
    R2 = 0x00000000 R10 = 0xffffffff
    R3 = 0x00000001 R11 = 0xffffffff
    R4 = 0x00000009 R12 = 0x00000002
    R5 = 0x20000154 SP(R13) = 0x2000ab10
    R6 = 0x00000004 LR(R14) = 0x1000cfeb
    R7 = 0x2000ac08 PC(R15) = 0x1000cb1e
    PSR = 0x01000000
    ICSR = 0x00400803
    MMFSR = 0x00
    BFSR = 0x04
    UFSR = 0x0000
    HFSR = 0x40000000
    DFSR = 0x00000001
    MMAR = 0xe000ed34
    BFAR = 0xe000ed38
    AFSR = 0x00000000
    Terminating execution..."

    Thanks,

    Keron

  • Hi Keron,

    Thank you for the details you provided. I could reproduce the issue and open an internal ticket to track the issue.

    From the observations I made (please don't quote me on these ones before I get a confirmation), with SDK 3.40, I don't think you will be able to use the ROM version of the ECDSA_sign() function in your final product. You will have to use the flash version of the function. This is due to a few changes that have been made in some of the data structures used by ECDSA_sign().

    For the moment I will ask you to use the workaround you have found:
    - add the file ECDSACC26X2.c to your project
    - in ECDSACC26X2.c, rename the function ECDSA_sign() in ECDSA_sign_mod()
    - use the function ECDSA_sign_mod() in you application code

    I will get back to you with more details as soon as possible (it might take up to 3 weeks). Please bear with me.

    Best regards,