There are a few minor issues that prevent or1ksim from building on Mac OS X; the following patch should resolve them.
--- configure.ac (revision 59) +++ configure.ac (working copy) @@ -137,6 +137,8 @@
AC_CHECK_LIB(readline, add_history) +# Not all versions of readline have rl_event_hook (e.g., Mac OS X) +AC_CHECK_DECLS(rl_event_hook, [], [], #include <readline/readline.h>)
case "$host_os" in
--- sim-cmd.c (revision 59) +++ sim-cmd.c (working copy) @@ -837,8 +837,10 @@ / Tell the completer that we want a crack first. / rl_attempted_completion_function = sim_completion;
+#if HAVE_DECL_RL_EVENT_HOOK / Handle the gdb socket while waiting for input / rl_event_hook = check_gdb_comm; +#endif }
/* Attempt to complete on the contents of TEXT. START and END bound the
--- peripheral/atadevice.c (revision 59) +++ peripheral/atadevice.c (working copy) @@ -30,8 +30,16 @@ #include "port.h"
/ System includes / +#ifdef APPLE +#include <libkern/OSByteOrder.h> +#define bswap_16(x) OSSwapInt16(x) +#define bswap_32(x) OSSwapInt32(x) +#define bswap_64(x) OSSwapInt64(x) +#else #include <byteswap.h> +#endif
+ / Package includes / #include "atadevice.h" #include "atadevice-cmdi.h"
--- port/strndup.c (revision 59) +++ port/strndup.c (working copy) @@ -29,7 +29,8 @@
+/ the definition of size_t is provided in stddef.h / +#include <stddef.h> / Taken from glibc / char strndup (const char s, size_t n)
Er... formatting didn't come through. At any rate, the patch is clean if you "View source" on the page. I've uploaded a copy to http://jarv.in/or1ksim.svn.min.patch, just in case.
AC_CHECK_LIB(readline, add_history) +# Not all versions of readline have rl_event_hook (e.g., Mac OS X) +AC_CHECK_DECLS(rl_event_hook, [], [], #include <readline/readline.h>)
case "$host_os" in
--- sim-cmd.c (revision 59) +++ sim-cmd.c (working copy) @@ -837,8 +837,10 @@ / Tell the completer that we want a crack first. / rl_attempted_completion_function = sim_completion;
+#if HAVE_DECL_RL_EVENT_HOOK / Handle the gdb socket while waiting for input / rl_event_hook = check_gdb_comm; +#endif }
/* Attempt to complete on the contents of TEXT. START and END bound the
--- peripheral/atadevice.c (revision 59) +++ peripheral/atadevice.c (working copy) @@ -30,8 +30,16 @@ #include "port.h"
/ System includes / +#ifdef APPLE +#include <libkern/OSByteOrder.h>
+#define bswap_16(x) OSSwapInt16(x) +#define bswap_32(x) OSSwapInt32(x) +#define bswap_64(x) OSSwapInt64(x) +#else #include <byteswap.h> +#endif
+ / Package includes / #include "atadevice.h" #include "atadevice-cmdi.h"
--- port/strndup.c (revision 59) +++ port/strndup.c (working copy) @@ -29,7 +29,8 @@
+/ the definition of size_t is provided in stddef.h / +#include <stddef.h> / Taken from glibc / char strndup (const char s, size_t n)
</pre> <p> Jeremy </p> <p> -- <br /> Tel: +44 (1590) 610184<br /> Cell: +44 (7970) 676050<br /> SkypeID: jeremybennett<br /> Email: <a href="mailto:jeremy.bennett@embecosm.com">jeremy.bennett@embecosm.com</a><br /> Web: <a href="http://www.embecosm.com">www.embecosm.com</a> </p>Thanks for applying the patch. The code more-or-less builds cleanly from SVN on my Macbook (10.6.2). Presently, I have to execute the following to get the build to complete:
<pre> svn co --username=${OCUSER} http://opencores.org/ocsvn/openrisc/openrisc/trunk/or1ksim cd or1ksim automake --add-missing autoreconf ./configure --target=or32-elf --prefix=${OR32TOOLS}/or32-elf sed -i.bak -e's/^ECHO=/echo=/' libtool make all install </pre>