Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Curiosity driven Free-Pascal bootsrap and HPLC instruments control application running on MILK-V Pioneer, ICE-V progress

20 views
Skip to first unread message

Pavel Pisa

unread,
Aug 9, 2024, 5:25:21 AM8/9/24
to RISC-V Developer Board Community
Dear community,

the two MILK-V Pioneer boxes just arrived and because of coincidence
with my help to reinstall our HPLC instruments at Charless University
after laboratory move, I have tested (successfully) our more than 20
years old HPCL instrument control software

https://sourceforge.net/projects/chromulan/

Originally developed on Dephi 6. It run in experimental build
on Milk-V system including instruments connected through our
uLAN communication driver built on box as well and connected
by USB to data acquisition and control device

https://ulan.sourceforge.net/

Picture of MILK-V Pioneer at operation and short info at Mastodon

https://social.kernel.org/notice/AkjYvergU6jrFAYJ9M

Report about boostrap of Free-Pascal through deboostraped RISC-V chroot
on x86 box and then all rebuilt native on the Pioneer.
Only LCL from Lazarus as Lazarus bigide build triggers some problem
in FPC compiler RISC-V target, reported to Free-Pascal community

https://lists.freepascal.org/pipermail/fpc-devel/2024-August/045745.html

As for the box, I have some problems with video stability when monitor
has been connected to the HDMI Pioneer output through cable to DVI-D
on monitor. DVI-D to DVI-D cable worked well, except that initial resolution
has been 2k, when chosen to match monitor Full-HD, picture became smooth.

The one box is planned for fully preemptive Linux kernel testing
and our PICe designs testing including CTU CAN FD and CAN latency
benchmarking

https://canbus.pages.fel.cvut.cz/#can-bus-channels-mutual-latency-testing

I want to offer the other one for access to our studnets of
BE4M35PAP/B4M35PAP Advanced Computer Architectures course

https://cw.fel.cvut.cz/wiki/courses/b4m35pap/start

to test the second homework focused on OpenMP, MPI and other
parallel programming tasks.

On ICE-V side, NuttX our iCE-40 programming support is part
of NuttX mainline now.

Some report of our progress with PMSM motor control experiment
on ICE-V can be read in respective thread on ICE-V Wireless
project site

https://github.com/ICE-V-Wireless/ICE-V-Wireless/issues/21

We have achieved 500 Hz control loop with C application
based on PXMC

https://www.pxmc.org/

and 200 Hz with pysimCoder (block diagram editor and real time
code generator for Python)

https://github.com/robertobucher/pysimCoder

Jakub Janousek's diploma thesis is due for deference on
September 2 and would serve as documentation for these
interest in project.

Best wishes,

Pavel Pisa
phone: +420 603531357
e-mail: pi...@cmp.felk.cvut.cz
Department of Control Engineering FEE CVUT
Karlovo namesti 13, 121 35, Prague 2
university: http://control.fel.cvut.cz/
personal: http://cmp.felk.cvut.cz/~pisa
social: https://social.kernel.org/ppisa
projects: https://www.openhub.net/accounts/ppisa
CAN related:http://canbus.pages.fel.cvut.cz/
RISC-V education: https://comparch.edu.cvut.cz/
Open Technologies Research Education and Exchange Services
https://gitlab.fel.cvut.cz/otrees/org/-/wikis/home

Kurt Keville

unread,
Sep 12, 2024, 12:23:42 PM9/12/24
to Pavel Pisa, RISC-V Developer Board Community
Pavel et als,

AFAICT the Debian install instructions from https://milkv.fyi/en/distros.html  do not work ... I will bang on it some more and see if I can find an alternate method. I don't know if I need Debian immediately but I do need Docker... and there does not appear to be a path to that through Fedora 42 (the MilkV recommended update) .

People have installed Docker on a similar SOC so I have to figure there is a path forward...

Is your system recognizing all of your PCI cards? lspci is recognizing my PCI cards OK ... I just need to install drivers (hence the need for Docker in my particular case). 

Kurt Keville

To unsubscribe from this group and stop receiving emails from it, send an email to devboard-commun...@riscv.org.

