National Chung Cheng University,Taiwan,R.O.C eCos demo using x86 PCs I-Hung Lin Date:2004/4/29
Introduction of Redboot Redboot (Red Hat Embedded Debug and Bootstrap ) Support for connection to a host-based debugger : Serial (RS-232) Ethernet (BOOTP, DHCP,TFTP )
Scenario
Step by step install eCos on host Set configtools on host Start redboot on target by Floppy disk Connect via RS-232 Using gdb to remote debug Run “hello world” example
Toolchain binutils gcc ecosconfig configtool Good news is that you can use the prebuild toolchain of eCos and it works fine!
Choice a site Choice 2 for i386 pc
Building eCos Kernel cd /opt/ecos ; source ecosenv.sh cd /opt/ecos/ecos-2.0/work/ mkdir ecos-pc ecos-pc-redboot applications cd ecos-pc ecosconfig new pc configtool ecos.ecc
Choose Floppy set baudrate (Default) Default console channel 2
Building application cd /opt/ecos/ecos-2.0/work/ mkdir applications ; cd applications vi hello.c i386-elf-gcc -g -D__ECOS –I../ecos-pc/install/include \ hello.c –L../ecos-pc/install/lib -Ttarget.ld -nostdlib i386-elf-objcopy -O binary a.out dd conv=sync if=a.out of=/dev/fd0 #include int main(void) { printf(“hello world!\n”); return 0; }
See in target PC Insert the floppy disk and boot. You will directly see on the monitor. Hello world!
Host commands # cd / opt/ecos/red_install/bin # ls -ial rwxr-xr-x 1 root root Apr 28 10:15 redboot.bin rwxr-xr-x 1 root root Apr 27 18:29 redboot.elf # dd conv=sync if=redboot.bin of=/dev/fd0 # cd /opt/ecos/ecos-2.0/example # i386-elf-gcc -g -I/opt/ecos/work_install/include hello.c - L/opt/ecos/work_install/lib -Ttarget.ld –nostdlib (Note that work is another template which packages type “default”!) # i386-elf-gdb –nw a.out (continued in next page)
#GNU gdb 5.3 (eCosCentric) Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "--host=i686-pc-linux-gnu - -target=i386-elf"... (gdb) set remotebaud (gdb) target remote /dev/ttyS0 (gdb) load Gdb remote debug setting
Reference Especially Thank Mohasin for his useful advice.