OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 8:05 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Raspberry Pi | Error: backward ref to unknown label "1:"
PostPosted: Wed Jun 09, 2021 2:39 pm 
Offline
User avatar

Joined: Wed Jun 09, 2021 2:25 pm
Posts: 6
Hello I am trying to make a raspberry pi OS from scratch but I get this error for the boot.s file when building with a makefile:

Code:
..//src/kernel/boot.s: Assembler messages:
..//src/kernel/boot.s:32: Error: backward ref to unknown label "1:"
make: *** [Makefile:95: ..//build/objects/boot.o] Error 1


Whenever I look up the error it seems to be that the script cannot figure out that its supposed to be a number or something like that.
Sorry if this something only an asm noob could miss.


Boot.s Script:

Code:
// AArch64 mode

// To keep this in the first portion of the binary.
.section ".text.boot"

// Make _start global.
.globl _start

    .org 0x80000
// Entry point for the kernel. Registers:
// x0 -> 32 bit pointer to DTB in memory (primary core only) / 0 (secondary cores)
// x1 -> 0
// x2 -> 0
// x3 -> 0
// x4 -> 32 bit kernel entry point, _start location
_start:
    // set stack before our code
    ldr     x5, =_start
    mov     sp, x5

    // clear bss
    ldr     x5, =__bss_start
    ldr     w6, =__bss_size
3:  cbz     w6, 4f
    str     xzr, [x5], #8
    sub     w6, w6, #1
    cbnz    w6, 3b

    // jump to C code, should not return
4:  bl      kernel_main
    // for failsafe, halt this core too
    b 1b



Anyways thanks in advance.

_________________
-Sam()
Code:
{
    Programmer();
}


Top
 Profile  
 
 Post subject: Re: Raspberry Pi | Error: backward ref to unknown label "1:"
PostPosted: Wed Jun 09, 2021 3:14 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
Where did you get this code?


Top
 Profile  
 
 Post subject: Re: Raspberry Pi | Error: backward ref to unknown label "1:"
PostPosted: Wed Jun 09, 2021 4:17 pm 
Offline
User avatar

Joined: Wed Jun 09, 2021 2:25 pm
Posts: 6
Octocontrabass wrote:
Where did you get this code?

I got it from Raspberry Pi bare bones on OSDev

_________________
-Sam()
Code:
{
    Programmer();
}


Top
 Profile  
 
 Post subject: Re: Raspberry Pi | Error: backward ref to unknown label "1:"
PostPosted: Wed Jun 09, 2021 4:51 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
It looks like someone put untested code on the wiki again.

I'm no Raspberry Pi expert, but I think adding one line of code should fix it:
Code:
    // for failsafe, halt this core too
1:  wfe
    b 1b


Top
 Profile  
 
 Post subject: Re: Raspberry Pi | Error: backward ref to unknown label "1:"
PostPosted: Wed Jun 09, 2021 4:55 pm 
Offline
User avatar

Joined: Wed Jun 09, 2021 2:25 pm
Posts: 6
Octocontrabass wrote:
It looks like someone put untested code on the wiki again.

I'm no Raspberry Pi expert, but I think adding one line of code should fix it:
Code:
    // for failsafe, halt this core too
1:  wfe
    b 1b

Thank you I’ll try that

_________________
-Sam()
Code:
{
    Programmer();
}


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 57 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