Hi,
I am planning to start porting Genode to RK3588 Soc any day now. On top of that a cpu emulator for running 32bit code. The little cpu in the soc supports 32bit , but the big doesn't in a decent way.
I think the basic bringup will be easy, but after that it becomes harder. I still haven't seen a manual for the soc. I have seen a dts in uboot and with a bit of luck it works similar to RK3399.
For the emulation I use Unicorn emulation engine. A stripped down qemu that only does cpu. I hope that porting that to Genode will be a easy project, it doesn't have much dependencies. I am currently hacking it bit to fit my needs.
I plan to expose hardware directly to emulator, probaly by memory pointers that Genode sets up. First step is the all important debug uart.
As for Genode I think the soc would be a great platform for Sculpt. However I have no interest in Sculpt , so will not do that. But since I will do the basics I guess that someone can do Sculpt on top of that.
Cheers!
In message 2ef988485a.mickenx@michael.grunditz.gmail.com Michael Grunditz michael.grunditz@gmail.com wrote:
Hi,
I am planning to start porting Genode to RK3588 Soc any day now. On top of that a cpu emulator for running 32bit code. The little cpu in the soc supports 32bit , but the big doesn't in a decent way.
I think the basic bringup will be easy, but after that it becomes harder. I still haven't seen a manual for the soc. I have seen a dts in uboot and with a bit of luck it works similar to RK3399.
For the emulation I use Unicorn emulation engine. A stripped down qemu that only does cpu. I hope that porting that to Genode will be a easy project, it doesn't have much dependencies. I am currently hacking it bit to fit my needs.
I plan to expose hardware directly to emulator, probaly by memory pointers that Genode sets up. First step is the all important debug uart.
As for Genode I think the soc would be a great platform for Sculpt. However I have no interest in Sculpt , so will not do that. But since I will do the basics I guess that someone can do Sculpt on top of that.
Cheers!
As a follow up. Is there a way to use cmake in Genode sources? Like a crosscompile file.
Hi Michael,
thank you for announcing your upcoming work here.
As a follow up. Is there a way to use cmake in Genode sources? Like a crosscompile file.
There is no ready-to-use solution but your idea should be doable.
As a starting point, you may have a look at the Goa tool [1] that integrates popular build tools like CMake with Genode. The most important parts for the CMake integration are [2,3,4].
[1] https://github.com/nfeske/goa [2] https://github.com/nfeske/goa/tree/master/share/goa/cmake [3] https://github.com/nfeske/goa/blob/master/share/goa/lib/build /cmake.tcl [4] https://github.com/nfeske/goa/blob/master/share/goa/lib/flags.tcl
Note that Goa works on the basis of Genode's depot packages, not the Genode source repository. But I think that the way of how Goa invokes CMake could also work for calling CMake from the Genode build system - similar to how some Genode targets use autoconf via [5].
[5] https://github.com/genodelabs/genode/blob/master/repos/ports/mk/gnu_build.mk
Cheers Norman
In message 4d47681e-2c62-c03b-3935-349e75121dbb@genode-labs.com Norman Feske norman.feske@genode-labs.com wrote:
Hi Michael,
thank you for announcing your upcoming work here.
As a follow up. Is there a way to use cmake in Genode sources? Like a crosscompile file.
There is no ready-to-use solution but your idea should be doable.
As a starting point, you may have a look at the Goa tool [1] that integrates popular build tools like CMake with Genode. The most important parts for the CMake integration are [2,3,4].
[1] https://github.com/nfeske/goa [2] https://github.com/nfeske/goa/tree/master/share/goa/cmake [3] https://github.com/nfeske/goa/blob/master/share/goa/lib/build /cmake.tcl [4] https://github.com/nfeske/goa/blob/master/share/goa/lib/flags.tcl
Note that Goa works on the basis of Genode's depot packages, not the Genode source repository. But I think that the way of how Goa invokes CMake could also work for calling CMake from the Genode build system - similar to how some Genode targets use autoconf via [5].
[5] https://github.com/genodelabs/genode/blob/master/repos/ports/mk/gnu_build.mk
Thanks for te quick answer.
I think I will try (already sort of done) to extract which files I need to buld. I hope that I can skip cmake for the emulator.
I also found my backup from my previous aarch64 Genode project which will help me to get the board up and running.
The only thing that stops me now is that I need to find a cooling block for the board, for some very odd reason I need to cool two chips, and one of them are lower than the other :/
On Sun, 23 Oct 2022 at 11:41, Michael Grunditz michael.grunditz@gmail.com wrote:
In message 4d47681e-2c62-c03b-3935-349e75121dbb@genode-labs.com Norman Feske norman.feske@genode-labs.com wrote:
Hi Michael,
thank you for announcing your upcoming work here.
As a follow up. Is there a way to use cmake in Genode sources? Like a crosscompile file.
There is no ready-to-use solution but your idea should be doable.
As a starting point, you may have a look at the Goa tool [1] that integrates popular build tools like CMake with Genode. The most important parts for the CMake integration are [2,3,4].
[1] https://github.com/nfeske/goa [2] https://github.com/nfeske/goa/tree/master/share/goa/cmake [3] https://github.com/nfeske/goa/blob/master/share/goa/lib/build /cmake.tcl [4] https://github.com/nfeske/goa/blob/master/share/goa/lib/flags.tcl
Note that Goa works on the basis of Genode's depot packages, not the Genode source repository. But I think that the way of how Goa invokes CMake could also work for calling CMake from the Genode build system - similar to how some Genode targets use autoconf via [5].
[5]
https://github.com/genodelabs/genode/blob/master/repos/ports/mk/gnu_build.mk Thanks for te quick answer.
I think I will try (already sort of done) to extract which files I need to buld. I hope that I can skip cmake for the emulator.
I also found my backup from my previous aarch64 Genode project which will help me to get the board up and running.
Cooling sorted and I have started coding. Right now it crash in memory
init in Patform::Platform() probably right in when it fetches the addresses I haven't got any trm yet, but from linux boot log I have tried with the first ram added. If I chose a completely illegal address such as 0x0 I get exception from uboot exception handle. Genode::raw works so at least uart and stack is ok. With what I think is a valid address it just stops.. no errro message, and none of my debug prints from Platform::Platform(). I am basing this port on my little rk3399 port.
Michael
On Mon, 24 Oct 2022 at 10:50, Michael Grunditz michael.grunditz@gmail.com wrote:
On Sun, 23 Oct 2022 at 11:41, Michael Grunditz michael.grunditz@gmail.com wrote:
In message 4d47681e-2c62-c03b-3935-349e75121dbb@genode-labs.com Norman Feske norman.feske@genode-labs.com wrote:
Hi Michael,
thank you for announcing your upcoming work here.
As a follow up. Is there a way to use cmake in Genode sources? Like a crosscompile file.
There is no ready-to-use solution but your idea should be doable.
As a starting point, you may have a look at the Goa tool [1] that integrates popular build tools like CMake with Genode. The most important parts for the CMake integration are [2,3,4].
[1] https://github.com/nfeske/goa [2] https://github.com/nfeske/goa/tree/master/share/goa/cmake [3] https://github.com/nfeske/goa/blob/master/share/goa/lib/build /cmake.tcl [4] https://github.com/nfeske/goa/blob/master/share/goa/lib/flags.tcl
Note that Goa works on the basis of Genode's depot packages, not the Genode source repository. But I think that the way of how Goa invokes CMake could also work for calling CMake from the Genode build system - similar to how some Genode targets use autoconf via [5].
[5]
https://github.com/genodelabs/genode/blob/master/repos/ports/mk/gnu_build.mk Thanks for te quick answer.
I think I will try (already sort of done) to extract which files I need to buld. I hope that I can skip cmake for the emulator.
I also found my backup from my previous aarch64 Genode project which will help me to get the board up and running.
Cooling sorted and I have started coding. Right now it crash in memory
init in Patform::Platform() probably right in when it fetches the addresses I haven't got any trm yet, but from linux boot log I have tried with the first ram added. If I chose a completely illegal address such as 0x0 I get exception from uboot exception handle. Genode::raw works so at least uart and stack is ok. With what I think is a valid address it just stops.. no errro message, and none of my debug prints from Platform::Platform(). I am basing this port on my little rk3399 port.
Michael
Found the problem: Load elf doesn't work.. It seems like it requests a address above the image file. Why can it do that? My load address us 0x04000000 and the address from loadelf 0x4032000. I have disassembled the image and it ends before that address,
/Michael
On Mon, 24 Oct 2022 at 14:31, Michael Grunditz michael.grunditz@gmail.com wrote:
On Mon, 24 Oct 2022 at 10:50, Michael Grunditz michael.grunditz@gmail.com wrote:
On Sun, 23 Oct 2022 at 11:41, Michael Grunditz < michael.grunditz@gmail.com> wrote:
In message 4d47681e-2c62-c03b-3935-349e75121dbb@genode-labs.com Norman Feske norman.feske@genode-labs.com wrote:
Hi Michael,
thank you for announcing your upcoming work here.
As a follow up. Is there a way to use cmake in Genode sources? Like a crosscompile file.
There is no ready-to-use solution but your idea should be doable.
As a starting point, you may have a look at the Goa tool [1] that integrates popular build tools like CMake with Genode. The most important parts for the CMake integration are [2,3,4].
[1] https://github.com/nfeske/goa [2] https://github.com/nfeske/goa/tree/master/share/goa/cmake [3] https://github.com/nfeske/goa/blob/master/share/goa/lib/build /cmake.tcl [4] https://github.com/nfeske/goa/blob/master/share/goa/lib/flags.tcl
Note that Goa works on the basis of Genode's depot packages, not the Genode source repository. But I think that the way of how Goa invokes CMake could also work for calling CMake from the Genode build system - similar to how some Genode targets use autoconf via [5].
[5]
https://github.com/genodelabs/genode/blob/master/repos/ports/mk/gnu_build.mk Thanks for te quick answer.
I think I will try (already sort of done) to extract which files I need to buld. I hope that I can skip cmake for the emulator.
I also found my backup from my previous aarch64 Genode project which will help me to get the board up and running.
Cooling sorted and I have started coding. Right now it crash in memory
init in Patform::Platform() probably right in when it fetches the addresses I haven't got any trm yet, but from linux boot log I have tried with the first ram added. If I chose a completely illegal address such as 0x0 I get exception from uboot exception handle. Genode::raw works so at least uart and stack is ok. With what I think is a valid address it just stops.. no errro message, and none of my debug prints from Platform::Platform(). I am basing this port on my little rk3399 port.
Michael
Found the problem: Load elf doesn't work.. It seems like it requests a address above the image file. Why can it do that? My load address us 0x04000000 and the address from loadelf 0x4032000. I have disassembled the image and it ends before that address,
Err.. I dumped the headers and indeed there is a section for the modules!
Sorry for all mails.
Err.. I dumped the headers and indeed there is a section for the modules!
Sorry for all mails.
Right now it fails here, but not in all cases. , see links below. Where is insert_translation defined for arm_v8? https://github.com/genodelabs/genode/blob/master/repos/base-hw/src/bootstrap...
called from https://github.com/genodelabs/genode/blob/master/repos/base-hw/src/bootstrap...
If I ignore the error.. it fails in transition to el1 from el2. The eret never returns. I have cross checked manuals for A76 and A53, and all regs involved are the same, except that A76 extends some fields. It does remain compatible with the armv8 standard.
Any thoughts?
Michael
Hi Michael,
On Tue, Oct 25, 2022 at 11:46:54AM +0200, Michael Grunditz wrote:
Right now it fails here, but not in all cases. , see links below. Where is insert_translation defined for arm_v8? https://github.com/genodelabs/genode/blob/master/repos/base-hw/src/bootstrap...
Indeed, it would be good to instrument all occurrences of `throw` within the page-table implementation for ARMv8. It shares the implementation with ARMv7 Large Physical Address Extension support defined within the following header:
https://github.com/genodelabs/genode/blob/master/repos/base-hw/src/include/h...
Regards Stefan
On Tue, 25 Oct 2022 at 12:07, Stefan Kalkowski < stefan.kalkowski@genode-labs.com> wrote:
Hi Michael,
On Tue, Oct 25, 2022 at 11:46:54AM +0200, Michael Grunditz wrote:
Right now it fails here, but not in all cases. , see links below. Where is insert_translation defined for arm_v8?
https://github.com/genodelabs/genode/blob/master/repos/base-hw/src/bootstrap...
Indeed, it would be good to instrument all occurrences of `throw` within the page-table implementation for ARMv8. It shares the implementation with ARMv7 Large Physical Address Extension support defined within the following header:
https://github.com/genodelabs/genode/blob/master/repos/base-hw/src/include/h...
Regards Stefan
I also notice that alloc add
https://github.com/genodelabs/genode/blob/8ece2366354c941ad2206f3d511cd75a10... allways allocs a bigger amount out ram than I have in my ram declariation. If I increse my size it adds more. Why? Does it add image size to ram size?
Michael
On Tue, 25 Oct 2022 at 14:50, Michael Grunditz michael.grunditz@gmail.com wrote:
On Tue, 25 Oct 2022 at 12:07, Stefan Kalkowski < stefan.kalkowski@genode-labs.com> wrote:
Hi Michael,
On Tue, Oct 25, 2022 at 11:46:54AM +0200, Michael Grunditz wrote:
Right now it fails here, but not in all cases. , see links below. Where is insert_translation defined for arm_v8?
https://github.com/genodelabs/genode/blob/master/repos/base-hw/src/bootstrap...
Indeed, it would be good to instrument all occurrences of `throw` within the page-table implementation for ARMv8. It shares the implementation with ARMv7 Large Physical Address Extension support defined within the following header:
https://github.com/genodelabs/genode/blob/master/repos/base-hw/src/include/h...
Regards Stefan
I also notice that alloc add
https://github.com/genodelabs/genode/blob/8ece2366354c941ad2206f3d511cd75a10... allways allocs a bigger amount out ram than I have in my ram declariation. If I increse my size it adds more. Why? Does it add image size to ram size?
Just an alignment problem .. if I align my mem ,, it stays. But it doesn't help for the insert of region for loading elf objects.
And then the switch to el1.. still trying to find out the difference in cpu core that maskes that to fail, if it isn't ram related.
Michael
But it doesn't help for the insert of region for loading elf objects.
It all boils down to this:
***** Kernel: map size: 65536
Kernel: map pyhys: 4267704320
Kernel: map virt: 18446743937075974144
Kernel: map size: 1048576
Kernel: map pyhys: 4268228608
Kernel: map virt: 18446743937076043776
Kernel: map size: 716800
Kernel: map pyhys: 67293184
Kernel: map virt: 67108864 *****
The last map() gives something to insrert_translation that I think is wrong/bad the previous inserts adds to phys address each time and virt addresses looks consistent. insert_translation doesn't return. So elf loading fails.
And then the switch to el1.. still trying to find out the difference in cpu
core that maskes that to fail, if it isn't ram related.
Michael
On Tue, 25 Oct 2022 at 15:43, Michael Grunditz michael.grunditz@gmail.com wrote:
But it doesn't help for the insert of region for loading elf objects.
It all boils down to this:
Kernel: map size: 65536
Kernel: map pyhys: 4267704320
Kernel: map virt: 18446743937075974144
Kernel: map size: 1048576
Kernel: map pyhys: 4268228608
Kernel: map virt: 18446743937076043776
Kernel: map size: 716800
Kernel: map pyhys: 67293184
Kernel: map virt: 67108864
The last map() gives something to insrert_translation that I think is wrong/bad the previous inserts adds to phys address each time and virt addresses looks consistent. insert_translation doesn't return. So elf loading fails.
OK so I got it all wrong
this is the modules offset:
000000000402d000 <.data.boot_modules_binaries>: 402d000: 464c457f .inst 0x464c457f ; undefined 402d004: 00010102 .inst 0x00010102 ; undefined ... 402d010: 00b70002 .inst 0x00b70002 ; undefined 402d014: 00000001 .inst 0x00000001 ; undefined 402d018: 04000860 add z0.b, p2/m, z0.b, z3.b
and it reflects the pys in the above output. Boot image is inside my ram region.
Sorry! No more e-mails from me today!
MIchael
Hello Michael,
On Tue, Oct 25, 2022 at 03:24:01PM +0200, Michael Grunditz wrote:
Indeed, it would be good to instrument all occurrences of `throw` within the page-table implementation for ARMv8. It shares the implementation with ARMv7 Large Physical Address Extension support defined within the following header:
https://github.com/genodelabs/genode/blob/master/repos/base-hw/src/include/h...
Regards Stefan
I also notice that alloc add
https://github.com/genodelabs/genode/blob/8ece2366354c941ad2206f3d511cd75a10... allways allocs a bigger amount out ram than I have in my ram declariation. If I increse my size it adds more. Why? Does it add image size to ram size?
Just an alignment problem .. if I align my mem ,, it stays. But it doesn't help for the insert of region for loading elf objects.
And then the switch to el1.. still trying to find out the difference in cpu core that maskes that to fail, if it isn't ram related.
Did you instrumented all occurrences of `throw` inside the page-table header, like I've suggested? Exception handling does not function at this very early time. At this early stage usage of the page-table API always needs to be cooperativly in the sense that you're not allowed to double-insert, insert mis-aligned mappings, nor exceed the page-table memory. I expect that a C++ exception is the reason for your stall here. To find out what is going on, you should instrument that first.
It doesn't make sense to try to step further, when the page-table isn't set up appropriatedly. A switch to another exception level is not constructive without a useful MMU setup. Before switching from EL2 to EL1, the MMU for EL2 gets enabled using the page-table that got set up formerly.
When looking at your insert_translation trace, I expect it contains all calls of insert_translation?! I recognized that there has no 1:1 mapping occurred, which is normaly the case before the core/kernel ELF is loaded. Without the 1:1 mapping it is clear that enabling the MMU will lead to a fault resp. stall of the machine.
Regards Stefan
Den tis 25 okt. 2022 17:21Stefan Kalkowski stefan.kalkowski@genode-labs.com skrev:
Hello Michael,
On Tue, Oct 25, 2022 at 03:24:01PM +0200, Michael Grunditz wrote:
Indeed, it would be good to instrument all occurrences of `throw` within the page-table implementation for ARMv8. It shares the implementation with ARMv7 Large Physical Address Extension support defined within the following header:
https://github.com/genodelabs/genode/blob/master/repos/base-hw/src/include/h...
Regards Stefan
I also notice that alloc add
https://github.com/genodelabs/genode/blob/8ece2366354c941ad2206f3d511cd75a10...
allways allocs a bigger amount out ram than I have in my ram
declariation.
If I increse my size it adds more. Why? Does it add image size to ram
size?
Just an alignment problem .. if I align my mem ,, it stays. But it doesn't help for the insert of region for loading elf objects.
And then the switch to el1.. still trying to find out the difference in
cpu
core that maskes that to fail, if it isn't ram related.
Did you instrumented all occurrences of `throw` inside the page-table header, like I've suggested? Exception handling does not function at this very early time. At this early stage usage of the page-table API always needs to be cooperativly in the sense that you're not allowed to double-insert, insert mis-aligned mappings, nor exceed the page-table memory. I expect that a C++ exception is the reason for your stall here. To find out what is going on, you should instrument that first.
It doesn't make sense to try to step further, when the page-table isn't set up appropriatedly. A switch to another exception level is not constructive without a useful MMU setup. Before switching from EL2 to EL1, the MMU for EL2 gets enabled using the page-table that got set up formerly.
When looking at your insert_translation trace, I expect it contains all calls of insert_translation?! I recognized that there has no 1:1 mapping occurred, which is normaly the case before the core/kernel ELF is loaded. Without the 1:1 mapping it is clear that enabling the MMU will lead to a fault resp. stall of the machine.
Regards Stefan
-- Stefan Kalkowski Genode labs
https://github.com/skalk | https://genode.org
Genode users mailing list users@lists.genode.org https://lists.genode.org/listinfo/users
Thanks for reading my confused emails. The debug printouts is the last of many. I am doing something with throws now as you suggest. And yes I am aware of that the translation tables needs to be correct.
But none of this was problematic with a53. So something needs change for a76. Debugging translations will hopefully give some sort of answer. Register wise the cores should function the same. Ie both follow armv8 standards.
Correct me on this,but I can't find any register writing before el1 and mmu time.
I am also thinking of uboot. I have no control over it as it is now. It promptly refuses uimages, gives abort. I am loading binary to load/start address and start it with go.
Bootm command does a bit more than just jumping to a address.
I need to build uboot, but in order to boot from mmc I need to nuke boot sector on emmc.
A good thing is that I have the TRM's now.
Michael
Hello Michael,
On Tue, Oct 25, 2022 at 05:52:25PM +0200, Michael Grunditz wrote:
Thanks for reading my confused emails.
you're welcome.
The debug printouts is the last of many. I am doing something with throws now as you suggest. And yes I am aware of that the translation tables needs to be correct.
But none of this was problematic with a53. So something needs change for a76. Debugging translations will hopefully give some sort of answer. Register wise the cores should function the same. Ie both follow armv8 standards.
Correct me on this,but I can't find any register writing before el1 and mmu time.
I do not know in which mode your platform is started. From your writings, I did assumed it starts in EL2. If I remember correctly, apart from UART accesses, the first "register" access should be the EL2 MMU setup right before the assembler snippet switches to EL1.
I am also thinking of uboot. I have no control over it as it is now. It promptly refuses uimages, gives abort. I am loading binary to load/start address and start it with go.
Bootm command does a bit more than just jumping to a address.
I need to build uboot, but in order to boot from mmc I need to nuke boot sector on emmc.
A good thing is that I have the TRM's now.
To me this seems to be the root cause for the symptoms you are experiencing. When the image is somehow corrupted resp. not setup completely (e.g. non-zeroed data segment parts), you'll get strange results in the execution of the bootstrap code. Therefore, it would be good to first target the issues that lead to the uImage load failure. Normally, you do not necessarily need to build u-boot on your own. Maybe you can investigate what holds u-boot from loading your uImage successfully (trying different linking address, different loadaddr for the uImage etc.).
Regards Stefan
Michael
Genode users mailing list users@lists.genode.org https://lists.genode.org/listinfo/users
In message Y1kBF4LltIgWpXGj@genode-labs.com Stefan Kalkowski stefan.kalkowski@genode-labs.com wrote:
I do not know in which mode your platform is started. From your writings, I did assumed it starts in EL2. If I remember correctly, apart from UART accesses, the first "register" access should be the EL2 MMU setup right before the assembler snippet switches to EL1.
EL2 is where uboot leaves me.
I am also thinking of uboot. I have no control over it as it is now. It promptly refuses uimages, gives abort. I am loading binary to load/start address and start it with go.
Bootm command does a bit more than just jumping to a address.
I need to build uboot, but in order to boot from mmc I need to nuke boot sector on emmc.
A good thing is that I have the TRM's now.
To me this seems to be the root cause for the symptoms you are experiencing. When the image is somehow corrupted resp. not setup completely (e.g. non-zeroed data segment parts), you'll get strange results in the execution of the bootstrap code. Therefore, it would be good to first target the issues that lead to the uImage load failure. Normally, you do not necessarily need to build u-boot on your own. Maybe you can investigate what holds u-boot from loading your uImage successfully (trying different linking address, different loadaddr for the uImage etc.).
Regards Stefan
Makes sense. I have tried many load linking addresses. They all fail in the same way. It fails before "Starting kernel..."
We are moving to a new place here so it will not be done right now. Board and similar stuff makes it ways into boxes.
I have tried to use different banks of ram. Linux lists four areas. If I go with the second I get data abort at the place bootstrap code hangs. Not a very useful ESR , but the cpu is reading. PC,LR and SP points to addresses in uboot. I don't think alignment is a problem here. But it can be uboot. If interrupts are on it can make things corrupt pretty quick. But before it starts mapping elf segment it maps the beginning of image with success.
So new uboot is the first thing I will do when things are settled here.