hydos06
Posts: 4
Joined: Thu Feb 01, 2018 9:40 am

starting to make an os for rpi

Thu Feb 01, 2018 9:43 am

ive tried to make a rpi os on my windows pc but i can not find the 'YAGARTO GNU ARM toolchain for Windows' if annyone has a link to this could you please reply with the link thanks.

dwelch67
Posts: 925
Joined: Sat May 26, 2012 5:32 pm

Re: starting to make an os for rpi

Thu Feb 01, 2018 10:36 am

There are many other pre-built gnu packages. Did you try one of those, for example:

https://launchpad.net/gcc-arm-embedded
(which has now moved to an arm site directly)
https://developer.arm.com/open-source/g ... ain/gnu-rm

Another:

https://www.linaro.org/downloads/

I imagine the sticky tab at the top of this forum has these and/or other pre-builts, did you look there? If you are having problems with finding tools are you really ready to write an operating system?

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

Re: starting to make an os for rpi

Thu Feb 01, 2018 6:18 pm

Hi hydos06,

I don't want to broke down your enthusiasm, but writing an os from scratch is very difficult. As a matter of fact it's considered to be the most difficult task a programmer can do. If you have problems with installing and setting up a cross-compiler environment, probably it's out of your league as dwelch67 suggested. No offense meant, I just want to save you from disappointment. My advise is to start with simpler things.

bzt

fruitoftheloom
Posts: 16608
Joined: Tue Mar 25, 2014 12:40 pm

Re: starting to make an os for rpi

Thu Feb 01, 2018 6:22 pm

hydos06 wrote:
Thu Feb 01, 2018 9:43 am
ive tried to make a rpi os on my windows pc but i can not find the 'YAGARTO GNU ARM toolchain for Windows' if annyone has a link to this could you please reply with the link thanks.

http://intestinate.com/pilfs/
Adieu

dwelch67
Posts: 925
Joined: Sat May 26, 2012 5:32 pm

Re: starting to make an os for rpi

Fri Feb 02, 2018 3:31 am

I see a number of folks use the term OS when later it seems they were just thinking baremetal. So I guess will see if that is the case here. Wanted to work on a baremetal program or wanted to write an operating system?

Part of writing an operating system, is deciding on how and where programs are going to load in virtual space, and then modifying the back end of a compiler so that it generates the proper binaries for your operating system. Not only being able to find and install a compiler but part of the job is modifying and building. or take the lazy way out and use an existing design and then it is a case of just download and install one.

Now on the kernel side you still need to master the toolchain which starts with installation.

No offense meant here either. Different folks are motivated in different ways. Some folks come in knowing nothing and have a grand plan, may take them 10-20 years, have to learn to program, have to learn about the tools, instruction set, etc. But finally get there. Other folks come in with a grand plan thinking that it is a weekend project to find it is a multi-year project and give up on learning anything new. So for some you want them to come in and say I am going to write an artificial intelligence based operating system from scratch in assembly language. And others you want them to come in and say, I how do I blink the led. Then then get a taste and want to print a character on the uart, more success, tastes good, how about a pixel on the display...Its all about how folks handle failure and if they push through or give up.

So I hope you keep trying, and you are in the right place, tons of collective experience trolling around.

User avatar
Gavinmc42
Posts: 1949
Joined: Wed Aug 28, 2013 3:31 am

Re: starting to make an os for rpi

Fri Feb 02, 2018 5:26 am

If the OP wants to do DIY Linux OS distribution then Buildroot would be my preference.
Doing a complete OS on baremetal? See "You people are insane" post ;)

Start with Ultibo, lots of pain removed.

OS- operating Systems probably needs to be clarified, it means different things to different people at different skill levels.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

B.Goode
Posts: 5830
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: starting to make an os for rpi

Fri Feb 02, 2018 8:45 am

hydos06 wrote:
Thu Feb 01, 2018 9:43 am
ive tried to make a rpi os on my windows pc but i can not find the 'YAGARTO GNU ARM toolchain for Windows' if annyone has a link to this could you please reply with the link thanks.


A direct reply to the substantive question:

The University of Cambridge 'Baking Pi' tutorial https://www.cl.cam.ac.uk/projects/raspb ... gnuwindows links to this possible download:

https://sourceforge.net/projects/yagart ... /20121222/

hydos06
Posts: 4
Joined: Thu Feb 01, 2018 9:40 am

