Jump to content
Sign in to follow this  
chuckk

__div_16_16 Problem

Recommended Posts

Hi,

 

I have a block of code that needs to be called from a periodic interrupt. The code compiles OK, but in the link I get this:

 

Error: Function called in more than one execution thread: __div_16_16

 

This is running on a PIC18F4260.

 

Is there any way to either get source to this function or to force a call to an interrupt-friendly version?

 

Thanks!

Share this post


Link to post
Share on other sites

Chuck,

Hi,

 

I have a block of code that needs to be called from a periodic interrupt. The code compiles OK, but in the link I get this:

 

Error: Function called in more than one execution thread: __div_16_16

 

This is running on a PIC18F4260.

 

Is there any way to either get source to this function or to force a call to an interrupt-friendly version?

 

Thanks!

Upgrade to BoostC V6.55.

This will allow a function to be called from more than thread of execution and gives a serious warning.

Unless you ensure that the calls from the two thread cannot occure at the same time (re-enterancy) then the software stack will become corrupted. You can prevent the function from being called from the interrupt routine when called from the main thread of execution by disabling interrupts before the call.

 

 

This code won't suffer from software stack corruption problems:

void foo()
{
   ... do something
}

void interrupt()
{
   foo();
}

void main()
{
   Disable Interrupts
   foo();
   Enable Interrupts
}

 

Regards

Dave

Share this post


Link to post
Share on other sites

[

Upgrade to BoostC V6.55.

This will allow a function to be called from more than thread of execution and gives a serious warning.

Unless you ensure that the calls from the two thread cannot occure at the same time (re-enterancy) then the software stack will become corrupted. You can prevent the function from being called from the interrupt routine when called from the main thread of execution by disabling interrupts before the call.

 

 

This code won't suffer from software stack corruption problems:

void foo()
{
   ... do something
}

void interrupt()
{
   foo();
}

void main()
{
   Disable Interrupts
   foo();
   Enable Interrupts
}

 

Regards

Dave

 

Thanks. I will do that. Anyway, I found a workaround for this case, after tracking down where the offending function was getting called from - instead of a divide, I use a right shift - no more problem.

 

Chuck

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...