-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Raspberry Pi Zero (BCM2835) #76
Comments
it's interesting to find out why it hangs in startup.s. Because I believe it could just work. We're testing if the coreID is zero, and if not it passes through. You might want to find out what the value in the register is on a zero and so what it thinks the core ID is. |
What would happen if you set up a temporary interrupt handler first so when you execute the instruction (which I'm sure will trigger some kind of trap handler) you will just return to normal execution. It's a cursed idea but it might work and work for both kinds of systems. Alternatively you could have a seperate start.s file for every kind of chipset/architecture which might be the more sensical solution. Just a little more annoying if we ever want to support more architectures. |
Are you sure that the instruction will trigger a trap handler? It is a valid instruction, Also, I have read that on boot-up, the bootloader passes a dtb file which defines the system, including how many cores are present and the addresses of MMIO devices. How this happens exactly, I am not sure. But this would provide quite accurate system identification, and if we ever want to support more ARM boards, would be needed. Right now we are just checking what CPU we're using, and of course that's not ideal, since we're not even identifying the board. |
If it's possible to get access to that it'd be awesome |
According to this, the bootloader should place a pointer to the DTB data structure in r2. Not sure if its worth it to implement a parser for it though. |
I have been to retrieve the address where the DTB file is loaded by QEMU with no luck. First of all, it seems like the register r2 is loaded with no address. I found out that you should pass the DTB file to QEMU (On a real raspberry pi this is done by the bootloader), via the In the qemu manual, there is an entry for a "virt" board, which is also an arm board. It says there that if you give qemu a .elf file, the DTB will instead be loaded at a certain address. Based on the assumption that the RPi works in a similar way, this lead me to scan the entire memory for the DTB's magic string with gdb ( So either GDB is not reading from the memory correctly or QEMU is bugged. Or perhaps I am missing something else. Not entirely certain what else I can try at this point. |
I just managed to attach a JTAG debugger to a real pi zero. I can now confirm that the bootloader does indeed place a pointer to the dtb in r2 on kernel startup. I believe emulating this will be an indispensable part of our OS, if we plan to support several versions of the RPi and even more so to support other ARM boards. Right now I can think of two ways to achieve this:
|
I was looking into extracting the available memory from the device tree, and if you decompile the DTBs provided by the RPi foundation, then you will find that memory size is set to a value of zero. This was very odd, so I dumped the device tree from a running raspberry pi, and those fields were populated, despite the boot partition holding the a DTB file with memory size set to zero. So it looks like the bootloader populates this part of the DTB to the correct value. This means we won't be able to use the DTB's provided by RPi in QEMU, but instead only manually dumped DTB files, which is annoying. |
I've been attempting to modify the OS in order to be able to run it on an RPi Zero. Thus far, these are the problems I've identified will need to be solved:
The text was updated successfully, but these errors were encountered: