NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Various size of (Project) ideas for NetBSD and pkgsrc

Le 29/09/13 20:41, Ryo ONODERA a écrit :

From: Yann Sionneau <>, Date: Sun, 29 Sep 2013 
19:37:14 +0200

Hi Ryo,

Le 29/09/13 03:09, Ryo ONODERA a écrit :

(8) Porting NetBSD to some FPGA CPU board
OpenCores' OpenRISC 1200, Xilinx's MicloBlaze, Altera NIOS II is
available for FPGA board.
At least OpenRISC 1200 and MicroBlaze have Linux support.
Supporting these architecture is interesting for NetBSD.
(I have no idea about NetBSD/nios2 status.)
I am in the process of adding support for LatticeMico32 (LM32)
architecture to NetBSD 6 kernel.
Last year a MMU (memory management unit) has been added to the LM32
softcore which makes it able to run Linux or NetBSD.
LM32 already had a uCLinux (noMMU) working port.
This year I started the project to port NetBSD 6 kernel on MMU-enabled
LM32 CPU in general and on the Milkymist open source System-on-Chip in

Today I had my first result on this project:

-> NetBSD 6 kernel immediately panics and dies. Even though this might
-> seem like a poor result, there have been a lot of work behind it.
This is a first step which looks very promising :) (at least console
driver works ;))
Great work!
I am not kernel developer, but I want to know the following questions.

How about status of NetBSD current?
According to NetBSD development process, porting to current is essential,
if I understand correctly.
Sorry I was using wrong term by saying "NetBSD 6" maybe.
My work is based on "-current"
But it's been several months since I last merged back into current so I'm a bit outdated I guess...

But I don't think the kernel as changed so much that it would take more than a few hours to sort out how to merge correctly my branch with NetBSD-current :)

And how about bus support?
According to MiklyMist wiki, MilkyMist uses wishbone like bus, and
I understand correctly, wishbone or similar bus support are not
implemented in current NetBSD.
Wishbone is the "on-chip" bus used in the System-on-Chip.
It's totally transparent to the software.
Basically all of the cores in the system-on-chip have a set of registers which are memory mapped. So there is no need for a "bus support", or maybe something trivial like mapping those registers to virtual memory once and then use the mapping in the respective drivers of the different cores connected to the wishbone bus. Here is a block diagram of the Milkymist SoC:

The Milkymist System-on-Chip runs on various FPGAs (Spartan 3, Spartan
6, Virtex 4 etc) from various FPGA vendors (Xilinx, Lattice, Altera)
It has been ported on numerous boards (Milkymist One, ML401, De0-nano,
Nexys3 etc...)
It uses LatticeMico32 (open source softcore) as it's CPU softcore.

If you want more information about Milkymist and it's NetBSD porting
work status do not hesitate to e-mail me or the Milkymist mailing list
I think FAGA based hardware needs setup of hardware, so
NetBSD developer should write CPU softcore etc to FPGA chip.
Maybe developers not familiar with this kind of works.

For example, MilkyMist for DE0 namo is attractive for me.
It is low price FPGA hardware.
But I am completely newbie to FPGA device, and I cannot imagine
what is needed to start MilkyMist on DE0 nano.
You need:

