CMSIS 2.1 DSP in Codewarrior

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CMSIS 2.1 DSP in Codewarrior

3,398 Views
emh203
Contributor II

Has anyone successfully gotten the DSP libraries for CMSIS 2.1 to compile under codewarrior?   I am trying to use the SIMD integer instructions.

 

See Attached project.  I added the Header and sources files as well as defined  "__GNUC__" and  defined the symbols "ARM_MATH_CM4".  I get an error called "illegal number" that appears to be emitted by the assembler.

 

It seems that the problem lies in the inline assembly code used for the SIMD instructions.  For example in core_cm4.simd.h:

 

__ASM volatile ("sadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) );

 

it doesn't appear that CW likes this style of inline arguments (a string with arguments)

 

Can someone from the compiler team chime in?

 

 

 

12 Replies

1,327 Views
AMH23
Contributor II

If you're still interested I can post some details on how I was able to do it.  It's not extensively tested by any means.  I built the library, included it in a project and the type conversion and q31 cosine function seems to work correctly.

0 Kudos

1,327 Views
emh203
Contributor II

Please post what you got to work!

0 Kudos

1,327 Views
AMH23
Contributor II

The main trick is to use the Freescale supplied DSP intrinsics file: ${MCUToolsBaseDir}/ARM_EABI_Support/ewl/EWL_Runtime/Runtime_ARM/Common_Includes/cw_cortex_M4_dsp.h

You'll need some very simple modifications in core_cm4.h and core_cm4_simd.h which are in the CMSIS Include directory.  I've attached my versions.  If you are targeting a CPU with a floating point unit you may have more work to do.  See core_cm4.h line 142

Then a few adjustments to the project environment, such as defining ARM_MATH_CM4.  I don't know if I remember all the project settings specifics, so I'm attaching a zipfile of the project.  Extract it into the CMSIS/DSP_Lib/Source directory.  This will create a CWMCU directory which you will use as the eclipse workspace.  The project inside is arm_cortexM4x_math.  I'm not an eclipse expert, so I don't know how to tell you how to make the CWMCU folder be a proper workspace with the arm_cortexM4x_math project inside (I did not include my workspace metadata).  Maybe open Eclipse and tell it to use the CWMCU folder as the workspace and then import the project?  Or maybe it will see the project automatically.

Build the project and it will create a library file arm_cortexM4x_math.a  You'll get some warnings, but they all come from the Freescale intrinsics file and appear benign.  Since I did not implement a post build copy step, you'll want to manually move that file to a new folder called something like CMSIS/Lib/CWMCU.  I'm not an eclipse expert so I can't guarantee that I made a totally portable project (e.g. no absolute paths), so let me know if there is a problem building.

0 Kudos

1,327 Views
greglapin
Contributor I

The attached file that Aaron refers to: "I'm attaching a zipfile of the project" is no longer attached.

Would someone please restore it?

Thanks,

Greg

0 Kudos

1,327 Views
Monica
Senior Contributor III

Hello Greg!

Unfortunately, the content that neither AMH23 nor jordimerc said they posted is longer available due to the platform migration we had last September.

For us to be able to see the complete post, they would have to restore the zipfiles and attach them once again within the thread.

It would be great if you guys could upload the attachments once again.

Thank you!

Kindly,

Monica.

0 Kudos

1,327 Views
AMH23
Contributor II

Here are the files from my earlier posting.

1,327 Views
Monica
Senior Contributor III

I appreciate it Aaron! Thank you!

0 Kudos

1,326 Views
jordimerc
Contributor II

Hi,

 

I've followed the steps given by AMH23 and I've successfully build the arm_cortexM4x_math.a library, but I've not been able to create a new project and use such library.

I've created a new blank project in the same workspace include the headers from C:\CMSIS-2_10\CMSIS folder and the library.

when trying to build the application it doesn't recognize the variables although if I select it and press F3 it goes to its definition

I'm attachint the project 

Any comment will be helpful!


Thanks

Jordi

0 Kudos

1,326 Views
marcelo_freek
Contributor I

I'm having problems to register @ onarm.com.

 

After filling the register form, I try to log to download the library, but it says "your login data doesn't match our records".

 

Is there some workaround to solve it ?

 

I'm sure I used the correct data to log.

 

Marcelo

 

0 Kudos

1,327 Views
PeterFromSweden
Contributor III

Beware of the 2.10 patch for 4096 point FFT. It breaks operation of fixed point implementation, it only works for floatint point. The problem is the bit reverse table that is redefined for 4096 points, but is assumed to be 1024 points in fixed point FFT implementation.

0 Kudos

1,327 Views
PaoloRenzo
Contributor V

Maybe trying Keil or IAR ports? Only GNU supports that kind of comments as part of the assembler inlining

0 Kudos