Thank you for the information!

Making the configuration words static did seem to fix that.
I will fix it everywhere that I have it wrong.
I do like making the change to be like elsewhere though.

I was not so successful with _INTCONbits.  Maybe I did not do it correctly?
Adding the extern inside disableIntr like this:

#define disableIntr() \
        __asm   extern _INTCONbits                      __endasm; \
        __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

Or like this

#define disableIntr() \
        __asm; \
                extern _INTCONbits; \
                bcf   _INTCONbits,7; \
                btfsc _INTCONbits,7; \
                goto  $-2; \
        __endasm;

Gave this error
main.asm:785:Error[181]   Duplicate label or redefining symbol that cannot be 
redefined: "_INTCONbits"
In both trunk and the pic14 branch


I also tried adding
    __asm extern _INTCONbits __endasm
prior to main() or as the first line in main().  Both failed.

Manually adding extern _INTCONbit into main.asm in the correct
section did work but would be rather a pain to automate.

I can clearly implement this specific task with
    do GIE = 0; while (GIE);
but it adds an additional BANKSEL. Since INTCON is on every page,
I would rather not.  Also, this is likely not the only code which
causes this difficulty.

    - Don


On Jul 24, Gonzalo Pérez de Olaguer Córdoba propounded certain bytes, to wit:
> Subject: Re: [Sdcc-user] pic14 users: Please test the pic14 branch!
>
> 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.


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

Reply via email to