cancel
Showing results for 
Search instead for 
Did you mean: 

Spirit MP3 decoder not usable if your project uses hardware floats

PHolt.1
Senior III

I am working on a simple mp3 player project and have spent a few days on the Spirit library, as offered by ST.

This comes in a binary (.a) form only lib_mp3decoder_cortex_m4_v2.2.0.a and has apparently been built for soft floats, using some weird mode where they drive the FPU directly - the "VFP reggister arguments" thing. My project uses the FPU for a lot of stuff, and since you apparently cannot mix these floating modes at link time, I get these errors

Searching online finds a 2021 reply from ST on same topic, where ST say the Spirit company no longer exists so they can't help. But the website is still there, so I emailed them. I got a reply, surprisingly:

They don't support users, so I need to contact ST, to which I replied that I am not a car manufacturer, and I am happy to give them some money for a cortex-m4 lib which is actually usable :)

Lots of people have been around this. I have a hardware float compiler setting but this mp3 lib uses something different. One poster suggests "The error message indicates that at least part of your system is using soft-float ABI."

Claude suggests a compatibility mode, for the whole project, whereby float parameters are passed as integers, which "may" be compatible. Problem is, I use hard floats in lots of places, including a custom-rebuilt libc.a stdlib library which I spent months on, all extensively tested...

I tried to compile my .c file (the one which calls this lib) with soft floats, via some compiler command line spec. but this does not work. On the command line (GCC) I see -mfpu=fpv4-sp-d16 -mfloat-abi=hard and this is even if I put -mfloat-abi=softfp in the .c file properties / compiler flags. Someone did say this lib does weird float stuff. The doc says nothing about it.

Have there been any developments on this? It is silly to offer such a library for "cortex-m4" where most people will be looking to use hardware floats.

I also need the doc of the structure TSpiritMP3Decoder. It is carefully missing from all your documentation, which seems to be for some "demo" version of the Spirit lib.

These are my MCU settings

PHolt1_0-1764340814927.png

 

3 REPLIES 3
mƎALLEm
ST Employee

Similar topics:

Spirit MP3 Decoder support for hardware float

Could you release the MP3 decoder library with the hard float ABI?

STM32f429 and MP3 Decoder spirit

By reading an internal discussion (internal ticket refence 105443) it seems we don't have the source code of that library. I think MP3 spirit won't be released with HW float support as we couldn't compile it with FPU option.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
PHolt.1
Senior III

This is the email today from Spirit

From: Alexander Kravchenko <Kravchenko@videomost.com>
Date: Fri, 28 Nov 2025 11:06:53 +0000

Dear Peter-

Thank you for the query.
Please contact STMicroelectronics as we do not directly support their customers/users.

Thank you for understanding.

Kind regards,
Alex Kravchenko

I would be amazed that ST would distribute something this "big" and not have the source code. Especially as the 32F4xx have hardware single floats, which most people doing "maths" will be using in the "hard" mode.

I already saw those other threads. Obviously the Spirit company does exist, as the poster(s) pointed out.

In case ST wants to dig into this, I posted some extra info here
https://www.eevblog.com/forum/microcontrollers/simplest-way-to-do-sound-generation-from-an-mp3-file/msg6116673/#msg6116673
The funny thing appears to be that Spirit code does use the FPU but they call it directly, while building their .a library under the pretence that they use soft floats (i.e. do not use the FPU). This is a real hack and I wonder why anybody would do this, and then label the finished lib as "cortex m4".

AScha.3
Super User

I made a audio player, WAV, flac and MP3;

For the MP3 I recommend minimp3, search on GitHub.

Working fine, math is float.

I looked at the STM lib also, spirit, but I couldn't use it.

You can find 3 or more MP3 decoder libs on GitHub 

 

If you feel a post has answered your question, please click "Accept as Solution".