Hi,

I am trying to use sdcc (pic14) with a pic16f876a. The compilation works 
but the program does not.

Here is the source, test.c:
#################
#define __16f876a
#include "pic14/pic16f876a.h"

// Setup chip configuration
__code unsigned short __at(0x2007) _conf = (_CP_OFF &
  _WDT_OFF &
  _BODEN_OFF &
  _PWRTE_ON &
  _HS_OSC &
  _LVP_OFF);

void main(void)
{
     TRISB = 0x00; // PORT B all output
     PORTB = 0xFF; // Enable all
     while(1)  {
     }
}
#################

These are the commands I use to compile:
/opt/cross/bin/sdcc -c -mpic14 -p16f876a -I 
/opt/cross/share/sdcc/non-free/include/ --use-non-free test.c
gpasm -c test.asm
gplink test.o /opt/cross/share/sdcc/non-free/lib/pic14/pic16f876a.lib 
/opt/cross/share/sdcc/lib/pic14/libsdcc.lib 
-I/opt/cross/share/sdcc/include/ -a inhx8m -O 1 -o test.hex

Hardware: Just two LEDs at RB2 and RB3 (which stay off).

 > sdcc --version
SDCC : 
mcs51/gbz80/z80/z180/r2k/r3ka/ds390/pic16/pic14/TININative/ds400/hc08/s08 3.1.5 
#7873 (Jun 10 2012) (Linux)

I use a bootloader, but the program also does not work when flashed 
directly.

Changing
STARTUP    code 0x0000
     nop
     pagesel __sdcc_gsinit_startup
     goto    __sdcc_gsinit_startup

to

STARTUP    code 0x0000
     nop
     pagesel _main
     goto    _main

in test.asm gives a working program (the leds are on). Another asm 
program compiled with gputils also works.
What may be the problem here?

Kind Regards,
Vinzenz


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to