OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Apr 19, 2024 2:38 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Following RasPi Bare Bones Tutorial -- C compiling fails?
PostPosted: Mon Feb 25, 2019 9:59 pm 
Offline

Joined: Mon Feb 25, 2019 9:38 pm
Posts: 1
Hey there! I'm relatively new to OS development, but since I had a Raspberry Pi 3 lying around, I decided to try following this tutorial for a bit of an intro to bare-metal development: https://wiki.osdev.org/ARM_RaspberryPi_Tutorial_C
I've already done the Bare Bones tutorials on my Windows machine, and so I wanted to try a bit more basics before I really got into OS development.

Anyways, I'm probably doing something a bit odd in terms of RasPi development -- I'm compiling and running on the machine itself using 2 SD cards and a reader. I had no idea if just compiling without a cross-compiler would work, even though I was still going to run it on the same machine it was compiled on, so I just decided to cross-compile on the RasPi itself and use that. I set up the target for aarch64-elf, and proceeded to compile. It took a while, (it's a raspberry pi) but it was successful. All dependencies were installed beforehand, and I made sure to set it up correctly to the letter. Once I had confirmed that it had worked, I started building the code provided by the link above. The boot.S file compiled just fine, but the kernel.c file did not. They are pretty simple errors, but I wanted to make sure that I had actually set up my compiler correctly, and that it didn't just not want to compile the code itself. (outdated?) I used the most recent versions of Binutils and GCC, which I presume may have led to these errors.

So, my question: Does Binutils 2.32 work with GCC 8.3.0? Here's a small sample of the errors I got when compiling kernel.c:
Code:
kernel.c:2:20: error: no include path in which to search for stddef.h
#include <stddef.h>
                    ^
kernel.c:3:20: error: no include path in which to search for stdint.h
#include <stdint.h>
                    ^
kernel.c:6:31: error: unknown type name 'uint32_t'
static inline void mmio_write(uint32_t reg, uint32_t data)
                               ^~~~~~~~
kernel.c:6:45: error: unknown type name 'uint32_t'
static inline void mmio_write(uint32_t reg, uint32_t data)
                                             ^~~~~~~~
kernel.c:12:15: error: unknown type name 'uint32_t'
static inline uint32_t mmio_read(uint32_t reg)
               ^~~~~~~~


Top
 Profile  
 
 Post subject: Re: Following RasPi Bare Bones Tutorial -- C compiling fails
PostPosted: Tue Feb 26, 2019 3:54 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5137
Run "aarch64-elf-gcc -print-search-dirs" and see if the results seem reasonable for your cross-compiler. Post them here if you're not sure.


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: Bing [Bot], RevivalDBM and 166 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