Skip to content

Commit 9ae89db

Browse files
committed
samples: hello_ei: Switch to usage of EI SDK Zephyr module
- Use EI SDK Zephyr module instead of SDK deployed from EI studio, inside zip file. - Assume usage of model deployment in from of Zephyr library, update provided model. - Remove possibility to download zipped model from the web, only local files are supported now. - Update sdk-edge-ai west manifest to download EI SDK v1.82.3 and add EI west extensions commands. Jira: NCSDK-36946 Signed-off-by: Bartosz Meus <bartosz.meus@nordicsemi.no>
1 parent a09a0a1 commit 9ae89db

9 files changed

Lines changed: 47 additions & 243 deletions

File tree

samples/edge_impulse/hello_ei/CMakeLists.txt

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,36 @@ target_include_directories(app PRIVATE
1919
src/include
2020
)
2121

22-
# Add Edge Impulse library as a separate module
23-
add_subdirectory(edge_impulse)
22+
# Enable C linkage for Edge Impulse module (allows calling from C code)
23+
zephyr_compile_definitions(
24+
EI_C_LINKAGE=1
25+
EIDSP_SIGNAL_C_FN_POINTER=1
26+
)
27+
28+
# Suppress warnings generated by Edge Impulse SDK
29+
zephyr_compile_options(
30+
-Wno-double-promotion
31+
-Wno-unused
32+
-Wno-sign-compare
33+
-Wno-maybe-uninitialized
34+
)
35+
36+
# Expand any ${VARIABLES} in the path
37+
string(CONFIGURE ${CONFIG_EDGE_IMPULSE_PATH} CONFIG_EDGE_IMPULSE_PATH)
38+
39+
# Convert relative paths to absolute paths
40+
if(NOT IS_ABSOLUTE ${CONFIG_EDGE_IMPULSE_PATH})
41+
# Using application source directory as base directory for relative path
42+
set(CONFIG_EDGE_IMPULSE_PATH ${APPLICATION_SOURCE_DIR}/${CONFIG_EDGE_IMPULSE_PATH})
43+
endif()
44+
45+
set(FETCH_CONTENT_NAME edge_impulse)
46+
47+
include(FetchContent)
48+
49+
FetchContent_Declare(
50+
${FETCH_CONTENT_NAME}
51+
URL ${CONFIG_EDGE_IMPULSE_PATH}
52+
)
2453

25-
# Link Edge Impulse library to application
26-
target_link_libraries(app PRIVATE edge_impulse)
54+
FetchContent_MakeAvailable(${FETCH_CONTENT_NAME})

samples/edge_impulse/hello_ei/Kconfig

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,11 @@
66

77
mainmenu "Hello Edge Impulse sample application"
88

9-
config EDGE_IMPULSE_URI
10-
string "Edge Impulse library URI"
11-
default 'edge_impulse/nrf_accel_sim-v35.zip'
9+
config EDGE_IMPULSE_PATH
10+
string "Edge Impulse library path"
11+
default 'ei_model_nrf_accel_sim_v39.zip'
1212
help
13-
Specify URI used to access archive with Edge Impulse library.
14-
The library will be downloaded into the build directory. You can specify
15-
more than one URI separated by a semicolon.
16-
Make sure to specify the HTTP API key header as EI_API_KEY_HEADER
17-
variable during build if the HTTP server uses it.
18-
You can also specify the absolute file path of a local file. In that
19-
case, only one URI has to be defined.
13+
Specifies local file path of an archive containing Edge Impulse library.
2014

2115
config EDGE_IMPULSE_DEBUG_MODE
2216
bool "Run Edge Impulse library in debug mode"

samples/edge_impulse/hello_ei/edge_impulse/CMakeLists.ei.template

Lines changed: 0 additions & 81 deletions
This file was deleted.

samples/edge_impulse/hello_ei/edge_impulse/CMakeLists.txt

Lines changed: 0 additions & 146 deletions
This file was deleted.
-4.86 MB
Binary file not shown.
18.3 KB
Binary file not shown.

samples/edge_impulse/hello_ei/prj.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ CONFIG_FP16=n
1616
CONFIG_REQUIRES_FULL_LIBCPP=y
1717
CONFIG_CBPRINTF_FP_SUPPORT=y
1818
CONFIG_FPU=y
19+
20+
# Enable Edge Impulse SDK
21+
CONFIG_EDGE_IMPULSE_SDK=y

samples/edge_impulse/hello_ei/src/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
#include <zephyr/kernel.h>
88
#include <zephyr/logging/log.h>
99

10-
#include "edge-impulse-sdk/dsp/numpy_types.h"
11-
#include "edge-impulse-sdk/classifier/ei_classifier_types.h"
10+
#include <edge-impulse-sdk/dsp/numpy_types.h>
11+
#include <edge-impulse-sdk/classifier/ei_classifier_types.h>
1212

1313
#include "input_data.h"
1414

west.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,11 @@ manifest:
1818
revision: v3.2.0
1919
import: true
2020

21+
- name: edge-impulse-sdk-zephyr
22+
url: https://github.com/edgeimpulse/edge-impulse-sdk-zephyr
23+
path: modules/edge-impulse-sdk-zephyr
24+
revision: v1.82.3
25+
west-commands: west/west-commands.yml
26+
2127
self:
2228
path: edge-ai

0 commit comments

Comments
 (0)