embedded OS help

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
com1
Member
Member
Posts: 105
Joined: Sat Apr 28, 2007 11:57 am
Location: TN

embedded OS help

Post by com1 »

i am very curious about writing bootloaders for ARM, MIPS, and othere embedded processors. i have checked datasheets and such from the ARM sites, but i haven't found any information i wanted yet. since i look forward to one day my os being compatible with an embedded processor, i want to learn as much as possible and experiment with bootloader programming for this architecture.

thanks in advance!
oh microsoft, microsoft, what souls you have dismayed
User avatar
Alboin
Member
Member
Posts: 1466
Joined: Thu Jan 04, 2007 3:29 pm
Location: Noricum and Pannonia

Post by Alboin »

I'm not 100% sure, but doesn't the bootloading process vary per system you're working on? For example, the Gameboy Advance ARM will start differently than a cell phone's ARM.
C8H10N4O2 | #446691 | Trust the nodes.
com1
Member
Member
Posts: 105
Joined: Sat Apr 28, 2007 11:57 am
Location: TN

im not sure

Post by com1 »

i think it is so generalized, i mean, we are talking about embedded processors, it does vary so differently between cores, whether Secure IP, IP, or 32-bit. i personally want to write one for ARM7 MPCore
oh microsoft, microsoft, what souls you have dismayed
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

I have done alot of work with arm, including porting DexOS to ARM (not finished yet).
And you will find that 90% would boot with code like this:

Code: Select all

;****************************************;
; ARM Boot Demo.                        ;
;----------------------------------------;
; Prog by Dex.                           ;
; Coded with FasmARM.                    ;

; C:\fasmarm ArmBoot.asm ArmBoot.bin     ;
;                                        ;

;****************************************;
format binary
org	0			      ; code starts at offset 0.
use32				      ; use 32-bit code.

        b     reset                   ;
        b     undefined_instruction
        b     software_interrupt
        b     prefetch_abort
        b     data_abort
        b     not_used
        b     irq
        b     fiq

align 4

;********************************;
; boot start.                    ;
;********************************;
reset:

LetsLoop:
	b LetsLoop

;********************************;
; just Loop For Now ;)           ;
;********************************;
undefined_instruction:
software_interrupt:
prefetch_abort:
data_abort:
not_used:
irq:
fiq:
LetsLoopForNow:
	b     LetsLoopForNow

times 20000- ($-0)  db 0

The above in arm is = to this in x86 asm.

Code: Select all

format binary
org	0			      ; code starts at offset 0.
use32				      ; use 32-bit code.

        jmp     reset                   ;
        jmp     undefined_instruction
        jmp     software_interrupt
        jmp     prefetch_abort
        jmp     data_abort
        jmp     not_used
        jmp     irq
        jmp     fiq

align 4

;********************************;
; boot start.                    ;
;********************************;
reset:
LetsLoop:
	jmp LetsLoop

;********************************;
; just Loop For Now ;)           ;
;********************************;
undefined_instruction:
software_interrupt:
prefetch_abort:
data_abort:
not_used:
irq:
fiq:
LetsLoopForNow:
	jmp     LetsLoopForNow

times 20000- ($-0)  db 0
How it works, is simple on start up the first 4k of nand is load to the first 4k of ram and than it jumps to the "b reset" or jump to address reset.
At the "reset address" you would put the code to set everything up, eg: probably load more stuff from nand,etc. Now what you do here would be depend on the arm type, has you might need to set timing or differant lcd stuff up etc.
When you get a software_interrupt in ARM it will end up at the label "software_interrupt", so you will need to write code to test for functon numbers etc at that address.
Same goes for the rest of the labels.

If you can code x86 asm, you should easy be able to learn arm.
Also as a side note, most coders, would use a bootloader like "U-boot" to load there OS, just like Grubs for x86.

Some good links
http://www.embedded.com/design/opensour ... stid=64661
http://www.embedded.com/columns/technic ... stid=64784
Post Reply