Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#1064 bad code when INDF used in pic14

closed-works-for-me
5
2013-05-25
2006-02-13
rick
No

using:

SDCC :
mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08
2.5.4 #1198 (Jan 28 2006) (UNIX)
gplink-0.13.3 alpha

build commands:
/opt/emerald/nbp/sdcc/bin/sdcc -S -mpic14
-opt-code-size -p16f873 -Ibuild
-I/usr/share/sdcc/include/pic build/x.c -o build/x.asm
/opt/emerald/nbp/gputils/gpasm/gpasm -I
/opt/emerald/nbp/gputils/header -c build/x.asm -o build/x.o
/opt/emerald/nbp/gputils/gplink/gplink -m -s nbp.lkr -o
nbp.hex build/x.o /usr/share/sdcc/lib/pic16/libsdcc.lib

Leaving this line in:

bFlashAddressHigh = INDF;

causes the call:

Clear_Watchdog();

to generatea call to 0!:

000006 2000 call 0 CALL
_Clear_Watchdog

removing line causes correct assembly:

000006 200a call 0xa CALL
_Clear_Watchdog

Here is the file:
-------------------------------------------
#include <p16f873.h>
void Clear_Watchdog();

unsigned char bFlashAddressHigh;

void main(void)
{
Clear_Watchdog();
}//END OF MAIN

void Clear_Watchdog()
{
OPTION_REG = (1 << NOT_RBPU_BIT) + (1 << T0CS_BIT)
+ (1 << T0SE_BIT) +
(1 << PSA_BIT) + (1 << PS2_BIT) + (1 <<
PS1_BIT) + (1 << PS0_BIT);
}

void Flash_Write()

{
bFlashAddressHigh = INDF; /* comment this out and it
links okay !!! */

}

Discussion

  • Raphael Neider
    Raphael Neider
    2006-04-12

    • milestone: --> unreproducable
    • assigned_to: nobody --> tecodev
    • status: open --> pending-works-for-me
     
  • Raphael Neider
    Raphael Neider
    2006-04-12

    Logged In: YES
    user_id=1115835

    Seems to work in SDCC 2.5.6 build #1246 using the supplied
    header files.

    > /opt/emerald/nbp/gputils/gplink/gplink -m -s nbp.lkr -o
    > nbp.hex build/x.o /usr/share/sdcc/lib/pic16/libsdcc.lib
    You do not really link against libraries in the pic16
    directory, do you?

     
    • status: pending-works-for-me --> closed-works-for-me
     
  • Logged In: YES
    user_id=1312539

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 30 days (the time period specified by
    the administrator of this Tracker).