Rapsberry without OS/as pure embedded device


37 posts   Page 1 of 2   1, 2
by Soonar » Mon Jun 25, 2012 12:25 pm
Hi,

there are several (huge) images available for the Raspberry Pi to run a more or less complete Linux on it.

I could imagine to use it as a embedded device for hard realtime operations, while using full CPU power without burning any performance just for a fancy operating system.

So the software running on the board could consist of a USB-stack, (an Ethernet/TCP stack for the variant with Ethernet connector) and one single process that identifies itself via main(), is executed exclusively and accesses all hardware (including the GPIOs).

Is there something like that available that could be used as base for own embedded applications?
Posts: 5
Joined: Mon Jun 25, 2012 12:20 pm
by tufty » Mon Jun 25, 2012 1:15 pm
Soonar wrote:Is there something like that available that could be used as base for own embedded applications?

Nothing with USB or SD card support.

Yet.
Posts: 1367
Joined: Sun Sep 11, 2011 2:32 pm
by AndrewS » Mon Jun 25, 2012 1:26 pm
If you're wanting to use USB, TCP/IP and GPIO, it'll probably be much easier to do that with an OS (especially with the "unusual" hardware on the RPi).
If you want something minimal you'd probably want to build a Linux kernel with an embedded initramfs - see kernel_emergency.img for an example viewtopic.php?f=30&t=8990
Or if you really can't bear to have an OS, maybe Arduino would be a better choice?

Edit: Or you may find http://kernelnomicon.org/?p=133 interesting? :)
User avatar
Posts: 3494
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
by Soonar » Tue Jun 26, 2012 5:37 am
All the ideas with a (minimal) kernel/a initrd or something like that is way to much for what I imagine.

The Arduino-style software is a good example for what I plan to do: have everything in my own hands (or code) including all hardware access, IRQs and ressources. The Arduino hardware itself is nice but I dropped it due to its low computing power. Here the Raspberry and it s fast CPU is a much better solution.

I know, for most people it is really nice to have something fancy running on the board and they like to see X / webserver / whatever, but the hardware has very much capabilities of a really cheap and really powerful embedded device. Seems like the vendors of the RP did not notice this until now...
Posts: 5
Joined: Mon Jun 25, 2012 12:20 pm
by AndrewS » Tue Jun 26, 2012 8:53 am
Soonar wrote:All the ideas with a (minimal) kernel/a initrd or something like that is way to much for what I imagine.

"Way too much" in what way? As you say the RPi has a very fast (compared to a microcontroller) CPU, so running an OS should still leave plenty of processing left over for your own application(s).

The Arduino-style software is a good example for what I plan to do: have everything in my own hands (or code) including all hardware access, IRQs and ressources. The Arduino hardware itself is nice but I dropped it due to its low computing power. Here the Raspberry and it s fast CPU is a much better solution.

The Arduino has "open hardware" and fully detailed datasheets available, so you do get full access to all the hardware and every last register. But on the RPi much of the SoC is "closed hardware" and undocumented, so you'll have to become very good at reverse-engineering the Linux drivers if you want "full access" to the hardware (and you'll get almost zero access to the GPU side). Prepare to get your sleeves rolled up! :twisted:
https://github.com/raspberrypi/linux
http://elinux.org/RPi_Low-level_peripherals
http://www.raspberrypi.org/wp-content/u ... herals.pdf

the hardware has very much capabilities of a really cheap and really powerful embedded device. Seems like the vendors of the RP did not notice this until now...

Huh? The Foundation have repeatedly said that the only intention for the device was to teach kids programming. Any other uses it has is just a bonus ;-) But yeah, there's always been people been interested in using it in embedded-controller scenarios viewforum.php?f=37
User avatar
Posts: 3494
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
by tufty » Tue Jun 26, 2012 9:05 am
Soonar wrote:All the ideas with a (minimal) kernel/a initrd or something like that is way to much for what I imagine.

OK.

Head over to my git repository (see .sig), pull down the "standalone" branch, and build. That gets you a totally minimal multitasking nanokernel, if you look at main.c you'll see how to set up and run tasks. There are no drivers as such (although the serial port should work if you set the pin directions up), no libc, nothing. You don't even get malloc()m although sbrk() is there (for the moment, don\t count on it long term).

