cancel
Showing results for 
Search instead for 
Did you mean: 

arm_bitreversal_32 - undefined reference in CMSIS DSP

DKref
Associate

I got the latest CMSIS from github and tried using the DSP code on a STM32H743ZI chip. I call three APIs which are:

  • arm_cfft_f32()
  • arm_cmplx_mag_f32()
  • arm_max_f32()

The code compiles fine with GCC but when it comes time to link I get a 'undefined reference to arm_bitreversal_32' error which is used in the arm_cfft_f32() call. I've been all over the internet and tried many things, none of which worked. The short list of things I've tried is:

  • Added -lm
  • Renamed arm_bitreversal2.S to arm_bitreversal2.c
  • Added -x assembler-with-cpp
  • Added -mthumb
  • etc, etc, etc.

Has anyone gotten GCC to link CMSIS DSP and run any FFT related code? I assume there are some compiler switches I'm missing, all of the files are there it just won't link. It seems many people all over the internet have had this problem and each 'solution' seems to be hyper tailored to that individual.

Not that this should make a difference but I'm developing my code in Visual Studio 17 with the VisualGDB plugin with my project being of type Embedded.

1 ACCEPTED SOLUTION

Accepted Solutions
DKref
Associate

The issue was that MSBuild in VS2017 was ignoring the arm_bitreversal2.S file and not even bothering to compile it. To fix this issue I did the following:

  • Selected the arm_bitreversal2.S file in the project explorer
  • Right-clicked on the file and went to 'Properties'
  • Under 'Configuration Properties>General' select 'Item Type'
  • Change 'Item Type' to 'C/C++ Compiler'
  • Click 'OK'
  • Clean and rebuild

Simple fix that solved all of my problems.

View solution in original post

3 REPLIES 3

Ok so focus on making a function that's visible to the linker.

Why isn't  arm_bitreversal2.S getting built? Makefile looking for *.s vs *.S ?

Why doesn't  arm_bitreversal2.o contain an exportable symbol form of arm_bitreversal_32 ?

Look at the listing file. Look at the object via an objcopy type disassembly

If you can't figure out the why, how about explicitly putting the code in startup.S that you know the assembler is building.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
AvaTar
Lead

> Has anyone gotten GCC to link CMSIS DSP and run any FFT related code? I assume there are some compiler switches I'm missing, all of the files are there it just won't link. It seems many people all over the internet have had this problem and each 'solution' seems to be hyper tailored to that individual.

I have used CMSIS DSP code, and especially the FFT functions, several times.

And since I use Crossworks which is not directly supported by ST's examples, I had to re-make every example, adding all the resources manually.

Is the respective source file really part of your project ?

Check the source for "suspicious" defines. The DSP code used to differ between M0, M3 and M4 variants.

DKref
Associate

The issue was that MSBuild in VS2017 was ignoring the arm_bitreversal2.S file and not even bothering to compile it. To fix this issue I did the following:

  • Selected the arm_bitreversal2.S file in the project explorer
  • Right-clicked on the file and went to 'Properties'
  • Under 'Configuration Properties>General' select 'Item Type'
  • Change 'Item Type' to 'C/C++ Compiler'
  • Click 'OK'
  • Clean and rebuild

Simple fix that solved all of my problems.