RustyNeX
Posts: 9
Joined: Mon Jan 21, 2013 10:28 am

booting to a single graphical program

Wed Apr 22, 2015 5:08 pm

Hi there,

first of all i am new to the forum and the Pi, i have some experience in programming but thats about it.

what i want to do is use the Pi to display graphical information, for example gauges that show sensor values read by the GPIOs, i want to take full advantage of the graphics power of the Pi, but i am not sure where to start.

the main point though is that it must boot fast, a boot time of 30 seconds is just not viable. so i was thinking is there a way to create a small bit of software that boots quickly and simply runs a simple program? it would simply read the sensors on the GPIOs and then update the graphics.

i have done similar things with huge success using an arduino and the Gameduino, as well as 4D system's products. they are easy to program, boot pretty much instantly and are easy to learn, but they are very limited by what can be done with graphics.

If i wanted to do any kind of 3D images, fancy transparency or layers or even basic video then they pretty much fail completely.

the raspberry Pi is way more powerful (1Ghz quadcore, 1Gb) than the other things i have been using but i feel like that only adds complexity, i don't want to have to deal with a whole operating system to do basic functions that i have already been doing with other technology.

does anyone know if there is any good platforms that i can start from or if there is a good point to start from? so far all the graphical information about the Pi seems to start from a full blown OS,

thanks for your help guys and sorry if this is a really dumb question

kriss
Posts: 66
Joined: Thu Apr 02, 2015 8:53 pm
Location: france for now ...

Re: booting to a single graphical program

Wed Apr 22, 2015 5:39 pm

i don't know about something "light" that support opengl
you can try to make a light pilfs with only what you need but it continue to be a kernel ...
to code a self-bootable-gl look not what you want ...

RustyNeX
Posts: 9
Joined: Mon Jan 21, 2013 10:28 am

Re: booting to a single graphical program

Wed Apr 22, 2015 6:06 pm

thanks for the reply

where would i start with building that?


ronyoung1
Posts: 6
Joined: Fri Oct 11, 2013 6:37 am

Re: booting to a single graphical program

Wed Apr 22, 2015 6:24 pm

Hi:

Going "bare metal" is probably not what you want to do since you want to display graphics.

The 30 second boot time is mainly due to running a "Desktop" distribution with all of the associated daemons and support stuff.

One approach you may want to look at is to use the linux kernel and SDL but none of the normal desktop stuff. After the linux kernel boots, it executes a program called /sbin/init to bring up the rest of the system. It is a normal C program running as root. You can replace it with another program.

This program could then use SDL with a widgit library to do what you want. Google for "SDL widget",
for an example library: http://members.chello.nl/w.boeke/SDL-widgets/

I have used a similar approach for years to do things like this. One other thing, you may want to use
static libraries, so you don't have to worry about using all of the dynamic loading of shared libraries.

EDIT: I forgot to mention that you may want to use C and not an interpretive language like python. It probably can be done, but in my opinion, the further you get from a statically linked C program the
more overhead and support headaches are introduced.

Hope this helps

-ron
Last edited by ronyoung1 on Wed Apr 22, 2015 6:41 pm, edited 1 time in total.

RustyNeX
Posts: 9
Joined: Mon Jan 21, 2013 10:28 am

Re: booting to a single graphical program

Wed Apr 22, 2015 6:25 pm

thanks very much for your help!

RustyNeX
Posts: 9
Joined: Mon Jan 21, 2013 10:28 am

Re: booting to a single graphical program

Wed Apr 22, 2015 6:45 pm

thanks for the help ronyoung1, that was kinda what i was thinking, that there must be a way to boot my program instead of all the other stuff.

does anyone know what the boot time is like with the desktop switched off? i think 10 sec is my absolute limit.

and working with C would be preferable, i know more about C than python and my experience with python has been pretty negative.

User avatar
DougieLawson
Posts: 37134
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: booting to a single graphical program