I can't vouch for the solidity of the real-time aspect, although you can turn interrupts off if you like. To be honest, I'm not even certain that the timer interrupts are happening when thy should be...

It's all BSD-licensed, feel free to do what you like with it (including / especially using it as a base for porting a 'proper' RTOS)

Simon
Posts: 1367
Joined: Sun Sep 11, 2011 2:32 pm
by jamesh » Tue Jun 26, 2012 10:06 am
Soonar wrote:I know, for most people it is really nice to have something fancy running on the board and they like to see X / webserver / whatever, but the hardware has very much capabilities of a really cheap and really powerful embedded device. Seems like the vendors of the RP did not notice this until now...


Whuh? We noticed it about 5 seconds after the board was designed. Well,m actually, during the board design process. So that would be about a year ago. What on earth makes you think we hadn't noticed the possibilities?
Soon to be unemployed software engineer currently specialising in camera drivers and frameworks, but can put mind to most embedded tasks. Got a job in N.Cambridge or surroundings? I'm interested!
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11627
Joined: Sat Jul 30, 2011 7:41 pm
by AndrewS » Tue Jun 26, 2012 11:48 am
Maybe he's complaining that Linux is the only officially-supported OS? :?
Which is obviously far too bloated for his needs... ;)
User avatar
Posts: 3494
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
by Soonar » Wed Jun 27, 2012 5:07 am
@jamesh: AndrewS got the point exactly :-)
Posts: 5
Joined: Mon Jun 25, 2012 12:20 pm
by jamesh » Wed Jun 27, 2012 7:43 am
Soonar wrote:@jamesh: AndrewS got the point exactly :-)


And the point is.....why haven't the Foundation produced a embedded OS to run on the Pi?
Soon to be unemployed software engineer currently specialising in camera drivers and frameworks, but can put mind to most embedded tasks. Got a job in N.Cambridge or surroundings? I'm interested!
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11627
Joined: Sat Jul 30, 2011 7:41 pm
by tufty » Wed Jun 27, 2012 8:07 am
jamesh wrote:
Soonar wrote:@jamesh: AndrewS got the point exactly :-)


And the point is.....why haven't the Foundation produced a embedded OS to run on the Pi?

That's actually a fairly reasonable question, of course.

A minimal realtime or embedded OS with a single language runtime would have made it absolutely clear what the goals of the project are (i.e. not a super-cheap PVR or super-slow desktop machine) and obviated a lot of the issues we're seeing now from the crew who bought after seeing the Pi playing Big Buck Bunny on HotUKDeals.

On the other hand, getting such a beast up and running is no mean feat, especially when the documentation for (for example) the USB IP used in the SoC appears to be solely provided as a bugged-to-hell Linux driver. That said, the OS and C library side of things is relatively trivial, and I guess the Broadcom IP side of things wouldn't have been too much of an issue...

Simon
Posts: 1367
Joined: Sun Sep 11, 2011 2:32 pm
by mahjongg » Wed Jun 27, 2012 8:40 am
I think what you are looking for is called RiscOS, and indeed a version for the RPI is running as beta as we speak. Which by the way shows that simple video generation is indeed possible without much work, the video kernel gives access to a perfectly acceptable frame buffer mode without any "reverse engineering" needed, and actually at the moment that is what Linux is using too (for lack of hardware accelerated rendering). An amateur has written a "proof of concept" minimal OS too, that among other things displays a screen. Doubtlessly other kinds of OS will be developed in due time, for the moment a minimal Linux distro is probably the best choice to use most of the capabilities of the hardware.
User avatar
Forum Moderator
Forum Moderator
Posts: 5201
Joined: Sun Mar 11, 2012 12:19 am
by jamesh » Wed Jun 27, 2012 10:25 am
tufty wrote:
jamesh wrote:
Soonar wrote:@jamesh: AndrewS got the point exactly :-)


And the point is.....why haven't the Foundation produced a embedded OS to run on the Pi?

That's actually a fairly reasonable question, of course.

