Page 1 of 2

Write an OS for PocketPc

Posted: Sun May 18, 2008 7:17 am
by Karlosoft
It's a few of time that i've a question.
Is possible, write an OS for pocketpc?

Posted: Sun May 18, 2008 8:52 am
by Dex
Yes, but it depends what processor it uses, as to how you go about it.
If its a ARM, let me know as i have done some ARM programming.

Posted: Sun May 18, 2008 9:15 am
by Karlosoft
Yes it's a ARM, i think. On the screen is written that it's a Intel PXA255...

Posted: Sun May 18, 2008 10:21 am
by Dex
Right you need to get a suitable bootload eg: ArmBoot
http://armboot.sourceforge.net/

Also find linux example and google for info, if you get stuck just ask
Download & links
http://hw-server.com/hw_products/sld_hws.html

Intel PXA255 DIMM PC board - a detailed datasheet
http://hw-server.com/files/priloha/dimm_pc.pdf

Primary source about ARM architekture: www.arm.com.
Arm Reference Manual: www.arm.com/ARM.

Sources and manuals for gcc, gdb, glib+ and binary utilities : www.gnu.org.
Kernel souces and patches are on the page: www.arm.linux.org.uk.

Posted: Sun May 18, 2008 12:21 pm
by Karlosoft
thank you very much :)

Posted: Sun May 18, 2008 1:36 pm
by Dex
Karlosoft wrote:thank you very much :)
Your welcome, for my ARM Dev work, i use FasmArm http://arm.flatassembler.net/

Posted: Sun May 18, 2008 5:02 pm
by pcmattman
You can also compile a GCC toolchain that targets ARM (arm-elf, for instance), but that doesn't replace knowing the assembly ;).

It's always nice to be able to code in C instead of assembly though.

Posted: Sun May 18, 2008 7:53 pm
by molux
Hello,

Do you have an idée to emulate a minimliste PocketPC plateform ?
Does i simply have to find an ARM emulator ?
Is there a complicated boot procedure ? (differt thant conventional ARM emulator ?)

An more important, How about the bios ?
(Or where to find documentation for an ipaq for exemple)

Thanks a lot for your response
(Thousand excuses for my bad english)

Molux

Posted: Mon May 19, 2008 4:32 am
by tsp
pcmattman wrote:You can also compile a GCC toolchain that targets ARM (arm-elf, for instance)
Yes, WinARM is the one I'm using although there are other options also.

Posted: Mon May 19, 2008 5:02 am
by Karlosoft
What are the "elf executable at 0"???

Posted: Mon May 19, 2008 5:03 am
by JamesM
Karlosoft wrote:What are the "elf executable at 0"???
Can you give us some context?

Posted: Mon May 19, 2008 5:07 am
by Karlosoft
yes a moment...

here you are...

Code: Select all

	format ELF dwarf executable at 0
	entry start
	section 'one' executable readable writeable align 020h

start:	mov	r1,string_hello
	mov	r0,4		;SYS_WRITE0
	swi	0x123456	;Multi-ICE DCC semihosting
	mov	r0,18h		;angel_SWIreason_ReportException
	mov	r1,20000h	;Software reason code
	orr	r1,r1,26h	;ADP_Stopped_ApplicationExit
	swi	0x123456	;Multi-ICE DCC semihosting

string_hello	db	'Hello ARM semi-hosting world',13,10,0

and thann

Code: Select all

	format ELF executable
	entry start

	segment readable executable

start:	mov	r0,0
	add	r1,pc,hello-$-8
	mov	r2,hello_len
	swi	0x900004
	mov	r0,6
	swi	0x900001

hello:	db	'Hello world',10
hello_len=$-hello

	;dummy section for bss, see http://board.flatassembler.net/topic.php?t=3689
	segment writeable

Posted: Mon May 19, 2008 5:44 am
by molux
Hello,

And what about Pocket PC emulation and Pocket PC bios ?
(Does the ARM bios are "standardized" or there is a spécial bios on Pocket pc ?)

thanks in advance

Molux

Posted: Mon May 19, 2008 5:48 am
by Karlosoft
http://sourceforge.net/project/download ... z&26436493
I've found this link. i don't know how is it...

Posted: Mon May 19, 2008 10:09 am
by Dex
The posted programs seem to be examples for running on a OS, maybe linux on the ARM .
To write a OS for a ARM is a lot simpler than the x86, but you need to do most of the work your self, eg: No BIOS to set things up for you.
And most things that need setting up are differant on the differant ARM chips.

But this is a helloworld! bootloader that would work on all ARM chips

Code: Select all

:****************************************;
; ARM BootLoader.                        ;
;----------------------------------------;
; Prog by Dex.                           ;
; Coded with FasmARM.                    ;
; Part of the the x86 to ARM DexOS port. ;
; C:\fasmarm ArmBoot.asm ArmBoot.bin     ;
;                                        ;
;  C Bamford.2006(c)                     ;
;****************************************;
format binary
org	0			      ; code starts at offset 0.
use32				      ; use 32-bit code.

        b     reset                   ; b lable (is the same as jmp lable in x86 asm )
        b     undefined_instruction
        b     software_interrupt
        b     prefetch_abort
        b     data_abort
        b     not_used
        b     irq
        b     fiq

align 4

;********************************;
; boot start.                    ;
;********************************;
reset:
; here is where your start up code would go.
LetsLoop:
	b LetsLoop

;********************************;
; just Loop For Now ;)           ;
;********************************;
undefined_instruction:
software_interrupt:
prefetch_abort:
data_abort:
not_used:
irq:
fiq:
LetsLoopForNow:
	b     LetsLoopForNow
So for example the software int code would be placed under the lable
"software_interrupt" and so on, all that happans when you turn the device on is 4k of code is load from rom to ram starting at 0 and than it jumps to the 0 address.

I may write a tut if i get time.