Kurt Keville

unread,
Sep 12, 2024, 2:20:20 PM9/12/24
to Kurt Keville, Pavel Pisa, RISC-V Developer Board Community
Update.

The Debian install instructions are fine. I just had an obscure bug in my version of debootstrap that put me off the rails.

For the daring out there... there appears to be precompiled images of a number of distros at
but they are on a site in China and there does not appear to be any verification options...

Ali Tariq

unread,
Sep 12, 2024, 3:08:58 PM9/12/24
to Kurt Keville, Pavel Pisa, RISC-V Developer Board Community
Hi Kurt,
I hope you are well.

I tried installing debian from the HowtoFAQ page of sophgo repository. It seems that it does not have HDMI display option. Are you using USB to serial converter?

And where can i get latest fedora update (Fedora 42 as you mentioned above).

It will be very helpful if you could answer these questions for me.

Regards,
Ali

Ali Tariq

unread,
Sep 12, 2024, 3:27:35 PM9/12/24
to Kurt L Keville, klk, Pavel Pisa, RISC-V Developer Board Community
Hi Kurt,
Thanks for sharing the info.

That seems odd. It supports VGA but doesnt support HDMI 🤔.

Thanks a lot. I also will try it out.

Regards,
Ali

On Fri, Sep 13, 2024, 12:25 AM Kurt L Keville <kkev...@mit.edu> wrote:
Hello Ali,

It appears I was wrong on that. I am still on fedora 38. But I will look into upgrading that as well. I have been able to run Debian (unstable) with a VGA monitor. I will see if I can upgrade that install a bit more...  will keep you posted.

Kurt

From: Ali Tariq <ali....@10xengineers.ai>
Sent: Thursday, September 12, 2024 3:08 PM
To: klk <k...@mit.edu>
Cc: Pavel Pisa <pi...@fel.cvut.cz>; RISC-V Developer Board Community <devboard-...@riscv.org>
Subject: Re: Curiosity driven Free-Pascal bootsrap and HPLC instruments control application running on MILK-V Pioneer, ICE-V progress
 

Kurt L Keville

unread,
Sep 12, 2024, 4:16:11 PM9/12/24
to Ali Tariq, klk, Pavel Pisa, RISC-V Developer Board Community
Hello Ali,

It appears I was wrong on that. I am still on fedora 38. But I will look into upgrading that as well. I have been able to run Debian (unstable) with a VGA monitor. I will see if I can upgrade that install a bit more...  will keep you posted.

Kurt

From: Ali Tariq <ali....@10xengineers.ai>
Sent: Thursday, September 12, 2024 3:08 PM
To: klk <k...@mit.edu>
Cc: Pavel Pisa <pi...@fel.cvut.cz>; RISC-V Developer Board Community <devboard-...@riscv.org>
Subject: Re: Curiosity driven Free-Pascal bootsrap and HPLC instruments control application running on MILK-V Pioneer, ICE-V progress
 

Michael Orlitzky

unread,
Sep 12, 2024, 8:22:14 PM9/12/24
to Kurt L Keville, Ali Tariq, klk, Pavel Pisa, RISC-V Developer Board Community
On 2024-09-12 19:25:01, Kurt L Keville wrote:
> Hello Ali,
>
> It appears I was wrong on that. I am still on fedora 38. But I will
> look into upgrading that as well. I have been able to run Debian
> (unstable) with a VGA monitor. I will see if I can upgrade that
> install a bit more... will keep you posted.

It's still a work in progress, but I've been documenting the Pioneer
Box at,

https://wiki.gentoo.org/wiki/Milk-V_Pioneer_Box

At this point it should be mostly free of misinformation. Despite the
URL, only a few parts are specific to Gentoo -- it should have
everything you need to install a "real" Fedora or Debian. The main
thing I assume (since Gentoo is source based) is that you have a
working riscv64 toolchain, but presumably that isn't too hard to come
by on Debian/Fedora.

I'm not aware of any userland problems, but you will need to build
your own kernel (relevant CONFIGs are listed on the page), and I would
recommend updating the bootloader/firmware ASAP since a lot of my
weird problems disappeared when I did that.

