• Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

Bare metal programming

PaulC

Coder
Hi all! First post. Day job is principle engineer, 20yr, lately mostly Java and BigData Warehousing ETL in capital markets sector.

So, for hobbies I do anything but.

Recently I learnt my way around an Atmel MCU Atmega328p (of Arduino fame). Like learnt how to program it in ASM and C, with and without the Arduino IDE/Stack and eventually with the gcc-avr cross compile environment. Ending in a hand designed, hand soldered, minimal "blinky" on a PCB with a bare-metal bootloader-less chip, running custom ASM only. 0% Arduino.

Recently I found a series of YouTube videos on bare-metal in terms of modern x86_64 architecture which cover the ASM to get the CPU switched into various modes from 16bit with BIOS to 32bit protected and 64bit long mode, setting up the virtual memory maps and LSB page tables.

It got me started, towards a hobby space, learn by doing avenue to OS design and implementation, but now I'm a little stuck at a cross roads with where to go from here.

First I need to decide is I should remain in 64bit long mode and all the complications there in, or should I hand around in BIOS or 32bit mode and learn a few more basics first. Like a proper console, basic file and device IO, segmentation, multi-programming, scheduling, multi-tasking and so on. Then later move up into 64bit mode.

Then I need to decide the order to tackle things in. I doubt for example I would be getting anywhere near supporting the whole GNU LibC. I would be lucky if I could get a kernel to support stdlib!

I'm even wondering if it might be better to research and select a good book, even the Minux one Linus used and work that way.

Anyone done this?
Any tips, links, guides, books?

I suppose a good question is "What is the purpose?" and again, it would be as an exercise to understand by doing. Also I find all this low level bit-banging hardware a breath of fresh air after a day job in high level enterprise Java.

Out of interest, the closest I've come to OS design was making my own "Linux from scratch" based on the open source book and even contributed to the "Beyond Linux from scratch" book, all the way out to Open Office, KDE and Firefox compiles/installs.

Paul
 
Top