Closed martinberlin closed 3 years ago
Hello Martin, If you are compiling an application, ESP-IDF requires that an app_main() function be declared as a C function to be called by the SDK. This is the main entry point to your application. As it must be a C function if you are using C++, you have to encapsulate it as follows: extern "C" { void app_main(void) { } } // extern "C"
Usually, the ESP-IDF is compiled at the same time as an application that requires it. You cannot create, say, a pre-compiled library with it. Hope this help Cheers! Guy On Sun, 2021-03-14 at 08:46 -0700, Martin wrote:
Very nice project!
I'm developing an epaper component for the IDF and I though would be very nice to make an ePub reader that support multiple epapers. But I see you made a great work here so I guess will start using yours. Tried to compile, my idf version is this one:
ESP-IDF v4.2-dev /home/martin/.espressif/tools/xtensa-esp32-elf/esp-2020r2- 8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32- elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: esp- idf/esp32/libesp32.a(cpu_start.c.obj):(.literal.main_task+0x24): undefined reference to
app_main'/home/martin/.espressif/tools/xtensa-esp32-elf/esp-2020r2- 8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32- elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: esp- idf/esp32/libesp32.a(cpu_start.c.obj): in function
main_task':/home/martin/esp/esp- idf/components/esp32/cpu_start.c:567: undefined reference to `app_main'collect2: error: ld returned 1 exit status Or I'm building this wrong and I have to build it using Platformio? Thanks in advance— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
I may now better understand your question :-) The EPub-Inkplate was developped using PlaformIO. I don't expect that you could get it built directly with ESP-IDF unless you modify the folder structure or add CMake elements in the built description files. On Sun, 2021-03-14 at 08:46 -0700, Martin wrote:
Very nice project!
I'm developing an epaper component for the IDF and I though would be very nice to make an ePub reader that support multiple epapers. But I see you made a great work here so I guess will start using yours. Tried to compile, my idf version is this one:
ESP-IDF v4.2-dev /home/martin/.espressif/tools/xtensa-esp32-elf/esp-2020r2- 8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32- elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: esp- idf/esp32/libesp32.a(cpu_start.c.obj):(.literal.main_task+0x24): undefined reference to
app_main'/home/martin/.espressif/tools/xtensa-esp32-elf/esp-2020r2- 8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32- elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: esp- idf/esp32/libesp32.a(cpu_start.c.obj): in function
main_task':/home/martin/esp/esp- idf/components/esp32/cpu_start.c:567: undefined reference to `app_main'collect2: error: ld returned 1 exit status Or I'm building this wrong and I have to build it using Platformio? Thanks in advance— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Some more information: If you look inside the platformio.ini file, you will see that there is a need for many specifics aspects to be defined to get the EPub-Reader compiled. The message you get is related to the fact that some #defined values are not properly setup. As the application as been designed to support building both linux and esp32 based executables, a proper
targetted device. For the standard InkPlate6 device, look in platformio.ini config file for the following header: [env:inkplate_6_release] GuyOn Sun, 2021-03-14 at 08:46 -0700, Martin wrote:
Very nice project!
I'm developing an epaper component for the IDF and I though would be very nice to make an ePub reader that support multiple epapers. But I see you made a great work here so I guess will start using yours. Tried to compile, my idf version is this one:
ESP-IDF v4.2-dev /home/martin/.espressif/tools/xtensa-esp32-elf/esp-2020r2- 8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32- elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: esp- idf/esp32/libesp32.a(cpu_start.c.obj):(.literal.main_task+0x24): undefined reference to
app_main'/home/martin/.espressif/tools/xtensa-esp32-elf/esp-2020r2- 8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32- elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: esp- idf/esp32/libesp32.a(cpu_start.c.obj): in function
main_task':/home/martin/esp/esp- idf/components/esp32/cpu_start.c:567: undefined reference to `app_main'collect2: error: ld returned 1 exit status Or I'm building this wrong and I have to build it using Platformio? Thanks in advance— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Thanks a lot for the guidance. The fact is that I use Platformio also but only as an IDE and then I build and compile my Firmware's directly in command-line.
Now I'm trying to build it with platformio, updated the platformio default_envs
[platformio]
default_envs = inkplate_6_release
Getting: In file included from include/models/fonts.hpp:8, from include/models/css.hpp:10, from include/models/epub.hpp:11, from include/controllers/books_dir_controller.hpp:9, from src/controllers/app_controller.cpp:8: include/models/ttf2.hpp:11:10: fatal error: ft2build.h: No such file or directory
But file is there, seems just not where Platformio is trying to search for it: EPub-InkPlate$ find . -name ft2build.h ./freetype-2.10.4/devel/ft2build.h ./freetype-2.10.4/include/ft2build.h ./lib_freetype/include/freetype2/ft2build.h
Sorry I know that I'm a bit lost here. Maybe there is some build command that I forgot to run, or an install section that I forgot to read? I think I know, I forgot to read: https://github.com/turgu1/EPub-InkPlate#freetype-library-compilation-for-esp32
Maybe it will be a nice idea to add a one page Wiki with the build instructions at the beginning?' I find Wiki's awesome to build documentation content since they are not branch specific. They are also indexed by Google and of course the advantage is that they are not inside files on the repository :)
Update: Point 5 of the freetype compilation for ESP32 is giving me this The following commands are executed:
$ cd freetype-2.10.4 $ bash myconf.sh $ make $ make install rm -rf /home/turgu1/Dev/EPub-InkPlate/lib_freetype/include/freetype2 -> My bad I forgot to change the --prefix, maybe this can be made like a command-line prompt?
UPDATE: Now this is solved. Next show-stopper when trying to build in Platformio is this
Package harfbuzz was not found in the pkg-config search path.
Perhaps you should add the directory containing `harfbuzz.pc'
to the PKG_CONFIG_PATH environment variable
Package 'harfbuzz', required by '/freetype2', not found
OSError: '/usr/bin/pkg-config --cflags --libs lib_freetype/lib/pkgconfig/freetype2.pc' exited 1:
File "/home/martin/.platformio/penv/lib/python3.8/site-packages/platformio/builder/main.py", line 177:
env.SConscript("$BUILD_SCRIPT")
Commented that line you mentioned in point 6. Now getting again:
In file included from include/models/fonts.hpp:8,
from include/models/css.hpp:10,
from include/models/epub.hpp:11,
from include/controllers/book_controller.hpp:9,
from src/controllers/book_controller.cpp:6:
include/models/ttf2.hpp:11:10: fatal error: ft2build.h: No such file or directory
A part of that getting a lot of: .pio/libdeps/inkplate_6_debug/ESP-IDF-Inkplate/include/services/esp.hpp:75:46: error: 'heap_caps_get_total_size' was not declared in this scope ESP_LOGD(TAG, "| Total heap: %7d |", heap_caps_get_total_size(MALLOC_CAP_8BIT ));
Like if heap_caps_get_total_size would not exist as a function.
Did you grab the complete platformio.ini file from the github repository? The inkplate_6_release env retuires access to other definitions under [inkplate_common] and [common]. Guy On Sun, 2021-03-14 at 10:40 -0700, Martin wrote:
Thanks a lot for the guidance. The fact is that I use Platformio also but only as an IDE and then I build and compile my Firmware's directly in command-line. Now I'm trying to build it with platformio, updated the platformio default_envs [platformio]default_envs = inkplate_6_release Getting:
In file included from include/models/fonts.hpp:8,
from include/models/css.hpp:10,
from include/models/epub.hpp:11,
from include/controllers/books_dir_controller.hpp:9,
from src/controllers/app_controller.cpp:8:
include/models/ttf2.hpp:11:10: fatal error: ft2build.h: No such file or directory But file is there, seems just not where Platformio is trying to search for it:
EPub-InkPlate$ find . -name ft2build.h
./freetype-2.10.4/devel/ft2build.h
./freetype-2.10.4/include/ft2build.h
./lib_freetype/include/freetype2/ft2build.h Sorry I know that I'm a bit lost here. Maybe there is some build command that I forgot to run, or an install section that I forgot to read?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
Sure, I cloned this repository completely, so I have the same stand as you in master. Thanks a lot will research a bit more
I'm using that configuration without any change on two different computer: One running Ubuntu 20.04, another running Linux Mint V20. I will do some test on a VmWare virtual Ubuntu in case there is something I've missed.... Guy On Sun, 2021-03-14 at 11:30 -0700, Martin wrote:
Sure, I cloned this repository completely, so I have the same stand as you in master. Thanks a lot will research a bit more
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
I've just built successfully the EPub-InkPlate reader using a vanilla Linux Ubuntu 20.04 system in a virtual VMPlayer device. I've done the following:
You will find attached the end of the output from the building process (I've lost the start of it... too long for the VSCode display).
Hope that help.
Guy result.txt
Another point: be sure using the platformio build task through the build icon at the bottom of the VSCode window... Guy On Sun, 2021-03-14 at 11:30 -0700, Martin wrote:
Sure, I cloned this repository completely, so I have the same stand as you in master. Thanks a lot will research a bit more
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
I've just seen your update comment where you tried to compile the freetype library (I was reading your comments through my email and the last part of your msg was not sent to me...). As mentioned in the readme, this is not required. It's already done and everything is at the right place in the folder structure. I suggest that you retrieve a fresh copy of the GitHub project and simply start a single platformio build command.
Ok that’s it I will start from zero again tomorrow. Thanks a lot for the effort. Maybe this is because I use esp-IDF separately of PlatformIO so maybe there is some conflict. Maybe doing this with a clean Ubuntu is a great idea.
There is no problem of having a other ESP-IDF SDK installed as long as your system path doesn't point at it I gues. I have such a SDK on my laptop and it is not used at all. Platformio take a copy of the sdk from the net and push it in a subfolder in the .pio folder under the main project folder and compile it there.
On Sun, 2021-03-14 at 12:51 -0700, Martin wrote:
Ok that’s it I will start from zero again tomorrow. Thanks a lot for the effort.
Maybe this is because I use esp-IDF separately of PlatformIO so maybe there is some conflict. Maybe doing this with a clean Ubuntu is a great idea.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
Pulled it again from 0 repeating your steps (Except OS is the same Ubuntu 20) This is what I get:
Processing inkplate_6_release (platform: espressif32; board: esp-wrover-kit; framework: espidf)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp-wrover-kit.html
PLATFORM: Espressif 32 (1.12.4) > Espressif ESP-WROVER-KIT
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (ftdi) On-board (ftdi) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
- framework-espidf 3.40001.200521 (4.0.1)
- tool-cmake 3.16.4
- tool-esptoolpy 1.20600.0 (2.6.0)
- tool-ninja 1.7.1
- toolchain-esp32ulp 1.22851.190618 (2.28.51)
- toolchain-xtensa32 2.80200.200827 (8.2.0)
Reading CMake configuration...
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 4 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <ESP-IDF-Inkplate> 0.9.4+sha.ef3a5f8
|-- <EPub_InkPlate>
| |-- <ESP-IDF-Inkplate> 0.9.4+sha.ef3a5f8
|-- <externals>
|-- <tools>
Building in release mode
Compiling .pio/build/inkplate_6_release/esp-idf/src/controllers/app_controller.cpp.o
Compiling .pio/build/inkplate_6_release/esp-idf/src/controllers/book_controller.cpp.o
Compiling .pio/build/inkplate_6_release/esp-idf/src/controllers/books_dir_controller.cpp.o
Compiling .pio/build/inkplate_6_release/esp-idf/src/controllers/common_actions.cpp.o
Compiling .pio/build/inkplate_6_release/esp-idf/src/controllers/event_mgr.cpp.o
Compiling .pio/build/inkplate_6_release/esp-idf/src/controllers/option_controller.cpp.o
Compiling .pio/build/inkplate_6_release/esp-idf/src/controllers/param_controller.cpp.o
In file included from include/models/fonts.hpp:8,
from include/models/css.hpp:10,
from include/models/epub.hpp:11,
from include/controllers/books_dir_controller.hpp:9,
from src/controllers/app_controller.cpp:8:
include/models/ttf2.hpp:11:10: fatal error: ft2build.h: No such file or directory
Strange is like if it's not finding the include directory where ft2build.h is. I assume you are leaving platformio.ini "as is" right? I cloned this again, my stand is 100% the same as you have in master branch. So it must be something that I have different on my toolset. Platformio version: 1.54.2
Do you see something strange on my build output?
Note when I open the file ttf2.hpp I also see this include marked in red in the IDE
We may have found the problem... It seems that you are using an old platformio version. It is loading an old esp-idf sdk (v4.0.1). Mine is version 2.3.0. That loads esp-idf v 4.2.0. Here is the information from the start of my own build process:
> Executing task: platformio run --environment inkplate_6_release <
Processing inkplate_6_release (platform: espressif32; board: esp-wrover-kit; framework: espidf)
------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp-wrover-kit.html
PLATFORM: Espressif 32 (3.1.0) > Espressif ESP-WROVER-KIT
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (ftdi) On-board (ftdi) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
- framework-espidf 3.40200.210118 (4.2.0)
- tool-cmake 3.16.4
- tool-esptoolpy 1.30000.201119 (3.0.0)
- tool-ninja 1.7.1
- toolchain-esp32ulp 1.22851.191205 (2.28.51)
- toolchain-xtensa32 2.80400.210211 (8.4.0)
Reading CMake configuration...
Library Manager: Installing git+https://github.com/turgu1/ESP-IDF-InkPlate.git#v0.9.4
git version 2.25.1
Cloning into '/home/turgu1/.platformio/.cache/tmp/pkg-installing-3sn5g2s6'...
Library Manager: ESP-IDF-Inkplate @ 0.9.4+sha.ef3a5f8 has been installed!
...
Good point. I went to "PIO Home" -> Frameworks and updated Espressif 32 which updates also IDF. Now I have the same version. But still get the problem that does not find the include. Again the logs, maybe there is something I miss? Where is the part where the folder where ft2build.h lives is referred to be included as a library?
I think this part is not doing, is not installing the lib just after showing the versions of everything, in yours there is:
Library Manager: Installing git+https://github.com/turgu1/ESP-IDF-InkPlate.git#v0.9.4 git version 2.25.1 Cloning into '/home/turgu1/.platformio/.cache/tmp/pkg-installing-3sn5g2s6'... UPDATE : Is not this. I deleted the library in the .piolib and install it's again.
Processing inkplate_6_release (platform: espressif32; board: esp-wrover-kit; framework: espidf)
-----------------------------------------------------------------------------------------------------
Tool Manager: Installing platformio/toolchain-xtensa32 @ ~2.80400.0
Downloading [####################################] 100%
Unpacking [####################################] 100%
Tool Manager: toolchain-xtensa32 @ 2.80400.210211 has been installed!
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp-wrover-kit.html
PLATFORM: Espressif 32 (1.12.4+sha.34b55a4) > Espressif ESP-WROVER-KIT
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (ftdi) On-board (ftdi) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
- framework-espidf 3.40200.210118 (4.2.0)
- tool-cmake 3.16.4
- tool-esptoolpy 1.30000.201119 (3.0.0)
- tool-ninja 1.7.1
- toolchain-esp32ulp 1.22851.191205 (2.28.51)
- toolchain-xtensa32 2.80400.210211 (8.4.0)
Reading CMake configuration...
Generating assembly for certificate bundle...
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 4 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <ESP-IDF-Inkplate> 0.9.4+sha.ef3a5f8
|-- <EPub_InkPlate>
| |-- <ESP-IDF-Inkplate> 0.9.4+sha.ef3a5f8
|-- <externals>
|-- <tools>
Building in release mode
Compiling .pio/build/inkplate_6_release/src/controllers/app_controller.o
Compiling .pio/build/inkplate_6_release/src/controllers/book_controller.o
Compiling .pio/build/inkplate_6_release/src/controllers/books_dir_controller.o
Compiling .pio/build/inkplate_6_release/src/controllers/common_actions.o
Compiling .pio/build/inkplate_6_release/src/controllers/event_mgr.o
Compiling .pio/build/inkplate_6_release/src/controllers/option_controller.o
Compiling .pio/build/inkplate_6_release/src/controllers/param_controller.o
In file included from include/models/fonts.hpp:8,
from include/models/css.hpp:10,
from include/models/epub.hpp:11,
from include/controllers/books_dir_controller.hpp:9,
from src/controllers/app_controller.cpp:8:
include/models/ttf2.hpp:11:10: fatal error: ft2build.h: No such file or directory
Got it... I'm the culprit :-( Here it is: I hard coded my folder location in a file that is read inside the platformio.ini file...
Look here: lib_freetype/lib/pkgconfig/freetype2.pc
The first 4 lines:
prefix=/home/turgu1/Dev/EPub-InkPlate/lib_freetype exec_prefix=/home/turgu1/Dev/EPub-InkPlate/lib_freetype libdir=/home/turgu1/Dev/EPub-InkPlate/lib_freetype/lib includedir=/home/turgu1/Dev/EPub-InkPlate/lib_freetype/include
You can replace there "/home/turgu1/Dev" with the location you have installed the source code.
That was done several month ago... i missed it!
I will find a way to get that more generic...
Yes. That was a big step forward. Maybe you can make an bash file that writes that freetype2.pc dynamically using your project directory to generate that paths (Idea)
Now I'm hitting this error:
*** [.pio/build/inkplate_6_release/bootloader/soc/esp32/cpu_util.o] Source `/home/martin/.platformio/packages/framework-espidf/components/soc/esp32/cpu_util.c' not found, needed by target `.pio/build/inkplate_6_release/bootloader/soc/esp32/cpu_util.o'.
That I'm not sure why it comes since the ESP-IDF is the right version now. But this must be something regarding framework versions, I will update everything and try again!
SOLUTION was to delete that : ~/.platformio/packages$ rm -fr framework-espidf And build again. That recreates the folder.
AND YES: Was a quite a fight but worth it. Thanks for all the help!
Checking size .pio/build/inkplate_6_release/firmware.elf Advanced Memory Usage is available via "PlatformIO Home > Project Inspect" RAM: [== ] 16.8% (used 55012 bytes from 327680 bytes) Flash: [======= ] 69.9% (used 1693944 bytes from 2424832 bytes) esptool.py v3.0 ===================================== SUCCESS] Took 44.85 seconds
Environment Status Duration
inkplate_6_release SUCCESS 00:00:44.853
Here are the four lines that works. No need for a shell script:
prefix=$PROJECT_DIR/lib_freetype exec_prefix=$PROJECT_DIR/lib_freetype libdir=$PROJECT_DIR/lib_freetype/lib includedir=$PROJECT_DIR/lib_freetype/include
I'm updating the project accordingly.
Please confirm that you can build the app properly.
Good! Thanks for your effort!
@turgu1 Thanks a lot!
Quick question: Would be OK with you if I Fork this repository and make a version that supports also another epapers ?
I wanted to practice C++ and this days I don't have any client project so I though to invent my own. I though about analyzing what you did here and replace the rendering part to work also with my Cale-idf epaper component.
Currently it supports only Lilygo EPD047 parallel epaper but has also like 10 other monochrome SPI epapers, that are much slower than Parallel, but still can be a good target to make an eBook reader for those that do not have an Inkplate.
If it's ok with you then I will rename my fork: EPub-epaper
I dislike opening Forks and seeing that all have same name, at least a minor intention to point that is not only for InkScape ;) And I will give you all the corresponding Credit's since at the end 90% of the code will be yours. I will try to innovate adding things like Touch (But it consumes also some mAh per hour so battery will drain more) Really glad to find this since it has most of the features that I wanted to achieve. Kind regards from Berlin
Hello Martin, I've no problem with your project. Please do. I'm currently resolving an issue that you can see in the github issues. Hope to resolve it soon. I'm also working on the next version that will have a complete CSS parser. I don't expect this version to be ready before several weeks. There is an InkPlate-6Plus that will have a tactile display in the futur for which I will add the functionality to interact with it. Have fun! On Mon, 2021-03-15 at 08:01 -0700, Martin wrote:
@turgu1 Thanks a lot! Quick question: Would be OK with you if I Form this repository and make a version that supports also another epapers ? I wanted to practice C++ and this days I don't have any client project so I though to invent my own.
I though about analyzing what you did here and replace the rendering part to work also with my Cale-idf epaper component. Currently it supports only Lilygo EPD047 parallel epaper but has also like 10 other monochrome SPI epapers, that are much slower than SPI, but still can be a good target to make an eBook reader for those that do not have an Inkplate. If it's ok with you then I will rename my fork: EPub-epaper
And I will give you all the corresponding Credit's since at the end 90% of the code will be yours. I will try to innovate adding things like Touch (But it consumes also some mAh per hour so battery will drain more)
Really glad to find this since it has most of the features that I wanted to achieve. Kind regards from Berlin
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
Ah great! Nice to hear. If you need some inspiration for the touch, I ported a touch component from Arduino-esp32 to ESP-IDF and currently supports:
https://github.com/martinberlin/FT6X36-IDF
Nice to met you Guy!
Just to let you know that I corrected a bug. A new version has been released: 1.2.1 Cheers! Guy
Very nice project! I'm developing an epaper component for the IDF and I though would be very nice to make an ePub reader that support multiple epapers. But I see you made a great work here so I guess will start using yours.
Tried to compile, my idf version is this one: ESP-IDF v4.2-dev
Or I'm building this wrong and I have to build it using Platformio? Thanks in advance