Ali Tariq

unread,
Sep 18, 2024, 3:22:43 AM9/18/24
to Michael Orlitzky, Kurt L Keville, klk, Pavel Pisa, RISC-V Developer Board Community
Thanks Michael,
I will check it out.

Btw, this morning i noticed that fedora 40 is out for RISC-V 😄

Regards,
Ali
IMG_20240918_122038.jpg

Ali Tariq

unread,
Sep 18, 2024, 6:42:09 AM9/18/24
to Michael Orlitzky, Kurt L Keville, klk, Pavel Pisa, RISC-V Developer Board Community
@Michael Orlitzky I have a question.

It seems that u-boot does not automatically detect any new installations if we upgrade the OS from within. I am trying to upgrade from Fedora 38 to Fedora 40. But it is still booting to Fedora 38 instead. 

Would you happen to know where I can change the process to boot to Fedora 40, which I just upgraded from within the Fedora 38 installation without building the whole bootloader from scratch?

Regards,
Ali (Cloud-V Team @ 10xEngineers)

Michael Orlitzky

unread,
Sep 18, 2024, 7:07:27 AM9/18/24
to Ali Tariq, Kurt L Keville, klk, Pavel Pisa, RISC-V Developer Board Community
On Wed, 2024-09-18 at 15:41 +0500, Ali Tariq wrote:
> @Michael Orlitzky <mic...@orlitzky.com> I have a question.
>
> It seems that u-boot does not automatically detect any new installations if
> we upgrade the OS from within. I am trying to upgrade from Fedora 38 to
> Fedora 40. But it is still booting to Fedora 38 instead.
>
> Would you happen to know where I can change the process to boot to Fedora
> 40, which I just upgraded from within the Fedora 38 installation without
> building the whole bootloader from scratch?

Sure. The default U-Boot command is actually compiled-in. U-Boot has a
.config file just like the Linux kernel, and the two relevant values
are,

CONFIG_USE_BOOTCOMMAND=y (enables the default boot command)
CONFIG_BOOTCOMMAND="a string of semicolon-separated commands"

