lvgl / lv_binding_micropython

LVGL binding for MicroPython
MIT License
245 stars 159 forks source link

Complete documentation #78

Closed TimonPeng closed 4 years ago

TimonPeng commented 4 years ago

I did the following work, but it was not included:

WORKDIR /root
RUN git clone --recurse-submodules https://github.com/micropython/micropython.git

WORKDIR /root/micropython
RUN git submodule update --init

WORKDIR /root/micropython/lib
RUN git clone --recurse-submodules https://github.com/lvgl/lv_binding_micropython.git

WORKDIR /root/micropython/lib/lv_binding_micropython/gen
RUN python gen_mpy.py -MD lv_mpy_example.json -M lvgl -MP lv -I../../berkeley-db-1.xx/PORT/include -I../../lv_binding_micropython -I. -I../.. -Ibuild -I../../mp-readline -I ../../lv_binding_micropython/pycparser/utils/fake_libc_include ../../lv_binding_micropython/lvgl/lvgl.h

WORKDIR /root/micropython
RUN make -j4 -C mpy-cross

WORKDIR /root/micropython/ports/esp32
CMD make -j4 submodules && make -j4 &
>>> help('modules')
__main__          framebuf          uasyncio/funcs    upip
_boot             gc                uasyncio/lock     upip_utarfile
_onewire          inisetup          uasyncio/stream   urandom
_thread           machine           ubinascii         ure
_uasyncio         math              ubluetooth        uselect
_webrepl          micropython       ucollections      usocket
apa106            neopixel          ucryptolib        ussl
btree             network           uctypes           ustruct
builtins          ntptime           uerrno            utime
cmath             onewire           uhashlib          utimeq
dht               sys               uhashlib          uwebsocket
ds18x20           uarray            uheapq            uzlib
esp               uasyncio/__init__ uio               webrepl
esp32             uasyncio/core     ujson             webrepl_setup
flashbdev         uasyncio/event    uos               websocket_helper
Plus any modules on the filesystem
>>> import lvgl
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: no module named 'lvgl'

What's the problem? please

embeddedt commented 4 years ago

@TimonPeng You also have to patch several upstream files in order for the lvgl module to be built and linked. Take a look at the difference between lv_micropython and upstream MicroPython.

amirgon commented 4 years ago

To add to @embeddedt answer, the simplest way to use lvgl+micropython is to clone and build lv_micropython, which is a fork of Micropython v1.12 that incorporates lvgl.

TimonPeng commented 4 years ago

@embeddedt thanks for your reply, but i can't found lv_conf.h in https://github.com/lvgl/lv_micropython/tree/master/lib

TimonPeng commented 4 years ago

@amirgon thanks for your reply, but i used the same process to compile lv_micropython, but something wrong

Building with ESP IDF v3
find: ‘/root/esp-idf/components/json/include’: No such file or directory
find: ‘/root/esp-idf/components/json/port/include’: No such file or directory
TimonPeng commented 4 years ago

@amirgon thanks for your reply, but i used the same process to compile lv_micropython, but something wrong

Building with ESP IDF v3
find: ‘/root/esp-idf/components/json/include’: No such file or directory
find: ‘/root/esp-idf/components/json/port/include’: No such file or directory

Use the same process as micropython

amirgon commented 4 years ago

but i can't found lv_conf.h in https://github.com/lvgl/lv_micropython/tree/master/lib

lv_conf.h is part of lv_binding_micropython

i used the same process to compile lv_micropython, but something wrong

Building with ESP IDF v3
find: ‘/root/esp-idf/components/json/include’: No such file or directory
find: ‘/root/esp-idf/components/json/port/include’: No such file or directory

Did you checkout the correct esp-idf version as described in the README?

Did you get any other errors?
I believe that the two warnings you showed above can be ignored.

In general, to build lv_micropython you need to follow the instructions here.

TimonPeng commented 4 years ago

@amirgon yes, i used correct esp-idf version, my dockerfile here:

FROM python:3

