From mboxrd@z Thu Jan 1 00:00:00 1970 From: Grant Edwards To: Joel Brenner <"joel".brenner@tchip.com> Cc: gdb@sourceware.cygnus.com Subject: Re: Semihosting output on ARM7TDMI Date: Tue, 14 Aug 2001 07:56:00 -0000 Message-id: <20010814095805.A8415@visi.com> References: <3B791E3D.A993411F@tchip.com> X-SW-Source: 2001-08/msg00125.html On Tue, Aug 14, 2001 at 02:49:01PM +0200, Joel Brenner wrote: > Hi I'm using JEENI debug module wich supports semihosting (libc) on a > ARM7TDMI target. I'make use of function printf() from newlib wich seems > to work. > I've tried to execute "printf("abc\n\n");" and I've logged the ADP > communication: > .... > R=0001000d H->T CI_HADP: ADP_Execute 00000000 > rx: [T=0 L=24] 01 d1 d1 01 0d 00 01 80 00 00 00 00 ff ff ff ff ff ff ff > ff 00 00 00 00 > R=8001000d H<-T CI_HADP: ADP_Execute 00000000 > rx: [T=0 L=36] 05 d2 d1 01 69 00 00 80 00 00 00 00 ff ff ff ff ff ff ff > ff 00 00 00 00 04 00 00 00 04 00 00 00 61 62 63 0a > R=80000069 H<-T CI_CLIB: CL_Write 00000000 00000004 00000004 0a636261 > tx: [T=0 L=28] 05 d2 d2 01 69 00 00 00 00 00 00 00 ff ff ff ff ff ff ff > ff 01 00 00 00 04 00 00 00 > R=00000069 H->T CI_CLIB: CL_Write 00000001 00000004 > rx: [T=0 L=33] 05 d3 d2 01 69 00 00 80 00 00 00 00 ff ff ff ff ff ff ff > ff 00 00 00 00 01 00 00 00 01 00 00 00 0a > R=80000069 H<-T CI_CLIB: CL_Write 00000000 00000001 00000001 0000000a > tx: [T=0 L=28] 05 d3 d3 01 69 00 00 00 00 00 00 00 ff ff ff ff ff ff ff > ff 01 00 00 00 01 00 00 00 > R=00000069 H->T CI_CLIB: CL_Write 00000001 00000001 > rx: [T=0 L=28] 02 d4 d3 01 01 00 02 80 00 00 00 00 ff ff ff ff ff ff ff > ff 20 00 02 00 00 00 00 00 > R=80020001 H<-T CI_TADP: ADP_Stopped 00020020 00000000 How handy! > but no message are printed to gdb console. Are the above > messages correct? Whath is the command to enable semihosting? > Where GDB puts the receved strings ? IIRC, The RDI interface code writes semihosting output data to whatever filedescriptor is requested. I think your request are for fd 0. The CL_Write data is fd,len,len,data. I've no clue why the length is there twice. There is an internal file table that translates from "RDI" fd number to Unix FILE pointers. The table is initialized to be empty, and then filled in when the semi-hosting client opens files. It looks like it needs to be changed so that it is pre-initialized so that stdin, stdout, and stderr are "pre-opened". I think you'll need to change the code in rdi-share/hsys.c HostSysInit() so that fds 0,1,2, are initialized to map to FILE pointers stdin, stdout, stderr. If you enable debugging info in hsys.c (by adding "#define DEBUG" at the top of the file) you might be able to get a better idea about what's going on. -- Grant Edwards grante@visi.com