Some background
The most important thing you should know is that the RaspberryPi is a strange beast where the ARM CPU
is the not main CPU - it's only a co-processor to the VideoCore GPU
. When the RaspberryPi starts, a GPU blob is read from the SD card to the L2 cache and executed. This code then brings up all the important peripherals (RAM, clocks etc) and starts the ARM CPU
. Then the 2nd stage bootloader or some operating system itself can be run on ARM CPU
.
GPU blob is not only a bootloader. It's actually an operating system (Video Core OS) by itself. Some important elements of the system are not directly accessible by ARM CPU and it has to communicate with GPU
(using mailbox
messaging system) to use them. There is partial documentation about this available. Now Video Core OS
(VCOS
) is extended from time to time by Broadcom employees to enable features needed by Linux
kernel, RISC OS
or sometimes even some hobby OSes. There is no good documentation about this however, you would have to dig in the RaspberryPi forum
, github
and possibly other places to find information about this. But it's there.. somewhere. And there are a few people who write their own bare metal code or even OSes on the RaspberryPi to help you out. And of course a lot of open source code - RasbperryPi's Linux kernel for example.
VideoCore is proprietary, there is no official documentation and development tools. So unless you want to put a lot of effort, you can't rewrite VCOS
with your own code. There is, however, some effort to reverse engineer the Video Core, you can find some information here.
Another problem is that the USB
stack by Synopsys is proprietary and again there is no documentation for it and it seems that even with documentation it's hard to implement it reliably. But again, the code is available (Linux kernel, u-boot, CSUD). Using advanced graphics capabilities of Video Core
may also be hard - there is some open source code for the graphics libraries, but it's only for the ARM
side.
That being said, it was possible to make the RISC OS
port from the information available (it's not entirely clear to me if they were using only publicly accessible information, though), some people are rewriting (independently from Broadcom) the Linux kernel for mainline, there is a FreeBSD
port, 'U-boot` and others. So it is definitively possible to write your own OS. It's just not as easy as it might possibly be.
Your goals
Number 1
As far as I know, there is no way that the SoC could start in another way than the one described. So first stage bootloader has to be on SD card
. And it has to be a GPU
binary, not an ARM
binary which is another problem. And there is no on board flash in the RaspberryPi which is also a problem.
Number 2
The main problem is that there is no on-board flash
on RaspberryPi. You could add one and it could be activated in your bootloader (which would have to be the 2nd stage bootloader already). Writing a USB driver could be problematic, however.
Number 3, 4, 5
This shouldn't be much of a problem. Most of the peripherals (at least those accessible to the ARM
) are documented here. Existing bootloader makes this even easier since you get your SoC completely configured. You can look here and here for some code and documentation.
Alternatives
I don't know any other board as good as RaspberryPi so it's hard to recommend something but you may take a look at some mature projects like OMAP based Beagleboard/Beaglebone/Pandaboard or you can follow the development of some new boards like the Allwinner based Cubieboard or PCduino. It all depends on what exactly you want to accomplish.