This is the mail archive of the crossgcc@cygnus.com mailing list for the crossgcc project.


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

Re: lots of 68k related questions..


    Hello!

>   ----- Forwarded message from Doug Evans -----
>   Now that I have my cross compiler building, I am still confused by a few
>   things.
>
>   Here is my short list of questions:
>
>   1) What is the difference between coff and aout formats?  Why would
>   I want to use one instead of the other?  This is for embedded applications.
>
    For standalone embedded development usually coff format is used. It is more
advanced than aout, particularly it makes possible to have additional section
in your program.

>   2) How/where do I configure my memory map?  Where do I put my initialization
>   code? etc?
>
    Memory map for your application could be configured in linker script.
You can read linker documentation to know more. Linker script allows to
describe your memory configuration and preferrable order of section
allocation in memory (ROM and RAM).

    Entry point of your application can be determined in linker script also.
Usually the start module called crt0, written in assembler provides
the overall initialization, copying of initialized data section (.data)
from ROM to RAM (if needed), clearing by zeros of uninitialized data (.bss)
and calling the main() function.

    Start addresses for .text, .data, .bss sections and entry point can be
set up also with appropriate linker options.

    Examples of linker scripts, initialization modules and newlib low-level
support routines (for open/close/read/write/... functionality) can be found
in libgloss directory in newlib package. Some documentation is provided here
(porting.texi, "Embed with gnu"). You can get one of them as start point
and modify to conform your needs. Makefile in libgloss builds the
BSP (board support package) module containing the applicable version of
newlib support routines. Minimal implementation is placed in libgloss
directory.

    Probably, it would be interesting for you to look for RTEMS (Real-Time
Execution for (Missile|Military|Multiprocessor) Systems). See
http://lancelot.gcs.redstone.army.mil.

>   3) I got the gdb to build using the patches which should allow it to
>   communicate using a BDM port.  How do I build something that gdb can
>   read, etc.
>
    You need to compile your C program and link it with libc.a library.
If all packages are configured in right way, the crt0.o file is linked
automatically. If you provide own crt0 in your own directory, give the
-nostdlib option to gcc while linking and add crt0.o in command line.

    I don't know what board you have used. If you have Motorola board with
ROM bug monitor, it is possible to configure gdb to interact with this monitor.
It is simplest way. In another case you need to port the m68k-stub.c
from gdb-4.16/gdb directory. This module implements the remote debugging
protocol which gdb understands, but you need to implement some procedures,
like send and receive bytes to/from serial channel. Some ports of
m68k-stub.c can be found in libgloss.

>   4) When I fire up gdb I get a memory corruption error.  Is this do
>   to my build or is it some know thing about gdb.
>
    This problem arises because gnu mmalloc library and new glibc library
conflict. The patch gdb-4.16-nommalloc.patch from gdb-4.16-9.src.rpm
package from RedHat 5.0 distribution can resolve this problem:

--- gdb-4.16/gdb/Makefile.in.ewt        Tue Aug 19 12:08:58 1997
+++ gdb-4.16/gdb/Makefile.in    Tue Aug 19 12:15:52 1997
@@ -90,14 +90,14 @@
 # Where is the MMALLOC library?  Typically in ../mmalloc.
 # Note that mmalloc can still be used on systems without mmap().
 # To use your system malloc, comment out the following defines.
-MMALLOC_DIR = ../mmalloc
-MMALLOC_SRC = $(srcdir)/$(MMALLOC_DIR)
-MMALLOC = $(MMALLOC_DIR)/libmmalloc.a
+#MMALLOC_DIR = ../mmalloc
+#MMALLOC_SRC = $(srcdir)/$(MMALLOC_DIR)
+#MMALLOC = $(MMALLOC_DIR)/libmmalloc.a
 # To use your system malloc, uncomment MMALLOC_DISABLE.
-#MMALLOC_DISABLE = -DNO_MMALLOC
+MMALLOC_DISABLE = -DNO_MMALLOC
 # To use mmalloc but disable corruption checking, uncomment MMALLOC_CHECK
 #MMALLOC_CHECK = -DNO_MMALLOC_CHECK
-MMALLOC_CFLAGS = -I$(MMALLOC_SRC) $(MMALLOC_CHECK) $(MMALLOC_DISABLE)
+MMALLOC_CFLAGS = $(MMALLOC_CHECK) $(MMALLOC_DISABLE)

 # Where is the BFD library?  Typically in ../bfd.
 BFD_DIR = ../bfd
------------end of patch------------
>   By the way, I am building for red-hat 5.0.
>   gdb-4.16
>   gcc 2.7.2.3
>   newlib 1.80
>   binutils 2.8.1.0.1
>
>   Thanks for any and all help.
>
>   - -Mike Dorin
>
>   - -Mike
>   ------- End of forwarded message -------
>
>   ----- End of forwarded message from Doug Evans -----
>
--- 
Victor V. Vengerov
TEPKOM State Enterprise, St. Petersburg, Russia
7 (812) 4284649
7 (812) 2797504 (home)