Jump to content
russ_hensel

Integer Math: Linker Problem?

Recommended Posts

I am a new ( free ) use of BoostC having a problem, with the linker. ( boostc is not installed under Program Files, by the way ).

 

When I have a subroutine that I include the line

 

MinStepsTarg = ( unsigned char ) ( MinNow * 10 ) / ( 3 );

 

in my program I can compile but not link. Simply commenting it out removes the problem ( and breaks the program ). It may also be of interest that with the line in but no calls to the subroutine the subroutine is optimized out, and there is no problem. I suspect that I need to tell the linker some dirty little secret, but cannot figure it out.

 

Here is the build output.

 

Building...

BoostC Optimizing C Compiler Version 6.60 (for PIC16 architecture)

http://www.sourceboost.com

Copyright© 2004-2006 Pavel Baranov

Copyright© 2004-2006 David Hobday

 

Single user Lite License (Unregistered) for 0 node(s)

Limitations: PIC12,PIC16 max code size:2048 words, max RAM banks:2, Non commercial use only

 

 

WClock.c

 

success

BoostLink Optimizing Linker Version 6.60

http://www.sourceboost.com

Copyright© 2004-2006 Pavel Baranov

Copyright© 2004-2006 David Hobday

 

 

Caution: argument of 'delay_10us' calls must have a value of 1 or more

Warning unreferenced functions removed:

rotateMin in: C:\Russ\Per\_XX\PIC\BoostC\WClock\WClock.c

InitMotorPos in: C:\Russ\Per\_XX\PIC\BoostC\WClock\WClock.c

spinMin in: C:\Russ\Per\_XX\PIC\BoostC\WClock\WClock.c

IncrementHr in: C:\Russ\Per\_XX\PIC\BoostC\WClock\WClock.c

IncrementHrFunky in: C:\Russ\Per\_XX\PIC\BoostC\WClock\WClock.c

 

Unexpected program termination!

 

 

Failure

D:\APPS\SOURCEBOOST\boostc.pic16.exe WClock.c -t PIC16F871

D:\APPS\SOURCEBOOST\boostlink.pic.exe /ld D:\APPS\SOURCEBOOST\lib libc.pic16.lib WClock.obj /t PIC16F871 /d C:\Russ\Per\_XX\PIC\BoostC\WClock /p WClock

Exit code was -2.

Removing target: WClock.hex

Failed to locate output file 'C:\Russ\Per\_XX\PIC\BoostC\WClock\WClock.hex'

Done

 

Failed

 

 

Fix this for me and I will buy the product and then bug you with more questions.

 

Thanks

 

Russ

Share this post


Link to post
Share on other sites

Russ,

I am a new ( free ) use of BoostC having a problem, with the linker. ( boostc is not installed under Program Files, by the way ).

 

....

....

 

Fix this for me and I will buy the product and then bug you with more questions.

The first thing to try is version V6.70 that is now available. Maybe this problem is already fixed.

 

Regards

Dave

Share this post


Link to post
Share on other sites

The first thing to try is version V6.70 that is now available. Maybe this problem is already fixed.

 

Regards

Dave

 

Still does not work. ( output below )

 

This is the second time I did it. First time I think the error message was a bit different with something about a library being out of date. But I could not get that part of the message a second time.

 

Despite this I bought the compiler anyway, so you really owe me. ( this is still the

free version as I do not have my registration yet )

 

Russ

 

 

 

Building...

BoostC Optimizing C Compiler Version 6.70 (for PIC16 architecture)

http://www.sourceboost.com

Copyright© 2004-2007 Pavel Baranov

Copyright© 2004-2007 David Hobday

 

Single user Lite License (Unregistered) for 0 node(s)

Limitations: PIC12,PIC16 max code size:2048 words, max RAM banks:2, Non commercial use only

 

 

WClock.c

 

success

BoostLink Optimizing Linker Version 6.70

http://www.sourceboost.com

Copyright© 2004-2007 Pavel Baranov

Copyright© 2004-2007 David Hobday

 

 

Caution: argument of 'delay_10us' calls must have a value of 1 or more

Warning unreferenced functions removed:

rotateMin in: C:\Russ\Per\_XX\PIC\BoostC\WClock\WClock.c

InitMotorPos in: C:\Russ\Per\_XX\PIC\BoostC\WClock\WClock.c

spinMin in: C:\Russ\Per\_XX\PIC\BoostC\WClock\WClock.c

IncrementHr in: C:\Russ\Per\_XX\PIC\BoostC\WClock\WClock.c

IncrementHrFunky in: C:\Russ\Per\_XX\PIC\BoostC\WClock\WClock.c

 

 

 

failure

Unexpected program termination!

D:\APPS\SOURCEBOOST\boostc.pic16.exe WClock.c -t PIC16F871

D:\APPS\SOURCEBOOST\boostlink.pic.exe /ld D:\APPS\SOURCEBOOST\lib libc.pic16.lib WClock.obj /t PIC16F871 /d C:\Russ\Per\_XX\PIC\BoostC\WClock /p WClock

Exit code was -2.

Removing target: WClock.hex

Failed to locate output file 'C:\Russ\Per\_XX\PIC\BoostC\WClock\WClock.hex'

Done

 

Failed

Share this post


Link to post
Share on other sites

I hate to say this, buit that does not look like a boostC issue at all ...

 

i had this same error at one point due to antivirus software blocking

a poorly named exe. file.pic.exe is flagged as a masked exicuitable.

 

Check your antivirus settings and perhaps add the boostC exicuitables

to the exception list.

Share this post


Link to post
Share on other sites
I hate to say this,  buit that does not look like a boostC issue at all ...

 

