Subject: Re: Embedded development platform
To: NetBSD Tech-embed <tech-embed@NetBSD.org>
From: Brian Rose <lists@brianrose.net>
List: tech-embed
Date: 08/05/2004 11:00:31
Hubert Feyrer wrote:

 > On Wed, 4 Aug 2004, Brian Rose wrote:
 >
 >>3) Fetch the sources from the website (src.tgz, gnu.tgz, etc) and 
install to /usr/src
 >
 >
 > Um, where did you get that from? Seems some documentation needs updating,
 > this seems horribly outdated. You can get -current sources via CVS with
 > the following commands:
 >
 >     env CVS_RSH=ssh CVSROOT=anoncvs@anoncvs.netbsd.org:/cvsroot cvs co src

I was trying to keep everything in the release that I was working on. I did 
not want to be tripped up with broken builds and such. But I guess the 
system sources ought to be stable.

 >
 >>6) Build the toolchain - './build.sh tools'
 >>7) Build the tools for the Coldfire (M68K) - './build.sh -m m68k tools'
 >
 >
 > This seems redundant - the first "build.sh tools" will give you a native
 > compiler. Dunno if you want that. :)
 >

My thinking was that I would need the naitive compiler to build the cross 
compiler.

 > I wish you a LOT of luck for the patches you mention to work with NetBSD's
 > sources. Maybe drop a note here when it does. :)
 >

Will do. I noticed that the stock gcc that comes with NetBSD 1.6.1 is 
2.95.3. After doing a little googling on using gcc for coldfire 
development, I ran across some patches that fixed some coldfire specific 
bugs for 2.95.3. I do not know if they have been fixed in the newer gcc.

I had downloaded and compiled gcc from source, but I wanted to try using 
the NetBSD sources and try to do things in a more 'NetBSD way'.

 >
 >
 >>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. 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.
 >>
 >>This is where I need some help. Does anyone have a short makefile that
 >>they can share with me to help me along?
 >
 >
 > Um, Makefile that does what exactly? There's a big bunch included in
 > NetBSD's source, and in some places even assembly language files (*.S) are
 > compiled into object files (*.o). The NetBSD Makefiles use a framework of
 > Makefile-fragments (share/mk/bsd.*) which make building things quite easy,
 > you just say what source files you have, and the rest happens
 > automagically. See e.g. src/libexec/ld.elf_so for an example.

I'm not looking for anything complicated. I have some assembly code that 
initializes the processor and then starts blinking some LEDs that are on 
the development board. Currently I build using Windriver's tools to build 
my application. The target has some boot rom that will start up and present 
a prompt and simple interface on one of the serial ports. I then download 
the S19 file via a serial console to the target and execute it.

What I am looking for is a simple makefile that assembles this file and 
then translates this .o file into a S19 record (used by the target boot rom 
to load code via the serial console). I figured if someone had a makefile, 
I could pick it apart and research the command that they are using.

 >
 > Tough luck if you have to change anything there though. ;) It might be
 > easier to use the programs in $TOOLDIR directly though.
 >
 > And while at it, maybe this article is of interest for you:
 > "Cross-Development with NetBSD -- Using NetBSD's new toolchain to develop
 > for an embedded device" (http://www.feyrer.de/NetBSD/xdev.html)

Cool, I shall check it out.

 >
 >
 >  - Hubert
 >
 >
 > P.S.: Please tune your mail client to insert a newline every 75 chars.