You don't have to recompile to upgrade your kernel, but my point is
that there is simply an environment variable called "bootcmd" that
contains the series of U-boot commands that will be run. There's also
"bootargs" that contain the kernel CLI arguments. To update to a new
kernel, you'll have to change one or both of those variables, and then
save them with "saveenv" (this will write the variables to disk -- next
time, they're loaded automatically).

So in short:

1. Reboot, and hit a key to stop U-Boot's default process. This
will put you into a U-Boot shell.

2. Figure out what commands are needed to boot your new kernel.

3. Use "setenv" to save those commands in the "bootcmd" variable.

4. Save any new kernel CLI flags in "bootargs" with "setenv".

5. Save them with "saveenv".

6. Type "boot" to execute the default bootcmd/bootargs that you
just saved.

Ali Tariq

unread,
Sep 18, 2024, 8:23:19 AM9/18/24
to Michael Orlitzky, Kurt L Keville, klk, Pavel Pisa, RISC-V Developer Board Community
Thanks a lot, Michael,
I am also trying to change the boot to use grub instead of u-boot. I have seen your issue regarding SG2042.fd where you mentioned that the .fd file compiled from source code does not work and you also mentioned that the .fd file present in the fedora distro works fine.

Can you tell me where I can get this .fd file which is inside the fedora distro? Do I need to extract the tarball of the fedora distro present on the Sophgo distro? or can I get it from inside the installed OS in the MILK-V pioneer box that comes shipped with it?

(I am planning to use an SD card for grub as it is mentioned in your docs that it is checked first in the boot flow process for any bootloader entries)

Regards,
Ali (Cloud-V Team @ 10xEngineers)

Michael Orlitzky

unread,
Sep 18, 2024, 8:51:07 AM9/18/24
to Ali Tariq, Kurt L Keville, klk, Pavel Pisa, RISC-V Developer Board Community
On Wed, 2024-09-18 at 17:23 +0500, Ali Tariq wrote:
>
> Can you tell me where I can get this .fd file which is inside the fedora
> distro? Do I need to extract the tarball of the fedora distro present on
> the Sophgo distro? or can I get it from inside the installed OS in the
> MILK-V pioneer box that comes shipped with it?
>
> (I am planning to use an SD card for grub as it is mentioned in your docs
> that it is checked first in the boot flow process for any bootloader
> entries)
>

On this page...

https://github.com/sophgo/sophgo-doc/blob/main/SG2042/HowTo/FAQ.rst

You can download,

Fedora-38-riscv64-sophgo-single-20240125.img.tar.gz

When you extract that, you'll have a file called "fedora-sophgo.img"
that contains a raw disk image (the result running "dd" on a hard
drive) of a Fedora 38 install. The first partition in that image will
have SG2042.fd.

On Linux, the easiest way I can think of to access it is to run,

$ losetup -P -f fedora-sophgo.img

which will associate several loopback devices (/dev/loop0pX) with the
partitions inside the image. You should then be able to mount
/dev/loop0p1 normally, and copy SG2042.fd from wherever you mounted it.


Ali Tariq

unread,
Sep 23, 2024, 3:19:11 AM9/23/24
to Michael Orlitzky, Kurt L Keville, klk, Pavel Pisa, RISC-V Developer Board Community
Hi Michael,
Did you try the revyos (Debian) images available at https://mirror.iscas.ac.cn/revyos/extra/images/sg2042/ by PLCT? 

They have updated the kernel version with the latest patches. They also provide bin and img file for firmware updates but I don't know how to install them on the Pioneer. I am currently flashing the OS image on the SD card but getting weird errors. I guess that they require us to flash the firmware on the SD card and flash the OS on the SSD to work properly.


If you find a way to install them, please also let me know.

Regards,
Ali (Cloud-V Team @ 10xEngineers)

Kurt Keville

unread,
Sep 23, 2024, 8:40:54 AM9/23/24
to Ali Tariq, Michael Orlitzky, Kurt L Keville, klk, Pavel Pisa, RISC-V Developer Board Community
This was a good catch, Ali. 

I have been looking for a simple way to get a slightly more modern kernel and this might be it. This distro comes with the 6.6 kernel. I would love to be able to work with 6.12 some time but I can wait. 6.5 or 6.6 would give us a lot of feature options.

I have found a couple of Pioneer topic threads outside of this list and have invited some of those folks to come over and join us here. There are a lot of RV enthusiasts interested in this board.  

Michael Orlitzky

unread,
Sep 23, 2024, 9:01:24 AM9/23/24
to devboard-...@riscv.org
On Mon, 2024-09-23 at 12:18 +0500, Ali Tariq wrote:
> Hi Michael,
> Did you try the revyos (Debian) images available at
> https://mirror.iscas.ac.cn/revyos/extra/images/sg2042/ by PLCT?
>
> They have updated the kernel version with the latest patches. They also
> provide bin and img file for firmware updates but I don't know how to
> install them on the Pioneer. I am currently flashing the OS image on the
> SD card but getting weird errors. I guess that they require us to flash the
> firmware on the SD card and flash the OS on the SSD to work properly.
>
> The repository is: https://github.com/revyos/revyos?tab=readme-ov-file
>
> If you find a way to install them, please also let me know.
>

No, I haven't tried them, sorry. I was able to get Gentoo installed
with the SOPHGO 6.1.x kernel and that scratched my immediate itch. The
upstream progress at,

https://github.com/sophgo/linux/wiki

gives me some hope that within a version or two, the upstream kernel
might be usable. In daily usage I can live without the MTD and poweroff
drivers, for example. And I'm not sure what is meant by "network" and
"RTC" because the drivers for the NICs (r8169 / ixgbe) and the RTC
(ds1307) are already upstream.

In any case:

* firmware_single_sg2042-v6.6-lts-v0p7.img is a disk image for an
SD card. You could write it to the card directly with "dd", or you
can mount it using the "losetup -f -P" trick to see what it
contains (the usual suspects, fip.bin, SG2042.fd, conf.ini, etc.)

* firmware_single_sg2042-v6.6-lts-v0p7.bin is an image for the SPI
flash. I haven't actually tried it, so buyer beware, but the fact
that it's <64MiB and contains many of the same strings as my own
/dev/mtd1 makes me pretty confident that that's what it is. You
would use "flashcp" to write this one to /dev/mtd1. But keep in
mind that you also need to flashcp a conf.ini to /dev/mtd0.

Kurt Keville

unread,
Sep 23, 2024, 10:01:55 AM9/23/24
to RISC-V Developer Board Community
FWIW, I have never relied on an RTC. Since dev boards don't ship with a battery I have been using the old local-setclock on logout script. If your clock is set to somewhere within a couple months of correct time I think ssh will still work.  

Raspian also has a timedatectl hack for same...

Robert Lipe

unread,
Sep 23, 2024, 6:40:27 PM9/23/24
to Kurt Keville, RISC-V Developer Board Community
Most everything with a network stack will do an NTP upon boot and every once in a while after that.

While ntp.conf can be harrowing, most anything with even a UDP stack can implement "get a current time" from a public NTP server in about a hundred lines of primitive code, crafting and parsing the raw UDP.

RJL

To unsubscribe from this group and stop receiving emails from it, send an email to devboard-commun...@riscv.org.

Ali Tariq

unread,
Sep 24, 2024, 12:01:57 AM9/24/24
to Michael Orlitzky, RISC-V Developer Board Community
Hi Michael,
Thanks alot for the idea. I will try to burn it in SD card. That being said, the operating system has to be flashed on NVMe then. 

Currenly i am seeing kernel panic on their latest OS version. I dont think flashing a firmware will solve the problem. But i will try it out once i get a spare SD card and an nvme


Regards,
Ali

Jehan

unread,
Sep 26, 2024, 12:52:55 PM9/26/24
to devboard-...@riscv.org

Hi!

On 9/13/24 02:22, Michael Orlitzky wrote:
On 2024-09-12 19:25:01, Kurt L Keville wrote:
Hello Ali,

It appears I was wrong on that. I am still on fedora 38. But I will
look into upgrading that as well. I have been able to run Debian
(unstable) with a VGA monitor. I will see if I can upgrade that
install a bit more...  will keep you posted.
It's still a work in progress, but I've been documenting the Pioneer
Box at,

  https://wiki.gentoo.org/wiki/Milk-V_Pioneer_Box

At this point it should be mostly free of misinformation. Despite the
URL, only a few parts are specific to Gentoo -- it should have
everything you need to install a "real" Fedora or Debian. The main
thing I assume (since Gentoo is source based) is that you have a
working riscv64 toolchain, but presumably that isn't too hard to come
by on Debian/Fedora.

Thanks for this. I was wondering what OS to install (the partition Fedora 38 installed by default is just so small that I cannot even update to Fedora 40! Not enough space! 😆). Since Gentoo was one of my fondest memories of a Linux distributions, I decided to give it a try on this machine. I only left a bit of space after the Fedora partition so that I can later resize it from the Gentoo OS (to at least be able to update), while still leaving it. And 100GiB was given to Gentoo, and the rest to a $HOME. :-)

