timborian
Posts: 7
Joined: Fri Oct 30, 2015 12:27 pm

1920x1080 60Hz text output

Fri Oct 30, 2015 12:34 pm

I am planning to create an embedded system using Raspberry Pi and I don't want to go with the boot to Linux and then run the program path, but instead I want to create a bare metal app that will be triggered without any OS and directly from kernel.img .

However, I am not sure if the resolution 1920x1080 and 60 Hz will be possible with the current RP.

The problem with different LCD panels is not an issue, because it will be always used in a product with the same LCD (1920x1080) resolution.

It will be an app with a simple "textmode" like graphics, nothing fancy etc., but the requirement is the high 108p resolution and 60Hz to display it. There will be no video or images, just text. Think emacs-like environment in 1080p on Raspberry Pi. But it won't be a text editor, just the environment will be very similar.

Have somebody done that already? Are there any projects/how-tos like this on the internet?

fruitoftheloom
Posts: 20916
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: 1920x1080 60Hz text output

Fri Oct 30, 2015 1:12 pm

timborian wrote:I am planning to create an embedded system using Raspberry Pi and I don't want to go with the boot to Linux and then run the program path, but instead I want to create a bare metal app that will be triggered without any OS and directly from kernel.img .

However, I am not sure if the resolution 1920x1080 and 60 Hz will be possible with the current RP.

The problem with different LCD panels is not an issue, because it will be always used in a product with the same LCD (1920x1080) resolution.

It will be an app with a simple "textmode" like graphics, nothing fancy etc., but the requirement is the high 108p resolution and 60Hz to display it. There will be no video or images, just text. Think emacs-like environment in 1080p on Raspberry Pi. But it won't be a text editor, just the environment will be very similar.

Have somebody done that already? Are there any projects/how-tos like this on the internet?
The RPi VideoCore IV GPU supports several screen resolutions:

https://www.raspberrypi.org/documentati ... fig-txt.md
Retired disgracefully.....

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12344
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: 1920x1080 60Hz text output

Fri Oct 30, 2015 1:26 pm

HDMI mode 82.
Use Linux, you cannot easily do this with bare metal, you need a way to talk to the graphics subsystem.
Using it for text or graphics doesn't matter, the PI only supports graphics modes on which you can draw text using the OS.

timborian
Posts: 7
Joined: Fri Oct 30, 2015 12:27 pm

Re: 1920x1080 60Hz text output

Fri Oct 30, 2015 1:38 pm

I cannot use linux it will be a product that will be sold. I need to make it available in 6 - 9 months from now. So, if Raspberry can do it, great, if not, I will have to find something else. But if the GPU supports the resolution, the programmers can make a way to communicated with the gpu using 1920x1080 and 60 Hz, right? It might be hard , but it is possible, right?

One question though. Has anyone ever tried that on this forum? So, I can possibly hire him or at least ask him for some advice etc.?

User avatar
rpdom
Posts: 15408
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: 1920x1080 60Hz text output

Fri Oct 30, 2015 1:42 pm

You can use the framebuffer from bare metal at that resolution, but you will have to draw the text yourself and you won't be using any of the graphics accelerated features.

timborian
Posts: 7
Joined: Fri Oct 30, 2015 12:27 pm

Re: 1920x1080 60Hz text output

Fri Oct 30, 2015 2:13 pm

Thanks, it's just text, no animations. The most fancy and advanced stuff is scrolling of the text. The most important in this case is the ammount of text on the screen and a relatively good quality at once, that's why I need 1920 x 1080 at 60 Hz so the scroling is smooth.

So, could it be possible via the bare metal approach with some programming on Raspberry Pi, right?

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12344
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: 1920x1080 60Hz text output

Fri Oct 30, 2015 5:23 pm

There must be millions of products sold that internally use Linux, why do you think that using Linux would preclude you from selling it? The only requirements is that "The GPL requires that anyone who distributes software based on source code under this license, must make the originating source code (and any modifications) available to the recipient under the same terms.". I take it that you don't need to make any modifications to Linux, so what is holding you back?

timborian
Posts: 7
Joined: Fri Oct 30, 2015 12:27 pm

Re: 1920x1080 60Hz text output

Fri Oct 30, 2015 9:59 pm

