cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1

Anonymous
Not applicable

Hi, I am getting some warnings in my code. It is due to an interrupt routine -

   

This is the warning - MULTIPLE CALL TO FUNCTION.  I found out that I should create a reentrant file -  but I am not sure how to create one and what it should contain.

   

Best Regards 😉

0 Likes
1 Solution
Bob_Marlowe
Expert II

This error message pops up when you have got a routine that is called

   

a) from within an interrupt handler

   

and

   

b) from any other place in your project.

   

All will be well if you can avoid a) or b)

   

To make a reentrant function start reading here.

   

 

   

Bob

View solution in original post

0 Likes
7 Replies
Bob_Marlowe
Expert II

This error message pops up when you have got a routine that is called

   

a) from within an interrupt handler

   

and

   

b) from any other place in your project.

   

All will be well if you can avoid a) or b)

   

To make a reentrant function start reading here.

   

 

   

Bob

View solution in original post

0 Likes
Anonymous
Not applicable

Hi..

   

Okay, would a reentrant function solved my problem?

0 Likes
Bob_Marlowe
Expert II

Short answer: Yes!

   

Long answer: It is not your problem, it is a problem of the (old-fashioned) PSoC3 core 8051. This CPU has got a stack of only 256 bytes depth and there are a lot of provisions taken by Keil to have C-compiler generated code running flawlessly. To be quite honest I (personally) would suggest to start working with one of the more modern cores as PSoC5 with ARM M3 or PSoC4 with an M0 core.

   

Your above problem and others you have not come to yet do not exist in ARM cores.

   

Easiest door to the ARM - world:

   

CY8CKit-044 PSoC 4-M Pioneer development kit and the CY8CKit-059 the PSoC 5 prototyping kit.

   

 

   

Bob

Anonymous
Not applicable

Ok. I would definitely consider buying a Psoc5 (for future projects).

   

I have now used a re-entrant fill and I have been able to reduce the warnings from 13 til 6.

   

I have no idea- why the last 6 warnings are there. I have attached my code. 

   

Best regards.  

0 Likes
Bob_Marlowe
Expert II

You have to distinguish between your own function and generated code.

   

The former need a "reentrant" after their definition and declaration, the latter have to be put into the .cyre-file.

   

Your general problem is your program structure it looks like you try to handle everything within your interrupt handler. This is not recommended. Better practice is

   

In interrupt handler set a global (volatile!) flag to indicate the situation and reset the interrupt cause.

   

In main loop check for flag, if set, reset flag and act accordingly.

   

 

   

You have got many global variables in your functionner.c. Good practice is to declare those as "static" which will reduce the scope to this file only.

   

 

   

Bob

Anonymous
Not applicable

Hi Bob..

   

I now check for a flag in my main - and surprisingly the warnings are gone . Thanks for that

   

unfortunately new problems has arise.

   

plccom - (which is here the where interrupt flag is used) doesn't work and when my other functions in main also are

   

initialized (like udlejning and initservercommunication)... It is like my code gets stuck here. 

   

I have absolutely no ideas - why this is happening.

   

By the way I am also getting this warning 'returning': recursive call to non-reentrant function  

   

The code is detached.

   

Best regards. 

0 Likes
Bob_Marlowe
Expert II

When you compile and inspect the notes thoroughly you are hinted to the place of the warnings or you get names to search for in your code.

   

You have got a call to a function within the function (recursion)  When the function is declared as reentrant that will work, but I still question if that is wanted.

   

 

   

Bob

0 Likes