gnupic: Re: [gnupic] sdcc and pic16f877.h


Previous by date: 1 Aug 2005 10:00:15 +0100 [gnupic] more on weird resets, Bill Freeman
Next by date: 1 Aug 2005 10:00:15 +0100 Re: [gnupic] more on weird resets, John Sheahan
Previous in thread:
Next in thread:

Subject: RE: [gnupic] sdcc and pic16f877.h
From: Chen Xiao Fan ####@####.####
Date: 1 Aug 2005 10:00:15 +0100
Message-Id: <3B8AEFFADD3DD4118F8100508BACEC2C07F773EA@spex>

Get the latest sdcc and gputils from CVS and then follow
the procedures described in Martyn Welch's website.

http://ubicomp.lancs.ac.uk/~martyn/sdcc_linux/

Then the problem will be fixed. I've tested the building
process in both Ubuntu 5.04 (Debian based) and Fedora
Core 3 (newly installed, just to see if there is any difference
between Fedora and Ubuntu in terms of PIC development).

Take note that the include statement should be like following.
#include "pic/pic16f84.h"

Regards,
Xiaofan

// sample test.c from Martyn Welch.
// compile with: 
// sdcc -mpic14 -p16f84 test.c
// need the latest CVS of sdcc and gputils

#define __16f84
#include "pic/pic16f84.h"

// Set the __CONFIG word:
typedef unsigned int word;
word at 0x2007  __CONFIG = 0x3f72;

unsigned char count;

void main(void) {

        TRISA = 0;
        count = 0;
        while(1) {
                PORTA = count;
                count ++;
        }

}

-----Original Message-----
From: Odd Skjaeveland
Sent: Tuesday, July 12, 2005 5:26 PM

I am new to sdcc (and gputils) and try to learn how to use
sdcc/gputils for a pic16f877 project using a debian (unstable) 
system. I installed debian binaries and used the inc2h.pl script
to create the *.h files.

My first simple source file main.c :

#define __16F877

int
main(void)
{
  return(0);
}

Never mind the return from main in an embedded system, the code 
will just be used to illustrate what I need help to figure out.

I invoke the compiler (version 2.5.0 #1020) like this:

sdcc -I /usr/share/sdcc/include/pic -mpic14 -p16f877 main.c

sdcc compiles and assembles my main.c just fine. The following
compiles, but it does not assemble:

#define __16F877
#include <pic16f877.h>        /*  <---- new  */

int
main(void)
{
  return(0);
}

The assembler complains:

main.asm:128:Error [113] Symbol not previously defined (s0x7F)

The return statement is apparently supposed to store the return
value at location 0x7F, for which the compiler hands a
symbolic 's0x7F' to the assembler.

In the first case the assembler knows the definition of s0x7F,
(the compiler includes it in the .asm file) but this knowledge 
is lost somehow when I include the pic16f877.h file.

Removing #define __16F877 does not appear to have any effect 

I would appreciate if someone could point a sdcc/gputils beginner
in the right direction.

--
Odd Skjaeveland

Previous by date: 1 Aug 2005 10:00:15 +0100 [gnupic] more on weird resets, Bill Freeman
Next by date: 1 Aug 2005 10:00:15 +0100 Re: [gnupic] more on weird resets, John Sheahan
Previous in thread:
Next in thread:


Powered by ezmlm-browse 0.20.