It's an embedded system that will be shipped to the customers, Linux is out of question. Think of a washing machine (with a nice 192x1080 display) rather than a smart TV ;). It has to run within a second after the press of the switch button. It will have custom code build just for the display etc. Linux is an overkilll in this case. And don't mention Linux, Minix, Xinu ever, because I will go with Gumstix instead of Raspberry ;D

User avatar
kusti8
Posts: 3439
Joined: Sat Dec 21, 2013 5:29 pm
Location: USA

Re: 1920x1080 60Hz text output

Fri Oct 30, 2015 10:01 pm

timborian wrote:It's an embedded system that will be shipped to the customers, Linux is out of question. Think of a washing machine (with a nice 192x1080 display) rather than a smart TV ;). It has to run within a second after the press of the switch button. It will have custom code build just for the display etc. Linux is an overkilll in this case. And don't mention Linux, Minix, Xinu ever, because I will go with Gumstix instead of Raspberry ;D
I would still use Linux because it takes a lot of the hassle out. Make the file system read only and that will work fine.

But ultimately it's your decision. ;)
There are 10 types of people: those who understand binary and those who don't.

timborian
Posts: 7
Joined: Fri Oct 30, 2015 12:27 pm

Re: 1920x1080 60Hz text output

Fri Oct 30, 2015 10:12 pm

How long does the Linux boot from an sd card? 10 seconds? 5 seconds? 4 seconds? That's too much for me.

fruitoftheloom
Posts: 20916
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: 1920x1080 60Hz text output

Fri Oct 30, 2015 10:22 pm

timborian wrote:How long does the Linux boot from an sd card? 10 seconds? 5 seconds? 4 seconds? That's too much for me.
Regards Boot Time:

http://www.samplerbox.org/article/fastbootrpi
Retired disgracefully.....

timborian
Posts: 7
Joined: Fri Oct 30, 2015 12:27 pm

Re: 1920x1080 60Hz text output

Fri Oct 30, 2015 10:30 pm

3s is still too much in my case. I will try to do a prototype using Raspberry Pi without Linux and I think I can get under 2 seconds, eventuyally to 1 second after turning on the machine. We will see.It will be a lot of optimization and haradware hacking , I guess ;D

fruitoftheloom
Posts: 20916
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: 1920x1080 60Hz text output

Fri Oct 30, 2015 10:35 pm

timborian wrote:3s is still too much in my case. I will try to do a prototype using Raspberry Pi without Linux and I think I can get under 2 seconds, eventuyally to 1 second after turning on the machine. We will see.It will be a lot of optimization and haradware hacking , I guess ;D
This is the RPi Boot Sequence:

http://wiki.beyondlogic.org/index.php?t ... ot_Process
Retired disgracefully.....

timborian
Posts: 7
Joined: Fri Oct 30, 2015 12:27 pm

Re: 1920x1080 60Hz text output

Fri Oct 30, 2015 10:47 pm

Thanks for the links. Again, we will see, maybe Raspberry Pi will be slow an other COM will be used. What is great about Raspberry Pi is the price and the resolution.

My plan is to start prototyping on Raspberry Pi and if something better will be released in the next 3-6 months we will switch to the better hardware etc. Everything is still open.

And regarding Linux. Maybe I am too Z80-school ;) but putting an operating system in a simple embedded system with only one function is an overkill. Linux is great but not for what we want.

Imagine to use Drupal or Laravel instead of the raw PHP. Using these powerhouses is OK for a CMS or an e-commerce website or even a blog. But it's an overkill for a one page static page with a simple Contact us form and one mail() function to send the email (Yes, there is validation, that is really easy in Laravel ;) But I think you get an idea. You save requests, resources, energy and time (by time I mean not the development time but the execution/boot time; the development would be 10x faster on Linux, I admit, however, the speed and "readiness" of the product is more important).
Last edited by timborian on Fri Oct 30, 2015 10:55 pm, edited 1 time in total.

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

Re: 1920x1080 60Hz text output

Fri Oct 30, 2015 10:53 pm

timborian wrote: Linux is an overkilll in this case.
So you're going to write your own sdcard driver, your own filesystem driver, your own graphics engine to interface with the black box GPU on the RPi, your own scheduler, your own memory manager, etc.

Linux isn't overkill, Linux gives you a whole bunch of code for free that you won't have to develop from scratch on your own without any help. You're not willing to use something that's been developed for 20 years and more. It's relatively secure because it's been extensively tested, extensively security reviewed and extensively peer reviewed.

