PSoC4: Library Building

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

cross mob
ShVy_264716
Level 4
Level 4
50 replies posted 25 replies posted 10 replies posted

Hi All

   

I am working in a direction to build a library project in Creator. I have placed a default UART SCB and a Timer component in my schematic of the library project. I want to configure ISR handlers for both. But I do not know how to declare those ISR handlers because the standard "CY_PROTO_ISR (HandlerName);" format gives an error during compilation. Is there any method to declare and define ISR Handlers in a library project?

   

 

   

Thanks in advance.

   

 

   

Regards

   

Shaunak

0 Likes
8 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

A "Library" offers something to read, in terms of programming it contains C-code functions.

   

When (as in PSoC quite usual) some hardware is involved you should start creating a component.

   

This ensures, that the declared hardware and the associated software (APIs) work together.

   

 

   

Bob

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

"CY_PROTO_ISR (HandlerName);" only defines the function prototype so the compiler knows about it. You also need to define the actual ISR function (with "CY_ISR (HandlerName);"), and then make it known to the component (which then has a "X_StartEx(&HandlerName)" function).

0 Likes

hli: I have already applied the same method described by you, but I am still getting errors. I want to use the inbuilt UART and Timer components and create some user defined header and C files supporting them. As per my requirement, I went through the Component Author Guide and they are recommending to create a library project for this purpose. My need is: I want a plug and play library project of GSM that I can link with my new project anytime I want and get the things done fast with using the defined GSM library. For doing so, I need to configure two interrupts: 1. UART Rx 2. Timer. I am already done with all the defining header and C files related. I want to create a dedicated C file that has my ISR definitions. But I am still not able to integrate the two ISRs library within my project.

   

 

   

Regards

   

Shaunak

0 Likes
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted
        Shaunak, For better response please post your project (or better a small demo exemplifying the problem).   
0 Likes
lock attach
Attachments are accessible only for community members.

odissey1: Please find attached the library project. The CY_ISR_PROTO method is not working. I am not able to use cycode and cystatus related to EEPROM component because I can't find Em_EEPROM component in the Component List. By the time I have come to know that I am not able to generate application for the predefined components of Creator. That is why I am not able to use the Start_Ex API of the ISR component.

   

Regards

   

Shaunak

0 Likes
        
  • it is good (and essential practice) to make sure header files get included only once (by having at the to a #IFNDEF __myheader #DEFINE __myheader ..... #ENDIF
  •     
  • in your UART_Timer.h you declare the prototype of ISRUARTRxHandler (which is correct), but never implement this function (this would need a CY_ISR(ISRUARTRxHandler) somewhere)
  •     
  • in UART_Timer.h you declare the prototype of ISRTimerHandler, but UART_Timer.c uses MyTimerHandler
  •     
  • _StartEx must get the address of the function (as in _StartEx(&MyTimerHandler) )
  •    
0 Likes

hli: I am writing to you again. The CY_ISR_PROTO method is not working. I am not able to use cycode and cystatus related to EEPROM component because I can't find Em_EEPROM component in the Component List. By the time I have come to know that I am not able to generate application for the predefined components of Creator. That is why I am not able to use the Start_Ex API of the ISR component. I already know how to use the Start_Ex API. I haven't included the "CY_ISR" thing in the project as it gives error.

   

Regards

   

Shaunak

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

If you woul tell what exactly "is not working" means maybe we could help. Same with your CY_ISR issues. Both are that methods everybody else uses, so they work.

   

When you don't find an emulated EEPROM component, the device you have selected doesn't support it. In that case, its normal that you can 't use it - there is nothing we can do about it (and surely you can't use the code from component).

0 Likes