This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Debugging Thumb code


On Fri, Mar 20, 2009 at 02:16:59PM +0000, John Dallaway wrote:
> Hi Ilija and Sergei
> 
> Many thanks for your eCos 3.0 beta 1 testing reports.
> 
> I wonder if you're also able to check for correct debugging of eCos
> applications built for Thumb? Since one of you is using a big-endian ARM
> target and the other a little-endian ARM target you can together provide
> good coverage.
> 
> For avoidance of doubt:
> 
> a) eCos should build for Thumb on ARM architecture simply by enabling
> CYGHWR_THUMB. I strongly recommend using a completely new build tree and
> enabling CYGHWR_THUMB before invoking make for the first time.
> 
> b) The standard build of RedBoot should support debugging of both ARM
> and Thumb applications. You do not need to rebuild RedBoot.
> 
> If you're able to confirm the correct operation of Thumb breakpoints,
> single stepping and backtraces in a simple application which runs in a
> loop such as the "twothreads" example application this would be very
> helpful. You can build the twothreads example as follows:
> 
>   cd /opt/ecos/ecos-3.0b1/examples
>   make twothreads INSTALL_DIR=/path/to/ecos-build/install

Hi John

I will be to fulfil a job and paste the below

I will place a conclusion at the line the below

ALL WORKS FOR MY TARGET

~$ cd /tmp
/tmp$ rm -f -r t
/tmp$ mkdir t
/tmp$ cd t
/tmp/t$ ecosconfig new olpce2294
U CYGHWR_HAL_ARM_LPC2XXX, new inferred value LPC2294
/tmp/t$ cp ecos.ecc{,.0}
/tmp/t$ vi ecos.ecc
/tmp/t$ diff -U 5 ecos.ecc{.0,}
--- ecos.ecc.0  2009-03-20 18:26:46.000000000 +0200
+++ ecos.ecc	2009-03-20 18:27:08.000000000 +0200
@@ -2469,11 +2469,11 @@
     #     CYGINT_HAL_ARM_THUMB_ARCH == 1
     #   --> 1
 
     # Flavor: bool
     # No user value, uncomment the following line to provide one.
-    # user_value 0
+    user_value 1
     # value_source default
     # Default value: 0
 
     # The following properties are affected by this value
     # option CYGBLD_ARM_ENABLE_THUMB_INTERWORK
