Thanks very much for your help

I had to change the header file by hand, the format was not as you suggested.  If you don't mind spending a bit more time on me, could you tell me how you would have written the #define file to convert the following:

sfr P0      = 0x80;

into the format required?

Thanks again

Lee Russell

On 10/02/06, Jean-Paul <> wrote:

1. You _need_ the correct header file. The "memory locations" tell the
comppiler where data, code, stack... have to reside in the chip.
The header files (.h) give the physical address of each register.

Then you'll have to learn the numerous types of memory inside the chip:
registers, static RAM, static RAM indirectly accessed, code space,
external (auxiliary) RAM (with only indirect access), internal auxiliary
RAM (accessed as external RAM).

2. The Atmel files are not in the right format for sdcc.
Have a look at the definitions in the docs or in the SDCC .h files.

Once you have your REG8253.h, edit it to include the two '#define ...'
lines in the following:

* NAME: 89C51AC2.h
//#include "compiler.h"

#ifndef _89C51AC2_H_
#define _89C51AC2_H_

/* Include file for 8051 SFR Definitions  */

// These two lines convert the file from Atmel format to SDCC format
// simply copy them into the Atmel file
// then rename that .h file and include it in your source
// the compiler (in fact the preprocessor) knows what to do with them
// #define [input] [output]
// JP

#define Sfr(reg, addr) sfr at addr reg
#define Sbit(reg, addr, bit) sbit at addr+bit reg

/*  BYTE Register  */
Sfr (P0 , 0x80);
Sfr (P1 , 0x90);

Sbit (P1_7, 0x90, 7);
Sbit (P1_6, 0x90, 6);
Sbit (P1_5, 0x90, 5);

For example, the line
'Sbit (P1_7, 0x90, 7);'
is converted into
'sbit at 0x97 P1_7;'

It works for me with the 89C51AC2 controller.
It should work for you :-)


Le Vendredi 10 Février 2006 10:18, Lee Russell a écrit:
> Hello Everyone
> I am a complete novice as far as cross compiling goes, as such, I have
> to search the archives for the information I need, but I feel that I am
> missing something important.
> I am trying to compile some simple programs in C and place them on the
> AT89S8253.  I believe that the problems I am having are to do with
> locations", but as I said, I am so new to all this, I don't really know
> that means.  I am pretty sure that it is this letting me down as the pre
> compiled examples that came with the development board word fine when I
> write them to flash.
> How important is it to use the correct header file?  The header file I
> been supplied with is for the AT89S8252, is this significantly
different?  I
> have found a REG8253.h on the Atmel website is this the correct header
> Sorry for all the (probably) very simple questions, I am very keen to
> and look forward to your replies.
> Does anyone have any suggestions for a good place for a beginner in this
> field to start learning?
> Many thanks in advance

Never jump into a loop!

This email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
Sdcc-user mailing list