s.matyukevich
Posts: 2
Joined: Sat May 27, 2017 7:40 pm

RPi OS development tutorial

Sat Apr 14, 2018 2:59 am

I've recently published a step-by-step guide how to make an OS from scratch for Raspberry Pi. You can find it here: https://github.com/s-matyukevich/raspberry-pi-os The goal of this project is to teach OS development and not just RPi bare metal programming (at least right now the OS supports process scheduling, system calls and virtual memory, and I plan to add more functionality later) The OS comes with a very detailed tutorial and it doesn't require any prior OS development skills.

Hope this might be useful.

bzt
Posts: 155
Joined: Sat Oct 14, 2017 9:57 pm

Re: RPi OS development tutorial

Sat Apr 14, 2018 11:22 am

Hi, I've already posted a link to your wonderful tutorials but it's much better you did that too. People can now talk about it with you :-)

s.matyukevich
Posts: 2
Joined: Sat May 27, 2017 7:40 pm

Re: RPi OS development tutorial

Sat Apr 14, 2018 5:20 pm

Thanks! I haven't noticed your post originally.

AALLeeXXX
Posts: 70
Joined: Sun Apr 10, 2016 1:37 pm
Location: Yokohama

Re: RPi OS development tutorial

Sun Jul 22, 2018 2:55 pm

Hello,

Thank you very much for this great tuto ! I'm trying it now and have some concern related to the toolchains.

I successfully compiled the first example, but I'm not clear here about the tool chain. I installed this gcc-aarch64-linux-gnu package. But naming convention seems different and I cannot find my usual *-none-* pattern. I was used with arm one until now

Beside that one, I wanted to try the aarch64-elf-gcc from Linaro, but it seems not compatible. In the makefile, I just replaced the prefix

Code: Select all

#ARMGNU ?= aarch64-linux-gnu
by

Code: Select all

ARMGNU ?= aarch64-elf
Everything else I kept unchanged. Running it I got the following error:
[email protected]:/media/sf_sharedHome/rpi-os-s-matyukevich/src/lesson01$ make
mkdir -p build
aarch64-elf-gcc -Wall -nostdlib -nostartfiles -ffreestanding -Iinclude -mgeneral-regs-only -MMD -c src/mini_uart.c -o build/mini_uart_c.o
/home/alex/PI/tools/gcc-linaro-7.3.1-2018.05-i686_aarch64-elf/bin/../libexec/gcc/aarch64-elf/7.3.1/cc1: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
Makefile:16: recipe for target 'build/mini_uart_c.o' failed
make: *** [build/mini_uart_c.o] Error 1

I dont understand the dependency to a Linux library here, why is that needed here ? I wonder whether the toolchain is correct (baremetal ?) or if options are compatible ? (Linaro documentation is not convenient to search - no flat single pdf...)

Any similar experience ?

bzt
Posts: 155
Joined: Sat Oct 14, 2017 9:57 pm

Re: RPi OS development tutorial

Sun Jul 22, 2018 8:29 pm

In a nutshell, the aarch64-linux-gnu target expects a hosted environment, where libraries for the target (such as libz) exists and can be used (either because you're running it on the same target, or because they are pre-compiled for you). The aarch64-elf on the other hand is for a freestanding environment (no host libraries at all, they have to be compiled locally and specified manually). This is a vague description of the difference, but hopefully will point you in the right direction.

Cheers,
bzt

AALLeeXXX
Posts: 70
Joined: Sun Apr 10, 2016 1:37 pm
Location: Yokohama

Re: RPi OS development tutorial

Mon Jul 23, 2018 1:25 pm

Hello Bzt,
Thank you for this clarification. This is quite clear about the target software we build with the toolchain.
But then, since I'm using the freestanding toolchain (it's also indicated in the gcc options), why is this library requested here ? Is it required to be linked in the target software (which I don't expect), or is it necessary to build the target software ? The error message is not very clear :/

EDIT: I found it. Its required for the toolchain just to run, but this is caused by wrong toolchain selection in my environment ! I invoked the 32 bits toolchain on Ubuntu 18 (64 bits), thus libz 32 bits was necessary. Using 64 bits toolchain runs just well, even after removing the libz 32 bits.

Return to “Bare metal, Assembly language”

Who is online

Users browsing this forum: No registered users and 2 guests