Jump to content
richardc

Error: Unresolved External Function Trying To Divide

Recommended Posts

further issue I can't get a simple division to work

 

surely a 16bit divide will fit in a demo won't it ?

or do I need to include a math lib from somewhere

 

I'm using mplabx.

 

make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf

make[1]: Entering directory `C:/Users/rc/Documents/xc8/sbblink18/sbblink18.X'

make -f nbproject/Makefile-default.mk dist/default/production/sbblink18.X.production.hex

make[2]: Entering directory `C:/Users/rc/Documents/xc8/sbblink18/sbblink18.X'

gnumkdir -p build/default/production

"C:\Program Files\SourceBoost\xlaunch.exe" -t PIC18F45K20 -obj "build/default/production" -o "build/default/production/newmain.o" newmain.c

BoostC Optimizing C Compiler Version 7.22 (for PIC18 architecture)

http://www.sourceboost.com

Copyright© 2004-2014 Pavel Baranov

Copyright© 2004-2014 David Hobday

 

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

Limitations: PIC18 max code size:8192 bytes, max RAM banks:2, Non commercial use only

 

 

newmain.c

 

success

gnumkdir -p dist/default/production

"C:\Program Files\SourceBoost\boostlink_picmicro.exe" -t PIC18F45K20 -ld "C:\Program Files\SourceBoost"\lib -p dist/default/production/sbblink18.X.production.hex build/default/production/newmain.o

BoostLink Optimizing Linker Version 7.22

http://www.sourceboost.com

Copyright© 2004-2014 Pavel Baranov

Copyright© 2004-2014 David Hobday

 

 

 

 

failure

Error: Unresolved external function:'__div_16_16(unsigned short,unsigned short)'

Error: Unresolved external function:'__div_16_16(unsigned short,unsigned short)'

Error: Unresolved external function:'__div_16_16(unsigned short,unsigned short)'

Error: Unresolved external function:'__div_16_16(unsigned short,unsigned short)'

Error: Unresolved external function:'__div_16_16(unsigned short,unsigned short)'

Error: Unresolved external function:'__div_16_16(unsigned short,unsigned short)'

Error: Unresolved external function:'__div_16_16(unsigned short,unsigned short)'

Error: Unresolved external symbol, function:__div_16_16

make[2]: *** [dist/default/production/sbblink18.X.production.hex] Error -2

make[1]: *** [.build-conf] Error 2

make: *** [.build-impl] Error 2

make[2]: Leaving directory `C:/Users/rc/Documents/xc8/sbblink18/sbblink18.X'

make[1]: Leaving directory `C:/Users/rc/Documents/xc8/sbblink18/sbblink18.X'

 

BUILD FAILED (exit value 2, total time: 9s)

 

 

 

 

 

 

#include "system.h"

//#include "stdlib.h"

//#include "PIC18F45K20.h"

// #pragma config statements should precede project file includes.

// Use project enums instead of #define for ON and OFF.

 

// CONFIG1H

#pragma config FOSC = INTIO67 // Oscillator Selection bits (Internal oscillator block, port function on RA6 and RA7)

#pragma config FCMEN = OFF // Fail-Safe Clock Monitor Enable bit (Fail-Safe Clock Monitor disabled)

#pragma config IESO = OFF // Internal/External Oscillator Switchover bit (Oscillator Switchover mode disabled)

 

// CONFIG2L

#pragma config PWRT = OFF // Power-up Timer Enable bit (PWRT disabled)

#pragma config BOREN = SBORDIS // Brown-out Reset Enable bits (Brown-out Reset enabled in hardware only (SBOREN is disabled))

#pragma config BORV = 18 // Brown Out Reset Voltage bits (VBOR set to 1.8 V nominal)

 

// CONFIG2H

#pragma config WDTEN = OFF // Watchdog Timer Enable bit (WDT is controlled by SWDTEN bit of the WDTCON register)

#pragma config WDTPS = 32768 // Watchdog Timer Postscale Select bits (1:32768)

 

// CONFIG3H

#pragma config CCP2MX = PORTC // CCP2 MUX bit (CCP2 input/output is multiplexed with RC1)

#pragma config PBADEN = OFF // PORTB A/D Enable bit (PORTB<4:0> pins are configured as digital I/O on Reset)

#pragma config LPT1OSC = OFF // Low-Power Timer1 Oscillator Enable bit (Timer1 configured for higher power operation)

#pragma config HFOFST = ON // HFINTOSC Fast Start-up (HFINTOSC starts clocking the CPU without waiting for the oscillator to stablize.)

#pragma config MCLRE = ON // MCLR Pin Enable bit (MCLR pin enabled; RE3 input pin disabled)

 

// CONFIG4L

#pragma config STVREN = ON // Stack Full/Underflow Reset Enable bit (Stack full/underflow will cause Reset)

#pragma config LVP = OFF // Single-Supply ICSP Enable bit (Single-Supply ICSP disabled)

#pragma config XINST = OFF // Extended Instruction Set Enable bit (Instruction set extension and Indexed Addressing mode disabled (Legacy mode))

 

