[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT/APPLVGL-DEMO PATCH v2 1/1] apps/lvgl-demo: Unikraft LVGL baremetal demo running on a Raspberry Pi 3B+



Unikraft LVGL baremetal demo running on a Raspberry Pi 3B+.

Signed-off-by: Santiago Pagani <santiagopagani@xxxxxxxxx>
---
 Config.uk    |  11 ++
 Makefile     |  10 ++
 Makefile.uk  |   6 +
 README.md    |  24 +++-
 lv_example.c | 332 +++++++++++++++++++++++++++++++++++++++++++++++++++
 main.c       |  89 ++++++++++++++
 6 files changed, 471 insertions(+), 1 deletion(-)
 create mode 100644 Config.uk
 create mode 100644 Makefile
 create mode 100644 Makefile.uk
 create mode 100644 lv_example.c
 create mode 100644 main.c

diff --git a/Config.uk b/Config.uk
new file mode 100644
index 0000000..8e29483
--- /dev/null
+++ b/Config.uk
@@ -0,0 +1,11 @@
+### Invisible option for dependencies
+config APPLVGL_RASPI_DEMO_DEPENDENCIES
+       bool
+       default y
+
+### App configuration
+config APPLVGL_RASPI_DEMO_PRINTARGS
+       bool "Print arguments"
+       default y
+       help
+         Prints argument list (argv) to stdout
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..c0060c9
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,10 @@
+UK_ROOT ?= $(PWD)/../../unikraft
+UK_LIBS ?= $(PWD)/../../libs
+UK_PLAT ?= $(PWD)/../../plats/raspi
+LIBS := $(UK_LIBS)/lvgl:$(UK_LIBS)/newlib
+
+all:
+       @$(MAKE) -C $(UK_ROOT) A=$(PWD) P=$(UK_PLAT) L=$(LIBS)
+
+$(MAKECMDGOALS):
+       @$(MAKE) -C $(UK_ROOT) A=$(PWD) P=$(UK_PLAT) L=$(LIBS) $(MAKECMDGOALS)
diff --git a/Makefile.uk b/Makefile.uk
new file mode 100644
index 0000000..73b9adf
--- /dev/null
+++ b/Makefile.uk
@@ -0,0 +1,6 @@
+$(eval $(call addlib,applvgl_raspi_demo))
+
+APPLVGL_RASPI_DEMO_CINCLUDES-y += -I$(LIBRASPIPLAT_BASE)/include
+
+APPLVGL_RASPI_DEMO_SRCS-y += $(APPLVGL_RASPI_DEMO_BASE)/main.c
+APPLVGL_RASPI_DEMO_SRCS-y += $(APPLVGL_RASPI_DEMO_BASE)/lv_example.c
diff --git a/README.md b/README.md
index b5637ba..ea09f43 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,25 @@
 # lvgl-demo
 
