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.

Convert static DSP library into dynamic DSP library using Lightweight (Bare Metal) Dynamic Linking Model

Our existing algorithm project builds the static DSP library for C674x processor. We want to support the dynamic linking, which requires the static library to be converted to dynamic library.

I tried to create a dynamic wrapper library project and link my static library to export the functions I want to exported part of the dynamic library. As soon as, I use one symbol from my existing static library I start seeing following errors:

error: symbol "numFrees" is accessed using DP addressing in file

"../MyStaticLibrary.lib"; non-DSBT baremetal dynamic library
(--dynamic=lib) cannot use DP addressing
error: symbol "numFrees" is accessed using DP addressing in file
"../MyStaticLibrary.lib"; non-DSBT baremetal dynamic library
(--dynamic=lib) cannot use DP addressing
error: symbol "numMallocs" is accessed using DP addressing in file
"../MyStaticLibrary.lib"; non-DSBT baremetal dynamic library

Any idea or comments on above errors? Is my approach right on converting pre-built static lib to dynamic lib or its technically not possible with  Lightweight (Bare Metal) Dynamic Linking Model?

Appreciate any pointers on converting pre-built static library to dynamic library?

Thanks!

  • I'm pretty sure you need to build the C code with the compiler option --mem_model:data=far.  This wiki article says a dynamic library ...

    Must use far DP or absolute addressing to access its own data as well as data that it imports from other modules

    I'll get confirmation on this.

    Thanks and regards,

    -George

  • This will provide two benefits 1) can use our pre-build previous version library in dynamic fashion 2) avoid changing existing projects settings. 

    Will appreciate if you can confirm!

    Thanks!

  • George, that is correct. When using non-DSBT bare-metal dynamic linking model, the compiler should be made to assume that all data is far since the DP is not managed by the compiler in the non-DSBT model. The wiki article that you cite should be updated to make this point clear.

    ~Todd

  • Thanks Todd for the confirmation!

    For others dealing with similar issue, here is what solved my problem by changing existing static library project:

    - Only changed Build Settings -> CCS Build -> C6000 Compiler -> Advanced Options -> Runtime Model Options -> Data access model (--mem_model:data) set to far.

    Rebuild the static lib project.

    Now, you can consume this static library in Dynamic library project to build the dynamic library out of it.

    ~ARM