Hi, Philipp and Don.

The error with the configuration words can be avoided by declaring
them 'static', as shown (but not explicitly said) in the sdcc manual.

And to make the pic14 branch backwards compatible with the trunk with
respect to this issue, a change in src/pic14/glue.c should be made:

- The pieces of code that handle the configuration words can be identified
  looking for a call to pic14_assignConfigWordValue.

- In trunk it appears in pic14_constructAbsMap and in emitSymbolSet.

- In the pic14 branch only appears in pic14_constructAbsMap. It should be
  removed from this function and be moved to pic14_emitRegularMap.

I think the right way to go here should be to consider obsolete and discourage
this way to define values for the configuration words and implement it
through pragmas (as pic16 already does), and extend it to also support
ID locations.

With respect to the _INTCONbits errors, this is the same situation as
we had with _main in idata.c: the pic14 branch doesn't declare symbols
unused in C code (the trunk does it), and _INTCONbits is only used inside 
inlined
assembly code, where sdcc doesn't detect symbol usage.

Adding '__asm extern _INTCONbits __endasm;' somewhere before (or inside)
disableIntr() will do.




El Tue, 23 Jul 2019 22:51:20 +0200
Philipp Klaus Krause <p...@spth.de> escribió:

> Thanks.
> 
> I can reproduce the issue using the test program below:
> 
> test.asm:24:Error[113]   Symbol not previously defined: "_config2Reg"
> test.asm:25:Error[113]   Symbol not previously defined: "_config1Reg"
> test.asm:101:Error[113]   Symbol not previously defined: "_INTCONbits"
> test.asm:102:Error[113]   Symbol not previously defined: "_INTCONbits"
> test.asm:106:Error[113]   Symbol not previously defined: "_INTCONbits"
> 
> I compiled using ~/sdcc-branches/pic14/sdcc/bin/sdcc --use-non-free
> -mpic14 -p16f1825 --nostdinc
> -I/home/philipp/sdcc-branches/pic14/sdcc/device/include/pic14
> -I/home/philipp/sdcc-branches/pic14/sdcc/device/non-free/include/pic14
> test.c
> 
> I see no such error when compiling using sdcc from trunk.
> 
> Philipp
> 
> Program (tried to send as attachmnt earlier, but didn't show up on the
> list):
> 
> #include "pic16f1825.h"
> 
> typedef unsigned int config_word_t;
> __code config_word_t __at _CONFIG1 config1Reg = 0x01;
> __code config_word_t __at _CONFIG2 config2Reg = 0x01;
> 
> 
> #define disableIntr() \
>       __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
> Sdcc-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sdcc-user


-- 
   Gonzalo Pérez de Olaguer Córdoba       s...@gpoc.es
  -=- buscando empleo desde 1988 -=-       www.gpoc.es 

PGP: 3F87 CCE7 8B35 8C06 E637  2D57 5723 9984 718C A614


_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to