开发者

MATLAB C++ Code Generation

So I'm working on the design flow for my DSP where the filtering algorithm is modeled in MATLAB first, and then converted to C/C++ for the actual DSP hardware using MATLAB coder. Pretty basic I thought.

So my plan was to write my own C main function which gets inputs from the ADC registers etc and then just call the generated filter function in my main function. I would then include the filter.c and filter.h in the source files for my project in TI's CodeComposerStudio.

I've tested the design flow with a simple MATLAB function that just takes two numbers and multiplies them together. Now the result of running codegen on that function is crazy. There's around 20 files created. So when I'm adding source files to my CCS project I actually have to add every single library huh? It seems to me like this code can't possibly be efficient?

Am I missing something that would allow MATLAB to just generate a simple one header one source implementation? Is the code generated actually efficient? Has anyone actually had experience using MATLAB Coder for realtime DSP stuff?

Thanks.


EDIT: The only files I'm adding to my CCS project are the .c and associated .h files 开发者_运维知识库that MATLAB generated. Shouldn't that be a pretty simple linking process? Is there anyway I can generate a makefile through MATLAB that would help with this process?


MATLAB's code generation makes use of their extensive, well implemented libraries. In terms of development time, this can create a lot of efficiencies for you. However, MATLAB's intended use case here is for desktop development. If you are linking to libraries matlab provided, TI CCS build chain probably won't be making the best use of these libraries, if it can even link.

I've worked with CCS a good deal, and you will be hand recoding the important parts with the various hinting pragmas and vectorized functions. MATLAB cant help you there, DSP is a very different beast than MATLAB's normal targets. It also seems to be in the way for a clean start to a framework. My advice would be to start from scratch with CCS, and use the matlab implementation for test validation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