Hello Christian,

On 9/7/20 6:22 PM, Christian Mauderer wrote:
> Depending on your application, you might want to think about switching
> to the current master instead of the release. But note that I didn't
> compile the PC BSP there. So I'm not sure how well it works. i386 is
> normally not a platform that I use for RTEMS applications.

I've found some time to experiment more with fb on pc686 using
libbsd/littlevgl/example combo -- all projects with master branch
checkout as of today.

It looks like the reason why the demo was not working for me last time
was that framebuffer device can't be open. I've digged more and the
reason is that the device is missing due to example missing #define
CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER in its code.

The reason BBB was/is working is that it's using fb driver from libbsd,
but pc686 is using fb driver directly from BSP hence app needs to show
interest in using it this way I guess.

So after small fix, I've been (app was) able to open fb0, but then
output shows very strange values for x and y of screen. This was due to
fact that lvgl is using libbsd fb API by default, but pc686 provides
minimalistic linux API. So I've switched to linux with small patch to
lvgl and then found out that lvgl is using more rich linux API than
implemented by the pc686 VBE fb driver. So yet another patch to pc686 to
make lvgl compilable and I was able to get real values from the
fbdev_init lvgl function. Unfortunately function fails on me with error
that mmap of framebuffer is not suported.

Whole demo output looks:

i386: isr=0 irr=1
i386: isr=0 irr=1
FB_VESA_RM frame buffer -- driver initializing..


RTEMS LVGL HELLO WORLD

nexus0: <RTEMS Nexus device>
pcib0 pcibus 0
pci0: <PCI bus> on pcib0
pci0: <bridge, HOST-PCI> at device 0.0 (no driver attached)
pci0: <bridge, PCI-ISA> at device 1.0 (no driver attached)
pci0: <mass storage, ATA> at device 1.1 (no driver attached)
pci0: <bridge> at device 1.3 (no driver attached)
pci0: <display, VGA> at device 2.0 (no driver attached)
pci0: <network, ethernet> at device 3.0 (no driver attached)
cpu0
FB_VESA_RM open device
The framebuffer device was opened successfully.
FB_VESA_RM ioctl called, cmd=4602
fbxres 1024, fbyres 768
fbbpp 32
FB_VESA_RM ioctl called, cmd=4600
fbxres 1024, fbyres 768
fbbpp 32
1024x768, 32bpp
3145728 screen size.
Error: failed to map framebuffer device to memory: Not supported


All patches required to get here are attached for your reference.

Any idea why mmaping RTEMS /dev/fb0 fails is highly appreciated.

Thanks,
Karel
diff --git a/lvgl/gui/test.c b/lvgl/gui/test.c
index 7ff263e..8eff5ee 100644
--- a/lvgl/gui/test.c
+++ b/lvgl/gui/test.c
@@ -30,7 +30,7 @@
 
 #include <rtems.h>
 #include <rtems/bsd/bsd.h>
-#include <bsp/i2c.h>
+#include <dev/i2c/i2c.h>
 #include <rtems/console.h>
 #include <rtems/shell.h>
 #include <unistd.h>
@@ -251,8 +251,8 @@ SYSINIT_DRIVER_REFERENCE(ums, uhub);
 
 #define CONFIGURE_SHELL_USER_COMMANDS \
   &bsp_interrupt_shell_command, \
-  &rtems_shell_ARP_Command, \
-  &rtems_shell_I2C_Command
+  &rtems_shell_ARP_Command /* , \
+  &rtems_shell_I2C_Command */
 
 #define CONFIGURE_SHELL_COMMANDS_ALL
 
diff --git a/lvgl/gui/wscript b/lvgl/gui/wscript
index 5474181..2f8c6a5 100644
--- a/lvgl/gui/wscript
+++ b/lvgl/gui/wscript
@@ -25,4 +25,4 @@ def build(bld):
             target = 'lvgl_gui.exe',
             source = ['test.c'],
             includes = include_paths,
-            lib = ['m', 'lvgl', 'bsd'])
+            lib = ['m', 'lvgl', 'bsd', 'z'])
diff --git a/lvgl/hello/test.c b/lvgl/hello/test.c
index d6948b3..9bf3312 100644
--- a/lvgl/hello/test.c
+++ b/lvgl/hello/test.c
@@ -16,7 +16,7 @@
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  * ARE DISCLAIMED.	IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODSb
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
@@ -30,7 +30,7 @@
 
 #include <rtems.h>
 #include <rtems/bsd/bsd.h>
