Jump to content
Sign in to follow this  
simon

Thread Safety

Recommended Posts

Hi,

 

I'm currently 'studying' PIC programming using C, and looking to purchase a C compiler!!! I feel fairly confident on most aspects but I would be greatful if somebody could clarify the the situation regarding interrupts/thread safety!!

 

Basically what are the issues!

 

I can understand that the isr may interrupt the 'main loop' at any point and hence (global) variables may be in a inderterminate state, but why can't functions be used in both isr and main routines.

 

Surley the sw stack is used for 'main' and 'interrupt' functions, so local vars so they should be safe while the isr is running??

 

Does this relate to memory allocated for static vars, memory overlay/re-use, stack issues, or something else!!!

 

Also:

 

- Does the BoostC compiler use the 'advanced' instructions of the PIC18 chips??

- Are there any plans to integrate floats into the language & add a math library??

 

Thanks in advance...

 

Si

Share this post


Link to post
Share on other sites
I can understand that the isr may interrupt the 'main loop' at any point and hence (global) variables may be in a inderterminate state, but why can't functions be used in both isr and main routines.

 

Surley the sw stack is used for 'main' and 'interrupt' functions, so local vars so they should be safe while the isr is running??

The software stack (or memory overlay) means that all the memory useage on the "stack" has to be known at the time of linking the program. That makes functions that use the software stack un-interruptible or corruption will occur.

 

Does this relate to memory allocated for static vars, memory overlay/re-use, stack issues, or something else!!!
Primarily it's the memory overlay, but there are other issues as you mention.

 

- Does the BoostC compiler use the 'advanced' instructions of the PIC18 chips??
No.

 

- Are there any plans to integrate floats into the language & add a math library??
There is a floating point library, have a look at the Floating point library documention supplied with the SourceBoost installation.

 

Regards

Dave

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...