Thanks, that got me a little further.
I created a minimal crtstart.asm based on the manual...
---
.area GSINIT0 (CODE)
__sdcc_gsinit_startup::
mov sp,#__start__stack - 1
.area GSINIT2 (CODE)
; lcall __sdcc_external_startup
; mov a,dpl
; jz __sdcc_init_data
; ljmp __sdcc_program_startup
__sdcc_init_data:
---
Then I ran...
asx8051 -lo crtstart.asm
sdcc --no-xinit-opt --main-return --iram-size 0x80 crtstart.rel main.c
packihx main.ihx > main.tmp
d52 -pngd main.hex
Which gave me a main.d52 of...
---
.org 0x0
;
ljmp X0006 ; 0000 02 00 06 ...
;
X0003: ljmp X0012 ; 0003 02 00 12 ...
;
X0006: mov sp,#0x7 ; 0006 75 81 07 u..
clr a ; 0009 e4 d
mov r0,#0x7f ; 000a 78 7f x.
X000c: mov @r0,a ; 000c f6 v
djnz r0,X000c ; 000d d8 fd X}
ljmp X0003 ; 000f 02 00 03 ...
;
X0012: mov 93h,#0x0 ; 0012 75 93 00 u..
X0015: mov p0,#0xff ; 0015 75 80 ff u..
sjmp X0015 ; 0018 80 fb .{
;
end
---
Which actually looks the same as yours, which is good. Unfortunately, it
still doesn't run.
On a whim I took main.d52 and paired it down to the bare minimum, which
gave me test.asm...
---
.area HOME (ABS)
.org 0x0
mov 0x93,#0x0 ; 0012 75 93 00 u..
X0015: mov p0,#0xff ; 0015 75 80 ff u..
sjmp X0015 ; 0018 80 fb .{
---
then ran...
asx8051 -lo test.asm
sdcc test.rel
packihx test.ihx > test.hex
and then downloaded test.hex to the board. Still no joy. The LEDs flash
twice and go dark, same as before. So I'm thinking I must have a more
fundamental problem somewhere.
Reading the code off the chip produces a file identical to the one that
was written to it, so I don't think the problem is in the programmer.
Frieder Ferlemann wrote:
> But you have (manual) control over this code (see Manual 3.12.1)
> and if you f.e. link an adapted crtstart.asm
> (empty section GSINIT2 so only setting the stackpinter is set)
> then you'll have shaved off 14 bytes:)
>
> sdcc --no-xinit-opt --main-return --iram-size 0x80 crtstart.rel t.c
>
> you arrive at:
>
> :020000040000FA
> :1A000000020006020012758107E4787FF6D8FD0200037593007580FF80FBAB
> :00000001FF
>
> which (passed through d52 disassembler with "d52 -pngd t.ihx") is:
>
> ljmp X0006 ; 0000 02 00 06 ...
> ;
> X0003: ljmp X0012 ; 0003 02 00 12 ...
> ;
> X0006: mov sp,#0x7 ; 0006 75 81 07 u..
> clr a ; 0009 e4 d
> mov r0,#0x7f ; 000a 78 7f x.
> X000c: mov @r0,a ; 000c f6 v
> djnz r0,X000c ; 000d d8 fd X}
> ljmp X0003 ; 000f 02 00 03 ...
> ;
> X0012: mov 93h,#0x0 ; 0012 75 93 00 u..
> X0015: mov p0,#0xff ; 0015 75 80 ff u..
> sjmp X0015 ; 0018 80 fb .{
>
> You could strip that down yet another 4-5 bytes using ajmp
> and removing one ljmp.
>
> Considering it's about 5 years ago from Erik Petrich's commit
> 2004-03-17 for the initialization code it's strange that
> noone yet (seems to have) posted a minimized crtstart.asm :^)
|