A minimal realtime or embedded OS with a single language runtime would have made it absolutely clear what the goals of the project are (i.e. not a super-cheap PVR or super-slow desktop machine) and obviated a lot of the issues we're seeing now from the crew who bought after seeing the Pi playing Big Buck Bunny on HotUKDeals.

On the other hand, getting such a beast up and running is no mean feat, especially when the documentation for (for example) the USB IP used in the SoC appears to be solely provided as a bugged-to-hell Linux driver. That said, the OS and C library side of things is relatively trivial, and I guess the Broadcom IP side of things wouldn't have been too much of an issue...

Simon


Simple. Not been done because of Cost. Linux came 'free' with the SoC. Any sort of embedded OS port would have cost a fortune to develop. I mean, really big piles of money. And it would still be under development now!

And of course, Linux works absolutely fine for the target audience.

My own point of view is that I want it to run Linux, not some embedded OS with naff all program support, which is a pain to compile for and lacks most of the features available in the GPU.

YMMV.
Soon to be unemployed software engineer currently specialising in camera drivers and frameworks, but can put mind to most embedded tasks. Got a job in N.Cambridge or surroundings? I'm interested!
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11627
Joined: Sat Jul 30, 2011 7:41 pm
by Soonar » Wed Jun 27, 2012 10:42 am
jamesh wrote:Simple. Not been done because of Cost. Linux came 'free' with the SoC. Any sort of embedded OS port would have cost a fortune to develop. I mean, really big piles of money. And it would still be under development now!

OK, to come back to MY question: what I would prefer is much less than a RISC-OS. Just a possibility to place some (single-threaded) code that is executed as very first (and as one and only) when the CPU starts. No threads, no system calls, no file system, just plain access to CPU registers, IRQs, peripheral hardware (in my special case I would not need access the video device which simplifies it enormously).

There are funny things available one could build up everything that is needed without the need to have an operating system (as some examples: lwIP for setting up an embedded TCP/IP stack, FatFs for reading/writing FAT-FS media from within an embedded device, ARM-USB stacks to access the USB device and others more).
Posts: 5
Joined: Mon Jun 25, 2012 12:20 pm
by AndrewS » Wed Jun 27, 2012 11:16 am
Soonar wrote:Just a possibility to place some (single-threaded) code that is executed as very first (and as one and only) when the CPU starts. No threads, no system calls, no file system, just plain access to CPU registers, IRQs, peripheral hardware (in my special case I would not need access the video device which simplifies it enormously).

And no-one's stopping you... :)
search.php?keywords=bare+metal will probably find you some useful posts.
User avatar
Posts: 3494
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
by AndrewS » Wed Jun 27, 2012 11:19 am
tufty wrote:
jamesh wrote:And the point is.....why haven't the Foundation produced a embedded OS to run on the Pi?

That's actually a fairly reasonable question, of course.

A minimal realtime or embedded OS with a single language runtime would have made it absolutely clear what the goals of the project are (i.e. not a super-cheap PVR or super-slow desktop machine) and obviated a lot of the issues we're seeing now from the crew who bought after seeing the Pi playing Big Buck Bunny on HotUKDeals.

...and also made it totally unattractive to the intended target market :|
User avatar
Posts: 3494
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
by DexOS » Wed Jun 27, 2012 4:44 pm
You can test my bare metal OS, see here: viewtopic.php?p=108331#p108331

Its a port of my x86 OS called DexOS, its got a lot of function built in that can not be demoed yet, for lack of user input.
I have got around the lack of usb support by the use of a simple pic with usb host controller.
It will be fully open source once its usable.
Batteries not included, Some assembly required.
User avatar
Posts: 860
Joined: Wed May 16, 2012 6:32 pm
by tufty » Wed Jun 27, 2012 7:54 pm
AndrewS wrote:
tufty wrote:
jamesh wrote:And the point is.....why haven't the Foundation produced a embedded OS to run on the Pi?

That's actually a fairly reasonable question, of course.

A minimal realtime or embedded OS with a single language runtime would have made it absolutely clear what the goals of the project are (i.e. not a super-cheap PVR or super-slow desktop machine) and obviated a lot of the issues we're seeing now from the crew who bought after seeing the Pi playing Big Buck Bunny on HotUKDeals.

...and also made it totally unattractive to the intended target market :|

Why?

