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
#12
did you modify it to support the lcd you have?

yes obviously you are building it wrong

basically you commented out a function to suppress a warning treated as an error that should not have been considered an error

then this leads to new problems linking, so fix the -Wno-error flag to not set
Reply
#13
(2022-01-11, 02:38 AM)seandepagnier Wrote: did you modify it to support the lcd you have?

yes obviously you are building it wrong

basically you commented out a function to suppress a warning treated as an error that should not have been considered an error

then this leads to new problems linking, so fix the -Wno-error flag to not set

No i didnt change anything yet. I will try it with the same screen you have to see that its working and then i will see what i can do for the jlx12864 screen.

I will try this flag in the afternoon after work and i will post back.

Could you also post the pinout connections from the esp to the screen and the buttons ? 

Thank you Sean you are awesome !
Reply
#14
i am using ttgo t display module you can find the schematic:
https://github.com/Xinyuan-LilyGO/TTGO-T...(6-26).pdf

You can redefine the pins by changing the code too.
Reply
#15
No... i cant figure it out how i input the -Wno-error=unused-const-variable and -Wno-unused-const-variable flags.

can you tell me what to do ?

EDIT: 

I figured how to insert the flags. Now it gets past the previus error. But cant still not compile. I am again in the point of my previous post. Here...

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/micropython/modules/micropython_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/micropython/modules/micropython_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
ninja: build stopped: subcommand failed.
ninja failed with exit code 1
Makefile:34: recipe for target 'all' failed
make: *** [all] Error 2



The flags are inserted in the micropython.cmake file i posted above.
Just add this line at the end : 

Code:
target_compile_options(usermod_ugfx INTERFACE -Wno-error=unused-const-variable -Wno-unused-const-variable)

Now...does anyone have any suggestions how to proceed ? 

Giorgos
Reply
#16
Did you apply the patch in the README to support c++?


Attached Files
.txt   log.txt (Size: 40.08 KB / Downloads: 9)
Reply
#17
Brick 
No i didnt apply the patch. Where and how do i apply it ?

EDIT:

Ok so i have done my homework. i understand that this thing you posted in the readme.md is the output of the git diff command when you made the changes in the /ports/esp32/Makefile.

Code:
diff --git a/ports/esp32/Makefile b/ports/esp32/Makefile
index dcf4110cf..c473783e3 100644
--- a/ports/esp32/Makefile
+++ b/ports/esp32/Makefile
@@ -378,7 +378,8 @@ DRIVERS_SRC_C = $(addprefix drivers/,\

OBJ_MP =
OBJ_MP += $(PY_O)
-OBJ_MP += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
+OBJ_SRC_C = $(SRC_C:.c=.o)
+OBJ_MP += $(addprefix $(BUILD)/, $(OBJ_SRC_C:.cpp=.o))
OBJ_MP += $(addprefix $(BUILD)/, $(EXTMOD_SRC_C:.c=.o))
OBJ_MP += $(addprefix $(BUILD)/, $(LIB_SRC_C:.c=.o))
OBJ_MP += $(addprefix $(BUILD)/, $(DRIVERS_SRC_C:.c=.o))

The thing is that i have the stock Makefile and i dont know where to add thoose. I tried to copy them to a file named test.patch and runned from the repository's root the git apply test.patch but this is returning error.

Could you please give me some usable help here and not only just a few words? I will write a guide for the others afterwards.
If you have no time there is no problem. Just say it and i will give up and sleep more Angel
Reply
#18
You could manually apply it is so trivial, anyway, I just invoke patch directly, eg:

patch -p3 < patchfile

do you have your micropython repository online or can show me the exact branch you are using? I can diff from mine.
Reply
#19
I cloned your micropython fork
Reply
#20
and your only error is because of a warning being treated as an error?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)