Following RasPi Bare Bones Tutorial -- C compiling fails?
Posted: Mon Feb 25, 2019 9:59 pm
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:
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: Select all
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)
^~~~~~~~