What does the code look like before the packihx command?

-----Original Message-----
From: Brandon Fosdick <bfoz@bfoz.net>
To: sdcc-user@lists.sourceforge.net
Sent: Wed, 21 Jan 2009 5:01 pm
Subject: [Sdcc-user] Nordic nRF24LE

I'm trying to use sdcc with the Nordic Semi 8051-based parts, but I'm 
not having much luck. The Nordic rep dropped a pile of dev boards on me 
and said to use Keil, but that's just too expensive. Anyone have any 
experience with these parts?

I started by writing a very simple test program to light the LEDs 
attached to P0...

#include <8051.h>

__sfr at (0x93) P0DIR;

void main()
     P0DIR = 0x0;   // All pins are outputs
    P0 = 0xFF;

...and built it with both sdcc 2.8.0 and with the eval version of keil. 
Keil produces a very short hex file that does the right thing. sdcc 
produces a much longer file that doesn't work. After programming the 
sdcc version the LEDs flash twice and then go dark.

Here's how I built it with sdcc...
sdcc --no-xinit-opt --opt-code-speed main.c
packihx main.ihx > main.hex

the resulting main.hex...

and the keil output for comparison...

sdcc is generating an awful lot of instructions just to set some pins. 
Keil is putting the bulk of the code at 0x800 with a jmp at 0x0, but I 
don't see any reason it has to be that way. Nor do I see a way to get 
sdcc to do the same thing.

Did I do something wrong? Am I missing some magic command line options?

This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
Sdcc-user mailing list