-#include <bsp/i2c.h>
+#include <dev/i2c/i2c.h>
 #include <rtems/console.h>
 #include <rtems/shell.h>
 
@@ -67,6 +67,9 @@ Init(rtems_task_argument arg)
 	sc = rtems_bsd_initialize();
 	assert(sc == RTEMS_SUCCESSFUL);
 
+        /*        sc = frame_buffer_initialize(0, 0, NULL);
+        assert(sc == RTEMS_SUCCESSFUL);
+        */
 	lv_init();
 
 	fbdev_init();
@@ -107,6 +110,7 @@ Init(rtems_task_argument arg)
  */
 #define CONFIGURE_MICROSECONDS_PER_TICK 1000
 
+#define CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER
 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
 #define CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
@@ -146,8 +150,8 @@ Init(rtems_task_argument arg)
 
 #define CONFIGURE_SHELL_USER_COMMANDS \
   &bsp_interrupt_shell_command, \
-  &rtems_shell_ARP_Command, \
-  &rtems_shell_I2C_Command
+  &rtems_shell_ARP_Command /* , \
+  &rtems_shell_I2C_Command */
 
 #define CONFIGURE_SHELL_COMMANDS_ALL
 
diff --git a/lvgl/hello/wscript b/lvgl/hello/wscript
index c3e9da8..e0688af 100644
--- a/lvgl/hello/wscript
+++ b/lvgl/hello/wscript
@@ -24,4 +24,4 @@ def build(bld):
             target = 'lvgl_hello.exe',
             source = ['test.c'],
             includes = include_paths,
-            lib = ['m', 'lvgl', 'bsd'])
+            lib = ['m', 'lvgl', 'bsd', 'z'])
diff --git a/default_lv_drv_conf.h b/default_lv_drv_conf.h
index e8d2c40..41385e4 100644
--- a/default_lv_drv_conf.h
+++ b/default_lv_drv_conf.h
@@ -219,7 +219,7 @@
  *  Linux frame buffer device (/dev/fbx)
  *-----------------------------------------*/
 #ifndef USE_FBDEV
-#  define USE_FBDEV           0
+#  define USE_FBDEV           1
 #endif
 
 #if USE_FBDEV
@@ -230,7 +230,7 @@
  *  FreeBSD frame buffer device (/dev/fbx)
  *.........................................*/
 #ifndef USE_BSD_FBDEV
-#  define USE_BSD_FBDEV		1
+#  define USE_BSD_FBDEV		0
 #endif
 
 #if USE_BSD_FBDEV
diff --git a/lv_drivers b/lv_drivers
--- a/lv_drivers
+++ b/lv_drivers
@@ -1 +1 @@
-Subproject commit 6ca367ed127e2b53370ddf6b259e323411014407
+Subproject commit 6ca367ed127e2b53370ddf6b259e323411014407-dirty
diff --git a/display/fbdev.c b/display/fbdev.c
index b1a3bf6..1942ae8 100644
--- a/display/fbdev.c
+++ b/display/fbdev.c
@@ -23,7 +23,12 @@
 #include <sys/consio.h>
 #include <sys/fbio.h>
 #else  /* USE_BSD_FBDEV */
+#if __linux__
 #include <linux/fb.h>
+#endif /* __linux__ */
+#if __rtems__
+#include <rtems/fb.h>
+#endif /* __rtems__ */
 #endif /* USE_BSD_FBDEV */
 
 /*********************
@@ -133,6 +138,8 @@ void fbdev_init(void)
     // Figure out the size of the screen in bytes
     screensize =  finfo.smem_len; //finfo.line_length * vinfo.yres;    
 
+    printf("%d screen size.\n", screensize);
+
     // Map the device to memory
     fbp = (char *)mmap(0, screensize, PROT_READ | PROT_WRITE, MAP_SHARED, fbfd, 0);
     if((intptr_t)fbp == -1) {
diff --git a/bsps/i386/pc386/console/fb_vesa_rm.c b/bsps/i386/pc386/console/fb_vesa_rm.c
index 3263bc262b..9be4e569ce 100644
--- a/bsps/i386/pc386/console/fb_vesa_rm.c
+++ b/bsps/i386/pc386/console/fb_vesa_rm.c
@@ -793,6 +793,12 @@ void vesa_realmode_bootup_init(void)
 
     fb_var.xres = mib->XResolution;
     fb_var.yres = mib->YResolution;
+    /* virtual == physical res */
+    fb_var.xres_virtual = mib->XResolution;
+    fb_var.yres_virtual = mib->YResolution;
+    /* both offsets are 0 */
+    fb_var.xoffset = 0;
+    fb_var.yoffset = 0;
     fb_var.bits_per_pixel = mib->BitsPerPixel;
     fb_var.red.offset =      mib->LinRedFieldPosition;
     fb_var.red.length =      mib->LinRedMaskSize;