-Unikraft LVGL baremetal demo running in Raspberry Pi 3B+
\ No newline at end of file
+Unikraft LVGL baremetal demo running on a Raspberry Pi 3B+
+
+This is a demo for running the LittleVGL library with the example GUI from 
https://littlevgl.com/demo-theme-night.
+
+Please select/deselect the following options in the make menuconfig:
+- Architecture Selection --> Architecture --> select: Arrmv8 compatible (64 
bits)
+- Architecture Selection --> Processor Optimization --> select: Generic Armv8 
Cortex A53
+- Architecture Selection --> deselect: Workaround for Cortex-A73 erratum
+- Platform Configuration --> select: Raspberry Pi 3B+
+- Platform Configuration --> Raspberry Pi 3B+ --> Devices --> select: DSI LCD 
screen
+- Platform Configuration --> Raspberry Pi 3B+ --> Devices --> select: Touch 
screen
+- Library Configuration --> ukboot --> deselect: Show Unikraft banner (this is 
to minimize boot time)
+- Library Configuration --> select: lvgl
+- Build Options --> select: Drop unused functions and data
+
+Once built, in a blank SD card formated to FAT32, copy the generated 
kernel8.img Unikraft image (without changing
+the name of the image file, as otherwise the Raspberry Pi's bootloader will 
not recongize it), plus the four files
+that are inside the plats/raspi/bootfiles folder (i.e., bootcode.bin, 
config.txt, fixup.dat, and start.elf).
+
+#TODO: We still need to find an elegant way to have an lv_conf.h file in the 
application folder that overrides the
+lv_conf.h file in the lvgl ported library. Until then, to change the font 
size, we can set to 1 the LV_FONT_ROBOTO_xx
+of the size that we want to use (and the rest to 0) and then set 
LV_FONT_DEFAULT to &lv_font_roboto_xx that same size.
+For example, for this particular demo, font size 16 is what looks best in the 
7" LCD screen.
diff --git a/lv_example.c b/lv_example.c
new file mode 100644
index 0000000..ca5dc56
--- /dev/null
+++ b/lv_example.c
@@ -0,0 +1,332 @@
+/**
+ * File from 
https://github.com/littlevgl/lv_examples/blob/master/lv_tests/lv_test_theme/lv_test_theme_1.c
+ */
+
+#define LV_CONF_INCLUDE_SIMPLE
+#include <lvgl.h>
+
+/*********************
+ *      DEFINES
+ *********************/
+
+/**********************
+ *      TYPEDEFS
+ **********************/
+
+/**********************
+ *  STATIC PROTOTYPES
+ **********************/
+static void create_tab1(lv_obj_t * parent);
+static void create_tab2(lv_obj_t * parent);
+static void create_tab3(lv_obj_t * parent);
+
+/**********************
+ *  STATIC VARIABLES
+ **********************/
+
+/**********************
+ *      MACROS
+ **********************/
+
+/**********************
+ *   GLOBAL FUNCTIONS
+ **********************/
+
+/**
+ * Create a test screen with a lot objects and apply the given theme on them
+ * @param th pointer to a theme
+ */
+void lv_example_create(lv_theme_t * th)
+{
+    lv_theme_set_current(th);
+    th = lv_theme_get_current();    /*If `LV_THEME_LIVE_UPDATE  1` `th` is not 
used directly so get the real theme after set*/
+    lv_obj_t * scr = lv_cont_create(NULL, NULL);
+    lv_disp_load_scr(scr);
+
+    lv_obj_t * tv = lv_tabview_create(scr, NULL);
+    lv_obj_set_size(tv, lv_disp_get_hor_res(NULL), lv_disp_get_ver_res(NULL));
+    lv_obj_t * tab1 = lv_tabview_add_tab(tv, "Tab 1");
+    lv_obj_t * tab2 = lv_tabview_add_tab(tv, "Tab 2");
+    lv_obj_t * tab3 = lv_tabview_add_tab(tv, "Tab 3");
+
+    create_tab1(tab1);
+    create_tab2(tab2);
+    create_tab3(tab3);
+}
+
+/**********************
+ *   STATIC FUNCTIONS
+ **********************/
+static void create_tab1(lv_obj_t * parent)
+{
+    lv_page_set_scrl_layout(parent, LV_LAYOUT_PRETTY);
+
+    lv_theme_t * th = lv_theme_get_current();
+
+    static lv_style_t h_style;
+    lv_style_copy(&h_style, &lv_style_transp);
+    h_style.body.padding.inner = LV_DPI / 10;
+    h_style.body.padding.left = LV_DPI / 4;
+    h_style.body.padding.right = LV_DPI / 4;
+    h_style.body.padding.top = LV_DPI / 10;
+    h_style.body.padding.bottom = LV_DPI / 10;
+
+    lv_obj_t * h = lv_cont_create(parent, NULL);
+    lv_obj_set_style(h, &h_style);
+    lv_obj_set_click(h, false);
+    lv_cont_set_fit(h, LV_FIT_TIGHT);
+    lv_cont_set_layout(h, LV_LAYOUT_COL_M);
+
+    lv_obj_t * btn = lv_btn_create(h, NULL);
+    lv_btn_set_fit(btn, LV_FIT_TIGHT);
+    lv_btn_set_toggle(btn, true);
+    lv_obj_t * btn_label = lv_label_create(btn, NULL);
+    lv_label_set_text(btn_label, "Button");
+
+    btn = lv_btn_create(h, btn);
+    lv_btn_toggle(btn);
+    btn_label = lv_label_create(btn, NULL);
+    lv_label_set_text(btn_label, "Toggled");
+
+    btn = lv_btn_create(h, btn);
+    lv_btn_set_state(btn, LV_BTN_STATE_INA);
+    btn_label = lv_label_create(btn, NULL);
+    lv_label_set_text(btn_label, "Inactive");
+
+    lv_obj_t * label = lv_label_create(h, NULL);
+    lv_label_set_text(label, "Primary");
+    lv_obj_set_style(label, th->style.label.prim);
+
+    label = lv_label_create(h, NULL);
+    lv_label_set_text(label, "Secondary");
+    lv_obj_set_style(label, th->style.label.sec);
+
+    label = lv_label_create(h, NULL);
+    lv_label_set_text(label, "Hint");
+    lv_obj_set_style(label, th->style.label.hint);
+
+    static const char * btnm_str[] = {"1", "2", "3", LV_SYMBOL_OK, 
LV_SYMBOL_CLOSE, ""};
+    lv_obj_t * btnm = lv_btnm_create(h, NULL);
+    lv_obj_set_size(btnm, lv_disp_get_hor_res(NULL) / 4, 2 * LV_DPI / 3);
+    lv_btnm_set_map(btnm, btnm_str);
+    lv_btnm_set_btn_ctrl_all(btnm, LV_BTNM_CTRL_TGL_ENABLE);
+    lv_btnm_set_one_toggle(btnm, true);
+
+    lv_obj_t * table = lv_table_create(h, NULL);
+    lv_table_set_col_cnt(table, 3);
+    lv_table_set_row_cnt(table, 4);
+    lv_table_set_col_width(table, 0, LV_DPI / 3);
+    lv_table_set_col_width(table, 1, LV_DPI / 2);
+    lv_table_set_col_width(table, 2, LV_DPI / 2);
+    lv_table_set_cell_merge_right(table, 0, 0, true);
+    lv_table_set_cell_merge_right(table, 0, 1, true);
+
+    lv_table_set_cell_value(table, 0, 0, "Table");
+    lv_table_set_cell_align(table, 0, 0, LV_LABEL_ALIGN_CENTER);
+
+    lv_table_set_cell_value(table, 1, 0, "1");
+    lv_table_set_cell_value(table, 1, 1, "13");
+    lv_table_set_cell_align(table, 1, 1, LV_LABEL_ALIGN_RIGHT);
+    lv_table_set_cell_value(table, 1, 2, "ms");
+
+    lv_table_set_cell_value(table, 2, 0, "2");
+    lv_table_set_cell_value(table, 2, 1, "46");
+    lv_table_set_cell_align(table, 2, 1, LV_LABEL_ALIGN_RIGHT);
+    lv_table_set_cell_value(table, 2, 2, "ms");
+
+    lv_table_set_cell_value(table, 3, 0, "3");
+    lv_table_set_cell_value(table, 3, 1, "61");
+    lv_table_set_cell_align(table, 3, 1, LV_LABEL_ALIGN_RIGHT);
+    lv_table_set_cell_value(table, 3, 2, "ms");
+
+    h = lv_cont_create(parent, h);
+
+    lv_obj_t * sw_h = lv_cont_create(h, NULL);
+    lv_cont_set_style(sw_h, LV_CONT_STYLE_MAIN, &lv_style_transp);
+    lv_cont_set_fit2(sw_h, LV_FIT_NONE, LV_FIT_TIGHT);
+    lv_obj_set_width(sw_h, LV_HOR_RES / 4);
+    lv_cont_set_layout(sw_h, LV_LAYOUT_PRETTY);
+
+    lv_obj_t * sw = lv_sw_create(sw_h, NULL);
+    lv_sw_set_anim_time(sw, 250);
+
+    sw = lv_sw_create(sw_h, sw);
+    lv_sw_on(sw, LV_ANIM_OFF);
+
+
+    lv_obj_t * bar = lv_bar_create(h, NULL);
+    lv_bar_set_value(bar, 70, false);
+
+    lv_obj_t * slider = lv_slider_create(h, NULL);
+    lv_bar_set_value(slider, 70, false);
+
+    lv_obj_t * line = lv_line_create(h, NULL);
+    static lv_point_t line_p[2];
+    line_p[0].x = 0;
+    line_p[0].y = 0;
+    line_p[1].x = lv_disp_get_hor_res(NULL) / 5;
+    line_p[1].y = 0;
+
+    lv_line_set_points(line, line_p, 2);
+    lv_line_set_style(line, LV_LINE_STYLE_MAIN, th->style.line.decor);
+
+    lv_obj_t * cb = lv_cb_create(h, NULL);
+
+    cb = lv_cb_create(h, cb);
+    lv_btn_set_state(cb, LV_BTN_STATE_TGL_REL);
+
+    lv_obj_t * ddlist = lv_ddlist_create(h, NULL);
+    lv_ddlist_set_fix_width(ddlist, lv_obj_get_width(ddlist) + LV_DPI / 2);   
/*Make space for the arrow*/
+    lv_ddlist_set_draw_arrow(ddlist, true);
+
+    h = lv_cont_create(parent, h);
+
+    lv_obj_t * list = lv_list_create(h, NULL);
+    lv_obj_set_size(list, lv_disp_get_hor_res(NULL) / 4, 
lv_disp_get_ver_res(NULL) / 2);
+    lv_obj_t * list_btn;
+    list_btn = lv_list_add_btn(list, LV_SYMBOL_GPS,  "GPS");
+    lv_btn_set_toggle(list_btn, true);
+
+    lv_list_add_btn(list, LV_SYMBOL_WIFI, "WiFi");
+    lv_list_add_btn(list, LV_SYMBOL_GPS, "GPS");
+    lv_list_add_btn(list, LV_SYMBOL_AUDIO, "Audio");
+    lv_list_add_btn(list, LV_SYMBOL_VIDEO, "Video");
+    lv_list_add_btn(list, LV_SYMBOL_CALL, "Call");
+    lv_list_add_btn(list, LV_SYMBOL_BELL, "Bell");
+    lv_list_add_btn(list, LV_SYMBOL_FILE, "File");
+    lv_list_add_btn(list, LV_SYMBOL_EDIT, "Edit");
+    lv_list_add_btn(list, LV_SYMBOL_CUT,  "Cut");
+    lv_list_add_btn(list, LV_SYMBOL_COPY, "Copy");
+
+    lv_obj_t * roller = lv_roller_create(h, NULL);
+    lv_roller_set_options(roller, 
"Monday\nTuesday\nWednesday\nThursday\nFriday\nSaturday\nSunday", true);
+    lv_roller_set_selected(roller, 1, false);
+    lv_roller_set_visible_row_count(roller, 3);
+
+
+}
+
+static void create_tab2(lv_obj_t * parent)
+{
+    lv_coord_t w = lv_page_get_scrl_width(parent);
+
+    lv_obj_t * chart = lv_chart_create(parent, NULL);
+    lv_chart_set_type(chart, LV_CHART_TYPE_AREA);
+    lv_obj_set_size(chart, w / 3, lv_disp_get_ver_res(NULL) / 3);
+    lv_obj_set_pos(chart, LV_DPI / 10, LV_DPI / 10);
+    lv_chart_series_t * s1 = lv_chart_add_series(chart, LV_COLOR_RED);
+    lv_chart_set_next(chart, s1, 30);
+    lv_chart_set_next(chart, s1, 20);
+    lv_chart_set_next(chart, s1, 10);
+    lv_chart_set_next(chart, s1, 12);
+    lv_chart_set_next(chart, s1, 20);
+    lv_chart_set_next(chart, s1, 27);
+    lv_chart_set_next(chart, s1, 35);
+    lv_chart_set_next(chart, s1, 55);
+    lv_chart_set_next(chart, s1, 70);
+    lv_chart_set_next(chart, s1, 75);
+
+
+    lv_obj_t * gauge = lv_gauge_create(parent, NULL);
+    lv_gauge_set_value(gauge, 0, 40);
+    lv_obj_set_size(gauge, w / 4, w / 4);
+    lv_obj_align(gauge, chart, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 4);
+
+
+    lv_obj_t * arc = lv_arc_create(parent, NULL);
+    lv_obj_align(arc, gauge, LV_ALIGN_OUT_BOTTOM_MID, 0, LV_DPI / 8);
+
+    lv_obj_t * ta = lv_ta_create(parent, NULL);
+    lv_obj_set_size(ta, w / 3, lv_disp_get_ver_res(NULL) / 4);
+    lv_obj_align(ta, NULL, LV_ALIGN_IN_TOP_RIGHT, -LV_DPI / 10, LV_DPI / 10);
+    lv_ta_set_cursor_type(ta, LV_CURSOR_BLOCK);
+
+    lv_obj_t * kb = lv_kb_create(parent, NULL);
+    lv_obj_set_size(kb, 2 * w / 3, lv_disp_get_ver_res(NULL) / 3);
+    lv_obj_align(kb, ta, LV_ALIGN_OUT_BOTTOM_RIGHT, 0, LV_DPI);
+    lv_kb_set_ta(kb, ta);
+
+#if LV_USE_ANIMATION
+    lv_obj_t * loader = lv_preload_create(parent, NULL);
+    lv_obj_align(loader, NULL, LV_ALIGN_CENTER, 0, - LV_DPI);
+#endif
+}
+
+
+static void create_tab3(lv_obj_t * parent)
+{
+    /*Create a Window*/
+    lv_obj_t * win = lv_win_create(parent, NULL);
+    lv_obj_t * win_btn = lv_win_add_btn(win, LV_SYMBOL_CLOSE);
+    lv_obj_set_event_cb(win_btn, lv_win_close_event_cb);
+    lv_win_add_btn(win, LV_SYMBOL_DOWN);
+    lv_obj_set_size(win, lv_disp_get_hor_res(NULL) / 2, 
lv_disp_get_ver_res(NULL) / 2);
+    lv_obj_set_pos(win, LV_DPI / 20, LV_DPI / 20);
+    lv_obj_set_top(win, true);
+
+
+    /*Create a Label in the Window*/
+    lv_obj_t * label = lv_label_create(win, NULL);
+    lv_label_set_text(label, "Label in the window");
+
+    /*Create a  Line meter in the Window*/
+    lv_obj_t * lmeter = lv_lmeter_create(win, NULL);
+    lv_obj_align(lmeter, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 2);
+    lv_lmeter_set_value(lmeter, 70);
+
+    /*Create a 2 LEDs in the Window*/
+    lv_obj_t * led1 = lv_led_create(win, NULL);
+    lv_obj_align(led1, lmeter, LV_ALIGN_OUT_RIGHT_MID, LV_DPI / 2, 0);
+    lv_led_on(led1);
+
+    lv_obj_t * led2 = lv_led_create(win, NULL);
+    lv_obj_align(led2, led1, LV_ALIGN_OUT_RIGHT_MID, LV_DPI / 2, 0);
+    lv_led_off(led2);
+
+    /*Create a Page*/
+    lv_obj_t * page = lv_page_create(parent, NULL);
+    lv_obj_set_size(page, lv_disp_get_hor_res(NULL) / 3, 
lv_disp_get_ver_res(NULL) / 2);
+    lv_obj_set_top(page, true);
+    lv_obj_align(page, win, LV_ALIGN_IN_TOP_RIGHT,  LV_DPI, LV_DPI);
+
+    label = lv_label_create(page, NULL);
+    lv_label_set_text(label, "Lorem ipsum dolor sit amet, repudiare 
voluptatibus pri cu.\n"
+                      "Ei mundi pertinax posidonium eum, cum tempor maiorum 
at,\n"
+                      "mea fuisset assentior ad. Usu cu suas civibus 
iudicabit.\n"
+                      "Eum eu congue tempor facilisi. Tale hinc unum te vim.\n"
+                      "Te cum populo animal eruditi, labitur inciderint at 
nec.\n\n"
+                      "Eius corpora et quo. Everti voluptaria instructior est 
id,\n"
+                      "vel in falli primis. Mea ei porro essent admodum,\n"
+                      "his ei malis quodsi, te quis aeterno his.\n"
+                      "Qui tritani recusabo reprehendunt ne,\n"
+                      "per duis explicari at. Simul mediocritatem mei et.");
+
+    /*Create a Calendar*/
+    lv_obj_t * cal = lv_calendar_create(parent, NULL);
+    lv_obj_set_size(cal, 5 * LV_DPI / 2, 5 * LV_DPI / 2);
+    lv_obj_align(cal, page, LV_ALIGN_OUT_RIGHT_TOP, -LV_DPI / 2, LV_DPI / 3);
+    lv_obj_set_top(cal, true);
+
+    static lv_calendar_date_t highlighted_days[2];
+    highlighted_days[0].day = 5;
+    highlighted_days[0].month = 5;
+    highlighted_days[0].year = 2018;
+
+    highlighted_days[1].day = 8;
+    highlighted_days[1].month = 5;
+    highlighted_days[1].year = 2018;
+
+    lv_calendar_set_highlighted_dates(cal, highlighted_days, 2);
+    lv_calendar_set_today_date(cal, &highlighted_days[0]);
+    lv_calendar_set_showed_date(cal, &highlighted_days[0]);
+
+    /*Create a Message box*/
+    static const char * mbox_btn_map[] = {" ", "Got it!", " ", ""};
+    lv_obj_t * mbox = lv_mbox_create(parent, NULL);
+    lv_mbox_set_text(mbox, "Click on the window or the page to bring it to the 
foreground");
+    lv_mbox_add_btns(mbox, mbox_btn_map);
+    lv_btnm_set_btn_ctrl(lv_mbox_get_btnm(mbox), 0, LV_BTNM_CTRL_HIDDEN);
+    lv_btnm_set_btn_width(lv_mbox_get_btnm(mbox), 1, 7);
+    lv_btnm_set_btn_ctrl(lv_mbox_get_btnm(mbox), 2, LV_BTNM_CTRL_HIDDEN);
+    lv_obj_set_top(mbox, true);
+}
diff --git a/main.c b/main.c
new file mode 100644
index 0000000..0f0a180
--- /dev/null
+++ b/main.c
@@ -0,0 +1,89 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Santiago Pagani <santiagopagani@xxxxxxxxx>
+ *
+ * Copyright (c) 2020, NEC Laboratories Europe GmbH, NEC Corporation.
+ *                     All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS 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 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
+ */
+
+#include <uk/config.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <unistd.h>
+#include <uk/print.h>
+#include <uk/essentials.h>
+#include <raspi/setup.h>
+#include <raspi/time.h>
+#include <raspi/raspi_info.h>
+
+#ifndef LV_CONF_INCLUDE_SIMPLE
+       #define LV_CONF_INCLUDE_SIMPLE
+#endif
+#include <lvgl.h>
+void lv_example_create(lv_theme_t * th);
+#define LVGL_REFRESH_SLEEP_TIME                5000
+
+
+int main(int argc __unused, char *argv[] __unused)
+{
+       uint64_t main_entry = get_system_timer();
+
+       // LittleVGL demo
+       lv_theme_t * th = lv_theme_night_init(20, NULL);
+       lv_theme_set_current(th);
+       lv_example_create(th);
+
+       uint64_t little_vgl_done = get_system_timer();
+
+       printf("LittleLVGL demo on Raspberry Pi3\n");
+       printf("Boot Time (absolute, CPU reset after power on):    %lu us\n", 
_libraspiplat_get_reset_time());
+       printf("Main entry (absolute, main entry after power on):    %lu us\n", 
main_entry);
+       printf("LittleVGL draw (absolute, main entry after power on):    %lu 
us\n", little_vgl_done);
+       printf("Main entry (since Boot Time):    %lu us\n", main_entry - 
_libraspiplat_get_reset_time());
+       printf("LittleVGL draw (since Boot Time):    %lu us\n", little_vgl_done 
- _libraspiplat_get_reset_time());
+       printf("Text Size:    %lu\n", get_unikraft_text_size());
+       printf("Data Size:    %lu\n", get_unikraft_data_size());
+       printf("BSS Size:    %lu\n", get_unikraft_bss_size());
+
+       uint64_t old_time, current_time;
+       old_time = get_system_timer();
+       
+       while(1) {
+               uint64_t elapsed_time = get_system_timer() - old_time;
+               if (elapsed_time < LVGL_REFRESH_SLEEP_TIME)
+                       usleep(LVGL_REFRESH_SLEEP_TIME - elapsed_time);
+               current_time = get_system_timer();
+               lv_tick_inc((current_time - old_time)/1000);
+               old_time = current_time;
+               lv_task_handler();
+       }
+
+       return 0;
+}
-- 
2.17.1


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.