Giter VIP home page Giter VIP logo

Comments (8)

christophe0606 avatar christophe0606 commented on June 20, 2024

@ACleverDisguise You need to avoid using initialization functions like arm_cfft_init_f32 and instead use dedicated versions for the FFT lengths you need. For instance arm_cfft_init_512_f32

There are similar functions for other data types, and other transforms (rfft ...)

Like that, the linker will be able to deduce the table that are not used and they won't be included in the final build.

Those functions are documented in the doxygen generated documentation.

There is also a new section in the README : https://github.com/ARM-software/CMSIS-DSP?tab=readme-ov-file#code-size

(The required build and link options that are compiler dependent must also be used : like -ffunction-sections, -fdata-sections, -Wl,--gc-sections ...)

from cmsis-dsp.

ACleverDisguise avatar ACleverDisguise commented on June 20, 2024

I'm calling arm_cfft_init_256_q15().

It's still bringing in every size of every static variable.

from cmsis-dsp.

christophe0606 avatar christophe0606 commented on June 20, 2024

What's your compiler and command line options for compiling and linking ?

from cmsis-dsp.

ACleverDisguise avatar ACleverDisguise commented on June 20, 2024

IAR and I have no idea: the IDE does its level best to conceal that from me. I'll go digging to see what command line it comes up with.

from cmsis-dsp.

ACleverDisguise avatar ACleverDisguise commented on June 20, 2024

Ah, never mind. A third-party (as in another coworker's) file had a call for the general init and I wasn't expecting it to have any calls to the math lib at all, not to mention FFT.

Stripping that out and replacing it with the appropriately-sized init (64 in this case) solved our problem. Thanks, @christophe0606!

from cmsis-dsp.

ACleverDisguise avatar ACleverDisguise commented on June 20, 2024

Problem solved, but this really needs to be documented in the actual library docs, not buried in a README. Like perhaps arm_cfft_init_<type>()'s documentation should mention the sized variants?

Or optionally initialization could be a macro call that parametrizes by size and type like this: ARM_CFFT_INIT(&my_init_struct, q15, 256) and have that assemble the call to arm_cfft_init_256_q15(&my_init_struct)?

A macro I've (loosely) tested that does this is below:

#define ARM_CFFT_INIT_IMPL(S, T, N) arm_cfft_init ##N ##T(S)
#define ARM_CFFT_INIT_PREP(S, T, N) ARM_CFFT_INIT_IMPL(S, _ ##T, _ ##N)
#define ARM_CFFT_INIT(S, T, N) ARM_CFFT_INIT_PREP(S, T, N)

This permits me to write code like this:

#define DATA_TYPE q15
#define SAMPLE_SIZE 256
ARM_CFFT_INIT(&my_struct, DATA_TYPE, SAMPLE_SIZE)

And if I decide I want to expand or contract my sample size, I change it in one place and all uses are updated. Similarly if I decide I want to move to f32, I change it in one place and it gets updated everywhere.

from cmsis-dsp.

christophe0606 avatar christophe0606 commented on June 20, 2024

@ACleverDisguise We will upgrade the documentation so that it is more visible.
The macro is a good suggestion. Thank you.

from cmsis-dsp.

ACleverDisguise avatar ACleverDisguise commented on June 20, 2024

I've written now about a dozen such macros for the features I use. They've really helped in rapid changes while testing and prototyping. I'm sure if I spent actual time on it, I'd make macros that sucked slightly less. ;)

from cmsis-dsp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.