I have started doing Rockchip ( rk3399 to start with). I have built the driver. I don’t know how it would work, but I am facing a dtb issue. I only get a empty dts file. I have been trying to follow the allwinner port, but no luck. So the question of today is: What do I need to do in order to get a dts. I have dts extracting in usb_host/rk3399/target.mk and also the paths to the rk3399 and pinebooks dts files. I wonder … can it be that I ask for wrong selection? I am going to try that now. Since I tend to write a lot I thought a forum thread is better than spamming the maillist
I get this from the dtb creation part:
LINK rk3399_usb_host
genode-aarch64-cpp: internal compiler error: in do_spec_1, at gcc.cc:6087
Not so good , if you ask me… I have the 23.05 toolchain. If I hit make again , I don’t get that error , but from what I understand the preprocessor is needed.
To follow the lines of the Allwinner work, I recommend reading my article Taking Linux out for a Walk (in particular the Section Device-tree treasure trove) as well as the article Pruning device trees. Once you get useful results by using the tool/dts/extract tool manually, the make rules will hopefully become more clear.
Once you get useful results by using the tool/dts/extract tool manually, the make rules will hopefully become more clear.
Thanks! I could do it manually. The reason for ICE error is unknown since it worked manually. Same command line. Then the extract failed because of several labels had sub labels that the tool recognized as labels. I hand edited the flat file and the result look good. I now have a dtb file.
To summarize the ICE is still a mystery: IF it hasen’t got a file path to start with… and even if that worked the extract part will fail because of the aliases.
Next up:
icken@minimonster:~/src/Genode/git4/genode/build/arm_v8a$ make drivers/platform/rk3399 BOARD=rk3399 KERNEL=hw
Program drivers/platform/rk3399/rk3399_platform
micken@minimonster:~/src/Genode/git4/genode/build/arm_v8a$ ls drivers/platform/rk3399/
micken@minimonster:~/src/Genode/git4/genode/build/arm_v8a$
I have platform in my archives file and as you can see it says "Proogram … " but the directory is empty. In fact none of the drivers in archives are built from drivers-interactive… test-case run/demo
Found it!
[init → drivers] child “report_rom” announces service “Report”
[init → drivers] child “report_rom” announces service “ROM”
[init → drivers] child “platform_drv” announces service “Platform”
[init → drivers → gui_fb] — rk3399 fb driver —
[init → drivers → gui_fb] fb init: 0
[init → drivers → gui_fb] fb cfg: 0
[init → drivers → gui_fb] win0en: 0x3a000081
[init → drivers → gui_fb] act info: 0xef013f
[init → drivers → gui_fb] fb init2: 0x0
[init → drivers → gui_fb] fbset: 0x46400000
[init → drivers → gui_fb] vop sys: 0x20805800
[init → drivers] child “usb_drv” announces service “Usb”
[init → drivers] child “event_filter” announces service “Event”
[init → drivers → usb_drv] Error: Initcall __initcall_timer_sysctl_init6 unknown in initcall database!
[init → drivers → usb_drv] Error: Initcall __initcall_vsprintf_init_hashval4 unknown in initcall database!
[init → drivers → usb_drv] kmem_cache_create_usercopy() failed with error -22
[init → drivers → usb_drv] Error: Function dump_stack not implemented yet!
[init → drivers → usb_drv] backtrace “ep”
[init → drivers → usb_drv] 404fed68 1076fc8
[init → drivers → usb_drv] 404fee38 1077074
[init → drivers → usb_drv] 404fee98 10389e0
[init → drivers → usb_drv] 404feed8 1087af4
[init → drivers → usb_drv] 404feee8 108b924
[init → drivers → usb_drv] 404fef58 10790e4
[init → drivers → usb_drv] 404fef98 1086078
[init → drivers → usb_drv] Will sleep forever…
[init → scout] png is 101x92 depth=8
It loads , missing things but still progress
When it works I need somehow make the build work without hacks… shouldn’t be difficult except for the dtb thing.
[init → drivers → usb_drv] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[init → drivers → usb_drv] clocksource: dde_counter: mask: 0xffffffffffffff max_cycles: 0x1d854df40, max_ids
[init → drivers → usb_drv] sched_clock: 64 bits at 1000kHz, resolution 1000ns, wraps every 2199023255500ns
[init → drivers → usb_drv] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645s
[init → drivers → usb_drv] platform ff770000.syscon:phy@f780: Fixing up cyclic dependency with fe330000.mmc
[init → drivers → usb_drv] usbcore: registered new interface driver usbfs
[init → drivers → usb_drv] usbcore: registered new interface driver hub
[init → drivers → usb_drv] usbcore: registered new device driver usb
[init → drivers → usb_drv] Warning: lx_emul_random_gen_bytes: dummy implementation used, filling buffer wits
[init → drivers → usb_drv] clocksource: Switched to clocksource dde_counter
[init → drivers → usb_drv] usbcore: registered new interface driver genode
[init → drivers → usb_drv] ehci-platform fe380000.usb: error -6: IRQ index 0 not found
Getting there! I wonder IRQ index 0?
OK so it doesn’t get the irq number from its platform device. Sounds odd
The only answer duck and google gives me is that it might be a error in dts… but it looks ok
This looks suspicious. Is this the number of interrupts on my platform? I have 148 SPI.
I found this code in Genode:
unsigned max_irq() { return 32 * (readTyper::It_lines_number() + 1) - 1; }
I wonder what that resolves to.
The error message comes from drivers/base/platform.c . If I hardcode a IRQ I get a another error … ~ can’t add device with irq $IRQ.
To add to this is that Genode unmask is only called when timer is initialised. So if the timer should interrupt repeatable interrupts doesn’t work. Unmask timer doesn’t happen unless I mask everything
msr DAIFSet, #0b1111
I have tried to clear it , unmask it right after timer does unmask. But no luck. I guess timer wasn’t runnig if irqs was on during boot.
Interrupts worked for USB on RK3588, but back then I hacked something together from the old iMX8 code, and that isn’t possible using todays git.
Another issue is that it doesn’t boot at all with disable_mmu in boostrap crt0.s. I already mentioned that and it really puzzles me. I found out that I had this commented out in the bootstrap I used for RK3588. Probably not related to interrupts.
I am running unpatched mainline u-boot.
It would be great if someone could tell me how I need to patch mainline in order to boot uImage. That piece of code thus a few things before “go”. I can’t figure out what I need to do during system startup.
Ok so starting with uImage … actually starts. BUT it doesn’t help much because it fails probably because mmu is off … that is the same thing that happens if mmu_disable… gnargle
It seems that I can’t change category. for this thread.
Done ^^
If that didn’t break thing up I’ll apply the same method for other threads tomorrow.
OK so here is a more in depth debugging session:
The boostrap stack is defined to a region defined in bootstrap/init.cc
static constexpr size_t STACK_SIZE = 0x2000;
size_t bootstrap_stack_size = STACK_SIZE;
uint8_t bootstrap_stack[Board::NR_OF_CPUS][STACK_SIZE]
attribute((aligned(get_page_size())));
It happens to be that X1 points to SP. when entering Memory_region constructor.
The crashing instruction is:
3c810420 str q0, [x1], #16
Which gives alignment fault:
ESR 0x96000061
So why is it not aligned?
I was tired so that error was because of Genode::raw in init. Sorry
I am still facing the alignment fault. The default pagesize is 4096 so that hack added nothing I have checked where stack is and x1 is in that region if I still can do basic arithmetic
Memory_region is used 3 times in the Platform::Board::Board() constructor.
I bet it is the last of them that fails, something for tomorrow.
The problem is, I can’t access ram if atomic load to a word register. Which means that Genode::raw doesn’t work without mmu on. Is this a compiler issue? Genode::raw calls cxa_guard_acquire, which crashes.
I have this line in crt0.s (boostrap) as a test and it crashes.
ldxr w3,[x1]
ESR:
0x96000035
No problem if MMU is on, I expect that u-boot uses a 1:1 map, since I can write to hw regs, and Genode boots to graphics.
This doesn’t explain the alignment fault in Memory_region.
updating toolchain
Unfortunately I am at latest already
I am soo happy
Turns out that the recent release works! Git from last week didn’t.
But no usb yet… at least the system starts without mmu, very good.
Congratulations! That’s great news!
Congratulations! That’s great news!
I wish I known that git version was sort of borked. It was a not so pleasant debug session, that lasted several days.
That’s software for you!
Interrupts are working
proof:
Kernel: take req: 30
Kernel: _interrupt_cpu
Kernel: take req: 30
Kernel: _interrupt_cpu
Kernel: take req: 30
Kernel: _interrupt_cpu
Kernel: take req: 30
Kernel: _interrupt_cpu
Kernel: take req: 30
Kernel: _interrupt_cpu
Kernel: take req: 30
Kernel: _interrupt_cpu
Kernel: take req: 30
Kernel: _interrupt_cpu
Kernel: take req: 30
Kernel: _interrupt_cpu
Kernel: take req: 30
Kernel: _interrupt_cpu
Kernel: take req: 30
Kernel: _interrupt_cpu
Kernel: take req: 30
Kernel: _interrupt_cpu
Kernel: take req: 30
Kernel: _interrupt_cpu
Kernel: take req: 30
Kernel: _interrupt_cpu
Kernel: take req: 30
Kernel: _interrupt_cpu
Kernel: take req: 30
Kernel: _interrupt_cpu
Kernel: take req: 30
Kernel: _interrupt_cpu
Kernel: take req: 30
Kernel: _interrupt_cpu
I got tired of Linux so I have started on a generic EHCI driver. However I ran into logistics problem the first thing. This is how my little driver main looks like:
struct Ehci::Main
{
Env & _env;
Platform::Connection _platform { _env };
Platform::Device _device { _platform };
ehci_ctrl _ehci_ctrl { _device };
Main(Env &env) : _env(env)
{
log(“— Generic EHCI driver —”);
_ehci_ctrl.init();
}
};
void Component::construct(Genode::Env &env) {
static Ehci::Main main(env); }
The greeting isn’t displayed so unsure if the driver actually starts.
Any hints?
This is the serial output
[init → drivers] child “generic_ehci”
[init → drivers] RAM quota: 776K
[init → drivers] cap quota: 216
[init → drivers] ELF binary: rk3399_ehci_drv
[init → drivers] priority: 0
[init → drivers] child “event_filter”
[init → drivers] RAM quota: 776K
[init → drivers] cap quota: 46
[init → drivers] ELF binary: event_filter
[init → drivers] priority: 0
[init → drivers] provides service Event
[init → drivers] child “report_rom” announces service “Report”
[init → drivers] child “report_rom” announces service “ROM”
[init → drivers] child “platform_drv” announces service “Platform”
[init → drivers → gui_fb] — rk3399 fb driver —
[init → drivers → gui_fb] fb init: 0
[init → drivers → gui_fb] fb cfg: 0
[init → drivers → gui_fb] win0en: 0x3a000081
[init → drivers → gui_fb] act info: 0x437077f
[init → drivers → gui_fb] fb init2: 0x46000000
[init → drivers → gui_fb] fbset: 0x46000000
[init → drivers → gui_fb] vop sys: 0x20805800
[init → drivers] child “event_filter” announces service “Event”
[init → scout] png is 101x92 depth=8
What if you add a log() in construct, before the static...
ctor call.
If that one does work, meaning the ctor itself blocks, I’d comment out the class members until finding out which one is ‘holding up’ the constructor.
(if that makes sense?)