OSDev.org

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

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: asm volatile compile problem
PostPosted: Mon Feb 01, 2016 4:06 pm 
Offline

Joined: Mon Feb 01, 2016 3:40 pm
Posts: 2
Hi,

According to http://wiki.osdev.org/Raspberry_Pi_Bare_Bones tutorial, I did the steps until linking the kernel. I get this error:

Code:
alireza@alireza-VirtualBox:~/Downloads$ arm-none-eabi-gcc -T linker.ld -o myos.elf -ffreestanding -O2 -nostdlib boot.o kernel.o
/home/alireza/opt/cross/lib/gcc/arm-none-eabi/4.9.2/../../../../arm-none-eabi/bin/ld:linker.ld:1: ignoring invalid character `#' in expression
/home/alireza/opt/cross/lib/gcc/arm-none-eabi/4.9.2/../../../../arm-none-eabi/bin/ld:linker.ld:1: syntax error
collect2: error: ld returned 1 exit status


I invested the .c code mentioned in the tutorial and tried to compile it with gcc with this command:
Code:
gcc kernel.c

but it was not compiled:
Code:
kernel.c: Assembler messages:
kernel.c:22: Error: expecting operand after ','; got nothing

line 22 is :
Code:
asm volatile("__delay_%=: subs %[count], %[count], #1; bne __delay_%=\n": : [count]"r"(count) :"cc");


Would you please tell me how I can solve the problem?


Top
 Profile  
 
 Post subject: Re: asm volatile compile problem
PostPosted: Mon Feb 01, 2016 11:14 pm 
Offline
Member
Member
User avatar

Joined: Tue Dec 25, 2007 6:03 am
Posts: 734
Location: Perth, Western Australia
1. Where's the # in that linker script coming from? (The wiki page doesn't have one)
2. Compiling ARM code using your system gcc won't work (your system gcc probably targets x86_64, which has a different assembler syntax).

_________________
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc


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

All times are UTC - 6 hours


Who is online

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