- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 😉
Solved! Go to Solution.
- Labels:
-
PSoC 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi..
Okay, would a reentrant function solved my problem?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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