i still dont know what a source directory is or parent directory...here is the instructions givent from the website COMPUTER LABORATORY. I am trying to write a simple OS for the PI raspberry. here are the instructions.
here is a new addition to the instructions for website :
http://www.cl.cam.ac.uk/projects/ras...s/os/ok01.html
the instructions:
To be explicit, the folder structure should look like:
build/
(empty)
source/
main.s
kernel.ld
LICENSE
Makefile
here is the code i wrote for the OS..
. sections .init
.globl _start
_start:
ldr r0,=0x2020000
mov r1,#1
lsl r1,#18
str r1,[r0,#4]
mov r1,#1
lsl r1,#16
str r1,[r0,#28]
loop$:
b loop$
mov r2,#0x3F0000
wait1$:
sub r2,#1
cmp r2,#0
bne wait1$
THAT WAS THE CODE i put in a small text document. I just dont know how to get this into the kernel and what folder i should swap it with so the OS will run off this document. Its only supposed to turn the LED light on an off for the PI Raspberry. This was as far as lesson one and two took me.
HERE IS THE LAST STEP THAT I DONT KNOW HOW TO DO..(BELOW)
So we've written the code, now to get it onto the pi. Open a terminal on your computer and change the current working directory to the parent directory of the source directory. Type make and then press enter. If any errors occur, please refer to the troubleshooting section. If not, you will have generated three files. kernel.img is the compiled image of your operating system. kernel.list is a listing of the assembly code you wrote, as it was actually generated. This is useful to check that things were generated correctly in future. The kernel.map file contains a map of where all the labels ended up, which can be useful for chasing around values.
To install your operating system, first of all get a Raspberry PI SD card which has an operating system installed already. If you browse the files in the SD card, you should see one called kernel.img. Rename this file to something else, such as kernel_linux.img. Then, copy the file kernel.img that make generated onto the SD Card. You've just replaced the existing operating system with your own. To switch back, simply delete your kernel.img file, and rename the other one back to kernel.img. I find it is always helpful to keep a backup of you original Raspberry Pi operating system, in case you need it again.
Put the SD card into a Raspberry Pi and turn it on. The OK LED should turn on. If not please see the troubleshooting page. If so, congratulations, you just wrote your first operating system. See Lesson 2: OK02 for a guide to making the LED flash on and off.
[1]^ OK, I'm lying it tells the linker, which is another program used to link several assembled files together. It doesn't really matter.
[2]^ Clearly they're important to you. Since the GNU toolchain is mainly used for creating programs, it expects there to be an entry point labelled _start. As we're making an operating system, the _start is always whatever comes first, which we set up with the .section .init command. However, if we don't say where the entry point is, the toolchain gets upset. Thus, the first line says that we are going to define a symbol called _start for all to see (globally), and the second line says to make the symbol _start the address of the next line. We will come onto addresses shortly.
[3]^^ This tutorial is designed to spare you the pain of reading it, but, if you must, it can be found here SoC-Peripherals.pdf. For added confusion, the manual uses a different addressing system. An address listed as 0x7E200000 would be 0x20200000 in our OS.
[4]^ Only values which have a binary representation which only has 1s in the first 8 bits of the representation. In other words, 8 1s or 0s followed by only 0s.
[5]^ A hardware engineer was kind enough to explain this to me as follows:
The reason is that modern chips are made of a technology called CMOS, which stands for Complementary Metal Oxide Semiconductor. The Complementary part means each signal is connected to two transistors, one made of material called N-type semiconductor which is used to pull it to a low voltage and another made of P-type material to pull it to a high voltage. Only one transistor of the pair turns on at any time, otherwise we'd get a short circuit. P-type isn't as conductive as N-type, which means the P-type transistor has to be about 3 times as big to provide the same current. This is why LEDs are often wired to turn on by pulling them low, because the N-type is stronger at pulling low than the P-type is in pulling high.
There's another reason. Back in the 1970s chips were made out of entirely out of N-type material ('NMOS'), with the P-type replaced by a resistor. That means that when a signal is pulled low the chip is consuming power (and getting hot) even while it isn't doing anything. Your phone getting hot and flattening the battery when it's in your pocket doing nothing wouldn't be good. So signals were designed to be 'active low' so that they're high when inactive and so don't take any power. Even though we don't use NMOS any more, it's still often quicker to pull a signal low with the N-type than to pull it high with the P-type. Often a signal that's 'active low' is marked with a bar over the top of the name, or written as SIGNAL_n or /SIGNAL. But it can still be confusing, even for hardware engineer1
lsl r1,
Thanks for yalls help...maybe someone can help me out. Thanks