The intended target market is to teach programming, not making PVRs and and arcade machines.

jamesh wrote:Any sort of embedded OS port would have cost a fortune to develop. I mean, really big piles of money. And it would still be under development now!

Sorry, but I simply don't buy it. There's plenty of embedded and realtime OSs out there that are open source and already run on ARM11 (FreeRTOS is a decent starting point), there's vast amounts of open source USB/TCP etc stacks out there, all that would really have been required would be a port of the stuff that's relevant to the Broadcom SoC and development of a nice front end. It's not /that/ hard, especially when you have the documentation. Hell, Craig has graphics up, and he's only been at it for a little while. I have a multitasking kernel that's about to sprout a scheme runtime and UI, and I've developed that inbetween working as a chairlift driver and finishing building a house.

The choice of SoC has been fixed for over a year now. A few people with documentation and access to alpha hardware should have been able to come up with something worldbeating.

Yeah, I know, "we've got linux now", and "it came for free". But without accelerated graphics, it runs like cack; unless you throw away all the stuff that you would want to use it for, it's bordering on "not fit for purpose".

Simon
Posts: 1367
Joined: Sun Sep 11, 2011 2:32 pm
by AndrewS » Thu Jun 28, 2012 2:19 am
tufty wrote:
AndrewS wrote:...and also made it totally unattractive to the intended target market :|

Why?

The intended target market is to teach programming, not making PVRs and and arcade machines.

The intended target market is children. Short attention spans and all that ;) IMHO a single-task embedded-OS RasPi would be perceived by the target market as little different to the Arduino. See also http://elinux.org/Rpi_HardwareHistory#R ... 06_edition
I'm sure Liz/Eben have much more facts&figures, so I'll duck out here.
User avatar
Posts: 3494
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
by Soonar » Thu Jun 28, 2012 5:16 am
DexOS wrote:You can test my bare metal OS, see here: viewtopic.php?p=108331#p108331

Its a port of my x86 OS called DexOS, its got a lot of function built in that can not be demoed yet, for lack of user input.
I have got around the lack of usb support by the use of a simple pic with usb host controller.
It will be fully open source once its usable.


Thanks, I'll check it and get in touch with you directly.
Posts: 5
Joined: Mon Jun 25, 2012 12:20 pm
by DexOS » Thu Jun 28, 2012 2:04 pm
AndrewS wrote:
tufty wrote:
AndrewS wrote:...and also made it totally unattractive to the intended target market :|

Why?

The intended target market is to teach programming, not making PVRs and and arcade machines.

The intended target market is children. Short attention spans and all that ;) IMHO a single-task embedded-OS RasPi would be perceived by the target market as little different to the Arduino. See also http://elinux.org/Rpi_HardwareHistory#R ... 06_edition
I'm sure Liz/Eben have much more facts&figures, so I'll duck out here.

I do not want to get into a debate between linux or embedded OS.
But the Arduino has got lots of kids into electronics.
Also kids like everyone else are show offs, you give them a high res 3d games like quake 3 and it puts them off, there code is never going to look as good.
But if you give them something thats more limiting, but still widely distributed, and kids will want to push it past those limits, like Elite did.

When you have coding compo's for example, you limit them in some way.
This limit is what motivates people to enter.
The type of kids that think it must have the latest 3d graphic, are never going to be coders or into electronics anyway.

So we have linux and once embedded OS's start coming on tap, we can let the kids decide.
Batteries not included, Some assembly required.
User avatar
Posts: 860
Joined: Wed May 16, 2012 6:32 pm
by jamesh » Thu Jun 28, 2012 3:27 pm
tufty wrote:
AndrewS wrote:
jamesh wrote:Any sort of embedded OS port would have cost a fortune to develop. I mean, really big piles of money. And it would still be under development now!

Sorry, but I simply don't buy it. There's plenty of embedded and realtime OSs out there that are open source and already run on ARM11 (FreeRTOS is a decent starting point), there's vast amounts of open source USB/TCP etc stacks out there, all that would really have been required would be a port of the stuff that's relevant to the Broadcom SoC and development of a nice front end. It's not /that/ hard, especially when you have the documentation. Hell, Craig has graphics up, and he's only been at it for a little while. I have a multitasking kernel that's about to sprout a scheme runtime and UI, and I've developed that inbetween working as a chairlift driver and finishing building a house.

