On Tue, Apr 07, 2009 at 02:58:44PM +0200, Robert Brusa wrote:
> On Mon, 06 Apr 2009 23:39:24 +0200, Sergei Gavrikov  
> <[email protected]> wrote:
> 
> ..<cut>
> >>Robert, of course, the right way is to define own macro (= CDL rule) in
> >>the plf's stuff. But, that's not possible without a tweaking plf's code.
> >>I thought about a froud hack: to add something like the below in CFLAGS
> >>
> >>    -D"HAL_IDLE_THREAD_ACTION(x)={}"
> >>
> >>Well, it's ugly, but, if you do not want to mess up 3.0 sources, it  
> >>would
> >>be a way.
> >>
> >>Perhaps, eCos veterans know about another way.
> >>
> >
> >It's just for reference how it was done for lpc2xxx variants:
> >packages/hal/arm/lpc2xxx/var/current/include/var_arch.h:63
> >
> >So, I can use
> >
> >cdl_option CYGHWR_HAL_ARM_LPC2XXX_IDLE_PWRSAVE {
> >    user_value 0
> >};
> >
> >for my target to disable that "odd" mode. Certainly it can be disabled
> >with `configtool' too.
> >
> >Sergei
> 
> Sergei, I did it with brutal force: I modified the lines inside var_arch.h
> in directory ecos/packages/hal/arm/at91/var/current/include such that the  
> macro
> HAL_IDLE_THREAD_ACTION(_counter_) is no longer generated. Then I created a  
> new ecos and linked my little project with this new ecos. The results are  
> mixed:
> a) As before, when switching power on with no JTAG debugger (BDI2000)  
> connected, the program launches and works fine.
> 
> b) With the JTAG debugger connected, I am no longer in a position to  
> launch it with the BDI go 0 command (via telnet). No output at all.
> 
> c) I can set breakpoints in cyg_user_start and the output of the  
> diag_printf statement in this routine appear - but
>    the output of the diag_printf routines in the thread created and  
> resumed from this reoutine do not appear - although I can catch
>    breakpoints in this thread.
> 
> Not a very clear situation. Do you have a good idea? Thanks and regards
>    Robert

Hi

As I did promise I tried to reproduce your issue. My stuff was: eCos
3.0, OpenOCD (I built it this morning from SVN), parallel JTAG wiggler
from Olimex, CPU: ARM7TDMI-S (NXP LPC2294), board: Olimex LPC-H2294
header board.

I built eCos as I do it as well for tests using ecosconfig, template was
default. Only 2 imports were applied: 

cdl_component CYG_HAL_STARTUP {user_value ROM};
cdl_option CYGHWR_HAL_ARM_LPC2XXX_IDLE_PWRSAVE {user_value 0};

I reset the board, ran OpenOCD (see screenlog.0.txt) and did load a
built `twothreads' example. There is a full GDB session in the log. I
could stop a run at the outputs and before a start of a kernel and then.
All ouput will appear in minicom as I could expect. BTW, by default,
printf uses hal_if_diag_write_char(). See the log. I could output and
alone character and whole lines using breakpoints. ^C works as I could
expect too.

Yet another thing, if you could see, `serial' example uses printf(). BUT,

$ arm-eabi-nm examples/serial | grep -E '(printf|putc|_diag)'
00001cf8 t _GLOBAL__I.10100_diag_write_char
00001d24 t _ZL16_diag_write_charcPPv
8100027c d _ZL5_putc
00001ec8 t _ZL8_vprintfPFvcPPvES0_PKcS_
00005120 T cyg_hal_plf_serial_putc
00002a00 T diag_printf
00004eb8 T fputc
0000167c T hal_if_diag_init
000016bc T hal_if_diag_read_char
00001880 T hal_if_diag_write_char
00001244 t haldiag_putc
00004eb8 W putc
810002b8 D tty_io_diag
81003050 b tty_private_info_diag

There is no printf! Using CLI tools (arm-eabi-gdb) I at once noticed
that I cannot set a breakpoint on printf. And your IDE as I could see in
your pastes quite eats mice's breakpoints. AFAIR, I saw there

info threads
info sharedlibs

IDE shocks these requests the GDB for embedded. You set breakpoint, but,
program run. And I thought, that you can try `nm' on that your ELF to
check is there printf in text segment.  Well, it's just a guss only.