Wed Apr 22, 2015 8:21 pm

RustyNeX wrote: does anyone know what the boot time is like with the desktop switched off? i think 10 sec is my absolute limit.
I set my RPi2 (running Raspbian Jessie) to shutdown & reboot at 11:00 on Tuesday. The boot time (from /proc/stats) shows as 11:00:06. So less than five seconds (assuming it took one second to shutdown).
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

RustyNeX
Posts: 9
Joined: Mon Jan 21, 2013 10:28 am

Re: booting to a single graphical program

Wed Apr 22, 2015 8:35 pm

thats interesting, is that booting everything? like a full OS? how did you achieve that?

kriss
Posts: 66
Joined: Thu Apr 02, 2015 8:53 pm
Location: france for now ...

Re: booting to a single graphical program

Thu Apr 23, 2015 12:20 pm

if you can deal with making kernel module you should boot and begin to work in less than 3 second ;)

RustyNeX
Posts: 9
Joined: Mon Jan 21, 2013 10:28 am

Re: booting to a single graphical program

Thu Apr 23, 2015 12:22 pm

i like those numbers! so i just have to figure out how to make a kernel, write my software and get the pi to run it.... simple :D

User avatar
DougieLawson
Posts: 37134
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: booting to a single graphical program

Thu Apr 23, 2015 2:50 pm

RustyNeX wrote:thats interesting, is that booting everything? like a full OS? how did you achieve that?
That's a headless system no slow xwindows to get started and the time is from /proc/stats (btime). The time is used by uptime -s and uprecords, it does not mean that everything is ready and running. It's the time when the kernel started the init program.

I still think folks over complicate this stuff. It's about three times quicker than my Win8.1 laptop.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

RustyNeX
Posts: 9
Joined: Mon Jan 21, 2013 10:28 am

Re: booting to a single graphical program

Thu Apr 23, 2015 3:11 pm

i understand that it is way faster than a normal computer, but then it is a very basic solid state computer so it should be faster. when it comes to embedded stuff, boot times are not something that should be a problem. its like waiting 10 seconds for an arduino to boot, it would just be unacceptable.

User avatar
DougieLawson
Posts: 37134
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: booting to a single graphical program

Thu Apr 23, 2015 3:48 pm

RustyNeX wrote: its like waiting 10 seconds for an arduino to boot, it would just be unacceptable.
An Arduino is a computer by all traditional definitions. But, you can't compare a Raspberry Pi to an Arduino (unless the RPi is running a bare metal kernel). There's no bootstrap loader on an Arduino, there's nothing to load from external storage. With an Arduino when the _RESET_ pin goes high the Atmel processor starts at the first instruction in the loaded sketch (in NVRAM).

With an RPi there's a whole bunch of stuff loaded from the SDCard just to get to the point where the kernel starts, then a whole bunch of stuff before it launches the init process. That init process then has a whole bunch of stuff to do to get the applications defined in the /etc/inittab running. One of those applications is the rc program that gets the stuff from /etc/rc2.d (including rc.local) started.

I suspect my technical definition of "booting to kernel loaded" doesn't match everyone else's definition of "booting to usable".
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

RustyNeX
Posts: 9
Joined: Mon Jan 21, 2013 10:28 am

Re: booting to a single graphical program

Thu Apr 23, 2015 5:01 pm

yea bare metal is what i meant, a raspberry pi is still a microcontroller, as soon as it has power it begins executing code, so it shouldn't be such a strange idea to get a pi booting quickly

kriss
Posts: 66
Joined: Thu Apr 02, 2015 8:53 pm
Location: france for now ...

Re: booting to a single graphical program

Thu Apr 23, 2015 6:29 pm

RPI2 is not a micro-controller
you can view the gpu code in bootcode.bin as an integrated one that do small work and disappear ;)
it's 4 core arm anyway

Return to “Bare metal, Assembly language”