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: How to defined own driver interface in Simple Peripheral

Part Number: CC2642R


I am referring the BLE SDK v3.10, Simple Peripheral application.One of the requirement we have is to use our own TRNG_generateEntropy() instead of driver provided function in ti\drivers\trng\TRNGCC26XX.c.

Instead of modifying the TRNGCC26XX.c file, we prefer to have some other way to provide our own function for the TRNG.

Can you provide the way to achieve this?

  • Hi,

    The easiest way I see is to do the following:

    1. Copy the TRNGCC26XX.c file
    2. Do the modify you want in TRNGCC26XX.c (i.e. modify TRNG_generateEntropy())
    3. Import your own TRNGCC26XX.c file inside CCS
    4. At build time, the linker will first consider the file imported in CCS

    If you don't want to copy the whole file TRNGCC26XX.c, you could do the following (a bit more hacky - but this can definitely be scripted):

    1. Modify the TRNGCC26XX.c file in the SDK in order to declare TRNG_generateEntropy() as weak
    2. Rebuild the ti drivers libraries. In short:
      1. modify imports.mak to point on the right tools (imports.mak is a the root of the SDK)
      2. cd to source/ti/drivers and call gmake all (gmake can be found in /c/ti/xdctools)
    3. Create your own TRNGCC26XX.c file with only the function TRNG_generateEntropy()  and import it inside CCS
    4. At build time the linker will find twice the symbol TRNG_generateEntropy() and gives the priority to the non-weak

    I hope this will help,

    Kind regards,

  • Thanks for your reply. 

    I have already tried the 1st option thinking that the linker shall resolve the symbol by taking the function defined in the application specific file. But the linker was giving the error has the definition is found multiple times. What can be going wrong in here?

    Mehul

  • Hi Mehul,

    Have you imported in your project the TI driver source files too? If yes then it explains the problem :)

    Regards,

  • We have not imported TI driver source files. So, TO driver files do not get compiled at all as part of source code building. But, we are using the driver library as-is at the linking time.

  • Hello,

    The issue is solved. I had mistakenly removed one of the function from the TRNGCC26XX.c file due to which it was causing an issue. After replacing it again, it got just worked fine.

    Thanks,

    Mehul