Windows CE on freerunner

Alex Osborne ato at
Fri Aug 22 04:27:13 CEST 2008

On 22/08/2008, at 11:41 AM, Vikas Saurabh wrote:

> Why can't I fool the bootloader to think that I am a kernel. I  
> always thought boot loaders just load the kernel image, pass it  
> some parameters and start executing them.

Indeed, that's exactly what it does.  It loads the kernel image into  
RAM, puts some parameters and a pointer to the ATAGS (which include  
stuff the kernel command-line) into registers and jumps to the start  
of the image.  See here for details:

> I had done this helloworld kind of thing with grub during  
> college...but then maybe grub is advanced. What puzzles me is how  
> exactly?

Note that the Freerunner doesn't have a BIOS.  When you did it on x86  
you probably used the BIOS' printing routines.  If you want to do it  
on the FR you'll have to do your own font blitting etc.  If you have  
a debug board you could print it to a serial port.  You can then also  
use JTAG to debug your code and figure out what is going on.  If you  
don't have the debug board, I guess you could easily enough blink out  
hello world in morse code through an LED or by turning on and off the  
backlight or something.

It might also be useful to play with it in qemu, just pass in your  
binary with the -kernel option, you can connect gdb to it and step  
through line by line (see the qemu documentation for how to do this).

As to how to actually do it, it's a bit of a pain.  You'll probably  
need to write a little ARM assembler stub entry point to setup a  
stack and call your C code.  Although you might be able to just reuse  
u-boots stack, I guess.  Then you'll need to compile your code with - 
nostdlib and link it in a way that ensures your assembler code is at  
the start of the image, you might need to investigate custom linker  
scripts for this, I can't remember.  You can then use something like  
"objcopy -O binary mycode.elf mycode.bin" to pull the raw code out of  
the elf file the linker generated, so that you can give it to u-boot.

Remember also that you won't have any standard library, so you'll  
have to write every function you want to use yourself (or use  
something like the OSKit C library) and if you code has a bug it's  
just going to hang or reset the CPU, unless you define your own error  
handling code.

So yes, certainly doable and a good learning experience but it's not  
exactly straightforward.

More information about the community mailing list