PSoC API Regeneration causes vanishing code

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

cross mob
Anonymous
Not applicable

Hey.. my problem is as follows:

   

I'm using the PSoC 5, with a UART and LCD as peripherals and two interrupts tied to the Rx and Tx interrupts of the UART block. In main.c I have defined a variable [volatile uint8 user_control] which i intend will be updated by the UART interrupt: So in the interrupt header file isc_xxx.h i made an entry [extern volatile uint8 user_control]. Now the problem is that whenever i mak some changes to the top design; e.g. changing peripherals or settings - all the API files are recompiled and my 'extern' entry is gone - and the compile fails.

   

Now since I know this I am able to go back and add it again, but when there are more variables in more it'll be a PITA. Is there some workaround or anything? I notice that _code_ inside the isr functions remains intact somehow...

   

Thanks,

   

Abhijit

0 Likes
4 Replies
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

In every Interrupt.c file(For example if the name of ISR component instance is isr1, isr1.c),  there is a dedicated region for defines and includes which looks like this, 

   

/* `#START isr_1_intc` */

   


   

/* `#END` */

   

As long as the includes, in your case the extern variable is placed within this start and end construct, even if a clean and build is performed the includes will be retained. Picture attached illustrates the same.

0 Likes
Anonymous
Not applicable

Abhijit,

   

 

   

Please don't forget to include the necessary header files in the ISR file. In this case, you'll have to include the header file of the UART component used (like UART.h). The extern declaration and header files to be included should be written between the  following lines

   

/* `#START isr_rx_intc` */

/* `#END` */

   

The snap shot below shows the same.

   

0 Likes
Anonymous
Not applicable

The code which has to be executed upon occurrence of interrupt should be written in the section CY_ISR(isr_xxx_Interrupt). And the statements which has to be executed has to be written between the statements

   

    /* `#START isr_rx_Interrupt` */

    /* `#END` */

   

The code written within this part will not be erased upon build.

   

The snapshot below shows the same:

   

0 Likes
Anonymous
Not applicable

Ah yes.. thanks! Somehow completely missed the obvious...

   

~Abhijit

0 Likes