OSDev.org
https://forum.osdev.org/

Some notes on PI development
https://forum.osdev.org/viewtopic.php?f=1&t=33494
Page 1 of 1

Author:  AndrewIsOffline [ Sat Feb 09, 2019 9:32 pm ]
Post subject:  Some notes on PI development

Hello everyone! This is my first post on the forum, but I've been using the Pi development page for a while, and it's helped me a lot. Since then I've made a good amount of progress, and I wanted to share what I've found:
  • I don't know if it's a Cygwin thing, but my gcc setup doesn't seem to like "org" without a "." before it.
  • I think Qemu fixed the binary loading issue. The latest version loads the binary at 0x8000.
  • Using Qemu's "raspi2" (and, I'm guessing, using an actual PI 2) gives you a 32-bit ARM with 4 cores, even if you override the cpu setting (and it rejects any number of cores below 4). There isn't any code for shutting off the extra cores, and letting them run can crash or mess up the kernel, so I rewrote the ARM64 cores code to work with raspi2's cortex-A7 (and also my 4-core arm1176 setup):
    Code:
       mrc p15, 0, r5, c0, c0, 5
       and r5, r5, #3
       cmp r5, #0
       bne halt

       ldr r5, =_start
       mov sp, r5

    This goes right after "_start:" in the ARM32 code and replaces the "mov sp, #0x8000" line.
I hope this helps people here! I would post it on the wiki, but since I'm new I wanted to get feedback first.

Author:  bzt [ Sun Feb 10, 2019 6:06 am ]
Post subject:  Re: Some notes on PI development

AndrewIsOffline wrote:
Hello everyone! This is my first post on the forum, but I've been using the Pi development page for a while, and it's helped me a lot. Since then I've made a good amount of progress, and I wanted to share what I've found:
  • I don't know if it's a Cygwin thing, but my gcc setup doesn't seem to like "org" without a "." before it.
Don't think so. Keywords should be keywords under Cygwin too, so there should be a ".".
Quote:
  • I think Qemu fixed the binary loading issue. The latest version loads the binary at 0x8000.
  • Yes, and I have also fixed the ARM64 loading issue with "raspi3". Thanks to Pekka, now it's in the qemu mainline, since 2.12.
    Quote:
  • Using Qemu's "raspi2" (and, I'm guessing, using an actual PI 2) gives you a 32-bit ARM with 4 cores, even if you override the cpu setting (and it rejects any number of cores below 4).
  • You can't override the cpu setting because number of cores is fixed on the real machine. There is no way to use less cores on real hw, and qemu emulates that (correctly).
    Quote:
    There isn't any code for shutting off the extra cores, and letting them run can crash or mess up the kernel, so I rewrote the ARM64 cores code to work with raspi2's cortex-A7 (and also my 4-core arm1176 setup): ... This goes right after "_start:" in the ARM32 code and replaces the "mov sp, #0x8000" line.
    Yes, that's needed, because ARM32 uses 4 cores now too.
    Quote:
    I hope this helps people here! I would post it on the wiki, but since I'm new I wanted to get feedback first.
    I'm sure it will help people. I'd say go ahead, update the wiki. We always welcome contributions!

    Cheers,
    bzt

    Author:  AndrewIsOffline [ Sun Feb 10, 2019 5:15 pm ]
    Post subject:  Re: Some notes on PI development

    Okay, I'll post the changes. Thanks!
    Also, the reason for my weird setup is because I'm using a Pi Zero for this project, so I tried to emulate as close to that. Right now I'm using raspi2 and overriding the cpu with the Pi Zero's cpu.

    Page 1 of 1 All times are UTC - 6 hours
    Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
    http://www.phpbb.com/