Best of luck. I know what way I'd go if it were my project and I wanted to get it complete sometime in this decade rather than in 25 years time.
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.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12344
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: 1920x1080 60Hz text output

Sat Oct 31, 2015 2:01 pm

note that part of the boot time is reading in the GPU's own (ref time operating system) code, without which nothing at all will run.
this will take at least a second or so. only after the pi has flashed the rainbow GPU test screen ARM user code will be loaded and run.

also, if you want to use a keyboard or mouse, or a memory stick or any other USB device, you will need an USB stack, developing your own full USB stack will be nearly impossible. There is now a primitive bare metal USB stack, but before that most bare metal hackers made do with interfacing a PS/2 keyboard and serial mouse. Without linux having USB is not automatically a given!
on an alternative system you might not get an USB stack without using Linux.

ejolson
Posts: 3703
Joined: Tue Mar 18, 2014 11:47 am

Re: 1920x1080 60Hz text output

Sun Nov 01, 2015 3:11 am

It takes 1 to 2 seconds to get to the init process when booting the Linux kernel on a Raspberry Pi. The rest of the Raspbian boot time is occupied by running scripts that configure the Unix/Posix development environment, which you probably don't want at all for embedded applications.

"Linux the Kernel" without the GNU+X11 userland is present in televisions, wireless routers, medical devices, watches and cellphones among other things. The general idea is to boot directly to your own init process written in C and bypass everything but the kernel in Raspbian. This is not bare metal, but a bare kernel, which gives your application access to all the needed hardware drivers. The very minimal /sbin/init given by

Code: Select all

#define _XOPEN_SOURCE 700
#include <signal.h>
#include <unistd.h>

int main()
{
    sigset_t set;
    int status;

    if (getpid() != 1) return 1;

    sigfillset(&set);
    sigprocmask(SIG_BLOCK, &set, 0);

    if (fork()) for (;;) wait(&status);

    sigprocmask(SIG_UNBLOCK, &set, 0);

    setsid();
    setpgid(0, 0);
    return execve("/etc/rc",
        (char *[]){ "rc", 0 }, (char *[]){ 0 });
}
can be found at http://ewontfix.com/14/. This init process has a minimal loop to reap zombies and immediately executes the program "/etc/rc" which could be your embedded application.

User avatar
Ultibo
Posts: 158
Joined: Wed Sep 30, 2015 10:29 am
Location: Australia
Contact: Website

Re: 1920x1080 60Hz text output

Sun Nov 01, 2015 9:14 am

timborian wrote:I cannot use linux it will be a product that will be sold. I need to make it available in 6 - 9 months from now. So, if Raspberry can do it, great, if not, I will have to find something else. But if the GPU supports the resolution, the programmers can make a way to communicated with the gpu using 1920x1080 and 60 Hz, right? It might be hard , but it is possible, right?

One question though. Has anyone ever tried that on this forum? So, I can possibly hire him or at least ask him for some advice etc.?
Hi timborian,

What you are asking is entirely possible with the Raspberry Pi (1 or 2), I have bare metal code that displays text on screen at 1920x1080 and can scroll (Up, Down, Left and Right) along with bitmap fonts, colours etc. It depends on how much text you want as to whether you can use the framebuffer method (as I am using) or whether you need to look at accelerated stuff using the GPU.

The framebuffer method can display a full screen of text in less time than the human eye can perceive any form of redraw etc (once you have the caches etc enabled) so unless you need a huge amount of text output this should be all you need.

My code boots in around 2 seconds, including the time taken for the boot loader to load my kernel.img, and has drawn the screen before most HDMI monitors actually display anything.

As for the posts suggesting you need to use Linux if you want USB, file system and other things, well that depends on whether you need those things. I have written memory management, locking, threading, USB, MMC, IPv4, file system, keyboard, devices, DMA etc etc because I needed them all but your case may only require a small subset of those.

The point is, it is all possible in bare metal, it just depends on what you need and what you are willing to take on.

Ultibo.
Ultibo.org | Make something amazing
https://ultibo.org

Threads, multi-core, OpenGL, Camera, FAT, NTFS, TCP/IP, USB and more in 3MB with 2 second boot!

Return to “Bare metal, Assembly language”