Certainly, when I ran `serial' I used stops on hal_if_diag_write_char().

So, what's difference in our environments

a) different JTAGs
b) CLI against IDE
c) Linux against Cygwin
d) different targets

and what's the same:

eCos 3.0 release.

I have no more ideas.


Sergei
* My JTAG engine
  --------------

$ sudo /opt/openocd/bin/openocd-ioperm -f ../openocd.cfg
Password:
Open On-Chip Debugger 1.0 (2009-04-08-08:48) svn:1454


BUGS? Read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS


$URL: svn://svn.berlios.de/openocd/trunk/src/openocd.c $
force hard breakpoints
Warn : No parport port specified, using default '0x378' (LPT1)
Info : JTAG tap: lpc2294.cpu tap/device found: 0x4f1f0f0f (Manufacturer: 0x787, 
Part: 0xf1f0, Version: 0x4)
Info : JTAG Tap/device matched
Warn : DBGACK set while target was in unknown state. Reset or initialize target.
target state: halted
target halted in ARM state due to breakpoint, current mode: Supervisor
cpsr: 0x60000013 pc: 0x00005110
dcc downloads are enabled


* My eCos stuff
  -------------

$ echo $ECOS_REPOSITORY
/opt/ecos/ecos-3.0/packages
$ arm-eabi-gcc -v
Using built-in specs.
Target: arm-eabi
Configured with: /home/test/src/toolchains/gcc/gcc-4.3.2/configure -v 
--target=arm-eabi --prefix=/home/test/build/toolchains/arm-eabi/tools 
--with-newlib --with-gnu-as --with-gnu-ld --enable-languages=c,c++ 
--disable-__cxa_atexit --enable-threads 
--with-bugurl=http://bugs.ecos.sourceware.org/ --with-pkgversion='eCosCentric 
GNU tools 4.3.2-sw' --with-cpu=arm7tdmi --with-gmp=/opt/gmp-4.2.2 
--with-mpfr=/opt/mpfr-2.3.0
Thread model: single
gcc version 4.3.2 (eCosCentric GNU tools 4.3.2-sw) 


* Two threads debug
  -----------------

$ arm-eabi-gdb -nx
GNU gdb (eCosCentric GNU tools 4.3.2-sw) 6.8.50.20080706
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-eabi".
For bug reporting instructions, please see:
<http://bugs.ecos.sourceware.org/>.
(gdb) set logging on
Copying output to gdb.txt.
(gdb) file examples/twothreads
Reading symbols from /home/sg/prj09/openocd/ecos/examples/twothreads...done.
(gdb) target remote localhost:3333
Remote debugging using localhost:3333
printf (format=0x81006768 "�V")
    at 
/opt/ecos/ecos-3.0/packages/language/c/libc/stdio/v3_0/src/output/printf.cxx:74
74          rc = vfnprintf(stdout, INT_MAX, format, ap);
(gdb) load
Loading section .rom_vectors, size 0x40 lma 0x0
Loading section .text, size 0xa820 lma 0x40
Loading section .rodata, size 0x318 lma 0xa860
Loading section .data, size 0x34c lma 0xab78
Start address 0x40, load size 44740
Transfer rate: 13 KB/sec, 7456 bytes/write.
(gdb) tb cyg_user_start
Temporary breakpoint 1 at 0x698: file twothreads.c, line 25.
(gdb) c
Continuing.
Note: automatically using hardware breakpoints for read-only addresses.

Temporary breakpoint 1, cyg_user_start () at twothreads.c:25
25        printf("Entering twothreads' cyg_user_start() function\n");
Current language:  auto; currently c
(gdb) tb printf
Temporary breakpoint 2 at 0x5024: file 
/opt/ecos/ecos-3.0/packages/language/c/libc/stdio/v3_0/src/output/printf.cxx, 
line 74.
(gdb) c
Continuing.

Temporary breakpoint 2, printf (format=0x810066c0 "�F")
    at 
/opt/ecos/ecos-3.0/packages/language/c/libc/stdio/v3_0/src/output/printf.cxx:74
74          rc = vfnprintf(stdout, INT_MAX, format, ap);
Current language:  auto; currently c++
(gdb) c
Continuing.

Program received signal SIGINT, Interrupt.
idle_thread_main (data=0)
    at /opt/ecos/ecos-3.0/packages/kernel/v3_0/src/common/thread.cxx:1222
1222    idle_thread_main( CYG_ADDRESS data )
(gdb) tb hal_if_diag_write_char
Temporary breakpoint 3 at 0x18d8: file 
/opt/ecos/ecos-3.0/packages/hal/common/v3_0/src/hal_if.c, line 844.
(gdb) c
Continuing.

Temporary breakpoint 3, hal_if_diag_write_char ()
    at /opt/ecos/ecos-3.0/packages/hal/common/v3_0/src/hal_if.c:844
844         if (__chan)
Current language:  auto; currently c
(gdb) bt
#0  hal_if_diag_write_char ()
    at /opt/ecos/ecos-3.0/packages/hal/common/v3_0/src/hal_if.c:844
#1  0x000012a0 in haldiag_putc (chan=<value optimized out>, c=84 'T')
    at /opt/ecos/ecos-3.0/packages/io/serial/v3_0/src/common/haldiag.c:113
#2  0x00000dc4 in serial_write (handle=<value optimized out>, _buf=0x8100529c, 
    len=0x810052dc)
    at /opt/ecos/ecos-3.0/packages/io/serial/v3_0/src/common/serial.c:329
#3  0x00001b4c in cyg_io_write (handle=0x810002f8, buf=0x54, len=0x0)
    at /opt/ecos/ecos-3.0/packages/io/common/v3_0/src/iosys.c:177
#4  0x000011c4 in tty_write (handle=<value optimized out>, _buf=0x20612077, 
    len=0x6f6e2064)
    at /opt/ecos/ecos-3.0/packages/io/serial/v3_0/src/common/tty.c:200
#5  0x00001b4c in cyg_io_write (handle=0x810002f8, buf=0x54, len=0x0)
    at /opt/ecos/ecos-3.0/packages/io/common/v3_0/src/iosys.c:177
#6  0x000048b8 in Cyg_StdioStream::flush_output_unlocked (this=0x810040c0)
    at /home/sg/prj09/openocd/ecos/install/include/cyg/libc/stdio/io.inl:229
#7  0x00004b78 in Cyg_StdioStream::write (this=0x810040c0, 
    buffer=0xa8a8 " clock ticks\n", buffer_length=0, bytes_written=0x81005650)
    at 
/opt/ecos/ecos-3.0/packages/language/c/libc/stdio/v3_0/src/common/stream.cxx:714
#8  0x00005454 in vfnprintf (stream=0x810040c0, n=2147483647, 
    format=<value optimized out>, arg=0x81005694)
    at 
/opt/ecos/ecos-3.0/packages/language/c/libc/stdio/v3_0/src/output/vfnprin---Type
 <return> to continue, or q <return> to quit---
tf.cxx:276
#9  0x00005040 in printf (format=0x810066c0 "�F")
    at 
/opt/ecos/ecos-3.0/packages/language/c/libc/stdio/v3_0/src/output/printf.cxx:74
#10 0x0000066c in simple_program (data=<value optimized out>)
    at twothreads.c:56
#11 0x00002c34 in Cyg_HardwareThread::thread_entry (thread=0x810066c0)
    at /opt/ecos/ecos-3.0/packages/kernel/v3_0/src/common/thread.cxx:94
(gdb) b hal_if_diag_write_char
Breakpoint 4 at 0x18d8: file 
/opt/ecos/ecos-3.0/packages/hal/common/v3_0/src/hal_if.c, line 844.
(gdb) c
Continuing.

Breakpoint 4, hal_if_diag_write_char ()
    at /opt/ecos/ecos-3.0/packages/hal/common/v3_0/src/hal_if.c:844
844         if (__chan)
(gdb) c
Continuing.

Breakpoint 4, hal_if_diag_write_char ()
    at /opt/ecos/ecos-3.0/packages/hal/common/v3_0/src/hal_if.c:844
844         if (__chan)
(gdb) c
Continuing.

Breakpoint 4, hal_if_diag_write_char ()
    at /opt/ecos/ecos-3.0/packages/hal/common/v3_0/src/hal_if.c:844
844         if (__chan)
(gdb) d
Delete all breakpoints? (y or n) y
(gdb) b putc

Breakpoint 5 at 0x4ed8: file 
/opt/ecos/ecos-3.0/packages/language/c/libc/stdio/v3_0/src/output/fputc.cxx, 
line 71.
(gdb) c
Continuing.

Program received signal SIGINT, Interrupt.
idle_thread_main (data=0)
    at /opt/ecos/ecos-3.0/packages/kernel/v3_0/src/common/thread.cxx:1222
1222    idle_thread_main( CYG_ADDRESS data )
Current language:  auto; currently c++
(gdb) b fputc
Note: breakpoint 5 also set at pc 0x4ed8.
Breakpoint 6 at 0x4ed8: file 
/opt/ecos/ecos-3.0/packages/language/c/libc/stdio/v3_0/src/output/fputc.cxx, 
line 75.
(gdb) c
Continuing.

Program received signal SIGINT, Interrupt.
idle_thread_main (data=0)
    at /opt/ecos/ecos-3.0/packages/kernel/v3_0/src/common/thread.cxx:1222
1222    idle_thread_main( CYG_ADDRESS data )
(gdb) d
Delete all breakpoints? (y or n) y
(gdb) b hal_if_diag_write_char

Breakpoint 7 at 0x18d8: file 
/opt/ecos/ecos-3.0/packages/hal/common/v3_0/src/hal_if.c, line 844.
(gdb) c
Continuing.

Breakpoint 7, hal_if_diag_write_char ()
    at /opt/ecos/ecos-3.0/packages/hal/common/v3_0/src/hal_if.c:844
844         if (__chan)
Current language:  auto; currently c
(gdb) c
Continuing.

Breakpoint 7, hal_if_diag_write_char ()
    at /opt/ecos/ecos-3.0/packages/hal/common/v3_0/src/hal_if.c:844
844         if (__chan)
(gdb) d
Delete all breakpoints? (y or n) y
(gdb) b printf

Breakpoint 8 at 0x5024: file 
/opt/ecos/ecos-3.0/packages/language/c/libc/stdio/v3_0/src/output/printf.cxx, 
line 74.
(gdb) c
Continuing.

Breakpoint 8, printf (format=0x810066c0 "�F")
    at 
/opt/ecos/ecos-3.0/packages/language/c/libc/stdio/v3_0/src/output/printf.cxx:74
74          rc = vfnprintf(stdout, INT_MAX, format, ap);
Current language:  auto; currently c++
(gdb) bt
#0  printf (format=0x810066c0 "�F")
    at 
/opt/ecos/ecos-3.0/packages/language/c/libc/stdio/v3_0/src/output/printf.cxx:74
#1  0x0000066c in simple_program (data=<value optimized out>)
    at twothreads.c:56
#2  0x00002c34 in Cyg_HardwareThread::thread_entry (thread=0x810066c0)
    at /opt/ecos/ecos-3.0/packages/kernel/v3_0/src/common/thread.cxx:94
(gdb) c
Continuing.

Breakpoint 8, printf (format=0x81006768 "�V")
    at 
/opt/ecos/ecos-3.0/packages/language/c/libc/stdio/v3_0/src/output/printf.cxx:74
74          rc = vfnprintf(stdout, INT_MAX, format, ap);
(gdb) c
Continuing.

Breakpoint 8, printf (format=0x810066c0 "�F")
    at 
/opt/ecos/ecos-3.0/packages/language/c/libc/stdio/v3_0/src/output/printf.cxx:74
74          rc = vfnprintf(stdout, INT_MAX, format, ap);
(gdb) disconnect
Ending remote debugging.
(gdb) q


* Has `serial' example print?
  ---------------------------

$ arm-eabi-nm examples/serial | grep -E '(printf|putc|_diag)'
00001cf8 t _GLOBAL__I.10100_diag_write_char
00001d24 t _ZL16_diag_write_charcPPv
8100027c d _ZL5_putc
00001ec8 t _ZL8_vprintfPFvcPPvES0_PKcS_
00005120 T cyg_hal_plf_serial_putc
00002a00 T diag_printf
00004eb8 T fputc
0000167c T hal_if_diag_init
000016bc T hal_if_diag_read_char
00001880 T hal_if_diag_write_char
00001244 t haldiag_putc
00004eb8 W putc
810002b8 D tty_io_diag
81003050 b tty_private_info_diag
$ 

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

Reply via email to