national chung cheng university,taiwan,r.o.c ecos demo using x86 pcs i-hung lin date:2004/4/29
TRANSCRIPT
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 )
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 prebuil
d toolchain of eCos and it works fine!
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
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 \ h
ello.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 <stdio.h>
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 -ial509699 -rwxr-xr-x 1 root root 52160 Apr 28 10:15 redboot.bin509698 -rwxr-xr-x 1 root root 269765 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 Publ
ic 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 w
arranty" for details. This GDB was configured as "--host=i686-pc-linux-gnu
--target=i386-elf"... (gdb) set remotebaud 38400 (gdb) target remote /dev/ttyS0 (gdb) load
Gdb remote debug setting
Reference
http://sources.redhat.com/ecos/
http://sources.redhat.com/redboot/
http://sources.redhat.com/ml/ecos-discuss/
http://www.sfc.wide.ad.jp/~kei/ecos.html
http://www.mlbassoc.com/examples/build_hello.html
Especially Thank Mohasin for his useful advice.