diff --git a/README.md b/README.md index a46a0e0..69c6076 100644 --- a/README.md +++ b/README.md @@ -305,6 +305,12 @@ if(ESP32) endif() ``` +The checks for system libraries (`libpthread`, `libdl`, `libm`, `librt`) are also activated by changing the line 607 of the `CMakeList.txt` file: + +```cmake +if(UNIX OF ESP32) +``` + The `cmake` command is run, leading to the following errors: @@ -512,7 +518,17 @@ The library is compiled in the `3rdparty/` folder. Copy this folder into the esp ## Adding parallel support -TODO +To add loop parallelization on the 2 cores of the esp32, the following modifications are done: + +* Changed cmake command with `-DWITH_PTHREADS_PF=ON` +* Had to temporary add a pthread_cond usage in the main component for the link to work (otherwise had an *undefined reference to pthread_cond_* functions) + * The pthread_cond implementation is in the esp-idf pthread component. Haven't found yet how to link it +* In `parallel.cpp` function `getNumberOfCPUs`: + * For now, couldn't make `sysconf` function to work (to get the number of cpus), so returns 2 if ESP32 is defined +* In idf menuconfig: + * set pthread default stack size to 8192 + +These modifications haven't improved the performances on the benchmark for now. diff --git a/esp32/lib/opencv/3rdparty/liblibpng.a b/esp32/lib/opencv/3rdparty/liblibpng.a index 3b4a228..bbd0e26 100644 Binary files a/esp32/lib/opencv/3rdparty/liblibpng.a and b/esp32/lib/opencv/3rdparty/liblibpng.a differ diff --git a/esp32/lib/opencv/3rdparty/libzlib.a b/esp32/lib/opencv/3rdparty/libzlib.a index 3694252..b72351d 100644 Binary files a/esp32/lib/opencv/3rdparty/libzlib.a and b/esp32/lib/opencv/3rdparty/libzlib.a differ diff --git a/esp32/lib/opencv/libade.a b/esp32/lib/opencv/libade.a index 71e9cb7..de34352 100644 Binary files a/esp32/lib/opencv/libade.a and b/esp32/lib/opencv/libade.a differ diff --git a/esp32/lib/opencv/libopencv_core.a b/esp32/lib/opencv/libopencv_core.a index bbc433c..e935268 100644 Binary files a/esp32/lib/opencv/libopencv_core.a and b/esp32/lib/opencv/libopencv_core.a differ diff --git a/esp32/lib/opencv/libopencv_imgcodecs.a b/esp32/lib/opencv/libopencv_imgcodecs.a index ed1ae7e..f27a787 100644 Binary files a/esp32/lib/opencv/libopencv_imgcodecs.a and b/esp32/lib/opencv/libopencv_imgcodecs.a differ diff --git a/esp32/lib/opencv/libopencv_imgproc.a b/esp32/lib/opencv/libopencv_imgproc.a index 4e00c01..8822f40 100644 Binary files a/esp32/lib/opencv/libopencv_imgproc.a and b/esp32/lib/opencv/libopencv_imgproc.a differ diff --git a/modules/core/src/parallel.cpp b/modules/core/src/parallel.cpp index dd477a1..2929ffb 100644 --- a/modules/core/src/parallel.cpp +++ b/modules/core/src/parallel.cpp @@ -950,6 +950,10 @@ int cv::getNumberOfCPUs(void) #endif +#if defined(ESP32) + ncpus = 2; // TODO: Only for ESP32D0WD +#endif + return ncpus != 0 ? ncpus : 1; } diff --git a/modules/core/src/parallel_impl.cpp b/modules/core/src/parallel_impl.cpp index 958d7cd..fde8ccf 100644 --- a/modules/core/src/parallel_impl.cpp +++ b/modules/core/src/parallel_impl.cpp @@ -7,13 +7,7 @@ #include "parallel_impl.hpp" #ifdef HAVE_PTHREADS_PF -#ifdef __cplusplus -extern "C" { -#endif #include -#ifdef __cplusplus -} -#endif #include