The choice of SoC has been fixed for over a year now. A few people with documentation and access to alpha hardware should have been able to come up with something worldbeating.

Yeah, I know, "we've got linux now", and "it came for free". But without accelerated graphics, it runs like cack; unless you throw away all the stuff that you would want to use it for, it's bordering on "not fit for purpose".

Simon


Got a spare 'few people'? No, neither have we! And quite a few of people had alpha hardware. Still no ported RTOS.

I'm afraid I'm one of those people who thinks its not necessary to do bare metal programming to become a proficient software engineer. I'm also of the belief that starting at that level is massively likely to put people off rather than ease them in to programming. Once there, throw them some low level code, but not before. It's how the 80's micro revolution started - everyone wrote BASIC at first (and many stayed at that level), then assembler for the dedicated few who wanted higher speed. That's what I did. What it taught me is that I much prefer higher level languages to assembler....although I can write it.

If you think the Raspi is not fit for purpose 'because it runs like cack' perhaps it's not the device for you. I do however, think its the device for a lot of other people for whom its perfectly fast enough.

I suppose, the final word must be - if you want it, write it. As you say DexOS has made some progress in a pretty short time. Just the USB and ethernet stacks to get it to a point where it becomes easier enough to use as a teaching aid. Get together, finish it off. Only then would it be possible to compare the two approaches to see which works best.
Soon to be unemployed software engineer currently specialising in camera drivers and frameworks, but can put mind to most embedded tasks. Got a job in N.Cambridge or surroundings? I'm interested!
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11627
Joined: Sat Jul 30, 2011 7:41 pm
by tufty » Thu Jun 28, 2012 6:16 pm
We appear to have had this discussion before, James. Yes, you consider it futile to be doing anything other than Linux. We know that, although we don't all agree.
jamesh wrote:And quite a few of people had alpha hardware. Still no ported RTOS.

Still no OpenGL or OpenVG accelerated X, either. And the USB driver's still taking 20% of CPU time, too, last time I looked :P

I am, of course, trying to do something, and no, it's not driven by some "it has to be low level" ethos.

Still, what would make it a shedload easier for people like me, Craig, Dave, the guys on the RiscOS team, and anyone else wanting to do non-linux stuff, would be access to proper documentation for stuff like the SDIO and USB controllers. I've personally been in contact with both Arasan and Designware, and neither of them want to make the sort of documentation we need available. It would be *really* nice if the foundation could ask on our behalf (after all, all we need is a couple of specific documents, the ones that are referred to in the Broadcom peripherals datasheet). It would make it easier for people on the Linux side who are trying to debug and improve Designware's bloody awful USB code, too.

Simon
Posts: 1367
Joined: Sun Sep 11, 2011 2:32 pm
by jamesh » Thu Jun 28, 2012 9:51 pm
TBH, I don't think Broadcom even have the datasheet for the USB stuff. Not sure why not though. I agree of the terrible state of the USB code but without the datasheet (and a to of time) it's not an easy fix. I have a feeling even the manufacturers don't even know how it all works and even with the datasheet it would be a long road to a new driver.

Don't know about the SDIO stuff - have a feeling we are on the way to fixing that stuff with the last firmware upgrade.
Soon to be unemployed software engineer currently specialising in camera drivers and frameworks, but can put mind to most embedded tasks. Got a job in N.Cambridge or surroundings? I'm interested!
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11627
Joined: Sat Jul 30, 2011 7:41 pm
by DexOS » Fri Jun 29, 2012 12:06 pm
jamesh wrote:I suppose, the final word must be - if you want it, write it. As you say DexOS has made some progress in a pretty short time. Just the USB and ethernet stacks to get it to a point where it becomes easier enough to use as a teaching aid. Get together, finish it off. Only then would it be possible to compare the two approaches to see which works best.


Us bare metal OSDev's are control freaks, we could never work to together, we just reinvent the wheel, that why we make slow progress.
But its our wheel so we are happy :) .
Batteries not included, Some assembly required.
User avatar
Posts: 860
Joined: Wed May 16, 2012 6:32 pm