/tmp/t$ ecosconfig resolve
/tmp/t$ cp ecos.ecc{,.1}
/tmp/t$ vi ecos.ecc
/tmp/t$ diff -U 5 ecos.ecc{.1,}
--- ecos.ecc.1	2009-03-20 18:28:39.000000000 +0200
+++ ecos.ecc	2009-03-20 18:28:56.000000000 +0200
@@ -202,11 +202,11 @@
 # flags.
 #
 cdl_option CYGBLD_GLOBAL_CFLAGS {
     # Flavor: data
     # No user value, uncomment the following line to provide one.
-    # user_value "-Wall -Wpointer-arith -Wstrict-prototypes -Wundef -Woverloaded-virtual -Wno-write-strings  -mthumb  -mthumb-interwork -mcpu=arm7tdmi -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions"
+    user_value "-Wall -Wpointer-arith -Wstrict-prototypes -Wundef -Woverloaded-virtual -Wno-write-strings  -mthumb  -mthumb-interwork -mcpu=arm7tdmi -g -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions"
     # value_source default
     # Default value:  CYGBLD_GLOBAL_WARNFLAGS . CYGBLD_ARCH_CFLAGS .
     #                                 "-mcpu=arm7tdmi -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions" 
     #     CYGBLD_GLOBAL_WARNFLAGS == "-Wall -Wpointer-arith -Wstrict-prototypes -Wundef -Woverloaded-virtual -Wno-write-strings "
     #     CYGBLD_ARCH_CFLAGS == " -mthumb  -mthumb-interwork "
/tmp/t$ ecosconfig resolve
/tmp/t$ ecosconfig tree&&make -s
headers finished
/opt/trunk/devo/ecos/packages/hal/arm/lpc2xxx/var/current/src/hal_diag.c: In function âcyg_hal_plf_serial_isrâ:
/opt/trunk/devo/ecos/packages/hal/arm/lpc2xxx/var/current/src/hal_diag.c:260: warning: pointer targets in passing argument 1 of âcyg_hal_is_breakâ differ in signedness
build finished
/tmp/t$ make -C $ECOS_REPOSITORY/../examples clean INSTALL_DIR=`pwd`/install
make: Entering directory `/opt/trunk/devo/ecos/examples'
rm -f hello hello.o twothreads twothreads.o
rm -f simple-alarm simple-alarm.o serial serial.o
rm -f instrument-test instrument-test.o
make: Leaving directory `/opt/trunk/devo/ecos/examples
/tmp/t$ make -C $ECOS_REPOSITORY/../examples twothreads INSTALL_DIR=`pwd`/install
make: Entering directory `/opt/trunk/devo/ecos/examples'
arm-eabi-gcc -c -o twothreads.o -I/tmp/t/install/include -Wall -Wpointer-arith -Wstrict-prototypes -Wundef -Woverloaded-virtual -Wno-write-strings -mthumb -mthumb-interwork -mcpu=arm7tdmi -g -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions twothreads.c
cc1: warning: command line option "-Woverloaded-virtual" is valid for C++/ObjC++ but not for C
cc1: warning: command line option "-fno-rtti" is valid for C++/ObjC++ but not for C
cc1: warning: command line option "-Woverloaded-virtual" is valid for C++/ObjC++ but not for C
cc1: warning: command line option "-fno-rtti" is valid for C++/ObjC++ but not for C
arm-eabi-gcc -nostartfiles -L/tmp/t/install/lib -Ttarget.ld -mthumb -mthumb-interwork -mcpu=arm7tdmi -Wl,--gc-sections -Wl,-static -g -nostdlib -o twothreads twothreads.o
make: Leaving directory `/opt/trunk/devo/ecos/examples'
/tmp/t$ arm-eabi-gdb $ECOS_REPOSITORY/../examples/twothreads
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) set remotebaud 230400
(gdb) target remote /dev/ttyUSB0
Remote debugging using /dev/ttyUSB0
0x00008028 in ?? ()
(gdb) load
Loading section .rom_vectors, size 0x40 lma 0x81010000
Loading section .text, size 0xd6b4 lma 0x81010040
Loading section .rodata, size 0x9c0 lma 0x8101d6f4
Loading section .data, size 0x324 lma 0x8101e0b4
Start address 0x81010040, load size 58328
Transfer rate: 17 KB/sec, 299 bytes/write.
(gdb) b main
Breakpoint 1 at 0x8101af1a: file /opt/trunk/devo/ecos/packages/language/c/libc/startup/current/src/main.cxx, line 114.
(gdb) b simple_program
Breakpoint 2 at 0x810106ac: file twothreads.c, line 43.
(gdb) c
Continuing.
Entering twothreads' cyg_user_start() function
[Switching to Thread 3]

Breakpoint 2, simple_program (data=0) at twothreads.c:43
43	  int message = (int) data;
Current language:  auto; currently c
(gdb) bt
#0  simple_program (data=0) at twothreads.c:43
#1  0x81014052 in Cyg_HardwareThread::thread_entry (thread=0x81024768)
    at /opt/trunk/devo/ecos/packages/kernel/current/src/common/thread.cxx:9
(gdb) info threads
[New Thread 1]
[New Thread 2]
[New Thread 4]
  4 Thread 4 ( Name: Thread B, State: ready, Priority: 4 )  Cyg_HardwareThread::thread_entry (thread=0x0)
    at /opt/trunk/devo/ecos/packages/kernel/current/src/common/thread.cxx:84
  3 Thread 2 ( Name: main, State: ready, Priority: 10 )  Cyg_HardwareThread::thread_entry (thread=0x0)
    at /opt/trunk/devo/ecos/packages/kernel/current/src/common/thread.cxx:84
  2 Thread 1 ( Name: Idle Thread, State: ready, Priority: 31 )  Cyg_HardwareThread::thread_entry (thread=0x0)
    at /opt/trunk/devo/ecos/packages/kernel/current/src/common/thread.cxx:84
* 1 Thread 3 ( Name: Thread A, State: running, Priority: 4 )  simple_program (
    data=0) at twothreads.c:43
