On Tue, Dec 14, 2010 at 06:45:46PM +0100, Borut Razem wrote:
> This shows how many peope are using it...
> 
> Peter, can you please submit it to the bug tracker?
> 
> Borut
> 

        What has other people's experience with sdcdb on the 8051 been like?
Even the one from 2.9.0 release which at least starts doesn't run very well 
for me. Using this very simple test program (which runs on the simulator):

#include <stdio.h>
#include "w7100.h"

void serial_init(void) {

        TMOD &= 0x0f;   /* clear timer 1 mode bits              */
        TMOD |= 0x20;   /* timer 1 mode 1                       */
        PCON |= 0x80;   /* set SMOD0 fosc/32                    */
        TH1   = 0xfc;   /* set a baud rate (around 115K)        */
        TR1   = 1;      /* start timer 1                        */
        SCON  = 0x50;   /* set the uart mode                    */
        TI = 1;         /* indicate the UART is empty!          */
}


void putchar (char c) {

        while (!TI)
                ;
        TI = 0;
        SBUF = c;
}

main() {

        serial_init();
        printf("hello world\r\n");
        return 0;
}

        only sort of works in sdcdb somewhat:

$ "/cygdrive/c/program files/SDCC2_9_0"/bin/sdcdb test
SDCDB is free software and you are welcome to distribute copies of it
under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for SDCDB; type "show warranty" for details.
SDCDB 0.8 . Copyright (C) 1999 Sandeep Dutta (sandeep.du...@usa.net)
Type ? for help
WARNING: SDCDB is EXPERIMENTAL.
uCsim 0.5.4, Copyright (C) 1997 Daniel Drotos, Talker Bt.
uCsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
file "test1.ihx"
(sdcdb) l mai
23      main() {
24
25              serial_init();
26              printf("hello world\r\n");
27              return 0;
28      }
(sdcdb) b 26
(sdcdb) r
Starting program
Breakpoint 1, main() at test1.c:26
26              serial_init();
(sdcdb)
serial_init () at test1.c:6
6               TMOD &= 0x0f;   /* clear timer 1 mode bits              */
(sdcdb)
7               TMOD |= 0x20;   /* timer 1 mode 1                       */
(sdcdb)
8               PCON |= 0x80;   /* set SMOD0 fosc/32                    */
(sdcdb)
9               TH1   = 0xfc;   /* set a baud rate (around 115K)        */
(sdcdb)
10              TR1   = 1;      /* start timer 1                        */
(sdcdb)
11              SCON  = 0x50;   /* set the uart mode                    */
(sdcdb)
12              TI = 1;         /* indicate the UART is empty!          */
(sdcdb)
13      }
(sdcdb)
main () at test1.c:27
27              printf("hello world\r\n");
(sdcdb)
putchar () at test1.c:16
16      void putchar (char c) {
(sdcdb)
20              TI = 0;
(sdcdb)
21              SBUF = c;
(sdcdb)
22      }
(sdcdb)
Breakpoint 1 at 0x82: file test1.c, line 26.
addr 0xc2 in no module/function (runtime env?)
addr 0xc4 in no module/function (runtime env?)
addr 0xc7 in no module/function (runtime env?)
addr 0xc9 in no module/function (runtime env?)
addr 0xcb in no module/function (runtime env?)
addr 0xcd in no module/function (runtime env?)
addr 0xce in no module/function (runtime env?)
... (lots more) 
addr 0x105 in no module/function (runtime env?)
addr 0x107 in no module/function (runtime env?)
addr 0x109 in no modulmain () at test1.c:28
28              return 0;
(sdcdb)

        While this mostly works, I'd expect to see a line such as 

putchar () at test1.c:16
16      void putchar (char c) {

for each character in the string and that doesn't happen (I don't know if the
correct output goes to the serial port as I haven't figured out if I can 
get sdcdb to pass the file command to the simulator). 
        However the code I really want to debug breaks rather quickly making
sdcdb not useful. This code will have some problems as its for the Wiznet 
m7100 which has a bunch of non standard SFRs (as well as a tcpip engine that
isn't in the simulator) but it doesn't even get as far as any of the processor
specific code (which I could comment out if it did). As soon as it disables
the interrupts in the 8051 sdcdb dies:

pe...@pc700 ~/wiznet/nos
$ "/cygdrive/c/program files/SDCC2_9_0"/bin/sdcdb main
SDCDB is free software and you are welcome to distribute copies of it
under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for SDCDB; type "show warranty" for details.
SDCDB 0.8 . Copyright (C) 1999 Sandeep Dutta (sandeep.du...@usa.net)
Type ? for help
WARNING: SDCDB is EXPERIMENTAL.
uCsim 0.5.4, Copyright (C) 1997 Daniel Drotos, Talker Bt.
uCsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
file "main.ihx"
(sdcdb) b 67
(sdcdb) r
Starting program
Breakpoint 1, main() at main.c:68
68              sys_initialize();
(sdcdb) set srcmode
(sdcdb) s
Program exited with code 0.
idle_task () at m7100os.asm:968
968             clr     _EA
(sdcdb) l 968
967     ;       m7100os.c:219: SYS_DISABLE_INTERRUPTS;
968             clr     _EA
969             C$m7100os.c$222$1$1 ==.
970     ;       m7100os.c:222: STACK_OVERFLOW_nLED = 1;
971             setb    _P0_5
972             C$m7100os.c$225$1$1 ==.
973     ;       m7100os.c:225: DEBUG1 = 1;
974             setb    _P3_7
975             C$m7100os.c$231$1$1 ==.
976     ;       m7100os.c:231: __endasm;
(sdcdb) s

        At this point sdcdb is hung (it will after a long delay loops around
some non debugable code (never getting to the "setb _P0_5" which is the next
statement). I the have to close the cygwin window to exit sdcdb not even 
cntrl-c will get control back to cygwin or sdcdb.  I'll try and extract a small 
test program (this code takes most of the 64K external code and data memory 
which may be where the problem is :-)) and submit another bug report if I can 
get a small one to break. However the bottom line for me is that sdcdb isn't 
usable and I'm back to compiled in debug statements on the hardware for 
debugging the code. 

Peter Van Epp

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to