RUN apt-get update && apt-get -y install \
    git wget curl \
    build-essential libreadline-dev libffi-dev pkg-config gcc-arm-none-eabi libnewlib-arm-none-eabi \
    libncurses-dev flex bison gperf cmake ninja-build ccache libffi-dev libssl-dev \
    gawk gperf grep gettext automake texinfo help2man libtool libtool-bin make

ENV PATH="/root/esp/xtensa-esp32-elf/bin:$PATH"
ENV IDF_PATH="/root/esp-idf"

USER root

WORKDIR /root
RUN mkdir esp

WORKDIR /root/esp
RUN wget https://dl.espressif.com/dl/xtensa-esp32-elf-gcc8_2_0-esp-2020r1-linux-amd64.tar.gz
RUN tar -xzf xtensa-esp32-elf-gcc8_2_0-esp-2020r1-linux-amd64.tar.gz

WORKDIR /root
RUN git clone https://github.com/espressif/esp-idf.git

WORKDIR /root/esp-idf
# V3
RUN git checkout 6ccb4cf5b7d1fdddb8c2492f9cbc926abaf230df
# V4
# RUN git checkout 310beae373446ceb9a4ad9b36b5428d7fdf2705f
RUN git submodule update --init --recursive
RUN pip install -r requirements.txt

WORKDIR /root
RUN git clone --recurse-submodules https://github.com/lvgl/lv_micropython.git

WORKDIR /root/lv_micropython
RUN git submodule update --init
RUN make -j4 -C mpy-cross

WORKDIR /root/lv_micropython/ports/esp32

CMD make -j4 LV_CFLAGS="-DLV_COLOR_DEPTH=16 -DLV_COLOR_16_SWAP=1" submodules \
    && make -j4 LV_CFLAGS="-DLV_COLOR_DEPTH=16 -DLV_COLOR_16_SWAP=1"

but many warning and error logs here (5000+ lines):

In file included from /root/esp-idf/components/cxx/cxx_exception_stubs.cpp:2:
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:101:11: error: '::clearerr' has not been declared
   using ::clearerr;
           ^~~~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:102:11: error: '::fclose' has not been declared
   using ::fclose;
           ^~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:103:11: error: '::feof' has not been declared
   using ::feof;
           ^~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:104:11: error: '::ferror' has not been declared
   using ::ferror;
           ^~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:105:11: error: '::fflush' has not been declared
   using ::fflush;
           ^~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:106:11: error: '::fgetc' has not been declared
   using ::fgetc;
           ^~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:107:11: error: '::fgetpos' has not been declared
   using ::fgetpos;
           ^~~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:108:11: error: '::fgets' has not been declared
   using ::fgets;
           ^~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:109:11: error: '::fopen' has not been declared
   using ::fopen;
           ^~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:110:11: error: '::fprintf' has not been declared
   using ::fprintf;
           ^~~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:111:11: error: '::fputc' has not been declared
   using ::fputc;
           ^~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:112:11: error: '::fputs' has not been declared
   using ::fputs;
           ^~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:113:11: error: '::fread' has not been declared
   using ::fread;
           ^~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:114:11: error: '::freopen' has not been declared
   using ::freopen;
           ^~~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:115:11: error: '::fscanf' has not been declared
   using ::fscanf;
           ^~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:116:11: error: '::fseek' has not been declared
   using ::fseek;
           ^~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:117:11: error: '::fsetpos' has not been declared
   using ::fsetpos;
           ^~~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:118:11: error: '::ftell' has not been declared
   using ::ftell;
           ^~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:119:11: error: '::fwrite' has not been declared
   using ::fwrite;
           ^~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:120:11: error: '::getc' has not been declared
   using ::getc;
           ^~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:121:11: error: '::getchar' has not been declared
   using ::getchar;
           ^~~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:124:11: error: '::gets' has not been declared
   using ::gets;
           ^~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:126:11: error: '::perror' has not been declared
   using ::perror;
           ^~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:127:11: error: '::printf' has not been declared
   using ::printf;
           ^~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:128:11: error: '::putc' has not been declared
   using ::putc;
           ^~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:129:11: error: '::putchar' has not been declared
   using ::putchar;
           ^~~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:130:11: error: '::puts' has not been declared
   using ::puts;
           ^~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:131:11: error: '::remove' has not been declared
   using ::remove;
           ^~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:132:11: error: '::rename' has not been declared
   using ::rename;
           ^~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:133:11: error: '::rewind' has not been declared
   using ::rewind;
           ^~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:134:11: error: '::scanf' has not been declared
   using ::scanf;
           ^~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:135:11: error: '::setbuf' has not been declared
   using ::setbuf;
           ^~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:136:11: error: '::setvbuf' has not been declared
   using ::setvbuf;
           ^~~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:137:11: error: '::sprintf' has not been declared
   using ::sprintf;
           ^~~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:138:11: error: '::sscanf' has not been declared
   using ::sscanf;
           ^~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:139:11: error: '::tmpfile' has not been declared
   using ::tmpfile;
           ^~~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:143:11: error: '::ungetc' has not been declared
   using ::ungetc;
           ^~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:144:11: error: '::vfprintf' has not been declared
   using ::vfprintf;
           ^~~~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:145:11: error: '::vprintf' has not been declared
   using ::vprintf;
           ^~~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:146:11: error: '::vsprintf' has not been declared
   using ::vsprintf;
           ^~~~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:175:11: error: '::snprintf' has not been declared
   using ::snprintf;
           ^~~~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:176:11: error: '::vfscanf' has not been declared
   using ::vfscanf;
           ^~~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:177:11: error: '::vscanf' has not been declared
   using ::vscanf;
           ^~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:178:11: error: '::vsnprintf' has not been declared
   using ::vsnprintf;
           ^~~~~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:179:11: error: '::vsscanf' has not been declared
   using ::vsscanf;
           ^~~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:185:22: error: '__gnu_cxx::snprintf' has not been declared
   using ::__gnu_cxx::snprintf;
                      ^~~~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:186:22: error: '__gnu_cxx::vfscanf' has not been declared
   using ::__gnu_cxx::vfscanf;
                      ^~~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:187:22: error: '__gnu_cxx::vscanf' has not been declared
   using ::__gnu_cxx::vscanf;
                      ^~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:188:22: error: '__gnu_cxx::vsnprintf' has not been declared
   using ::__gnu_cxx::vsnprintf;
                      ^~~~~~~~~