- The hardware
- A Windows or Linux PC (don't know about BSD support, maybe with the linux syscall compatibility layer?) - The IDE for the FPGA vendor installed, for the DE0 it's the Altera IDE -> Quartus II Web Edition Software (free of charge) - Clone the source code over there: - Clone its dependencies (Migen and Mibuild from this github account:
- Install Migen, Mibuild (python install, that's all)
- cd milkymist-ng-de0nano && make

Then use whatever software your board needs to push the FPGA bitstream (the design file that tells the FPGA how to behave) in the FPGA.

And there you are, you get a minimalistic Milkymist-ng system-on-chip with LatticeMico32 core, uart console, memory mapped GPIOs, SDRAM controller.

A simple BIOS is provided, accessible from the UART.
And I want to know performance information about FPGA board.
I don't own this board, but you cannot seriously expect big fast FPGA for a very small amount of money. Those small dev boards usually feature the little children of the given FPGA family, which in some way is great because it's usually the only FPGAs supported by the Free of charge version of the IDE (this is true for Xilinx and Altera at least, dunno for Lattice or Actel)
Microsoft Windows PC is needed?
No Microsoft Windows PC needed, you can use only Linux if you want.
For some boards however, it's only possible to push the bitstream (FPGA design file) to the board from Windows, only because sometimes there is no Linux software for that. That could be what decides you to buy a board and not to buy another.
  Additional hardware?
There is no RS-232 connector on the De0-nano.
And I don't think USB blaster port can be used as a USB-uart.
A quick look at Mibuild (kind of python library acting as abstraction layer between a FPGA board and the Migen framework) indicates that the port of milkymist-ng to the De0-nano is using GPIOs D3 and C3 of the board as rx and tx for the UART. Which means you need to hook some 3V3 TTL->RS-232 converter up to the GPIO expansion header of the De0-nano in order to connect any PC to the uart of the System-on-Chip running on the De0 board.

Another way of doing this, would be to use an arduino if you have one, and do a little program that acts as a bridge between the board and your PC like this : [De0-nano] rx tx GPIO <-> digital input of Arduino [arduino board] USB uart <-> Computer

Writing how to setup hardware is needed, and it may be
another NetBSD project idea or homework for MilkyMist people.

By the way, what is your target? MilkyMist SoC? MilkyMist-ng?
For now my target is Milkymist SoC, because it's been heavily tested and works very well.
I know the SoC design is very solid and does not have any surprise.
However, Milkymist-ng seems to become stable nowadays, and it's very portable and getting more and more easy to deal with since it's written in Python by using the fantastic Migen framework :)

Anyway, Milkymist legacy or Milkymist-ng, from a software point of view it's very very similar.
Only the addresses of the different cores changed.
As long as you just want to support framebuffer, ethernet, gpio, timer, uart that's really pretty much nothing to change to kernel code to have it run on one or the other.
And How to get the hardware that is exactly as same as yours?
I have a Milkymist One ( board which can be tricky to get your hands on since Sharism has stopped operations. However, you can use the awesome work Michael Walle did by adding support for Milkymist SoC (legacy one) to Qemu :)

To be honest, I am mostly testing using Qemu those days since it's very convenient during development.
No power supply, no hardware to carry, to USB cables etc etc.
Just your NetBSD kernel, your GDB and your Qemu in your terminal :)

Another NetBSD developer is interested by the NetBSD/Milkymist project, he owns a Nexy 3 FPGA board ( ). I quickly ported Milkymist-ng SoC on his board ( ) so that he could run a simple BIOS on his board :) His board is more expensive though... BUT it has a USB-UART ;)
This question is how to start NetBSD/milkymist question.
What hardware/software should I buy to follow your work?
You don't need any hardware, at all. That's the beauty of having support for the Milkymist SoC in Qemu! But if you really want to play with hardware (which is pretty cool indeed :)) you can buy a cheap De0-nano and a TTL->RS-232 converter! You could definitely try my NetBSD kernel work on this board, since it has 32 MB of SDRAM.

And I have noticed some open source SPARC CPU sotfcore is available for
FPGA board (T1, S1, LEON, etc.).
You have S1, LEON, aeMB (open source clone of MicroBlaze), OpenRISC and a lot more If you want to know why Milkymist project chosed LM32 core instead of another, you can check out the master thesis Sébastien did, there is a short comparison between those cores: page 23 of the PDF file.

FYI MicroBlaze CPU is not open source, even though there are a few
open source clones out there (aeMB and others)
Nios II is not open source neither.
OpenRISC is open source and has a MMU and a Linux port, it's a nice
project as well :)
I am not sticky to open source hardware.
Of course, if CPU softcore is open source, I am more happy.
And do not forget NetBSD/emips.
Indeed that's a very nice project :)
Too bad boards listed in are starting to be getting very old.
And very hard to source.

All of this being said, I agree with you that having NetBSD running on
FPGA would be a really cool achievement, especially on OpenSource
hardware (PCB and FPGA design) which allows for deep understanding of
hardware, digital design and low level software as well as tweaking
the CPU (cache size, TLB size, instructions, pipeline configuration
Thanks for your information.

I think the following idea is shown in this thread by you and me.

(a) Porting NetBSD to MilkyMist SoC/MilkyMist-ng open source hardware (status: 
in progress)
(b) Porting NetBSD to OpenRISC 1200 (target board is not specified)
(c) Porting NetBSD to MIcroBlaze (target board is not specified)
(d) Porting NetBSD to FPGA board with SPARC CPU softcore (target CPU and board 
is not specified)
(e) Writing how to start NetBSD/milkymist with a certain board (target board 
should be specified)
You mean write a tutoriel about how to synthetize Milkymist SoC, put it in a board, compile NetBSD kernel and then get it to run on the SoC? That would be nice indeed :) But first I need to finish the kernel work, and there is still a lot of work to be done!

Thank you.
You're welcome :)

Yann Sionneau

Home | Main Index | Thread Index | Old Index