i had this same error at one point due to antivirus software blocking

a poorly named exe.  file.pic.exe is flagged as a masked exicuitable.

 

Check your antivirus settings and perhaps add the boostC exicuitables

to the exception list.

 

No this doesn't look like antivirus blocking the linker. If that was the case you wouldn't see any output from the linker. Looks like something happens in the middle of linker execution. This could be as simple as a crash :( It will be great if you can send your project to support@sourceboost.com so we try to reproduce the problem.

 

Regards,

Pavel

Share this post


Link to post
Share on other sites
I hate to say this,  buit that does not look like a boostC issue at all ...

 

i had this same error at one point due to antivirus software blocking

a poorly named exe.  file.pic.exe is flagged as a masked exicuitable.

 

Check your antivirus settings and perhaps add the boostC exicuitables

to the exception list.

 

No this doesn't look like antivirus blocking the linker. If that was the case you wouldn't see any output from the linker. Looks like something happens in the middle of linker execution. This could be as simple as a crash :( It will be great if you can send your project to support@sourceboost.com so we try to reproduce the problem.

 

Regards,

Pavel

 

There is nothing saying that error is from the linker, "Unexpected program termination!" is

one of the standard windows errors when a program dumps. The same one i have if my

AV is blocking it, as it just kills the process.

 

:( no screenshot for you, my new antivirus program gives a different combination of outputs

when the linker is blocked from a simple "failure" to "file not found".

Edited by emte

Share this post


Link to post
Share on other sites
No this doesn't look like antivirus blocking the linker. If that was the case you wouldn't see any output from the linker.

There is nothing saying that error is from the linker, "Unexpected program termination!" is

one of the standard windows errors when a program dumps. The same one i have if my

AV is blocking it, as it just kills the process.

But before the error, BoostC and BoostLink are both reporting version/copyright/messages, so they're not being completely blocked from executing. Are you saying that the AV is letting a program run but restricting its access?

Share this post


Link to post
Share on other sites

Russ

Send to support: Done

Looks like a compiler/linker bug.

 

Here is a work around:

	MinStepsTarg = (unsigned char)(unsigned int)( MinNow * 10);

 

Regards

Dave

Share this post


Link to post
Share on other sites

Dave,

 

Your work around may not alway be effective.

/*
  File: bug18.C
  Target: PIC16F877A
  OS: WinXP, SP2
  SourceBoostIDE: 6.70
  Compiler: BoostC 6.70
  Reproducible: always
  Expected behavior: link without error
 
  Description: 
 
   casting an experssion to a smaller data type provokes link error

   Examples:
     uI = (unsigned int)(uL * 10); // fails
     uC = (unsigned char)(uL * 10); // fails
     uC = (unsigned char)(unsigned int)(uL * 10); // fails
     uC = (unsigned char)(unsigned long)(uL * 10); // works
     uC = (uL * 10); // works
 
   Unsigned to signed does not seem to have a problem.
 
   This error is also context dependent:

   Example (this works):

     uI = (uL * 10);
     uC = (unsigned char)(uI * 10);
 
   Example (this fails):

     //uI = (uL * 10);
     uC = (unsigned char)(uI * 10);
*/
 
/*
Building...
BoostC Optimizing C Compiler Version 6.70 (for PIC16 architecture)
http://www.sourceboost.com
Copyright(C) 2004-2007 Pavel Baranov
Copyright(C) 2004-2007 David Hobday

Licensed to cac001 under Single user Pro License for 2 node(s)
Limitations: PIC12,PIC16 max code size:Unlimited, max RAM banks:Unlimited

bug19.c

success
BoostLink Optimizing Linker Version 6.70
http://www.sourceboost.com
Copyright(C) 2004-2007 Pavel Baranov
Copyright(C) 2004-2007 David Hobday

failure
"C:\Program Files\SourceBoost\boostc.pic16.exe" bug19.c -t PIC16F648A 
"C:\Program Files\SourceBoost\boostlink.pic.exe" /ld "C:\Program Files\SourceBoost\lib" libc.pic16.lib bug19.obj /t PIC16F648A /d C:\Public\SourceBoost\bugs /p bug19
Exit code was -2.
Removing target: bug19.hex
Unexpected program termination!
Failed to locate output file 'C:\Public\SourceBoost\bugs\bug19.hex'
Done

Failed

*/
#include <system.h>

unsigned long uL = 100;
unsigned int  uI = 100;
unsigned char uC;

void main()
{ 
 do
 {
   //uC = (unsigned char) (uL * 10);
   //uI = (unsigned int)  (uL * 10);
   uI = (uL * 10);
   uC = (unsigned char)(uI * 10);
 } while (1);
}

Share this post


Link to post
Share on other sites
No this doesn't look like antivirus blocking the linker. If that was the case you wouldn't see any output from the linker.

There is nothing saying that error is from the linker, "Unexpected program termination!" is

one of the standard windows errors when a program dumps. The same one i have if my

AV is blocking it, as it just kills the process.

But before the error, BoostC and BoostLink are both reporting version/copyright/messages, so they're not being completely blocked from executing. Are you saying that the AV is letting a program run but restricting its access?

 

Yes and No, it initially lets the program run until it tries to alter any data within the system.

So you see all the version and copyright stuff, then it gets killed, the system reports a failure

and the error gets dumped to the status window by sourceboost.

Share this post


Link to post
Share on other sites

Does compile and link with this. I have not tested to make sure

computation is correct, but more or less assume it is. Will post further if

there is any problem. Workaround is pretty painless, but I am not sure

I would have ever hit on it myself.

 

Thanks

 

 

Russ

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

×
×
  • Create New...