Anyway your instructions worked well. For the kernel only, I settled at just reusing the Fedora kernel (I could build a new one, but it won't start and really I didn't feel like putting too much time on this) to start Gentoo. 😅

My first test was to build babl, GEGL and GIMP, which worked very well. Now I'm going to test flatpak and see if we can build a RISC-V flatpak of GIMP. Would be cool. :-D

Anyway this machine is fun, though it's noisy as hell. And is it me or does it have weird freezes from time to time (like a few dozen seconds, or minutes, then it gets back to normal)? While stuff like compiling is very fast (with all these processors and that memory, it's expected!), when I tried to use the default GNOME desktop on Fedora at first, it didn't feel very responsive.

Anyway, thanks for the instruction pages. :-)

Jehan

I'm not aware of any userland problems, but you will need to build
your own kernel (relevant CONFIGs are listed on the page), and I would
recommend updating the bootloader/firmware ASAP since a lot of my
weird problems disappeared when I did that.

To unsubscribe from this group and stop receiving emails from it, send an email to devboard-commun...@riscv.org.
-- 
ZeMarmot open animation film
http://film.zemarmot.net
Liberapay: https://liberapay.com/ZeMarmot/
Patreon: https://patreon.com/zemarmot
Tipeee: https://www.tipeee.com/zemarmot