/root/esp/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/8.2.0/cstdio:189:22: error: '__gnu_cxx::vsscanf' has not been declared
   using ::__gnu_cxx::vsscanf;
                      ^~~~~~~
/root/esp-idf/components/cxx/cxx_exception_stubs.cpp: In function 'void __cxx_fatal_exception_message(const char*)':
/root/esp-idf/components/cxx/cxx_exception_stubs.cpp:24:5: error: 'printf' was not declared in this scope
     printf("%s%s\n", FATAL_EXCEPTION, msg);
     ^~~~~~
/root/esp-idf/components/cxx/cxx_exception_stubs.cpp:24:5: note: 'printf' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?
/root/esp-idf/components/cxx/cxx_exception_stubs.cpp:6:1:
+#include <cstdio>

/root/esp-idf/components/cxx/cxx_exception_stubs.cpp:24:5:
     printf("%s%s\n", FATAL_EXCEPTION, msg);
     ^~~~~~
/root/esp-idf/components/cxx/cxx_exception_stubs.cpp: In function 'void __cxx_fatal_exception_int(int)':
/root/esp-idf/components/cxx/cxx_exception_stubs.cpp:35:5: error: 'printf' was not declared in this scope
     printf("%s (%d)\n", FATAL_EXCEPTION, i);
     ^~~~~~
/root/esp-idf/components/cxx/cxx_exception_stubs.cpp:35:5: note: 'printf' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?
make: *** [Makefile:770: build-GENERIC//root/esp-idf/components/cxx/cxx_exception_stubs.o] Error 1
make: *** Waiting for unfinished jobs....
amirgon commented 4 years ago

I don't think the errors you are getting are specific to lv_micropython. I suggeest you first try your dockerfile with upstream Micropython: instead of cloning lv_micropython.git, clone micropython.git, checkout v1.12, and see if you get the same errors.

There are many unusual things I noticed on your dockerfile:

stale[bot] commented 4 years ago

This issue or pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.