<div dir="ltr">This is great! Thanks for the information. <div><br></div><div>Does gdb work on sh2 (j2)? I can't for the life of me seem to build gdb that supports either sh2 or sh4. The closest I got was building gdbserver from the gdb-5.3 package, but then I couldn't actually cross compile gdb, itself. </div><div><br></div><div>Thank you,</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div style="font-family:arial;font-size:small">Don A. Bailey</div><div style="font-family:arial;font-size:small">Founder / CEO</div><div style="font-family:arial;font-size:small">Lab Mouse Security</div><div style="font-family:arial;font-size:small"><a href="https://twitter.com/InfoSecMouse" target="_blank">@InfoSecMouse</a></div><div style="font-family:arial;font-size:small"><a href="https://www.securitymouse.com/" target="_blank">https://www.securitymouse.com/</a></div><div><br></div></div></div></div>
<br><div class="gmail_quote">On Fri, Jan 6, 2017 at 10:47 AM, Rob Landley <span dir="ltr"><<a href="mailto:rob@landley.net" target="_blank">rob@landley.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Jeff's reply didn't go to the list properly...<br>
<br>
On 01/06/2017 02:07 AM, D. Jeff Dionne wrote:<br>
<span class="">> Don A. Bailey wrote:<br>
>><br>
>> Hi All,<br>
>><br>
>> I'm very happy to have accidentally stumbled upon the j-core project<br>
>> today. I'm currently involved in RISC-V and it's wonderful to see<br>
>> another open source CPU project. I'm interested in using the j-core<br>
>> sh2 "clone". Is there the equivalent of a datasheet? I'd like to<br>
>> learn how to port my custom operating system to it, but I'm having<br>
>> trouble finding clear SH-2 architecture documents that describe more<br>
>> than the instruction set. E.g. what are the vectors<br>
>> in the VBR, what is the order, etc.?<br>
<br>
</span>I'm usually a bit further down in the software stack on this project,<br>
and Rich is offline this week, but here's the patch series that added<br>
interrupt controller support to the Linux kernel?<br>
<br>
  <a href="http://lkml.iu.edu/hypermail/linux/kernel/1608.0/03337.html" rel="noreferrer" target="_blank">http://lkml.iu.edu/hypermail/<wbr>linux/kernel/1608.0/03337.html</a><br>
<br>
We've basically been using the Linux device tree to document this stuff:<br>
<br>
<br>
<a href="https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/sh/boot/dts/j2_mimas_v2.dts" rel="noreferrer" target="_blank">https://git.kernel.org/cgit/<wbr>linux/kernel/git/torvalds/<wbr>linux.git/tree/arch/sh/boot/<wbr>dts/j2_mimas_v2.dts</a><br>
<span class=""><br>
>> Any advice is appreciated. Congrats on a very cool project!<br>
>> Best,<br>
>><br>
>> Don A. Bailey<br>
>> Founder / CEO<br>
>> Lab Mouse Security<br>
><br>
</span>> We’ve got this.  It’s very out of date… that is, contains now completely<br>
> incorrect, not just incomplete, information.  But it could be a starting<br>
> point.  As for the ISA, we have relied on Hitachi documents, and<br>
> architecture is not documented (at least not completely).<br>
><br>
> J<br>
<br>
The hitachi document is probably:<br>
<a href="http://koti.kapsi.fi/~antime/sega/files/h12p0.pdf" rel="noreferrer" target="_blank">http://koti.kapsi.fi/~antime/<wbr>sega/files/h12p0.pdf</a><br>
<br>
Although for an ISA reference we've more recently been using:<br>
<a href="http://www.shared-ptr.com/sh_insns.html" rel="noreferrer" target="_blank">http://www.shared-ptr.com/sh_<wbr>insns.html</a><br>
<br>
As the j-core web page says, our local changes for j2 are:<br>
<br>
> We've added two backported sh3 barrel shift instructions (SHAD and<br>
> SHLD) to make modern compilers happy, and a new cmpxchg (mnemonic<br>
> CAS.L Rm, Rn, @R0 opcode 0010-nnnn-mmmm-0011, based on the IBM 360<br>
> instruction).<br>
<br>
Current gcc/binutils has cpu "j2" which knows about these changes. We're<br>
using <a href="https://github.com/richfelker/musl-cross-make" rel="noreferrer" target="_blank">https://github.com/richfelker/<wbr>musl-cross-make</a> to build fdpic<br>
toolchains, using something vaguely like:<br>
<br>
make install OUTPUT=~/cross-sh2eb-linux-<wbr>muslfdpic \<br>
  TARGET=sh2eb-linux-muslfdpic GCC_CONFIG=--disable-nls \<br>
  --disable-libquadmath --disable-decimal-float --with-cpu-mj2<br>
<br>
(I have wrapper scripts that build various static and native toolchains<br>
for different targets, that was me sticking an "echo" in front of the<br>
make call to build the simple j2 one, once the script had worked out the<br>
arguments.)<br>
<br>
There's a j2_defconfig under arch/sh in current Linux kernels you can<br>
use to build a kernel targeted for the Numato board with that toolchain.<br>
(Rich asked me to upload a dtb file and I forgot, but you can build it<br>
from above dts file using dtc.)<br>
<br>
As for root filesystem, we're just doing a simple initramfs on the open<br>
source side. (It's got mmc sdcard support but it's fairly slow.) I'm<br>
doing a talk on building tiny root filesystems at ELC next month, which<br>
should eventually be listed on here:<br>
<br>
<a href="http://events.linuxfoundation.org/events/embedded-linux-conference/program/schedule" rel="noreferrer" target="_blank">http://events.linuxfoundation.<wbr>org/events/embedded-linux-<wbr>conference/program/schedule</a><br>
<br>
And presumably video will go up sometime after that?<br>
<span class="HOEnZb"><font color="#888888"><br>
Rob<br>
</font></span></blockquote></div><br></div>