Subject: Re: Embedded development platform
To: NetBSD Tech-embed <tech-embed@netbsd.org>
From: Aaron J. Grier <agrier@poofygoof.com>
List: tech-embed
Date: 08/05/2004 11:17:49
On Wed, Aug 04, 2004 at 03:47:42PM -0400, Brian Rose wrote:
> 3) Fetch the sources from the website (src.tgz, gnu.tgz, etc) and install 
> to /usr/src

you won't need these unless you want to compile the native NetBSD
programs.  they won't be terribly useful for your embedded work, unless
you're porting NetBSD to the target.  (and unless motorola^Wfreescale
has introduced a 52xx variant with an MPU, I find that unlikely.)

> 4) Patch the gnu compiler with the Coldfire patch available on 
> http://www.fiddes.net/coldfire/

these may have been superceded by Peter Barada's patches, which I
believe are already be merged into the official gcc sources somewhere
along the 3.1.x process if I recall correctly.  getting the last
official release of 3.4.x should do what you want.

> 5) Patch the gnu debugger with the BDM patch on Sourceforge 
> (http://sourceforge.net/projects/bdm/)
> 6) Build the toolchain - './build.sh tools'
> 7) Build the tools for the Coldfire (M68K) - './build.sh -m m68k tools'

while you could theoretically patch and use the GNU tools in the NetBSD
source tree, it'd likely be easier to pull down the official sources and
keep the two separated.  I would even encourage installing all your
cross-development tools in a separate prefix from the rest of the
system, to avoid confusion.

> Once this is done, I would like to test out my setup by building a
> small application that blinks a few lights on the development board.
> For now I will download using the built in firmware and a terminal
> program to send the S19 file via RS232.

if you have BDM working, you can skip the serial port altogether.

> I will need a makefile that will build the assembly code file into a
> S19 file. The assembly file currently works using Windriver's Diab
> compiler and assembler.

the assembly might need a bit of massaging before gas (the gnu
assembler) is happy with it.

> Also if there are any other things I should know about, please let me
> know.

you'll need a custom linker script for your target, as well as a custom
gdb initialization file.

don't forget about newlib if you're looking for a C library.

the first two hurdles are getting BDM working (along with bdmcheck) and
getting the toolchain together.

some other places that might be helpful:

- http://www.WildRice.com/ColdFire/
  general coldfire mailing list; a mix of software and hardware
  discussion.  you'll hear about GCC developments for coldfire here.

- http://sources.redhat.com/ml/crossgcc/ 
  the crossgcc mailing list; for people building cross-compilers.  most
  are trying for a uClinux/glibc system with their coldfire boards, but
  there are a few fringe non-linux guys there.  (:

- http://www.rtems.com/
  if you're looking for an embedded OS for your target, I'd look here
  first.  I run it on a 68331 with good success.

-- 
  Aaron J. Grier | "Not your ordinary poofy goof." | agrier@poofygoof.com
  "someday the industry will have throbbing frontal lobes and will be able
  to write provably correct software.  also, I want a pony." -- Zach Brown