Re: starting to make an os for rpi

Fri Feb 02, 2018 7:39 pm

i am aware how hard making an os is and would still like some sort of tutorial for the raspberry pi 3

User avatar
Gavinmc42
Posts: 1949
Joined: Wed Aug 28, 2013 3:31 am

Re: starting to make an os for rpi

Fri Feb 02, 2018 10:46 pm

Not sure if this would be a tutorial, but it is an OS
viewtopic.php?t=22423
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

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

Re: starting to make an os for rpi

Sat Feb 03, 2018 5:16 pm

hydos06 wrote:
Fri Feb 02, 2018 7:39 pm
i am aware how hard making an os is and would still like some sort of tutorial for the raspberry pi 3
There's no such tutorial. It's going to be YOUR os, nobody has written it for you. If you really want to write an os, you'll need:
1. first of all, read beginner's mistakes on tutorials
2. you'll need lots and lots of theory. Read this wiki page on required knowledge (not comprehensive). Some may disagree, but I'd also recommend Tanenbaum's book as well as a minimum.
3. lots of deep hardware knowledge, particularly in ARM and BCM2837.
4. able to read and comprehend technical documentation on your own (if you have to ask all the time, it won't work)
5. able to read and understand other people's (often very complex) code, like the linux kernel, in order to figure out how to do undocumented things
6. able to see the big picture, not get lost in the details, yet able to write low level code. With other words, you must have a skill to understand and define proper abstraction layers. If you haven't designed any userspace interface so far, you won't know what I'm talking about.
7. able to put theories in practice, test it out, figure out was it the implementation that failed or your understanding of the theory; if the former debug it, if the latter rethink and start all over. All of that alone, on your own, without asking people on forums. If you have to ask questions like "why isn't my code working?" you'll not succeed for sure.
8. several years of free time to dedicate for the task
9. and above all: endurance, presistence, tenacity

Good luck!
bzt

hydos06
Posts: 4
Joined: Thu Feb 01, 2018 9:40 am

Re: starting to make an os for rpi

Sat Feb 03, 2018 8:19 pm

thank you for an actually helpful post :)

sumeet
Posts: 21
Joined: Mon Jan 15, 2018 3:34 pm

Re: starting to make an os for rpi

Sat Feb 03, 2018 10:56 pm

If you need source code of a small working OS you can have a look at xv6. xv6 is used as a teaching OS at MIT. MIT have created it for x86 but someone has ported it to RPi. Below is the GitHub URL.

https://github.com/zhiyihuang/xv6_rpi2_port

I have tried it on RPi3. You will have to connect your Pi to your desktop/laptop using USB to TTL cable.

dwelch67
Posts: 925
Joined: Sat May 26, 2012 5:32 pm

Re: starting to make an os for rpi

Sun Feb 04, 2018 3:12 am

While you need the things on bzt's list, that doesnt mean you have to learn them on your own in a vacuum. How you learn to read technical documentation, in part is by asking someone, a mentor or the general public as that is a thing now. Do learn how to ask the question, dont come in saying I am going to build my house but I cant figure out how to operate the nailgun. You simply say I cant figure out how to operate this nailgun. If someone asks why you say i want to learn how to use it, I might want to build something with it some day. but cant until I learn how to use it.

Not all operating systems are created solo, great if you can pull it off, but not all are done that way. Some folks may do the high level design, some do mid or low level design, some do various parts of the implementation. A number of folks start off doing the grunt work for the senior folks to nap most of the day and bark orders or give advice or tell long stories about way back when (folks like me). And as you do more grunt work for your mentors, *IF* you pay attention to what the others are doing and try to understand it, occasionally asking questions, good, bad or otherwise. You work your way up the ladder to being that senior person, which in theory can build the whole thing solo, or can just bark out orders and nap.

From your original question, step one, get a toolchain, even better get three or four.
step 2: cross compile an OBJECT, and then disassemble to see what was produced.
step 3: link one or more objects. start to master then linker or at least beat it into submission enough to control where the sections go and in what order or at least have the vector/start code in the right place in the binary.

