Have a look into the "System Reference Guide" (from Creator Help menu). Everything is explained there. There are no handlers for your interrupts yet, you'll have to provide them yourself.
I know how to use handlers from peripherals. But I would like to know the method to use interrupts defined by Cortex-M0.
Basically, CM0 MCU of STM or NXP define the handler start up file. Also FM0+ is the same as STM or NXP.
It is easy to modify the handler name. Because it is just rename by #define.
Whereas Creator have to define CY_ISR() and CY_ISR_PROTO() or API for peripheral. But there is no information for SVCall or others in PSoC Creator User Guide because I searched key word with SVC or Pend but did not hit in PDF.
Please let me know example code.
There is no default software for "SVC" or "Pend" in the PSoC generated code;
To associate a handler with the callback, you would need to call the ISR_startex(callback_handler); function with the associated peripheral that you want to be handled by the function.
Or, if you have the handler function prototype/name written to match the default naming of the peripheral, then you can use just ISR_Start();
Look up the documentation on ISRs and interrupt handling to see example code and the two methods I mentioned above.
If I put a component has interrupt function such as "Interrupt" or "SCB" in Schematic space, I can indicate the component name into the API of ISR(Component Name)_StartEx(); or ISR(Component Name)_SetVector();. But SVC, PendSV and SysTick are not peripheral such as components prepared by Cypress. Those are common exceptions in Cortex-M MCU.
Generally, Interrupt handler name is defined in a start up file .s, but the start up file generated by Creator does not have the definitions for handler. Whereas, start up file of PSoC6 has the definitions.
If the handlers is defiled like PSoC6, I can use the handler in my source code such as below.
/* Write handler behavior*/
However, PSoC4 does not have the description in start up file.
Therefore, I have to use the API for component peripherals but the component for SVC, PendSV and Systick are not prepared in Component Catalog. So I am confusing how to use and indicate those in Creator.
Below is about PSoC5 and FreeRTOS.
SVC, PendSV and Systik handler is defined by function pointer, and the definition is set to ram address like below.
extern void xPortPendSVHandler( void );
extern void xPortSysTickHandler( void );
extern void vPortSVCHandler( void );
extern cyisraddress CyRamVectors;
CyRamVectors[ 11 ] = ( cyisraddress ) vPortSVCHandler;
CyRamVectors[ 14 ] = ( cyisraddress ) xPortPendSVHandler;
CyRamVectors[ 15 ] = ( cyisraddress ) xPortSysTickHandler;
I understand if we offset vector table address from flash to ram, we can call the vPortSVCHandler, xPortPendSVHandler and xPortSysTickHandler when those exception happen. But it spend ram space and it is not easy to read and the cause of confusing in future. So at first, I would like to know the interrupt algorithm for PSoC4 to make ideal environment for my system.
Please kindly let me know an example or documentation for available of these handlers.
The FreeRTOS example has references to the SVC in it: http://www.cypress.com/blog/technical/freertos-psoc-component
Here is a thread where someone wanted to setup the same thing: Are there software interrupts on PSoC4?
bob.marlowe answers are useful from what I am looking at
2 of 2 people found this helpful
You can declare your own handler for these interrupts, and install the ISR in its appropriate entry in the interrupt vector table. An example code for PSoC4000 is as below:
/* Pointer to the function to be called back by the PendSV ISR */
typedef void (* PENDEDCALLBACK_PTR)(void);
/* Pointer to pended callback function */
volatile PENDEDCALLBACK_PTR pendedCallbackPtr;
/* Setup interrupt vectors */
/* Set the interrupt priority, SHPR3 has SYSTICK and PENDSV priority */
(INTERRUPT_PRIORITY_1 << CM0_SHPR3_PRI_14_SHIFT) | (INTERRUPT_PRIORITY_1 << CM0_SHPR3_PRI_15_SHIFT));
void RegisterPendedCallback(PENDEDCALLBACK_PTR callbackPtr)
/* Register the function callback */
pendedCallbackPtr = callbackPtr;
/* Set PendSV interrupt state to pending */
/* Clear PendSV interrupt pending status */
/* Call the pended function registered */