OSDev.org

The Place to Start for Operating System Developers
It is currently Mon Aug 19, 2019 1:14 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Some notes on PI development
PostPosted: Sat Feb 09, 2019 9:32 pm 
Offline

Joined: Sat Feb 09, 2019 8:43 pm
Posts: 2
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.


Top
 Profile  
 
 Post subject: Re: Some notes on PI development
PostPosted: Sun Feb 10, 2019 6:06 am 
Offline
Member
Member
User avatar

Joined: Thu Oct 13, 2016 4:55 pm
Posts: 337
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


    Top
     Profile  
     
     Post subject: Re: Some notes on PI development
    PostPosted: Sun Feb 10, 2019 5:15 pm 
    Offline

    Joined: Sat Feb 09, 2019 8:43 pm
    Posts: 2
    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.


    Top
     Profile  
     
    Display posts from previous:  Sort by  
    Post new topic Reply to topic  [ 3 posts ] 

    All times are UTC - 6 hours


    Who is online

    Users browsing this forum: No registered users and 7 guests


    You cannot post new topics in this forum
    You cannot reply to topics in this forum
    You cannot edit your posts in this forum
    You cannot delete your posts in this forum
    You cannot post attachments in this forum

    Search for:
    Jump to:  
    Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group