I used your way of compiling. I added -V
$ cat do_test
#! /bin/bash -x
#SDCC_DIR=/public/salo/pic/sdcc-svn/pic14-r11327
SDCC_DIR=/home/don/c/pic/sdcc/branchTest/sdcc
SDCC="$SDCC_DIR/bin/sdcc -V --use-non-free --nostdinc
-I$SDCC_DIR/device/include/pic14 -I$SDCC_DIR/device/non-free/include/pic14
--nostdlib -L$SDCC_DIR/device/lib/build/pic14
-L$SDCC_DIR/device/non-free/lib/build/pic14"
$SDCC -mpic14 -p16f1825 test2.c
$ ./do_test
+ SDCC_DIR=/home/don/c/pic/sdcc/branchTest/sdcc
+ SDCC='/home/don/c/pic/sdcc/branchTest/sdcc/bin/sdcc -V --use-non-free
--nostdinc -I/home/don/c/pic/sdcc/branchTest/sdcc/device/include/pic14
-I/home/don/c/pic/sdcc/branchTest/sdcc/device/non-free/include/pic14 --nostdlib
-L/home/don/c/pic/sdcc/branchTest/sdcc/device/lib/build/pic14
-L/home/don/c/pic/sdcc/branchTest/sdcc/device/non-free/lib/build/pic14'
+ /home/don/c/pic/sdcc/branchTest/sdcc/bin/sdcc -V --use-non-free --nostdinc
-I/home/don/c/pic/sdcc/branchTest/sdcc/device/include/pic14
-I/home/don/c/pic/sdcc/branchTest/sdcc/device/non-free/include/pic14 --nostdlib
-L/home/don/c/pic/sdcc/branchTest/sdcc/device/lib/build/pic14
-L/home/don/c/pic/sdcc/branchTest/sdcc/device/non-free/lib/build/pic14 -mpic14
-p16f1825 test2.c
+ /home/don/c/pic/sdcc/branchTest/sdcc/bin/sdcpp -nostdinc -Wall -std=c11
-I/home/don/c/pic/sdcc/branchTest/sdcc/device/include/pic14
-I/home/don/c/pic/sdcc/branchTest/sdcc/device/non-free/include/pic14
-D__SDCC_PROCESSOR="16f1825" -D__SDCC_PIC16F1825 -D__SDCC_PIC14_ENHANCED
-D__SDCC_PIC14_STACK_SIZE=17 -obj-ext=.o -D__SDCC_CHAR_UNSIGNED
-D__SDCC_USE_NON_FREE -D__SDCC=3_9_2 -D__SDCC_VERSION_MAJOR=3
-D__SDCC_VERSION_MINOR=9 -D__SDCC_VERSION_PATCH=2 -D__SDCC_REVISION=11327
-D__SDCC_pic14 -D__STDC_NO_COMPLEX__=1 -D__STDC_NO_THREADS__=1
-D__STDC_NO_ATOMICS__=1 -D__STDC_NO_VLA__=1 -D__STDC_ISO_10646__=201409L
-D__STDC_UTF_16__=1 -D__STDC_UTF_32__=1 test2.c
+ gpasm -o test2.o -c test2.asm
+ gplink -I/home/don/c/pic/sdcc/branchTest/sdcc/device/lib/build/pic14
-I/home/don/c/pic/sdcc/branchTest/sdcc/device/non-free/lib/build/pic14 -w -r
-o test2 test2.o libsdcce.lib pic16f1825.lib
message: Using default linker script
"/usr/local/share/gputils/lkr/16f1825_g.lkr".
error: Duplicate symbol "_main" defined in "test2.o" and "libsdcce_a-idata.o".
warning: Relocation symbol "_cinit" [0x0000] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0004] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0018] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x001C] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0000] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0004] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0018] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x001C] has no section. (pass 0)
error: Error while writing hex file.
+ gplink -I/home/don/c/pic/sdcc/branchTest/sdcc/device/lib/build/pic14
-I/home/don/c/pic/sdcc/branchTest/sdcc/device/non-free/lib/build/pic14 -w -r
-o test2 test2.o libsdcce.lib pic16f1825.lib returned errorcode 256
I notice that (void)INTCONbits; fixes the _INTCONbits problem.
As you would expect, I do not see the _cinit error with a program
containing data.
I do not wish to impact real development. If this problem I am
having seems to be unique to me, please move on with something of
more importance. Please let me know if there is real help I can
provide.
- Don
On Jul 26, Gonzalo Pérez de Olaguer Córdoba propounded certain bytes, to wit:
> Subject: Re: [Sdcc-user] pic14 users: Please test the pic14 branch!
>
> Hi, Don.
>
> If you add the option -V to sdcc you will see the commands it executes
> to run external commands (gpasm and gplink). I suspect you may be
> mixing different versions.
>
> I'm compiling this way:
>
> $ SDCC_DIR=/public/salo/pic/sdcc-svn/pic14-r11327
> $ SDCC="$SDCC_DIR/bin/sdcc --use-non-free --nostdinc
> -I$SDCC_DIR/device/include/pic14 -I$SDCC_DIR/device/non-free/include/pic14
> --nostdlib -L$SDCC_DIR/device/lib/build/pic14
> -L$SDCC_DIR/device/non-free/lib/build/pic14"
> $ $SDCC -mpic14 -p16f1825 test2.c
>
> The options --nostdlib and -L... tell gplink where to look for libraries.
> Be sure it takes the libraries built from the pic14 branch.
>
>
>
>
>
> El Fri, 26 Jul 2019 10:39:58 -0400
> Don Wooton <[email protected]> escribió:
>
> > I have a newer gpasm than you.
> >
> > gpasm --version
> > gpasm-1.5.2 #1319 (Jul 18 2019)
> >
> > The test2.c file is exactly as you sent it.
> >
> > /home/don/c/pic/sdcc/branchTest/testInstall/bin/sdcc --version
> > SDCC : pic14 3.9.2 #11327 (Linux)
> > published under GNU General Public License (GPL)
> >
> > /home/don/c/pic/sdcc/branchTest/testInstall/bin/sdcc \
> > --use-non-free -mpic14 -p16f1825 --nostdinc \
> > -I/home/don/c/pic/sdcc/branchTest/testInstall/share/sdcc/include/pic14 \
> >
> > -I/home/don/c/pic/sdcc/branchTest/testInstall/share/sdcc/non-free/include/pic14
> > \
> > test2.c
> > message: Using default linker script
> > "/usr/local/share/gputils/lkr/16f1825_g.lkr".
> > error: Duplicate symbol "_main" defined in "test2.o" and
> > "libsdcce_a-idata.o".
> > warning: Relocation symbol "_cinit" [0x0000] has no section. (pass 0)
> > warning: Relocation symbol "_cinit" [0x0004] has no section. (pass 0)
> > warning: Relocation symbol "_cinit" [0x0018] has no section. (pass 0)
> > warning: Relocation symbol "_cinit" [0x001C] has no section. (pass 0)
> > warning: Relocation symbol "_cinit" [0x0000] has no section. (pass 0)
> > warning: Relocation symbol "_cinit" [0x0004] has no section. (pass 0)
> > warning: Relocation symbol "_cinit" [0x0018] has no section. (pass 0)
> > warning: Relocation symbol "_cinit" [0x001C] has no section. (pass 0)
> > error: Error while writing hex file.
> >
> > --------------------
> >
> > /usr/local/bin/sdcc --version
> > SDCC :
> > mcs51/z80/z180/r2k/r3ka/gbz80/tlcs90/ez80_z80/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8/pdk13/pdk14/pdk15
> > 3.9.2 #11326 (Linux)
> > published under GNU General Public License (GPL)
> >
> > /usr/local/bin/sdcc \
> > --use-non-free -mpic14 -p16f1825 --nostdinc \
> > -I/usr/local/share/sdcc/include/pic14 \
> > -I/usr/local/share/sdcc/non-free/include/pic14 \
> > test2.c
> > message: Using default linker script
> > "/usr/local/share/gputils/lkr/16f1825_g.lkr".
> > warning: Relocation symbol "_cinit" [0x0000] has no section. (pass 0)
> > warning: Relocation symbol "_cinit" [0x0004] has no section. (pass 0)
> > warning: Relocation symbol "_cinit" [0x0018] has no section. (pass 0)
> > warning: Relocation symbol "_cinit" [0x001C] has no section. (pass 0)
> > warning: Relocation symbol "_cinit" [0x0000] has no section. (pass 0)
> > warning: Relocation symbol "_cinit" [0x0004] has no section. (pass 0)
> > warning: Relocation symbol "_cinit" [0x0018] has no section. (pass 0)
> > warning: Relocation symbol "_cinit" [0x001C] has no section. (pass 0)
> >
> > - Don
> >
> > On Jul 26, Gonzalo Pérez de Olaguer Córdoba propounded certain bytes, to
> > wit:
> > > Subject: Re: [Sdcc-user] pic14 users: Please test the pic14 branch!
> > >
> > > Hi, Don.
> > >
> > > El Wed, 24 Jul 2019 20:08:09 -0400
> > > Don Wooton <[email protected]> escribió:
> > >
> > > > [...]
> > > > I was not so successful with _INTCONbits. Maybe I did not do it
> > > > correctly?
> > >
> > > You did it right. All the variations you tried work for me.
> > > Maybe the difference is this:
> > >
> > > $ gpasm --version
> > > gpasm-1.5.0 #1285 (May 29 2019)
> > >
> > > What version of gputils are you using?
> > >
> > > > Manually adding extern _INTCONbit into main.asm in the correct
> > > > section did work but would be rather a pain to automate.
> > >
> > > Please try the attached file test2.c
> > >
> > > In case of failure, please post the C file and the resulting
> > > assembly file.
> > >
> > > --
> > > Gonzalo Pérez de Olaguer Córdoba [email protected]
> > > -=- buscando empleo desde 1988 -=- www.gpoc.es
> > >
> > > PGP: 3F87 CCE7 8B35 8C06 E637 2D57 5723 9984 718C A614
> >
> > > #include "pic16f1825.h"
> > >
> > > typedef unsigned int config_word_t;
> > > static __code config_word_t __at _CONFIG1 config1Reg = 0x01;
> > > static __code config_word_t __at _CONFIG2 config2Reg = 0x01;
> > >
> > >
> > > #define disableIntr() \
> > > (void)INTCONbits; \
> > > __asm __endasm; \
> > > __asm bcf _INTCONbits,7 ; disableIntr() __endasm; \
> > > __asm btfsc _INTCONbits,7 __endasm; \
> > > __asm goto $-2 __endasm; \
> > > __asm __endasm
> > >
> > > #define enableIntr() \
> > > __asm __endasm; \
> > > __asm bsf _INTCONbits,7 ; enableIntr() __endasm; \
> > > __asm __endasm
> > >
> > > void main(void)
> > > {
> > > disableIntr();
> > >
> > > enableIntr();
> > > }
> > >
> >
> >
> > > _______________________________________________
> > > Sdcc-user mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/sdcc-user
> >
> > >-- End of excerpt from Gonzalo Pérez de Olaguer Córdoba'
> >
> >
> > _______________________________________________
> > Sdcc-user mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/sdcc-user
>
>
> --
> Gonzalo Pérez de Olaguer Córdoba [email protected]
> -=- buscando empleo desde 1988 -=- www.gpoc.es
>
> PGP: 3F87 CCE7 8B35 8C06 E637 2D57 5723 9984 718C A614
>
>
> _______________________________________________
> Sdcc-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sdcc-user
>-- End of excerpt from Gonzalo Pérez de Olaguer Córdoba'
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user