nios2_iss usability
Morten Kristiansen
millibit+rtems at gmail.com
Mon Apr 6 20:13:52 UTC 2009
> I am also wondering, is the current version of nios2-gen under tools/cpu/nios2 works ? I tired to parse
>my ptf file (even the nios2_iss.ptf) and
> it says no CPU found. Does that mean to create a BSP of NIOS2 will required manually editing the bsp.h and
> mailing list ?
If I read you correctly, there are other ways. Under the NiosII shell
you can use the command nios2-bsp-editor to generate a .bsp file and
from that using nios2-bsp-generate-files generate a BSP with drivers
for most hardware in your Nios system, including a _start function
which initialize cache, etc. This is all described in the Altera
Manual "Nios II Software Developer’s Handbook 9.0" chapter 15.
Now parts of the function names collide with what you'll find in
newlib, like gettimeofday (AFAIR). You can rename these functions by
generating your own alt_syscall.h from the already generated files:
$ cat ~/bin/mk_rtems_os_h
#!/bin/sh -e
SRC="HAL/inc/os/alt_syscall.h"
DST="os/alt_syscall.h"
[ -d os ] || mkdir os
{
echo "/* Translated by $0 from $SRC to $DST */"
sed -r '/^#define ALT_/s/(ALT_[^ \t]+[ \t]+)/\1alt_/' "$SRC"
} > "$DST"
cat - <<EOF
Now compile your code like this:
make CC=nios2-rtems4.9-gcc AR=nios2-rtems4.9-ar AS=nios2-rtems4.9-gcc
EOF
This should give you a nice .a file with most of the stuff inside. It
was my plan to integrate this nicely; but so far I got stuck with
problems building gcc and newlib together. I'm starting to dream about
commercial compilers...
I hope above information helps you.
More information about the users
mailing list