This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Remote LCD Nokia5510/JLX12864 with ESP32
#11
Bug 
Hello Sean,

i cant make it work. These are the steps i followed: 

following this guide : https://github.com/micropython/micropyth...orts/esp32

Code:
sudo apt-get install esptool
cd
mkdir esp
cd esp
git clone -b v4.2 --recursive https://github.com/espressif/esp-idf.git
cd esp-idf
./install.sh  
source export.sh (I know i have to rerun this command each time i quit the terminal session)
cd
mkdir micropython
cd micropython
mkdir esp32
cd esp32
git clone https://github.com/pypilot/micropython.git
cd micropython
make -C mpy-cross
cd ports/esp32
make submodules
make

It builds! So everything is ok until now. 

i uploaded with :
Code:
make erase
make deploy


It uploads and micropython is working on the esp32

Now, when i :

Code:
cd ~/Desktop
git clone https://github.com/pypilot/pypilot.git
cd pypilot-master/hat
nano Makefile #to change the MPY-CROSS path to my own
make
make upload

The .mpy files are created and uploaded to my esp32. I can see the files when i connect to the esp32's console and type :

Code:
import os
os.listdir()

when i press the reboot button on the esp32 pcb and look at the console i see import pypilot module not found in the font.py file. Ok i knew it because the ugfx module in not in the esp32 and in the font.py file here :


Code:
try:
   import micropython
   import ugfx
   #fontpath = '/_#!#_spiffs/ugfxfonts/'
   fontpath = ''
   character = ugfx.surface(64, 84, 1)

except:
   micropython = False
   import os
   from pypilot.hat.ugfx import ugfx


If it fails to load ugfx module, it thinks it is in raspberry enviroment.


SO NOW ! 

Now the fun starts. Compiling the micropython with your micropython_ugfx module.

Code:
cd ~/micropython/esp32/micropython
mkdir modules
cd modules
git clone https://github.com/pypilot/micropython_ugfx.git
mv micropython_ugfx ugfx
cd ../ports/esp32
make clean
make USER_C_MODULES=../../../modules CFLAGS_EXTRA="-DMODULE_UGFX_ENABLED=1" all

This one FAILS with 

Code:
CMake Error at /home/labcnc/Desktop/micropython/py/usermod.cmake:42 (include):
 include requested file is a directory:

   ../../../modules
Call Stack (most recent call first):
 main/CMakeLists.txt:10 (include)

I found a very usefull link : https://docs.micropython.org/en/latest/d...dules.html

In this link it says that you need to point to the .cmake file but you dont have a .cmake file in github repo. So i took the one in the example folder and altered it and copied it in:
~/micropython/esp32/micropython/modules/ugfx/micropython.cmake


This is the file:
Code:
# Create an INTERFACE library for our C module.
add_library(usermod_ugfx INTERFACE)

# Add our source files to the lib
target_sources(usermod_ugfx INTERFACE
   ${CMAKE_CURRENT_LIST_DIR}/modugfx.c
   ${CMAKE_CURRENT_LIST_DIR}/ilidriver.c
   ${CMAKE_CURRENT_LIST_DIR}/upy_wrap.cpp
   ${CMAKE_CURRENT_LIST_DIR}/ugfx.cpp
)

# Add the current directory as an include directory.
target_include_directories(usermod_ugfx INTERFACE
   ${CMAKE_CURRENT_LIST_DIR}
)

# Link our INTERFACE library to the usermod target.
target_link_libraries(usermod INTERFACE usermod_ugfx)

then again: 

Code:
cd ~/micropython/esp32/micropython/ports/esp32/
make clean
make USER_C_MODULES=../../../modules/ugfx/micropython.cmake CFLAGS_EXTRA="-DMODULE_UGFX_ENABLED=1" all
this one FAILS with that error and some warnings :
Code:
/home/labcnc/Desktop/micropython2/modules/ugfx/modugfx.c:184:35: error: 'ugfx_surface_free_obj' defined but not used [-Werror=unused-const-variable=]
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(ugfx_surface_free_obj, 0, ugfx_surface_free);
                                  ^~~~~~~~~~~~~~~~~~~~~
/home/labcnc/Desktop/micropython2/py/obj.h:351:36: note: in definition of macro 'MP_DEFINE_CONST_FUN_OBJ_KW'
    const mp_obj_fun_builtin_var_t obj_name = \
                                   ^~~~~~~~
cc1: some warnings being treated as errors

I edited the mofugfx.c file and commented out line 184 since it is not used. 
I rerun the make clean and make commants above and this time it FINISHED and i had a smile until my ears ! But lasted not so long  Big Grin Big Grin
I uploaded the binaries with make erase and make deploy and restarted the esp32 with no errors on the console. I tried to import ugfx in the console and ... No existing module named ugfx 
I thought that maybe the 
CFLAGS_EXTRA="-DMODULE_UGFX_ENABLED=1"
is not recognized because when i runned the make command i saw that the files where builded

So i edited the modugfx.c file again and in the end i changed the line :
MP_REGISTER_MODULE(MP_QSTR_ugfx, mp_module_ugfx, MODULE_UGFX_ENABLED);

to
MP_REGISTER_MODULE(MP_QSTR_ugfx, mp_module_ugfx, 1);

again :


Code:
make clean
make USER_C_MODULES=../../../modules/ugfx/micropython.cmake all

This time it FAILS after 
Linking CXX executable micropython.elf
with :

Code:
/home/labcnc/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: CMakeFiles/micropython.elf.dir/home/labcnc/Desktop/micropython2/modules/ugfx/modugfx.c.obj:(.literal+0x14): undefined reference to `ugfx_surface_c_free'
/home/labcnc/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: CMakeFiles/micropython.elf.dir/home/labcnc/Desktop/micropython2/modules/ugfx/modugfx.c.obj: in function `ugfx_display_surface_refresh':
modugfx.c:(.text+0x39b): undefined reference to `ugfx_surface_c_free'
collect2: error: ld returned 1 exit status

Now i am stucked  Cool

I tried esp-idf 4.0.2 and 4.1.1 and 4.2
i tried the official micropython repository with the same results

Any Ideas ? 

Giorgos
Reply


Messages In This Thread
RE: Remote LCD Nokia5510/JLX12864 with ESP32 - by kagouraki - 2022-01-10, 09:17 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)