public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Bart Veer <bartv@redhat.com>
To: tcheewan@dso.org.sg
Cc: ecos-discuss@sourceware.cygnus.com
Subject: Re: [ECOS] Running hello.c on i386
Date: Fri, 09 Feb 2001 12:08:00 -0000	[thread overview]
Message-ID: <200102092008.f19K8QS27690@sheesh.cambridge.redhat.com> (raw)
In-Reply-To: <3A80F870.8BA24E06@dso.org.sg>

>>>>> "Philip" == Philip Teng <tcheewan@dso.org.sg> writes:

    Philip> I tried to make hello.c using the Makefile given in the /examples.
    Philip> bash.exe-2.04$ make hello.o
    Philip> i386-elf-gcc -c -o hello.o -g -Wall
    Philip> -I//c/users/philip/ecos/stub1_install/include -ffunction-sections
    Philip> -fdata-sections hello.c
    Philip> hello.c:2: stdio.h: No such file or directory
    Philip> make: *** [hello.o] Error 1

    Philip> I encountered some errors and I fixed it by adding one
    Philip> more include path...

    Philip> bash.exe-2.04$ make hello.o
    Philip> i386-elf-gcc -c -o hello.o -g -Wall
    Philip> -I//c/users/philip/ecos/stub1_install/include -I/usr/include -ffunction-sections
    Philip> -fdata-sections hello.c
    Philip> bash.exe-2.04$

    Philip> The compilation was successful. The target I used is a
    Philip> PIII machine, host is Windows NT. I started up the i386
    Philip> target using the gdb stub floppy and run the following:

No, that is wrong. The header file /usr/include/stdio.h will be for
use by cygwin applications, not eCos applications. I suspect that you
are trying to re-use the same configuration for the boot floppy and
for "hello world".

When targetting a PC, you are essentially building two different
applications. The first application is the gdb stub for the boot
floppy, and serves the same purpose as a ROM monitor on a conventional
embedded target. The second application is the "hello world" program.
The two applications run in very different environments, e.g. they
need completely separate startup code, so you need two different
configurations. 

First you need to create a configuration for building the gdb stub,
build that, and install the resulting executable on a floppy. It looks
like you have already done this. The requirements for the gdb stub are
fairly simple, e.g. there is no need for a C library, so the C library
does not get built and its header files do not get installed.

Now create a new configuration using the default template, i.e. a
configuration suitable for ordinary applications. This will include
the C library, so the <stdio.h> header file will get installed. The
two configurations should live in completely separate directories.

    Philip> bash.exe-2.04$ i386-elf-gdb -nw hello.o
    Philip> GNU gdb 5.0
    Philip> Copyright 2000 Free Software Foundation, Inc.
    Philip> GDB is free software, covered by the GNU General Public License, and you
    Philip> are
    Philip> welcome to change it and/or distribute copies of it under certain
    Philip> conditions.
    Philip> Type "show copying" to see the conditions.
    Philip> There is absolutely no warranty for GDB.  Type "show warranty" for
    Philip> details.
    Philip> This GDB was configured as "--host=i686-pc-cygwin --target=i386-elf"...
    Philip> (gdb) set remotebaud 38400
    Philip> (gdb) target remote com1
    Philip> Remote debugging using com1
    Philip> 0x37dc in ?? ()
    Philip> (gdb) continue
    Philip> Continuing.

    Philip> Program received signal SIGTRAP, Trace/breakpoint trap.
    Philip> 0x37dc in ?? ()

    Philip> Anyone has any idea why the program hit a stop?

Another mistake I am afraid. You are trying to debug hello.o, an
intermediate object file. You must first link the object file with the
appropriate libraries. This will give you an executable file a.out or
hello or hello.exe, depending on exactly how you drive the tools,
and it is this executable which can then be debugged with gdb.

Bart

  reply	other threads:[~2001-02-09 12:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-06 23:11 Philip Teng
2001-02-09 12:08 ` Bart Veer [this message]
2001-02-11 17:09   ` Teng Chee Wan Philip
  -- strict thread matches above, loose matches on Subject: below --
2001-02-05  5:16 JITENDRA kanitkar
2001-02-05 11:05 ` Jonathan Larmour

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200102092008.f19K8QS27690@sheesh.cambridge.redhat.com \
    --to=bartv@redhat.com \
    --cc=ecos-discuss@sourceware.cygnus.com \
    --cc=tcheewan@dso.org.sg \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).