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
     while(1)
    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...
:03000000020008F3
:03001B00020003DD
:0500030012001E80FE4A
:08001E007593007580FF80FB63
:06001500E478FFF6D8FDBF
:0D000800758107120026E5826003020003E7
:0400260075820022BD
:00000001FF

and the keil output for comparison...
:08080C00E4F5947580FF80FB08
:03000000020800F3
:0C080000787FE4F6D8FD75810702080C33
:00000001FF

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.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user