just got the R-01 in the mail - we have snow on the ground so this is a good project - from other threads there have been issues with the keyboard - I think it works great for thumb typing - nice unit - working on some network tools etc on it - will be a great console and good for jotting notes. thanks for the notes on this thread!
The Allwinner D1 doesnāt have cpufreq support, but the clock controller is very easy to poke at, and thereās loads of overclocking headroom (at least on my machine):
use this at your own risk, you are directly poking SOC CCU registers! this should all reset back to safe defaults on a reboot, but it may be possible to cause hardware damage with this(!). the user manual wants you to switch the CPU clock to something that isnāt the PLL before modifying PLL settings (3.2.4.1), but I havenāt seen this crash yet (with reasonable overclocks). At your own risk!
see the Allwinner D1 user manual for the background.
to set the PLL multiplier for CPU domain, poke PLL_CPU_CTRL_REG-
busybox devmem 0x02001000 32 0xFA00XX00
(where XX is your multiplier value (N) - 1, in hex)
to set for DDR domain, poke PLL_CPU_CTRL_REG: busybox devmem 0x02001010 32 0xF800XX00
(where XX is your multiplier value (N) - 1, in hex).
the actual clock frequency for each domain is (24MHz * N). stock values are CPU N=0x30, DDR N=0x42. On my uConsole, I can overclock with reasonable stability to CPU N=0x46 (1700MHz CPU clock!), DDR N=0x61 (2328MHz)
This improves CPU performance by more than 50%, according to my benchmarks. (there may be even more room if youāre brave enough to increase voltagesā¦ which is also fairly easy to do but is even more likely to cause hardware damage so iām not going to give instructions for it here). Naturally, it will increase power consumption.
Did anyone try or researched osdev with R-01? So no linux, no nothing, just straight up bare metal?
Hi, I tried bare metal in R-01 and unfortunately, it was a complete fiasco, I would be very grateful if someone who succeeded could share the results.
Alwinner has a big Chinese community but I canāt find anything about the problem I tried to solve.
So what I personally have - yes is possible to boot Allwinner D1 by SPL and work with UART and GPIO absolutely fine (example projects like baremetal-lichee-rv or d1-nezha-baremeta), but if you want something more serious is almost not possible. In my case, I want to operate with a ClockworkPi Devterm display !
Display controlled by MIPI DSI interface in Allwinner documentation nothing about this, and no any open HAL or library.
Only what I found are drivers in the Linux kernel and look like the same drivers but adopted for RT-thread OS. Driver is a thousand lines of code mixed for all Allwinner platforms and with my programming experience is impossible to adapt to bare metal, wonder if someone can do this.
I tried to build a project only with these drivers and cut everything from OS specific, as a result, is compiled great, UART and GPIO work, but the Display is still black, why ? I donāt know.
Debugging is another headache to be solved.
I donāt want to upset you but I am disappointed and thinking of throwing D1 in the trash and buying some ARM.
I would be very grateful if someone could share the project where they managed to assemble the RT-thread for D1 with Sunxi HAL, I have a compilation error now.
any idea whereās the normal blinking cursor at?
jesus christ, this hit the spot!
A generic update ( sorry for my radio silence all, hella busy on this end ). The RISC-V / R-01 unit got me deep into āi3ā, by following rabbit holes with the display, the back-light, and not seeing the cursorā¦ Deep into i3 enough that Debian + i3 are my daily driver at work.
That being said I wanted to add to this thread @katmai 's amazing thread and notes.
If youāve put effort in on the R-01 @katmai has some great sd card is imaged ā usable uConsole notes, add to em if you have the notes or configs to spare!
sudo dd if=image.card of=/dev/mmcblk0 bs=512
62333952+0 records in
62333952+0 records out
31914983424 bytes (32 GB, 30 GiB) copied, 6665.29 s, 4.8 MB/s
took only a million fucking years to write
wget https://www.bioget.com/image.card
dd if=image.card of=/dev/mmcblk0 bs=512
Hi, post with my img ready-to-run ubuntu 22.04
OS for R-01 RISC V board (UCONSOLE & DEVTERM) - uConsole - clockworkpi
Just a heads up, iāve made the code available for getting a cleaner terminal/console experience. This is intended to use with a freshly flashed R01 DevTem.
Highlights:
- Added fan control.
- Temp control.
- Bigger font.
- Less ape on disabling services.
- Ability to wind back to how it all was.
- Snappier.
Code available here:
hey, all. just got my r01 in the mail the other day, neat little device. iām one of those people who intends to try and replace their phone with the r01, since i donāt really use my phone as a phone - just a crappy linux box in my pocket. iām not a fan of the default image though, so i want to try and port KISS Linux (https://kisscommunity.bvnf.space/) to the r01. itās a musl and busybox-based system oriented towards minimal overhead and posix compliance so it should be much smoother than the stock system given the SoMās limited capabilities.
that being said, iāve only ever tinkered with this sort of stuff in the x86 world - never RISC-V, or even ARM. i was using CLFS as a guide, but then started looking for source code and tools and heard that there are violations of the GPL wrt: distribution being locked behind an NDA or something. i did see @PotatoMania mention their github, and i grabbed the kernel w/ bsp, but the toolchain appears to only be available as a binary there - a problem, because my main system uses an aarch64 CPU.
would someone with experience be able to clarify if a standard cross toolchain is applicable here?
also, unrelated, is there a centralized community space for work on the r01? obviously the r01 tag exists here, but i a) donāt particularly love the interface and b) thereās still lots of cross-talk from the cm4 people. is there an irc or git presence controlled by community members?
thanks a ton. looking forward to working with everyone to get the ball rolling.
Hi, @midfavila I believe this toolchain can be suitable for your task GitHub - riscv-collab/riscv-gnu-toolchain: GNU toolchain for RISC-V, including GCC. Also, this article in general, is very helpful Building boot software and Debian from sources for a RISC-V board (Sipeed Lichee RV with D1 processor) - Andreas' website and this Allwinner Nezha - linux-sunxi.org.
About centralized community, I donāt know but it is a great idea
@ylyamin thanks a ton for the pointers, iāll review them over the next few days along with the other stuff iāve grabbed. if thereās sufficient interest iām sure we could register some officially unofficial channels for uconsole talk on libera.chat - i know that thereās a discord, but i think itās unusual to lock talk about open source hardware and software behind a closed system (even moreso considering that outside of libpurple i donāt know of any way to effectively use discord on the r01ā¦).
so, back with some unfortunate news. first off, looked at some of that material, decided to try and start by building a kernel - but, alas, my laptop, of all things, hasnāt got the disk space for a cross toolchain right now (itās running off an 8gb eMMC module - long story). iām currently finishing a move across canada and once i get my next paycheque iām going to see if i can get my workstation shipped out. thatās going to be way better for development. until then iām going to poke around and see if i can find a way to get realtime A/V playback working on the r01 - in theory you should be able to use plain ffmpeg on the framebuffer with a command something like this:
#!/bin/sh -e
ffmpeg -re -i "$1" -f alsa hw:0,0,0 -c:v rawvideo -pix_fmt bgra -f fbdev /dev/fb0
the problem is that the version of ffmpeg available for the uconsole is horribly out of date and canāt rotate the video stream during playback to the correct orientation. like, weāre two or three full major releases behind, at least - i think upstream is at 7.x.x, and weāre on 4.4.2. from 6.x.x onward you should be able to use -display_rotation 90
for that.
of course, the ideal would be figuring out if thereās a way to alter the ārealā display orientation from portrait to landscape in the kernel. but thatās not something i would know how to do off the top of my head.
next step is experimenting with the available resources on LTE, SMS, and calling. i get all that working reliably iāll probably start either a) getting important community developments on hardware and software put together in a proper page on my site or b) iāll write a simple dialog-based UI in bourne shell to use instead of a plain shell prompt.
anyway, thatās my bit so far.
another quick update after getting over pneumonia: while i was stuck in bed, i was doing some tinkering and associated reading. apparently the suggested method is to just build a new rootfs and then stick the existing kernel and such in thereā¦ not really my style, but for now itāll have to do.
speaking of my style, iāve somehow managed to kludge together a (very, very, very) minimal linux from scratch system based on busybox and musl. iāll put up the image somewhere soon as a proof of concept. could be useful as a starting point for others down the line. thatās what iām using it as, anyway; iām also just about done with a (very, very) slapdash port of KISS Linux to RISC-V. once i have a solid, self-hosting system, iāll put in some tweaks and QoL stuff for the uconsole, basic software, whatever, and push it out as an alpha image. give it another couple weeks, under ideal conditions.
hope youāre all having fun with your consoles!
been doing some more work on things. iāve gotten a fair few packages from my usual fork of kiss linux (using it since iām just more familiar with it), such as bsdcurses, libarchive, suckless userspace, etc, in addition to the previously mentioned packages. however, iāve run into no end of trouble compiling a native riscv64 compiler on my build machine - iāve gotten binutils up, but gcc just refuses to work. always throws out some junk about ambiguating new declaration of 'char* basename(const char*)' ...
i found an old post on the gentoo forums complaining about a similar issue and i tried some of the fixes in that thread, but no luck. iāll keep plinking away at the other stuff, but itās a real bummer i canāt figure out how to get a native gcc runningā¦
Keep at it you are doing amazing work and this will help the community!
I tried to do the same, but didnāt get much further. Those display drivers are a tangle to get through and I wasnāt able to stitch them together in a way that worked. I put up a little post-mortem on my website (http://www.jusentari.com/one-pixel) but suffice it to say, I only got UART and the backlight to work. Still chipping away at it though, so Iāll post something if I have any breakthroughs.