then the processor learning starts, how does this processor boot, what do I have to place where to get it to boot or continue to boot from the bootloader and have my code take over this processor. unfortunately the pi 3 for example has multiple paths you can take, most painful for experienced folks. getting a pi-zero and starting there is very much in your best interest. stay on the pi-zero for a very long time. OF the platforms out there the pi is a very good one for your overall goal, but start with the pi-zero, which may include a little soldering or somehow figuring out how to get the uart hooked up. If you can find a pi A+, adafruit has them in stock now, the pins are there, no soldering required, a couple to ten dollars for a usb to 3.3v serial (which adafruit sells, multiple solutions, or ebay).

This involves reading arm docs, broadcom docs, learning that documentation is often wrong or has holes. there are schematics for the original pi which to some extent apply to the following pi boards, or at least can get a feel for one of the designs, the latter designs even the A+ are different and by the pi-zero and pi3 probably more so, but still being able to see that on at least one board there was a chip, it had some gpio, one of the gpio pins is tied to an led that is described in old baking pi or other tutorials. then see that someone has simply given you the answer that on the pi-zero it is no on this gpio pin (or on the pi3 it is not connected to a gpio pin). can also see in those schematics where the pins we use for a uart are, what gpio pins they are and in the broadcom docs how that gpio pin has a set of alternate functions one of which is uart tx or uart rx depending on the pin.

master the led, master the led.
master the uart, master the uart, master the uart.
beat a toolchain into submission, beat a toolchain into submission. you can see in my examples I do almost nothing to beat on the toolchain yet I have near complete control. some folks like a lot of knobs and features, I like to use as little as possible, ymmv.

If you dont have access to oscilloscopes and know how to use them or other such tools (although you can get a pretty good one for like $650 now) then the led is your number one debug tool, the uart number two. perhaps other boards pis or microcontrollers which you can build your own logic analyzer-ish/scope-ish adhoc tools are what you can use. Even having a scope can be as much of a problem as a solution, sometimes touching a probe to the circuit fixes it, sometimes it breaks it...gotta know your tools.

interrupts, processor modes, etc. lots and lots of getting your hands dirty...to work through the kinds of things in bzt's list. and a number of those learning experiences require mentoring from other folks. online or in person. even the beginnings of an operating system are setting up a timer based interrupt and saving state such that you can switch between two tasks without corrupting/crashing one of them, long before you have to design a (more complicated) scheduler, long before you have to even read about protection, etc...Get the books by Tanenbaum or Labrosse or both or others.

I hate to say it this way but if you are struggling to find a cross compiler for arm, you are not ready for the armv7 nor the armv8, thus the reason i say start with the pi-zero (or A+) (or the B+) or woah, the pi-zero-w at adafruit has headers. You can hold off on having to learn to solder. Although I recommend somehow hooking up a momentary on/closed pushbutton to the run pins, so you dont have to unplug and replug the board to try again. if you can solder, awesome...these https://www.sparkfun.com/products/97 work great on the raspberry pi boards, break off two of the legs so they dont short with anything, take the other two and twist them and move them closer together so you can fit them in the holes and solder them in place.

LdB
Posts: 754
Joined: Wed Dec 07, 2016 2:29 pm

Re: starting to make an os for rpi

Sun Feb 04, 2018 2:10 pm

I have considered making an O/S tutorial but there are two big issues with the Pi

1.) You have to get the USB up to have a keyboard unless you want to use a uart or ps2 via some adapter board.
That means a USB stack that is workable with your proposed O/S. I have even written a cut down USB stack (which is about the most simple one you can write) for one core but you need at least a mutex or semaphore for point 2.

2.) You really need to be able to deal with multi-cores unless you are going to either stay on the Pi1 or use only 1/4 the power of a pi2 or Pi3.

I have currently just putting finishing touches to a TOY RTOS write up for CodeProject but I found I had to make lots of choices to even do that. I started out wanting to make an AMP cluster because I had the idea later on to harness spare GPU cores for fun. There isn't a huge amount of basic AMP cluster code around there is a pile of basic SMP cluster code around.

It was at that point I ran across "Enea OSE Multicore" which is a hybrid AMP/SMP kernel and I fell in love with it.
It has a standards interface MCAPI that has been published and along with code samples (links down further)
So anyhow long and short I set about build a toy rtos built around the system.

You can see the problem you end up having to make decision after decision and it's very difficult to write a tutorial because there is not just 1 sort of O/S there are hundreds of different types.

Now if you want to restrict to one core and in C I don't think you can go past xinu just because of the documentation. Circle is in my opinion a better O/S and code base but it is in C++ and documentation is not as advanced.
http://xinu.mscs.mu.edu/Raspberry_Pi
http://embedded-xinu.readthedocs.io/en/latest/arm/rpi/
https://github.com/rsta2/circle

