cancel
Showing results for 
Search instead for 
Did you mean: 

Linking DPC_AverageCurrentCtrl_IAR.a with VS Code and CMake?

simon_12542
Associate III

Hi everyone,

I'm working on a power conversion project using the STEVAL-7BIDIRCB reference design.

The firmware uses a specific static library: DPC_AverageCurrentCtrl_IAR.a. As the name suggests, it was compiled with IAR EWARM. However, I would like to use VS Code and CMake for my development environment instead of the IAR IDE.

A few questions:

Is this specific library compatible with the arm-none-eabi-gcc linker in a CMake setup, or will I face ABI/runtime issues (especially regarding FPU and math functions)?

If I use the IAR Build Tools (compiler/linker) through CMake in VS Code, will it work seamlessly with this .a file?

Is there a GCC version of this library available for the STEVAL-7BIDIRCB, or are the sources available somewhere to recompile it for GCC?

The control loop is obviously critical for this board, so I want to make sure I don't introduce any instability by mixing toolchains.

Thanks for your help!

1 REPLY 1
Nawres GHARBI
ST Employee

hi @simon_12542 

you should treat it as incompatible as:

  • IAR and GCC use different ABIs:

    • Different name mangling rules (for C++, if any).

    • Different conventions for:

      • Function prolog/epilog

      • Passing/returning structs, 64‑bit types, floating‑point values

      • Use of registers vs. stack, especially with FPU.

  • Runtime dependencies differ:

    • An IAR static library usually depends on IAR’s C runtime (DLib / CLib), their math implementations, and startup assumptions.

    • GCC code expects newlib or newlib-nano, different libm, different startup.

Even if the .a is “just” ARM code, the object files inside are built against IAR’s ABI and runtime. Mixed-toolchain linking is not supported

 

what we recommend as approach:

  1. If you must use GCC (arm-none-eabi-gcc):
    • Do not link against DPC_AverageCurrentCtrl_IAR.a.
    • Try to obtain a GCC version of the library, or the source code for the control algorithm.
    • Only once you have GCC-compiled control code should you proceed with full integration.
  2. If keeping the exact ST‑provided control loop is more important than using GCC:
    • Use IAR Build Tools with CMake + VS Code.
    • Configure your CMake toolchain file for IAR.
    • Build everything with IAR to avoid ABI/runtime issues.

  3. Under no circumstances mix toolchains (e.g. main app built with GCC and link in DPC_AverageCurrentCtrl_IAR.a). That’s precisely the kind of subtle problem that can manifest as unstable current/voltage control under load transients.