Hi,
I'm suffering a rather strange (at least to me) error:
error: missing definition for symbol "_ADCON2", required by "main.o"
It seems to refer to the following command in the main() routine in
main.c, since when I remove this command the error is no longer
present.
ADCON2 = 0x01;
I have been looking for a clue and I discovered (using the -V option
of sdcc) that the pic18f452.lib is used by gpasm and gplink instead
of pic18f4220.lib. I am unsure why this is used since I 'define' that
I want to use a pic18f4220 as following:
#define __18f4220
I am using the following command to compile my code:
sdcc -I ../lib -I ./ -I ../ -mpic16 --optimize-df --optimize-cmp \
--optimize-goto --fstack --obanksel=2 -Wl -s../lib/linker.lkr -V main.c
And the result of this command is:
+ "/usr/bin/sdcpp" -nostdinc -Wall -std=c99 -I"../lib" -I"./" -I"../"
-Dpic18f452 -D__18f452 -DSTACK_MODEL_SMALL -obj-ext=.o
-DSDCC_MODEL_SMALL -DSDCC=260 -DSDCC_pic16 -D__pic16
-I"/usr/bin/../share/sdcc/include/pic16"
-I"/usr/share/sdcc/include/pic16" -I"../lib" -I"./" -I"../" "main.c"
+ "/usr/bin/gpasm" -DSDCC_MODEL_SMALL -Dpic18f452 -D__18F452
-DSTACK_MODEL_SMALL -c "main.asm" -o "main.o"
+ "/usr/bin/gplink" -I"/usr/bin/../share/sdcc/lib/pic16"
-I"/usr/share/sdcc/lib/pic16" -s../lib/linker.lkr -o main main.o
crt0i.o pic18f452.lib libsdcc.lib
error: missing definition for symbol "_ADCON2", required by "main.o"
I have attached main.c in which my main() routine resides.
I hope one of you has a clue, because I am running out of them,
Thanks for the help to come :),
Maarten Faddegon
/* main.c
* Copyright 2006 Maarten Faddegon
* This file is part of the Delfi-C3 project.
*/
#include "lib/pic18f4680.h"
#include "util/types.h"
//#include "dev/adc.h"
// configuration bits
#define __18f4220
// Use the external oscillater with PLL enabled.
// Thus the clockspeed now is 4 * 4.9152Mhz.
code char at __CONFIG1H _conf0 = _OSC_HS_PLL_1H;
code char at __CONFIG2L _conf1 = _PUT_OFF_2L & _BODEN_OFF_2L;
code char at __CONFIG2H _conf2 = _WDT_DISABLED_CONTROLLED_2H;
code char at __CONFIG3H _conf3= _PBADEN_PORTB_4_0__analog_inputs_on_RSET_3H & _LOW_POWER_TIMER1_OSC_DISABLE & _MCLRE_MCLR_Enabled_RE3_Disabled_3H;
code char at __CONFIG4L _conf4 = 0x81; // _STVR_ON_4L & _LVP_OFF_4L
// TODO: replace hexadecimal values with defines
code char at __CONFIG5L _conf5 = 0x0F; //_CP_0_OFF_5L & _CP_1_OFF_5L & _CP_2_OFF_5L & _CP_3_OFF_5L;
code char at __CONFIG5H _conf6 = 0xC0; //_CPD_OFF_5H & _CPB_OFF_5H;
code char at __CONFIG6L _conf7 = 0x0F; //_WRT_0_OFF_6L & _WRT_1_OFF_6L & _WRT_2_OFF_6L & _WRT_3_OFF_6L;
code char at __CONFIG6H _conf8 = 0xE0; //_WRTD_OFF_6H & _WRTB_OFF_6H & _WRTC_OFF_6H;
code char at __CONFIG7L _conf9 = 0x0F; //_EBTR_0_OFF_7L & _EBTR_1_OFF_7L & _EBTR_2_OFF_7L & _EBTR_3_OFF_7L;
code char at __CONFIG7H _conf10 = 0x40; // _EBTRB_OFF_7H;
void main (void)
{
int i;
// set internal oscillator frequency to 31 kHz
OSCCONbits.IRCF2 = 0;
OSCCONbits.IRCF1 = 0;
OSCCONbits.IRCF0 = 0;
// select primary oscillator
// (the order -first SCS0 and then SCS1- assures us from a direct switch)
OSCCONbits.SCS0 = 0;
OSCCONbits.SCS1 = 0;
// make PORTB test output
PORTB = 0;
//adc_init(); TODO put me back!!
ADCON2 = 0x1;
while (true)
{
//PORTB = adc_get_voltage( AN1 ); TODO put me back!!
// wait a bit
for (i = 0; i < 0xff; ++i)
;
}
}
/** Interrupt Service Routine
*/
static void isr(void) interrupt 1
{
}
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user