diff --git a/cpukit/include/rtems/fb.h b/cpukit/include/rtems/fb.h
index dd8c64333e..c47b312b3d 100644
--- a/cpukit/include/rtems/fb.h
+++ b/cpukit/include/rtems/fb.h
@@ -68,6 +68,10 @@ struct fb_bitfield {
 struct fb_var_screeninfo {
     uint32_t xres;                  /* visible resolution        */
     uint32_t yres;
+    uint32_t xres_virtual;          /* virtual resolution    */
+    uint32_t yres_virtual;
+    uint32_t xoffset;               /* offset from virtual to visible */
+    uint32_t yoffset;               /* res */
     uint32_t bits_per_pixel;        /* guess what            */
     struct fb_bitfield red;	    /* bitfield in fb mem if true color, */
     struct fb_bitfield green;	    /* else only length is significant */
diff --git a/dhcpcd/crypt/hmac_md5.c b/dhcpcd/crypt/hmac_md5.c
index 06ea465a..36ac6909 100644
--- a/dhcpcd/crypt/hmac_md5.c
+++ b/dhcpcd/crypt/hmac_md5.c
@@ -40,6 +40,7 @@
 #define IPAD		0x36
 #define OPAD		0x5C
 
+#ifndef __rtems__
 /* hmac_md5 as per RFC3118 */
 void
 hmac_md5(const uint8_t *text, int text_len,
@@ -84,3 +85,4 @@ hmac_md5(const uint8_t *text, int text_len,
 	MD5Update(&context, digest, MD5_DIGEST_LENGTH);
 	MD5Final(digest, &context);
 }
+#endif /* __rtems__ */
diff --git a/freebsd/sys/kern/uipc_mbuf.c b/freebsd/sys/kern/uipc_mbuf.c
index 2f1768da..623806fd 100644
--- a/freebsd/sys/kern/uipc_mbuf.c
+++ b/freebsd/sys/kern/uipc_mbuf.c
@@ -1810,8 +1810,10 @@ m_unmappedtouio(const struct mbuf *m, int m_off, struct uio *uio, int len)
 		off = 0;
 		seglen = min(seglen, len);
 		len -= seglen;
+#ifndef __rtems__
 		pg = PHYS_TO_VM_PAGE(ext_pgs->pa[i]);
 		error = uiomove_fromphys(&pg, segoff, seglen, uio);
+#endif /* __rtems__ */
 		pgoff = 0;
 	};
 	if (len != 0 && error == 0) {
diff --git a/rtemsbsd/include/bsp/nexus-devices.h b/rtemsbsd/include/bsp/nexus-devices.h
index 92125619..7da1c74c 100644
--- a/rtemsbsd/include/bsp/nexus-devices.h
+++ b/rtemsbsd/include/bsp/nexus-devices.h
@@ -162,9 +162,9 @@ RTEMS_BSD_DRIVER_USB_MASS;
 #elif defined(LIBBSP_I386_PC386_BSP_H)
 
 RTEMS_BSD_DRIVER_PC_LEGACY;
-RTEMS_BSD_DRIVER_PCI_LEM;
+/*RTEMS_BSD_DRIVER_PCI_LEM;
 RTEMS_BSD_DRIVER_PCI_IGB;
-RTEMS_BSD_DRIVER_PCI_EM;
+RTEMS_BSD_DRIVER_PCI_EM;*/
 RTEMS_BSD_DRIVER_PCI_RE;
 RTEMS_BSD_DRIVER_REPHY;
 
_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to