(gdb) l
43	  int message = (int) data;
44	  int delay;
45	
46	  printf("Beginning execution; thread data is %d\n", message);
47	
48	  cyg_thread_delay(200);
49	
50	  for (;;) {
51	    delay = 200 + (rand() % 50);
52	
(gdb) b 51
Breakpoint 3 at 0x810106c4: file twothreads.c, line 51.
(gdb) c
Continuing.
Beginning execution; thread data is 0
[Switching to Thread 4]

Breakpoint 2, simple_program (data=1) at twothreads.c:43
43	  int message = (int) data;
(gdb) n
46	  printf("Beginning execution; thread data is %d\n", message);
(gdb) 
Beginning execution; thread data is 1
48	  cyg_thread_delay(200);
(gdb) c
Continuing.
[Switching to Thread 2]

Breakpoint 1, main (argc=1, argv=0x8102213c)
    at /opt/trunk/devo/ecos/packages/language/c/libc/startup/current/src/main.cxx:114
114	    Cyg_Thread::self()->suspend();
Current language:  auto; currently c++
114	    Cyg_Thread::self()->suspend();
Current language:  auto; currently c++
(gdb) n
[Switching to Thread 3]

Breakpoint 3, simple_program (data=0) at twothreads.c:51
51	    delay = 200 + (rand() % 50);
Current language:  auto; currently c
(gdb) 
55	    cyg_mutex_lock(&cliblock); {
(gdb) 
[Switching to Thread 4]

Breakpoint 3, simple_program (data=1) at twothreads.c:51
51	    delay = 200 + (rand() % 50);
(gdb) d
Delete all breakpoints? (y or n) y
(gdb) c
Continuing.
Thread 1: and now a delay of 230 clock ticks
Thread 0: and now a delay of 239 clock ticks
Thread 1: and now a delay of 221 clock ticks
Thread 0: and now a delay of 214 clock ticks
Thread 1: and now a delay of 224 clock ticks
Thread 0: and now a delay of 243 clock ticks

Program received signal SIGINT, Interrupt.
[Switching to Thread 1]
idle_thread_main (data=0)
    at /opt/trunk/devo/ecos/packages/kernel/current/src/common/thread.cxx:1228
1228	        idle_thread_loops[CYG_KERNEL_CPU_THIS()]++;
Current language:  auto; currently c++
(gdb) bt
#0  idle_thread_main (data=0)
    at /opt/trunk/devo/ecos/packages/kernel/current/src/common/thread.cxx:1228
#1  0x81014052 in Cyg_HardwareThread::thread_entry (thread=0x8101f728)
    at /opt/trunk/devo/ecos/packages/kernel/current/src/common/thread.cxx:94
(gdb) info th 
  4 Thread 4 ( Name: Thread B, State: sleeping, Priority: 4 )  0x8101fff0 in Cyg_Scheduler::scheduler ()
  3 Thread 2 ( Name: main, State: suspended, Priority: 10 )  0x8101fff0 in Cyg_Scheduler::scheduler ()
* 2 Thread 1 ( Name: Idle Thread, State: running, Priority: 31 )  idle_thread_main (data=0)
    at /opt/trunk/devo/ecos/packages/kernel/current/src/common/thread.cxx:1228
  1 Thread 3 ( Name: Thread A, State: sleeping, Priority: 4 )  0x8101fff0 in Cyg_Scheduler::scheduler ()
(gdb) c
Continuing.
Thread 1: and now a delay of 210 clock ticks
Thread 0: and now a delay of 224 clock ticks
Thread 1: and now a delay of 207 clock ticks
Thread 0: and now a delay of 244 clock ticks
Thread 1: and now a delay of 229 clock ticks
Thread 0: and now a delay of 243 clock ticks
Thread 1: and now a delay of 212 clock ticks

Program received signal SIGINT, Interrupt.
idle_thread_main (data=0)
    at /opt/trunk/devo/ecos/packages/kernel/current/src/common/thread.cxx:1228
1228	        idle_thread_loops[CYG_KERNEL_CPU_THIS()]++;
(gdb) deta
Ending remote debugging.
(gdb) q
/tmp/t$


Regards,
Sergei

Attachment: gdb.txt
Description: Text document

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]