New RISCV board (cartesi-machine)

Marcelo Politzer marcelo.politzer at cartesi.io
Thu Sep 16 11:01:41 PDT 2021


On Wed, Sep 15, 2021 at 6:58 PM Ahmad Fatoum <a.fatoum at pengutronix.de> wrote:
>
> Hello Marcelo,
>
> On 15.09.21 23:43, Marcelo Politzer wrote:
> > On Wed, Sep 15, 2021 at 6:17 PM Ahmad Fatoum <a.fatoum at pengutronix.de> wrote:
> >>
> >> Hello Marcelo,
> >>
> >> On 15.09.21 22:30, Marcelo Politzer wrote:
> >>> Hi, I'm new to barebox
> >>>
> >>> I'm currently porting barebox to a riscv board (cartesi-machine).
> >>
> >> Oh, looks interesting! What SoC does it use?
> >
> > It uses SOC_VIRT. It is an emulator to be precise, we use it for
> > verifiable computations.
> > It is pretty easy to try it out (there is a docker image for it):
> > https://www.cartesi.io/en/docs/machine/host/overview/
>
> Thanks, will check it out.
>
> >>> I got it mostly working:
> >>> - new serial: serial_sbi.c and
> >>
> >> Keep in mind that newer SBI versions deprecate
> >> sbi_console_getchar() and sbi_console_putchar() with no replacement.
> >>
> >> But if your board's firmware provides it, there is no issue with
> >> adding a driver for it.
> >
> > That is what the emulator implements for now.
> > I have to admit that a virtio system would be cool, maybe in the future.
>
> Like this? :-)
>
> https://www.barebox.org/jsbarebox/

That is cool!

>
> >>> - ext4 filesystem with mtdram
> >>>
> >>> 1) What I am still trying to figure out is how to customize `env` correctly.
> >>> I got it to build and appear based on the docs [1], [2],
> >>
> >> Those look ok. I assume you have
> >>
> >> defaultenv_append_directory(defaultenv_cartesi); in your board code?
> >
> > yes
> >
> >>
> >>> however the only way I found around [3] was to replace `bin/init` with
> >>> this[4] layout.
> >>
> >> After drivers probe, barebox invokes init to source init scripts and
> >> do the countdown and such. This is written in C, but you can override
> >> it with an /env/bin/init shell script, which is what you did here.
> >>
> >> I would not recommend this. Drop /env/bin/init and use the same C init
> >> nearly everyone else does. You can still customize it via the
> >> /env/init/ scripts
> >>
> >>> Is there a recommended way to go about this?
> >>
> >> You need to set boot.default, e.g.
> >>
> >> echo 'cartesi net' > defaultenv-cartesi/nv/boot.default
> >>
> >> Which would try cartesi first and then net if the first one failed.
> >
> > That worked great.
> > Looks a lot cleaner now.
> >
> >>
> >>> 2) I also would like clarification on the upstreaming process, is it
> >>> PR based, patches on this list?
> >>
> >> Patches to the mailing list are the usual way of contributing.
> >
> > OK, I'll clean this up and send it as two patches:
> > - serial_sbi
> > - cartesi (board)
>
> Sounds good.

Patches attached, please review at your convenience.

>
> Cheers,
> Ahmad
>
> >
> >>
> >> Cheers,
> >> Ahmad
> >>
> >>>
> >>> best,
> >>> Marcelo
> >>>
> >>>
> >>> [1] Makefile:
> >>> ```
> >>> bbenv-$(CONFIG_BOARD_CARTESI) += defaultenv-cartesi
> >>> ```
> >>>
> >>> [2] arch/riscv/boards/cartesi:
> >>> ```
> >>> defaultenv-cartesi
> >>> ├── boot
> >>> │   └── cartesi
> >>> ├── init
> >>> │   ├── automount
> >>> │   └── ps1
> >>> └── nv
> >>>     ├── allow_color
> >>>     ├── autoboot_timeout
> >>>     └── user
> >>> ```
> >>>
> >>> [3]
> >>> ```
> >>> Hit m for menu or any to stop autoboot:    0
> >>> Booting entry 'net'
> >>> ```
> >>>
> >>> [4]
> >>> ```
> >>> defaultenv-cartesi
> >>> ├── bin
> >>> │   └── init
> >>> └── boot
> >>>     └── cartesi
> >>> ```
> >>>
> >>> _______________________________________________
> >>> barebox mailing list
> >>> barebox at lists.infradead.org
> >>> http://lists.infradead.org/mailman/listinfo/barebox
> >>>
> >>
> >>
> >> --
> >> Pengutronix e.K.                           |                             |
> >> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> >> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> >> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
> >
>
>
> --
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-RISC-V-cartesi-Initial-port.patch
Type: text/x-patch
Size: 5107 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/barebox/attachments/20210916/e3f4b57d/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-serial-implement-SBI-UART-support.patch
Type: text/x-patch
Size: 3961 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/barebox/attachments/20210916/e3f4b57d/attachment-0003.bin>


More information about the barebox mailing list