Edge Impulse Linux -- OpenCV Support (Microchip SAMA7G54) -- Buildroot

Hi,

I’m trying to interface a thermal camera with Microchip SAMA7G54 over USB.
The Python script that interprets the thermal data into images depends on some of the Python packages listed below.

image

I wanted to confirm if the edge impulse pre-built image supports these (mostly for cv2 and numpy). If not, do I need to configure the build root?

Regards,
Pratyush

Any help on this? Please?

Pratyush,

The pre-built image does not have these but you only need to do a few things.

  1. Update the buildroot config file to include OPENCV and NUMPY by setting BR2_PACKAGE_OPENCV3 (or BR2_PACKAGE_OPENCV4) and BR2_PACKAGE_PYTHON_NUMPY from commented out to =y
  2. Enable python support from the make menuconfig options under Interpreter languages and scripting to select them both and then argparse, time, and io should also be available as part of the standard python library support
  3. Rebuild the image

I haven’t tested this deployment but it should work for you, if it doesn’t just let me know and I’ll get back to you quickly, my apologies for not answering sooner!

Best regards,
Brennan

Hi Brennan,

Thanks for the response.
I followed the steps as mentioned and the build fails when trying to compiler for nodejs package, specifically for the openssl package. I have pasted the logs below for reference.

…/…/src/crypto/crypto_util.h:585:29: warning: ‘int ENGINE_free(ENGINE*)’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
585 | CHECK_EQ(ENGINE_free(engine), 1);
| ~^~
…/…/src/util.h:142:44: note: in definition of macro ‘UNLIKELY’
142 | #define UNLIKELY(expr) __builtin_expect(!!(expr), 0)
| ^
~
…/…/src/util.h:160:24: note: in expansion of macro ‘CHECK’
160 | #define CHECK_EQ(a, b) CHECK((a) == (b))
| ^
~~
…/…/src/crypto/crypto_util.h:585:9: note: in expansion of macro ‘CHECK_EQ’
585 | CHECK_EQ(ENGINE_free(engine), 1);
| ^~~~~~~~
…/…/…/…/host/arm-buildroot-linux-gnueabihf/sysroot/usr/include/openssl/engine.h:493:27: note: declared here
493 | OSSL_DEPRECATEDIN_3_0 int ENGINE_free(ENGINE e);
| ^~~~~~~~~~~
…/…/src/crypto/crypto_tls.cc: In member function ‘void node::crypto::TLSWrap::ClearOut()’:
…/…/src/crypto/crypto_tls.cc:820:49: warning: 'const char
ERR_func_error_string(long unsigned int)’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
820 | const char* fs = ERR_func_error_string(ssl_err);
| ~^
In file included from …/…/src/crypto/crypto_util.h:17:
…/…/…/…/host/arm-buildroot-linux-gnueabihf/sysroot/usr/include/openssl/err.h:459:35: note: declared here
459 | OSSL_DEPRECATEDIN_3_0 const char *ERR_func_error_string(unsigned long e);
| ^
~~~~~~~~
[452/2991] CXX obj.host/deps/v8/src/init/v8_init.setup-isolate-full.o
FAILED: obj.host/deps/v8/src/init/v8_init.setup-isolate-full.o
/buildroot-microchip/buildroot-at91/output/host/bin/arm-buildroot-linux-gnueabihf-g++ -MMD -MF obj.host/deps/v8/src/init/v8_init.setup-isolate-full.o.d -D_GLIBCXX_USE_CXX11_ABI=1 -DNODE_OPENSSL_CONF_NAME=nodejs_conf -DICU_NO_USER_DATA_OVERRIDE -DV8_GYP_BUILD -DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64 -D__STDC_FORMAT_MACROS -DV8_TARGET_ARCH_ARM -DCAN_USE_ARMV7_INSTRUCTIONS -DCAN_USE_VFP3_INSTRUCTIONS -DCAN_USE_VFP32DREGS -DV8_HAVE_TARGET_OS -DV8_TARGET_OS_LINUX ‘-DV8_EMBEDDER_STRING=“-node.17”’ -DENABLE_DISASSEMBLER -DV8_PROMISE_INTERNAL_FIELD_COUNT=1 -DV8_ENABLE_PRIVATE_MAPPING_FORK_OPTIMIZATION -DOBJECT_PRINT -DV8_ATOMIC_OBJECT_FIELD_WRITES -DV8_ENABLE_LAZY_SOURCE_POSITIONS -DV8_USE_SIPHASH -DV8_SHARED_RO_HEAP -DV8_WIN64_UNWINDING_INFO -DV8_ENABLE_REGEXP_INTERPRETER_THREADED_DISPATCH -DV8_USE_ZLIB -DV8_ENABLE_TURBOFAN -DV8_ENABLE_WEBASSEMBLY -DV8_ENABLE_JAVASCRIPT_PROMISE_HOOKS -DV8_ALLOCATION_FOLDING -DV8_ALLOCATION_SITE_TRACKING -DV8_ADVANCED_BIGINT_ALGORITHMS -I…/…/deps/v8 -I…/…/deps/v8/include -Iobj.host/gen/generate-bytecode-output-root -Iobj.host/gen -pthread -Wno-unused-parameter -Wno-return-type -fno-strict-aliasing -march=armv7-a -mfpu=vfpv3 -mfloat-abi=hard -marm -O3 -fno-omit-frame-pointer -fdata-sections -ffunction-sections -O3 -fno-rtti -fno-exceptions -std=gnu++17 -c …/…/deps/v8/src/init/setup-isolate-full.cc -o obj.host/deps/v8/src/init/v8_init.setup-isolate-full.o
arm-buildroot-linux-gnueabihf-g++.br_real: fatal error: Killed signal terminated program cc1plus
compilation terminated.
[472/2991] CXX obj.host/deps/v8/src/compiler/turboshaft/v8_turboshaft.optimize-phase.o
ninja: build stopped: subcommand failed.
make[1]: *** [Makefile:149: node] Error 1
make[1]: Leaving directory ‘/buildroot-microchip/buildroot-at91/output/build/nodejs-src-20.11.1’
make: *** [package/pkg-generic.mk:283: /buildroot-microchip/buildroot-at91/output/build/nodejs-src-20.11.1/.stamp_built] Error 2

Pratyush,

What system are you running buildroot from?

fatal error: Killed signal terminated program cc1plus
compilation terminated.

I’ve seen this before when the system runs out of RAM during compilation. How much does your system or VM running buildroot have free before you start the build?

Thanks,
Brennan

I’m running it on windows 11 system.

Regards,
Pratyush

Pratyush,

Can you please monitor your memory utilization during the build to see if you’re potentially running out of memory?

Thanks,
Brennan

Thanks for pointing it out, @dayberry . On Windows, not sure why; the docker used wsl as the backend, and the wsl process would keep hogging ram for no reason.

I eventually switched to the Linux platform and got the image built with all the changes suggested. However, I’m still unable to find the OpenCV package in the images. I tried multiple times with opencv3/4, but nothing got built into the image; I’m not sure why. Also, I didn’t face any errors during rebuilding the image.

Regards,
Pratyush

Pratyush,

Is it possible for you to send your sdcard.img file to me and I’ll test with it before trying my own buildroot image?

I sent you a slack message and maybe the file can be sent through that platform?

Best regards,
Brennan

1 Like