Jump to content
Sign in to follow this  
parky

Boostc 1.6 And Mplab 6.6 - Modulo Arithmetic Error

Recommended Posts

Bug description:

======================================================

With the following code, I get the listed output log as well as an MPLab message box:

 

Code:

----------------------------

#include <system.h>

 

#pragma CLOCK_FREQ 10000000

 

void main()

{

unsigned char ctemp = 0;

 

trise = 0x00;

 

while (1 == 1)

{

porte = ctemp++;

ctemp = ctemp % 8;

delay_ms(1);

}

}

 

 

Output Log:

----------------------------

Clean: Deleting intermediary and output files.

Clean: Deleted file "test1.OBJ".

Clean: Deleted file "C:\Shared\Programming\BoostC\MPLabTest1\test1.HEX".

Clean: Done.

Executing: "C:\Program Files\SourceBoost\boostc.pic18.exe" test1.c -O0 -W2 -di -v -t18F452

BoostC Optimizing C Compiler Version 1.6 Alpha (for PIC18 architecture)

http://www.picant.com/c2c/c.html

Copyright© 2004 Pavel Baranov

Copyright© 2004 David Hobday

 

 

test1.c success

success

Executing: "C:\Program Files\SourceBoost\linker.exe" "C:\Shared\Programming\BoostC\MPLabTest1\test1.obj" -O0 -v -t18F452

BoostLink Optimizing Linker Version 1.6 Alpha

http://www.picant.com/c2c/c.html

Copyright© 2004 Pavel Baranov

Copyright© 2004 David Hobday

Optimisation level:0 - Off

Warning: Unable to successfully create 'delay_us' with clock freq 10000000 Hz

Error: Unresolved external function:_rem_8_8

Error: unresolved external symbol, function:_rem_8_8

 

Failed

Loaded C:\Shared\Programming\BoostC\MPLabTest1\test1.HEX

BUILD SUCCEEDED: Tue Nov 02 18:44:04 2004

 

 

Message Box:

----------------------------

"The end of the file has been reached unexpectedly; the hex file appears to have been corrupted."

 

 

Expected Behavior:

=====================================================

The code works fine if, instead of "ctemp = ctemp % 8;", I put the following:

 

if (ctemp > 7)

ctemp = 0;

 

 

IDE version: MPLab 6.60

Compiler: BoostC

Compiler version: 1.6

Target device: PIC18F452

OS: Windows XP Pro

Share this post


Link to post
Share on other sites

If code uses */% operations it needs to link with libc library. When building from SourceBoost IDE this is done automatically. Otherwise you need to link with libc library using other means. (For libc library look into the 'lib' subdirectory in your SourceBoost installation directory).

 

Regards,

Pavel

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