Including CMSIS library to PSoC project

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

 1. How to include CMSIS library to the PSoC project?

   

Ans:

   

Here are the steps that needs to be followed to include the CMSIS library in your project:

   

1. Please copy the CMSIS library into your project's directory.

   

2. In workspace explorer(in creator), right click your project and select 'Build settings'->compiler->General. In the 'Additional include directories', add the path of the header files(include folder of CMSIS library).

   

3. In the same window, change 'preprocessor definitions' to 'ARM_MATH_CM3'.

   

4. In the same window, please go to linker->general and add 'additional libraries' as 'm'. Apply changes and close the window.

   

5. In arm_math.h file, add this line "include <device.h>".

   

6. Since PSoC 5 already contains part of the CMSIS library in "Generated_Source\cy_boot", we have to delete the following definitions.

   

In core_cmInstr.h, remove the definition of following functions:

   

__RBIT, __LDREXB, __LDREXH, __LDREXW, __STREXB, __STREXH, __STREXW, __CLREX.

   

In core_cmFunc.h, remove

   

__get_PSP, __set_PSP, __get_MSP, __set_MSP, _get_PRIMASK, _set_PRIMASK, _enable_fault_irq, _disable_fault_irq, __get_BASEPRI, _set_BASEPRI, __get_FAULTMASK, __set_FAULTMASK, _enable_irq, _disable_irq, _get_CONTROL, _set_CONTROL.

   

7. Right click source files (workspace explorer), select add->existing item->'and add all necessary source files that you are using'.

   

Now, the project will build.

   

Note: Step 6 is not needed in creator 3.0.

   
        
0 Likes
2 Replies
Anonymous
Not applicable

Hi there

   

Why do you need to add "#include <device.h>" in "arm_math.h"?

   

The method didn't work for me when it ran into a compiler error as it couldn't find the "device.h" file (on PSoC Creator 3.0)

   

I had to remove that line to make it work

   

 

   

Rgds

   

Bill

0 Likes
Anonymous
Not applicable

Hi,

   

 

   

I found that you should add  "#include <project.h>"  in stead of device.h   (in Creator 3 and for PSoC5).

   

After that, no errors

   

Rob

0 Likes