@brolly759 Sorry for the late reply, i saw the post now.
Actually there are but that is not a finished code(even beta).
My work partner and I parted ways, and the project was canceled so i don't code it further.
In the code there are lots of comment lines with Turkish language, when i create a free time i can change the comment lines and push the "unfinished code" to github. If it'll work for someone i will be glad.
it is not the same but this is a errorless compile machine setup that tested!
P.S: I coud not create time for update the topic, installing node part; just "argon" is enough don't install others. On KernelMenuConfig you can pass append staging drivers, those are for tftlcd display.
nvm install lts/argon
npm install -g node-gyp
and be careful the make download and stay connected with the internet. There should be no problem.
@György-Farkas This is a special case and I hope someone who suffering for this, can solve it in this way if those are having trouble in Turkey. Thank you.
In my case; Istanbul is GMT+3 and I couldn't find the +3 for Istanbul and i create it myself. Details are here https://wiki.openwrt.org/doc/uci/system (Time Zones
section)
uci set system.@system[0].timezone='EET-2EEST'
uci set system.@system[0].zonename='Istanbul'
uci commit
echo "EET-2EEST" > /etc/TZ
Thank you for your hard work, @Maximilian-Gerhardt . I am willing to help or test this, actually i cloned directfb, and lvgl_project, but i couldn't create time for the full scale display manager because of my project.
I've nearly finished a prototype device for education purpose using fbtft on omega, plus atmel328 that drives touch screen and rc522 rfid R/W, display on/off, some digital controls ...
After this project i will take my time, firstly chrooted debian i am thinking of, this way i can find a way out or might be see a workaround. After than that, not for just prototype, from top to toe openwrt lede specialist, I am aiming for. I am lack of knowledge for the full scale solution but all of us together is another thing. If this thing works Omega2 will be a fullscale computer
In a month or so i will be dive deeper i think.
@Maximilian-Gerhardt yes you are right, the "fps" is limited with the spi bus speed, and that is at max 100, in the memory it works same speed with the cpu's that one is the 387 for 150Kbytes 16bit embedded bmp. It can't be showing but it is there. In the future if there is much faster spi speed then we can use these rates.
fill screen function, after first line just memcpy()
void
fillScreen ( struct fb_info *fb_info, unsigned int color )
{
//~ for ( int i=0; i <= fb_info -> screensize; i++ )
//~ putPixelDirectToLocation( fb_info, i, color );
for ( int i=0; i < fb_info -> var.xres; i++ )
{
putPixel( fb_info, i, 0, color );
}
for ( int i=1; i < fb_info -> var.yres; i++ )
{
memcpy( fb_info -> ptr + ( fb_info -> fix.line_length * i ),
fb_info -> ptr,
( fb_info -> var.xres * ( fb_info -> var.bits_per_pixel / 8 ) ) );
}
/***********/
//~ for ( int i = 0; i < fb_info -> var.yres; i++)
//~ {
//~ drawHorizontalLine ( fb_info, 0, i, (unsigned int)fb_info -> var.xres, color );
//~ }
}
this is the embedded bmp push code
for (int i=0; i<1000; i++)
{
/* memcpy() bmp show */
memcpy( fb_info.ptr, &logo_bmp[0], logo_bmp_len );
}
and this is the simple test code
date nanoseconds enabled from menuconfig "%N" and bc installed
#!/usr/bin/env sh
count=1000
first=$(date +"%s.%N")
echo -e "started\t"$first
#for i in `seq $count`; do ./fb-test; done;
./fb-test
last=$(date +"%s.%N")
echo -e "ended\t"$last
echo $(echo "$count/($last-$first)" | bc)" fps"
Last one the built in debug, i think it has some kind of bug or it is not an optimized code ( ~3000Kb * ~5 = ~15.000 Kb ) i think this is the equation:
when you use debug=$((1<<5)) it shows, (~ 3000Kb) * ( ~5 )
or echo -e $((1<<5)) > /sys/class/graphics/fb0/debug
then, for cancle echo -e 0 > /sys/class/graphics/fb0/debug
Extras
I wrote something similar Adafruit_GFX, it capable of draw lines, draw triangles, draw squares, draw circles, push 16bit bmps ... but the code has a lots of issue, there is a long way to go for stable. When i clean things up I will push the code to gitlab.
if you compile modules builtin, below script activates the display in 10 seconds or so when power up the omega2, i am trying to activate with uboot but no luck for now.
display init script init.d
#!/bin/sh /etc/rc.common
START=01
STOP=99
DEFAULT_ROTATION=3
ROTATE_ANGLE=270
EXTRA_COMMANDS="rotate"
EXTRA_HELP="
rotate Change the display direction to one of the [0 1 2 3] values 0:0, 1:90, 2:180, 3:270
"
start() {
insmod fbtft_device custom name="fb_ili9341" busnum=32766 cs=1 speed=96666000 mode=3 fps=100 txbuflen=3145728 buswidth=8 bgr=1 gpios=reset:2,dc:3 width=240 height=320 verbose=0 rotate=$ROTATE_ANGLE debug=0
}
stop() {
rmmod fbtft_device
}
rotate() {
if [ ! -z $1 ]; then
stop
if [ $1 -eq 0 ]; then
ROTATE_ANGLE=0
echo "$1 0"
elif [ $1 -eq 1 ]; then
ROTATE_ANGLE=90
echo "$1 90"
elif [ $1 -eq 2 ]; then
ROTATE_ANGLE=180
echo "$1 180"
elif [ $1 -eq 3 ]; then
ROTATE_ANGLE=270
echo "$1 270"
else
ROTATE_ANGLE=270
echo "$1 270"
fi
start
fi
}
boot() {
start
}
I am thinking the SPI protocol engine is hardware based fetching directly from RAM space
Yes, that's exactly what it is. The other question " how much of the CPU time is left over for Omega2+ to perform its regular job " i2ve just test it, it seems to be ok, but i did'nt test it for durability, just push the work load to omega2 and its just fine;
25fps ram loaded bmp sequence push to /dev/fb0 using sleep microseconds
3 ssh connection + serial console,
working top application,
shiftOut application that drives 7 segment lcd using 8bit shiftregister on omega
web site download using wget in to omega2
bmp push to /dev/fb0
#!/usr/bin/env sh
echo "mkdir /tmp/kizu"
echo "cp -v /tmp/mounts/USB-A1/kizuwa/* /tmp/kizu"
if [ -d /tmp/kizu ]; then
while : # infinite loop
do
for i in `ls -v /tmp/kizu/*.bmp`
do
$(cat $i > /dev/fb0) > /dev/null
# opkg install coreutils-sleep (microsecond sleep)
# this way this script will work 25 times in a second
# human eyes can't grab above this value so this is ok.
echo $i
sleep 0.04
done
done
fi
mkdir ~/.ssh
nano ~/.ssh/config
# add below lines in to config file
Host github.com
User unique1984 "this one is your github username"
IdentityFile ~/.ssh/id_rsa "this one is your created id_rsa file"
# save and close the file Ctrl+o, Ctrl+x
# change permissions to ./ssh and nested files
chmod 744 ~/.ssh
chmod 600 ~/.ssh/*
id_rsa is your enc/dec key, don't lose it nor give someone else, id_rsa.pub goes to github's side.
add github hostkey in to knownhosts typing,
ssh-keyscan -H "github.com" >> ~/.ssh/known_hosts
this way we won't see append key prompt from github
configuring git global
git config --global user.name "Yasin KARABULAK"
git config --global user.email "yasinkarabulak@gmail.com"
that's it.
Getting the build system source from omega
[ ] Clone the source
cd ~/
git clone https://github.com/OnionIoT/source.git
# or if you have a github account that setted up with your ssh key.
git clone git@github.com:OnionIoT/source.git
! At least 1 time reading before any question, would be nice (I'm just a human being I might miss some points.) !Open Wrt Lede Build System Usage Docs
Fully specified documentation of lede build system.
With these two documents we can start build process
[ ] Make host system config
Cross Compile binaries's location in to the $PATH variable.
nano ~/.bashrc
# append below line in to .bashrc file
export PATH=$PATH":~/source/staging_dir/host/bin:~/source/staging_dir/toolchain-mipsel_24kc_gcc-5.4.0_musl-1.1.16/bin"
# save and close the file ctrl+o,ctrl+x
this way system will know where are the cross compilation binaries.
Image Build Process
cd ~/source
git log
commit d62d8430d155f737013a9f4aa9c2a98e6440e903
Author: greenbreakfast <lazardemin@gmail.com>
Date: Tue Jul 17 23:41:25 2018 +0000
added telnet and telnetd to busybox config
commit 0066202f3a8ef8dc8b0da6842d9b72692a814646
Author: greenbreakfast <lazardemin@gmail.com>
Date: Wed Jul 11 21:38:47 2018 +0000
added adc-exp package and python module to package repo, as well as kernel modules for spi gpio bitbang
commit 72d103106dd7a22edbdfdba0d0c98d3ac33afcf6
Author: greenbreakfast <lazardemin@gmail.com>
Date: Thu Jul 5 21:42:13 2018 +0000
updated onion script, new versions of OnionOS and camera apps
...
# each commit is our build number last commit is "b192" before that "b191" after compilation our build named to "b193".
Image Configuration
We are using the Onion's build system so we don't need to change menuconfig's "Target System", "Subtarget", "Target Profile", "Target Devices" and "Target Images" options, if anyone who wants to chroot type image then activate this selection in the "Target Images" menu.
[ ] Update & Install feeds
2. ./scripts/feeds update -a
* Update feeds
3. ./scripts/feeds install -a
* install feeds
[ ] Menu configuration
4. make menuconfig
* save and exit for now, details are here
5. make defconfig
* It means this
[ ] Kernel menu configuration
6. make kernel_menuconfig
* this command will compile some of the cross compile tools and shows the kernel_menuconfig window.
* details are here
* we will select fbtft driver modules in here.
* You can take a coffe or two in this step. (Depends of Cpu power) We will select some Graphic Drivers, some Character Devices, some Staging Drivers from under the "Device Drivers" section
attention: below list is not a menu ordered, it is a process ordered list
Device Drivers --->
Graphics support --->
Frame buffer Devices --->
<M> Support for frame buffer devices --->
[*] Enable firmware EDID
[*] Framebuffer foreign endianness support --->
[*] Enable Video Mode Handling Helpers
[*] Enable Tile Blitting Support
[*] Backlight & LCD device support --->
[*] Bootup logo --->
[*] Staging drivers --->
[*] Staging Board Support
<M> Support for small TFT LCD display modules --->
# select your display driver or all of them your cohice
<M> FB driver for the ILI9341 LCD Controller
<M> Generic FB driver for TFT LCD displays
<M> Module to for adding FBTFT devices
Character devices --->
[*] Virtual terminal
[*] Enable character translations in console (NEW)
[*] Support for console on virtual terminal (NEW)
[*] Support for binding and unbinding console drivers
[*] Support multiple instances of devpts
Graphics support --->
Console display driver support --->
[*] Enable Scrollback Buffer in System RAM (NEW)
<M> Framebuffer Console support
[*] Map the console to the primary display device
[*] Framebuffer Console Rotation
Library routines --->
[*] Select compiled-in fonts
[*] VGA 8x8 font
[*] VGA 8x16 font
# Save and Exit kernel_menuconfig window
9. make download
* This command get all the files those will compile
! Before the compile process
check this file's 29th line package/feeds/telephony/re/Makefile
...
DEPENDS:=+libopenssl +libpthread +zlib
...
if +zlib is not in there, put it in there. libre, librem, baresip packages allways gives an error for this.
Leave your computer connected to the internet, i think make download is not enough.
LANG=C LC_ALL=C enter.
[ ] Before the compilation process check the config files for reset !It happened to me while writing this tutorial, built was succeeded but created image was 5.3MB it should be 7.1MB, when I checked the menuconfig there was nothing in there, there are 2 things that i can think
1st one is, It is normal, first run just compile the toolchain with base system without packages then after this we should make menuconfig and kernel_menuconfig.
2nd one is, This is abnormal do 'make clean' take Revert to the base step and do it again above steps.
I could not try the 2nd possibilty because of the time (23:13) and already compiled toolchain (it took 2 hours on my computer) simply I did menu_config and kernel_menuconfig without make clean (this clean all the packages those built) and diff (7th step).
[ ] Compile the images and all selected packages ignoring errors.
10. IGNORE_ERRORS=1 make -j2
* node-usb and i2c-exp-node packages will give an error (look at the after compilation part)
* This command starts build process
* make package/utils/busybox/{clean,compile,install} -j1 V=s this will clean then compile then install the package busybox with debugging mode (-j1 V=s)
* IGNORE_ERRORS=1 make -j2 this is a life saver if you want to troubleshooting after compilation you can use this, if some packets give an error then you can compile and debug them using above command.
* Details are here
[ ] After Compilation
we should use node lts/argon for the node-usb and i2c-exp-node packages.
nvm use lts/argon
npm install -g node-gyp
# after restart the machine node default will be node version
make package/feeds/onion/node-usb/{clean,compile,install} -j1 V=s
make package/feeds/onion/i2c-exp-node/{clean,compile,install} -j1 V=s
# after these steps refreshing the compile
make -j2
# that is it.
[ ] For cleanup and revert the config (do not use if it's not must, time issues)
make clean deletes all of the compiled packages without touching toolchain, if you use it mistakenly it will possibly give a headache. Details are here
after make clean you can go to step Revert to the base and start all over with having toolchain.
[ ] Locating image (bin) files
They have created under ~/source/bin/targets/ramips/mt7688/ directory.
[ ] Copy image file in to a flashdisk and flash the Omega2, tutorial is here
[ ] Locating the needed fbtft module (.ko) files
# under the ~/source/ directory
find . -name "*.ko" | grep "fb" -type f
this command gives us most of the modules we need. Other ones trial and error, insmod and if it is give an error grep -irn "error_function_name" ./ this way we will learn which module is absent and find it and append the list.
Further to do list for myself, i have.
[ X ] Find a way to creating image includes these modules. | Edit 29.07.2018 without fbtft_device.ko, the way found. (+200KB in to the original image)
[ X ] Find a way to implement fbtft_device (31.07.2018)
[ X] Find a way to append spi touch modules.(29.08.2018)
With Atmega328p, rc522 and spi touch modules integrated. I wrote my communication protocol(simple and stupid, 1Mhz) because of serial interface's slow transmit rate. This way i am manipulating Atmega for my own needs, using omega2's power.
[ X ] Write a simple framebuffer parser that can create and manipulate a desktop area on the display.(29.08.2018)
[ ] Find a way to make use of kdb and UTF-8 console fonts for the desktop and it's applications.
[ ] Take over the Mars before Elon do.
If these are happens, many projects that look cool and with minimal cost can be implemented with Omega2, I think.
@Maximilian-Gerhardt In this topic ffmpeg side you can find BMP image conversion, i am using ffmpeg, gimp, imagemagic(convert) all the image job, quick tip:
mkdir ~/sequence
# basically we have 2 steps for conversion in ffmpeg
# 1. convert the video to resolotion of display, in my case 320x240(4:3 ratio)
ffmpeg -i the-prey-video.xyz -vf scale=320:240 scaled.mp4
# 2. create the sequence files from given video
ffmpeg -i scaled.mp4 -pix_fmt rgb565 -r 25/1 ~/sequence/seq%0001d.bmp
# if you want to convert one image file(png,jpeg,bmp) to rgb565 bmp
ffmpeg -i some-image-file.png -vf scale=320:240 -pix_fmt rgb565 exported-image.bmp
thats it.
Tested right now, when the files located in ram (/tmp) on omega it gives stable 100fps. In here 100fps notro's wiki says "Thus above fps=20 we only have 4 distinct values: 100/25=4, 100/26=3, 100/34=2, 100/51=1 (integer division)" in here so i think it can go further. Simple math says we have 96Mhz spi frequency hardware limit.
27:16 rs_clk_sel Register Space SPI clock frequency select.
0: SPI clock frequency is hclk/2. (50% duty cycle, duty cycle is the ratio of the output high time to the total cycle time)
1: SPI clock frequency is hclk/3. (33.33% or 66.67% duty cycle)
2: SPI clock frequency is hclk/4. (50% duty cycle)
3: SPI clock frequency is hclk/5. (40% or 60% duty cycle)
4095: SPI clock frequency is hclk/4097 page 143
I think we could'nt get the max freq... i do'nt know that, ok then i will prepare a document "how to fbtft supported image" today, see you soon.
here is my custom image file, and it works(just flashed) 1st possibilty is higher, but i sure of it i was using the b192 (#!) i'll inspect this further but right now time is 22:00 here and i dont want to miss bloody moon.
@Maximilian-Gerhardt I will prepare how to for the kernel_menuconfig, right now i share fbtft and virtual console modules and init/deinit scripts
I forgat that you are using ili9325, just compiled it, here is the module fb_ili9325.ko
ps. after fbtft_device init virtual console does'nt work properly.
ps2. when trying send the image files simply 1st run take the images allocation in to the buffer, and file access will be faster. this is my test script
#!/usr/bin/env sh
fps=$((1000000/20))
if [ ! -z $1 ]; then
fps=$((1000000/$1))
echo $fps
fi
#img_count=1;
#timer=0;
start_second=$(date +"%S")
while true
do
#for i in `ls -v /root/flashdisk/sequence/*.bmp`
#for i in `ls -v /root/msd/sequence/*.bmp`
i=1
while [ $i -lt 5000 ]
do
#echo $i
#cat $i > /dev/fb0
# cat /root/flashdisk/sequence/file$i.bmp > /dev/fb0
cat /tmp/mounts/USB-A1/sequence/file$i.bmp > /dev/fb0
echo /tmp/mounts/USB-A1/sequence/file$i.bmp
#sleep 0.001
#img_count=$(($img_count + 1))
#usleep $fps
#timer=$(($timer+$fps+1))
#echo $timer
#if [ $timer -gt 1000000 ]; then
# echo $img_count
# timer=0
# exit
#fi
i=$(($i+1))
if [ $i -gt 400 ]; then
echo $start_second" -"$(date +"%S") >> refresh.log
# exit
i=1
start_second=$(date +"%S")
fi
done
done
@Maximilian-Gerhardt actually i did nothing, parts are allways on the desk. After red your kernel driver compile topic i catch a glimps that i did not copy the ".ko" files in to omega :D, i know this is laughable but i could'nt find the solution until read this topic of yours.
simply put
make kernel_menuconfig
Append neccecary parts and compile,
after the compilation process
copy these files in to omega's /root/modules/ folder.
this part as simple as breathe but actual problem is how to fbtft_device.ko configuration.
This is the best part, after inspecting fbtft's all the source code i decide to bruteforce
load one of the kernel module, give the error, find the neccecity file, insmod that and again and again. that's it after no error insmod fbtft_device custom init save my day.
I learnt that we have 96Mhz clock, i did'nt know this.(If i'm not wrong 40Mhz is in the datasheet of mt7688)
I am learning how to write framebuffer application, i think i can write a simple framework that work like css or something similar.
The questions:
can we build X11 and configure it to work with /dev/fb0?
after simple search i found fbgui, and littlevgl, i did not push all the way to x11 but i am researching for a while. It's possible I gues.
can we get a graphical desktop running? Enlightenment?
Yes! I will write that i hope but not a rival of KDE
can we cross-compile libs like libsdl2 or mesa3D to the Omega2?
I did not look that but when i researching fbtft i came across something mesa with openwrt
can we get more powerhungry emulators running?
I do'nt think so, i tried ffmpeg 320x240 video to bmp sequence 25fps but 12fps is the limit of omega2p's, on the other hand we probably use omega2p cluster 10 of them
can we finally prove LadyAda from Adafruit wrong who said that the Omega2 can't run Doom?
I do'nt know, really. I believe that omega2 is strong enough to do more, playing doom1 exactly can, i play that 25Mhz Cpu computer in 1990's but doom 3 and after releases (if there are) ? mmm i do'nt think so for now, floating point units a must for the job.