Pavel Pisa

unread,
Sep 27, 2024, 1:59:44 PM9/27/24
to devboard-...@riscv.org, Jehan
Hello Jehan and others,

I have not much time lately, the semester starts there.

On Thursday 26 of September 2024 18:52:50 Jehan wrote:
> Hi!
...
> Thanks for this. I was wondering what OS to install (the partition
> Fedora 38 installed by default is just so small that I cannot even
> update to Fedora 40! Not enough space!.

There is lot of space on NVME drive so I have used simple/quick
fix option to gain some space for Fedora by extending the
partition by resize2fs.

dnf install e2fsprogs parted util-linux

I have used fdisk to extend /dev/nvme0n1p3 partition.
It can be done even from the running system.

fdisk /dev/nvme0n1

You should list the partitions "p"

Device Boot Start End Sectors Size Id Type
/dev/nvme0n1p1 8192 258047 249856 122M c W95 FAT32 (LBA)
/dev/nvme0n1p2 * 258048 1257471 999424 488M 83 Linux
/dev/nvme0n1p3 1257472 156250000 154992529 73.9G 83 Linux

then you need to extend partition 3, so you can delete it and recreate
it with bigger size, check that it starts exactly at the same sector.
It is critical. Only if it is correct, save the partitions table.

The using parted may be more safe

parted /dev/nvme0n1

actual resize command, i.e.

resizepart 3 80GB

then run

resize2fs /dev/nvme0n1p3

It should work on the running system and worked for me.

I plan to test Debian and current/mainline kernel in the next steps.

I have not analyzed boot sequence much yet. But I would prefer to switch
U-boot console and kernel console to some serial port. Ideally frontend
with USB-C connector. Or I have more 1.8 to 5.0 V capable (L)VTTL UART
to USB converters even with galvanic isolation, so I would use that.

So I would be gratefull, if somebody gives me hint how to get to the
U-boot or other boot prompt over serial to be on safe side.

I have option to take the NVME our of the box to the USB
converter if something goes wrong, but I would prefer
to have simple solution.

Best wishes,

Pavel
--

Ali Tariq

unread,
Sep 27, 2024, 3:51:25 PM9/27/24
to Pavel Pisa, RISC-V Developer Board Community, Jehan
Hi Pavel,
I have already tested Debian 12 provided by PLCT at https://github.com/revyos/revyos. They have kernel version 6.6 already working.

The Pioneer box first checks for the bootloader in the SD card and then SPI flash memory if the SD card is not inserted. Luckily, revyos distro includes images for SD card (.img file) as well as SPI flash (..bin file). I flashed an SD card instead of an SPI flash to keep it safe from being corrupted.


I also observed that if the kernel is updated inside Fedora, it is not visible to the boot menu so you have to change the entry manually. But I was getting kernel panic so I flashed the NVMe with the latest OS image of revyos and it seems to be working fine.

So, I just flashed the SD card with the .img file of the bootloader and flashed the NVMe with revyos OS image

There is one other issue that I observed, if you try to boot revyos latest distro with an old bootloader it fails (I tried to boot it from an SD card).

Regards,
Ali (Cloud-V @ 10xEngineers)

Han Gao/Revy

unread,
Sep 27, 2024, 9:15:23 PM9/27/24
to RISC-V Developer Board Community, ali....@10xengineers.ai, RISC-V Developer Board Community, Jehan, pi...@fel.cvut.cz
> There is one other issue that I observed, if you try to boot revyos latest distro with an old bootloader it fails (I tried to boot it from an SD card).

There will be this problem. The solution is to use the SD card to flash a new img.
Another problem is that the Linuxboot 6.1 kernel is a little different from the 6.6 kernel. Revyos is now abandoning 6.1 and maintaining 6.6. After 6.12 is released as a lts, ​​consider porting it to 6.12.
Reply all
Reply to author
Forward
0 new messages