There are plenty of text books available for "Embedded Xinu"

Anyone wanting to play with AMP clusters there is a good baremetal setup on an app note on the xilinx site
It's on 2 cortex A9's but it walks you thru everything and the code is simple enough to modify for the Pi.
https://www.xilinx.com/support/document ... tex-a9.pdf

For Hybrid AMP/SMP clusters you can't go past the Multicore Association for standards
https://www.multicore-association.org/index.php
https://bitbucket.org/hollisb/openmcapi/wiki/Home
https://www.embedded.com/design/mcus-pr ... ed-designs

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

Re: starting to make an os for rpi

Wed Feb 07, 2018 12:25 pm

dwelch67 wrote:
Sun Feb 04, 2018 3:12 am
While you need the things on bzt's list, that doesnt mean you have to learn them on your own in a vacuum. How you learn to read technical documentation, in part is by asking someone, a mentor or the general public as that is a thing now.
Oh hell yes! What I've meant is if one is keep asking questions it is a sign he/she hasn't mastered the art of reading documentation :-)
Not all operating systems are created solo, great if you can pull it off, but not all are done that way.
Right, but many people seems to think if they start to write an OS lot of developers will volunteer to help immediately. That's a false hope. The truth is, there's a good change nobody will care about your project except you. Also that would require another skill, code and project management, as you've pointed out. That's not easy either, I've worked as a development manager for years, I know what I'm talking about :-) Learning agile methodology can help you there a lot. Regardless of the drawbacks, if you have comrades, take the chance!

@LdB: nice, that cluster project seems interesting! A big plus one for Circle btw, it's a very clean code, one can learn a lot from it!

bzt

dwelch67
Posts: 925
Joined: Sat May 26, 2012 5:32 pm

Re: starting to make an os for rpi

Wed Feb 07, 2018 9:24 pm

I fully understand what you are saying. just trying to say that there is a line you cross where you need to ask questions, working in a vacuum is a bad idea for many reasons. Where than line lands matters. If you dont try to do any of the things in your list, basically ask for everything and do little reading/research yourself you will eventually fail. But part of the learning process is to find that the docs are often bad as they are good, or full of holes like we have here, we cannot contact them directly to ask questions because we are individuals and not representatives for one of the short list of possible customers (if we were the NDA would ideally prevent us from talking here). And the available sources like bsp's or linux driver source are sometimes as bad as a bad set of documentation and create as many questions as answers. There is a line, this forum IMO is about asking those questions, this product is about education, I want to see more baremetal educated people, and dont want one to lose one or ten or 1000 because we couldnt take their desire to learn big or small and turn that into success. I assume everyone here reading this that is successful at baremetal, hobby or professionally or both, has had failures, has walked away from projects or come close. I read at stackoverflow some folks preaching how bad an idea it is to treat a linux processor as an mcu, what value is there in that...well the value is education...I see folks preaching that in general assembly or baremetal or other has no value, not worth learning. That person clearly fell in a trap, and gave up, didnt have the right mentor...Its pretty sad to see... but also very damaging to the folks they discourage from learning.

dwelch67
Posts: 925
Joined: Sat May 26, 2012 5:32 pm

Re: starting to make an os for rpi

Wed Feb 07, 2018 9:26 pm

I did/do like your list, well presented. need to post that on its own somewhere. your requirements/goals are ...

dwelch67
Posts: 925
Joined: Sat May 26, 2012 5:32 pm

Re: starting to make an os for rpi

Wed Feb 07, 2018 9:35 pm

and my desire to get more folks out of and through traps tends to get me into situations like this where i am doing more bad than good writing down opinions...

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

Re: starting to make an os for rpi

Thu Feb 08, 2018 5:52 pm

@dwelch67: Don't feel bad 'cos you shared your thoughts! I understand you, and I totally agree with you about that line, the quality of docs and sources, everything! Sorry that my original post could be misleading, I never meant to suggest you should work in isolation (or vacuum), only that one should learn to solve problems on their own; simply because there are so many problems popping up with OS development that it would take forever to ask and wait for the answer every time. That's all what I meant.

Return to “Bare metal, Assembly language”

Who is online

Users browsing this forum: albiorixza and 2 guests