[J-core] What is the recomended binary header for compiler output?

Rob Landley rob at landley.net
Sat Aug 20 17:15:41 EDT 2016

On 08/20/2016 03:12 PM, Daniel V wrote:
> If you have made a Compiler, what header would be best for programs?
> Should I use the FDPIC ELF? Or is Shared FLAT sufficient?

The website points to the old uclibc+elf2flt toolchain aboriginal linux
used, but these days the modern toolchain (using current gcc and
binutils versions) is:


I think you can just download that and go:

  make TARGET=sh2eb-linux-muslfdpic

And it'll probably work? (More or less that. The readme and sample
config file list all the knobs.)

Of course what _I_ want is statically linked compilers (so you can
extract a tarball of binaries into an arbitrary directory on an
arbitrary linux distro and have it work), and I want native compilers
you can actually run on the board (or under qemu).

I'm putting together some build scripts which produce both cross and
native compilers from musl-cross-make (basically small wrappers that set
a bunch of environment variables to feed it the right set of
--disable-libquadmath and such flags to optimizethings, several of which
are mentioned in config.mak.dist), but a few days ago I hit an assert in
binutils trying to build a sh2eb native native compiler, and Rich has
been too busy with the VHDL repository conversion to look at it.

Rich has said that once we agree on a compiler version that Aboriginal
Linux can use to build its targets (as an externally supplied binary
toolchain), he's willing to host the binaries on his website. So you
should be able to download prebuilt binary toolchains for this sometime
next month (and we'll post the build scripts I used to make
musl-cross-make produce them).

Of course I'm trying to support arm and mips and powerpc and so on, so I
have more stuff to test before I hit a good stopping point. But the
assert I hit was in the sh2eb native compiler build.

> And is there any file that documents the specific instructions the in
> J2? Like a technical document for J2.

The webpage links to a superh instruction list. We support the sh2
instructions, plus the ones listed in that paragraph.

We haven't put it together into a technical document yet though. We need
to create a proper programming manual ala:


But we haven't yet.

> And is there any VM in c-code, that can be used to simulate the
> instruction set, while developing the compiler on your own computer?
> Or is I best to write it yourself?

Our build can use ghdl to produce similators (and we've used nvc to
simulate J1), info on both was posted here earlier. I should dig it up
and put it on the website. Alas, said simulators are cycle accurate and
just about useless for running linux. (I think the fastest machine we
have takes something like half an hour to boot linux to shell prompt
under simulator. You can see the individual characters output on the
virtual serial port.)

QEMU has sh4 support, which is a superset of sh2. On a gigahertz PC it's
faster than running on the numato board. Rich got our sh2 userspace
running in that under an sh4 kernel. (In theory fdpic should just work
if you can enable the fdpic loader in the kernel config. Making binflt
binaries work required a shim, I don't remember if he posted it here to
the list or not.)

Somebody was working to add a proper -cpu j2 target to QEMU, and numato
and turtle board emulations, but I haven't heard from them in weeks.

We have gcc for this target. What we'd really _like_ is llvm for this
target, but it's not out there yet. (Renesas paid to have it ported, and
then buried the results in a sea trench.)

Somebody was also working on that, and I haven't heard from them in even
longer. I've been totally buried with other things and haven't followed
up, but both conversations are in the list archives here.


More information about the J-core mailing list