[ECOS] Problem about using gdb which is started form redboot

叶晓晖 yexh@wireless.mdc.tsinghua.edu.cn
Fri Mar 21 10:05:00 GMT 2003


Hi all,

I use ROM based redboot on snds board and want to start arm-elf-gdb tool from redboot, 
then debug the app with the gdb environment, but it cannot work.

The detail is:
First the board is connected by serial port using hyperterminal and was started with redboot. 
After I enter "$", disconnect the hyperterminal and start arm-elf-gdb tool, 
it can connect with the board via serial port(using the same port that redboot just connect) 
and it can download elf file into the RAM,  
but when download process is completed, it cannot start with the downloading programme. 

The programme is ok because it can run when I directly download it with "load" command and 
then run it with "go" command in redboot. And when I use ROM based stub, 
it also can run and debug in arm-elf-gdb.

And in my configuration, I select stand-alone network stack and use default IP address.

Some relevant source codes are below, in the file redboot/.../src/main.c:

if (res == _GETS_GDB) {
	int dbgchan;
        hal_virtual_comm_table_t *__chan;
        int i;
        // Special case of '$' - need to start GDB protocol
        gdb_active = true;
				
        // Mask interrupts on all channels
        for (i = 0;  i < CYGNUM_HAL_VIRTUAL_VECTOR_NUM_CHANNELS;  i++) {
        	CYGACC_CALL_IF_SET_CONSOLE_COMM(i);
                __chan = CYGACC_CALL_IF_CONSOLE_PROCS();
                CYGACC_COMM_IF_CONTROL( *__chan, __COMMCTL_IRQ_DISABLE );
        }
	CYGACC_CALL_IF_SET_CONSOLE_COMM(cur);
#ifdef HAL_ARCH_PROGRAM_NEW_STACK
        HAL_ARCH_PROGRAM_NEW_STACK(breakpoint);
#else
        breakpoint();  // Get GDB stubs started, with a proper environment, etc.
#endif			
	dbgchan = CYGACC_CALL_IF_SET_DEBUG_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT);
	CYGACC_CALL_IF_SET_CONSOLE_COMM(dbgchan);
        }

Because in my configuration, HAL_ARCH_PROGRAM_NEW_STACK is not defined, so it excute
 "breakpoint();" instead.

I notice that if I substitude 
breakpoint();
with
for( ; ; ) breakpoint();
in source codes above,then after completely downloading the elf file, the gdb will generate interrupt 
and say: Program received signal SIGTRAP, Trace/breakpoint trap.
 
Who knows what's the problem? And how can I start arm-elf-gdb to debug a app from redboot?

thanks

Xiaohui Ye


More information about the Ecos-discuss mailing list