// CONFIG5L

#pragma config CP0 = OFF // Code Protection Block 0 (Block 0 (000800-001FFFh) not code-protected)

#pragma config CP1 = OFF // Code Protection Block 1 (Block 1 (002000-003FFFh) not code-protected)

#pragma config CP2 = OFF // Code Protection Block 2 (Block 2 (004000-005FFFh) not code-protected)

#pragma config CP3 = OFF // Code Protection Block 3 (Block 3 (006000-007FFFh) not code-protected)

 

// CONFIG5H

#pragma config CPB = OFF // Boot Block Code Protection bit (Boot block (000000-0007FFh) not code-protected)

#pragma config CPD = OFF // Data EEPROM Code Protection bit (Data EEPROM not code-protected)

 

// CONFIG6L

#pragma config WRT0 = OFF // Write Protection Block 0 (Block 0 (000800-001FFFh) not write-protected)

#pragma config WRT1 = OFF // Write Protection Block 1 (Block 1 (002000-003FFFh) not write-protected)

#pragma config WRT2 = OFF // Write Protection Block 2 (Block 2 (004000-005FFFh) not write-protected)

#pragma config WRT3 = OFF // Write Protection Block 3 (Block 3 (006000-007FFFh) not write-protected)

 

// CONFIG6H

#pragma config WRTC = OFF // Configuration Register Write Protection bit (Configuration registers (300000-3000FFh) not write-protected)

#pragma config WRTB = OFF // Boot Block Write Protection bit (Boot Block (000000-0007FFh) not write-protected)

#pragma config WRTD = OFF // Data EEPROM Write Protection bit (Data EEPROM not write-protected)

 

// CONFIG7L

#pragma config EBTR0 = OFF // Table Read Protection Block 0 (Block 0 (000800-001FFFh) not protected from table reads executed in other blocks)

#pragma config EBTR1 = OFF // Table Read Protection Block 1 (Block 1 (002000-003FFFh) not protected from table reads executed in other blocks)

#pragma config EBTR2 = OFF // Table Read Protection Block 2 (Block 2 (004000-005FFFh) not protected from table reads executed in other blocks)

#pragma config EBTR3 = OFF // Table Read Protection Block 3 (Block 3 (006000-007FFFh) not protected from table reads executed in other blocks)

 

// CONFIG7H

#pragma config EBTRB = OFF // Boot Block Table Read Protection bit (Boot Block (000000-0007FFh) not protected from table reads executed in other blocks)

#pragma CLOCK_FREQ 64000000

void my_ms(unsigned int d);

void main(void) {

osccon=0X70;

osctune.PLLEN=1;

trisd=0;

 

for (; ;)

{

latd.2=0;

latd.1 = 1; // turn on LED on GP1 (bit 1)

latd.3=!portd.3;

my_ms(2000); // stay on for 2000 ms

latd.1=0;

latd.2=1; // turn off LED (clearing GPIO clears GP1)

my_ms(500); // stay off for 800 ms

 

} // repeat forever

 

// repeat forever

 

 

 

 

 

 

return;

}

void my_ms(unsigned int d){

 

for(int i=0;i<d/10;i++){

delay_ms(10);

}

}

Share this post


Link to post
Share on other sites

Hi Richard,

 

It looks like the linker could not find the "libc.pic18.lib" to resolve the linkage.

 

I am not an MPLAB user so cannot give you much advice.

 

I assume you did the integrate thing when you installed SB.

 

Check the integration section in the manual.

Check you have some setting pointing you towards the SB library directory.

 

Cheers

 

Reynard

Share this post


Link to post
Share on other sites

it seems installing sourceboost in "program files\sourceboost" is the problem , the linker looks in " files\sourcesboost" the space in the file name is an issue.

I copied the sourceboost\lib files to another directory and then add the required library from the new directory to the mplabx project

its a bit rough

Share this post


Link to post
Share on other sites

looks like my reply disappeared i'll try again.

the linker seems to be unable to access lib files in "program files\sourceboostlib\" seems not to like space in directory name

solution for mplabx ,copy lib files to a directory with no spaces in path

Share this post


Link to post
Share on other sites

Hi Richard,

 

Working under the SB IDE having "Program Files" as a directory name is not a problem.

 

I mentioned a while ago that having spaces in source and header file names does cause a problem.

The solution was to insert underscores as word separators.

 

Others would have said something if spaces in directory name were causing problems under MPLAB.

 

Your example shows double quotes around the SB directory name.

 

Cheers

 

Reynard

Share this post


Link to post
Share on other sites

I can confirm that Richard is correct about the problem with adding libraries that have spaces in their path under MPLAB-X. I have been trying to use the function uitoa_hex() from the compiler documentation and I experienced the same problem with the linker.

 

I created a directory named 'C:\SB' and moved the library there, then added it to my project. Problem solved.

 

MPLAB-X does actually warn you about spaces in directory names having the potential to cause problems. It seems these problems start to show up when you want to add libraries to the project.

 

BJH.

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