Subject: Crosscompiling for evbarm
To: None <port-arm@netbsd.org>
From: Richard =?iso-8859-1?q?K=E4stner?= <richard.kaestner@kabsi.at>
List: port-arm
Date: 11/29/2006 22:36:32
since a few days, I own a Olimex CS-EP9301 board.
It comes with pre-installed NetBSD and Linux.
Unpacked, started - basically works out of the box!

Honestly, I was impressed: small board, seems to have everything for small 
applications - and it took me 10 minutes to have NetBSD up and running!
Sure, to have (only) a USB-disk can't be called a fast thing, but so what - 
there is NFS!

Unfortunately, there are no config files on the Olimex CD ...
(from the mail archives I understand, Olimex is busy in other products ...)


So there are 3 issues at this time:
- how do I adopt configuration files to get the drivers (epgpio, epwdg, ...)
- what is wrong with my cross compiling userland
- finally: how do I set correct memory addresses for download with RedBoot
  (that's another problem I saw today, downloading one of 'my' kernels)

I tried to adopt what I found in 'Current':
- copied from TS7200 and some from Armadillo9:
  created a new Kernel configuartion
  copied several 'files.*' - files
and try to compile.
I must have done something stupid - cross compiling the kernel seems to work 
but userland refuses!
 (at least I get compiled kernels without error messages)

The files I modified:
  OLIMEX_EP9301      configuration copied from TS7200 and Armadillo9
  files.ep9301
  mk.ep9301
  std.ep9301



I can see the device epgpio in :
epia1(root) OLIMEX_EP9301> pwd
/usr/www/pages/ftp/pub/NetBSD/evbarm/SRC/sys/arch/evbarm/compile/obj/OLIMEX_EP9301

epia1(root) OLIMEX_EP9301> ll netbsd*
-rwxr-xr-x  1 root  wheel  3485212 Nov 29 14:59 netbsd
-rwxr-xr-x  1 root  wheel  3485217 Nov 29 14:59 netbsd-epe0
-rwxr-xr-x  1 root  wheel  3109016 Nov 29 14:59 netbsd-epe0.bin
-rw-r--r--  1 root  wheel  1710539 Nov 29 14:59 netbsd-epe0.map
-rwxr-xr-x  1 root  wheel  3485216 Nov 29 14:59 netbsd-sd0
-rwxr-xr-x  1 root  wheel  3109016 Nov 29 14:59 netbsd-sd0.bin
-rw-r--r--  1 root  wheel  1710467 Nov 29 14:59 netbsd-sd0.map
-rwxr-xr-x  1 root  wheel  3109016 Nov 29 14:59 netbsd.bin
-rw-r--r--  1 root  wheel  1710246 Nov 29 14:59 netbsd.map

epia1(root) OLIMEX_EP9301> ll epgpio.*
-rw-r--r--  1 root  wheel  4755 Nov 29 14:46 epgpio.d
-rw-r--r--  1 root  wheel    18 Nov 29 11:37 epgpio.h
-rw-r--r--  1 root  wheel  9344 Nov 29 14:49 epgpio.o

... so I think, the first step was not too bad !
(it was not a too big step: I copied from TS7200 and Armadillo9)



However, trying to compile userland fails - at different points.
(In the meantime, I got megabytes of logfiles)

First attempt (sources were at /usr/src that time):
cd /usr/src
  ./build.sh -m evbarm release
. . .
#   install  /usr/src/obj/destdir.evbarm/dev/MAKEDEV
cd /usr/src/etc/obj && 
STRIP=/usr/src/obj/tooldir.NetBSD-4.99.4-i386/bin/arm--netbsdelf-strip /usr/src/obj/t
ooldir.NetBSD-4.99.4-i386/bin/nbinstall  -N /usr/src/etc -c  -r -T etc_pkg -o 
root -g wheel -m 555  MAKEDEV
/usr/src/obj/destdir.evbarm/dev
nbinstall: MAKEDEV: stat: No such file or directory

*** Failed target:  install-etc-files
*** Failed command: cd /usr/src/etc/obj && ...

(Hubert Feyrer pointed me in tech-embed@ to this list and mentioned to do 
MAKEDEV manually - no change!)


Later attempts fail with different messages - however, much earlier in the 
compile process.
One looks like this:

#   compile  gas/tc-arm.o
/usr/www/pages/ftp/pub/NetBSD/evbarm/SRC/obj/tooldir.NetBSD-4.99.4-i386/bin/arm--netbsdelf-gcc -O2
-fack-protector -Wstack-protector --param 
ssp-buffer-size=1  -Werror   -I/usr/www/pages/ftp/pub/NetB
SDvbarm/SRC/gnu/usr.bin/binutils/gas/arch/arm -I/usr/www/pages/ftp/pub/NetBSD/evbarm/SRC/gnu/usr.bin
/butils/gas/../../../dist/binutils/gas -I/usr/www/pages/ftp/pub/NetBSD/evbarm/SRC/gnu/usr.bin/binuti
lsas/../../../dist/binutils/gas/config 
. . .
 -c    /usr/www/pages/ftp/pub/NetBSD/evbarm/SRC/gnu/usr.bin/binutils/gas/../../../
di/binutils/gas/config/tc-arm.c
cc1: warnings being treated as errors
/usr/www/pages/ftp/pub/NetBSD/evbarm/SRC/gnu/usr.bin/binutils/gas/../../../dist/binutils/gas/config/
-arm.c: In function 'start_unwind_section':
/usr/www/pages/ftp/pub/NetBSD/evbarm/SRC/gnu/usr.bin/binutils/gas/../../../dist/binutils/gas/config/tc
-arm.c:13721: warning: not protecting local variables: variable length buffer

*** Failed target:  tc-arm.o

--------------

I am absolutely new to this matter - so please bear with me.

This is my host system for cross compiling:
epia1(root) 2006-11-29> uname -a
NetBSD epia1 4.99.4 NetBSD 4.99.4 (RFK) #0: Sat Nov 25 20:27:08 CET 2006  
root@epia1:/usr/obj/sys/arch/i386/compile/RFK i386

(compiling and installing worked flawless on i386!)

Same sources (but I moved to different place) for my attempt to port to 
CS-EP9301.

The /etc/mk.conf I used for compiling:

DISTDIR=/usr/DISTFILES
PACKAGES=/usr/PACKAGES
WRKOBJDIR=/usr/rfk/wrkobjdir
DESTDIR=/usr/www/pages/ftp/pub/NetBSD/evbarm/DESTDIR/
RELEASEDIR=/usr/www/pages/ftp/pub/NetBSD/evbarm/RELEASEDIR/
BSDSRCDIR=/usr/www/pages/ftp/pub/NetBSD/evbarm/SRC/
MAKEVERBOSE=2
MKCATPAGES=no
MKCRYPTO=yes
MKCVS=yes
MKDOC=no
MKHTML=no
MKINFO=no
MKMAN=no
MKMANZ=no
MKNLS=yes
MKPAM=yes
MKOF=yes
MKPIC=yes
MKPOSTFIX=no
MKUPDATE=yes
MKX11=no
MKYP=no
USE_PAM=yes
USE_SSP=yes

(my original mk.conf has lots of comments in - I want to learn about ;=)

What I want to do:
- assuming, that TS7200 is quite similar to CS-EP9301
- finding out, that Armadillo9 uses a similar CPU (CS9315)
  they have the on-chip GPIO!

- want to create a system, that allows using the CS9301 GPIO (epgpio)
- if possible, try to use SPI, I2C
  (seems a possible way to start into kernel / driver programming)
- and finally, maybe, access the on-chip ADC

Since everything has to be done for the first time, I decided, this could be 
the case for me ...
I have some experience with FreeBSD (and previously with VMS), with 
microcontrollers - so it should be possible for me.


- what have I done wrong,
- anything more detailed required 
  (did not want to spam this list with unnecessary long stuff)

- could anyone guide me a bit 
Hope to find helping hands here 

Thanks in advance

rfk
-- 
Richard Kaestner
IT-Consulting - Training - Development

Woerthgasse 17
A-2500 Baden
Austria

richard.kaestner@ycn.com
richard.kaestner@kabsi.at