ESP-ADF and ESP-DSP

User avatar
thefury
Posts: 20
Joined: Thu Sep 05, 2019 5:25 pm

ESP-ADF and ESP-DSP

Postby thefury » Thu Sep 26, 2019 10:53 pm

I've written some custom DSP code into a pipeline and I've run out of CPU time (even splitting across cores) so it would appear I need some optimized instructions to proceed further in my development.

In trying to load up ESP-DSP to see about integrating those optimized functions into my application, I've hit a snag. ESP-DSP doesn't compile as-is in my current setup.

I have tried with the downloaded toolchain (1.22.0-80-g6c4433a) as well as building the toolchain from source. My host system is ubuntu 18.04 and I'm working with a LyraT 4.3 board.

esp-idf version is at v3.3, adf (although unrelated since I'm just trying to build a dsp example outside of ADF for now) is currently v2.0-beta1-47-gdf76962

What version of esp-idf, esp-adf, esp-dsp, and xtensa-esp32-elf should I be using?
  1. build@build:~/esp$ git clone https://github.com/espressif/esp-dsp.git
  2. Cloning into 'esp-dsp'...
  3. remote: Enumerating objects: 83, done.
  4. remote: Counting objects: 100% (83/83), done.
  5. remote: Compressing objects: 100% (49/49), done.
  6. remote: Total 1644 (delta 30), reused 65 (delta 29), pack-reused 1561
  7. Receiving objects: 100% (1644/1644), 340.85 KiB | 1.60 MiB/s, done.
  8. Resolving deltas: 100% (842/842), done.
  9. build@build:~/esp$ cd esp-
  10. esp-adf/ esp-dsp/ esp-idf/
  11. build@build:~/esp$ cd esp-dsp/examples/
  12. basic_math/ dotprod/    fft/        fft_window/ iir/        matrix/
  13. build@build:~/esp$ cd esp-dsp/examples/dotprod/
  14. build@build:~/esp/esp-dsp/examples/dotprod$ ls -al
  15. total 24
  16. drwxr-xr-x 3 build build 4096 Sep 26 18:37 .
  17. drwxr-xr-x 8 build build 4096 Sep 26 18:37 ..
  18. -rw-r--r-- 1 build build  308 Sep 26 18:37 CMakeLists.txt
  19. drwxr-xr-x 2 build build 4096 Sep 26 18:37 main
  20. -rw-r--r-- 1 build build  387 Sep 26 18:37 Makefile
  21. -rw-r--r-- 1 build build 1511 Sep 26 18:37 README.md
  22. build@build:~/esp/esp-dsp/examples/dotprod$ make -j4
  23. DEFCONFIG
  24. #
  25. # configuration written to /home/build/esp/esp-dsp/examples/dotprod/sdkconfig
  26. #
  27. MENUCONFIG
  28.  
  29.  
  30. *** End of the configuration.
  31. *** Execute 'make' to start the build or try 'make help'.
  32.  
  33. GENCONFIG
  34. App "dotprod" version: v1.0
  35. CC build/app_trace/app_trace_util.o
  36. App "dotprod" version: v1.0
  37. CC build/app_update/esp_ota_ops.o
  38. CC build/app_trace/host_file_io.o
  39. CC build/app_trace/app_trace.o
  40. WARNING: Toolchain version is not supported: crosstool-ng-1.22.0-95-ge082013a
  41. Expected to see version: crosstool-ng-1.22.0-80-g6c4433a
  42. Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk.
  43. Python requirements from /home/build/esp/esp-idf/requirements.txt are satisfied.
  44. CC build/app_update/esp_app_desc.o
  45. CXX build/asio/asio/asio/src/asio.o
  46. CC build/app_trace/gcov/gcov_rtio.o
  47. AR build/app_update/libapp_update.a
  48. AR build/aws_iot/libaws_iot.a
  49. CC build/bootloader_support/src/bootloader_flash.o
  50. AR build/app_trace/libapp_trace.a
  51. CC build/bt/bt.o
  52. CC build/bootloader_support/src/flash_qio_mode.o
  53. AR build/bt/libbt.a
  54. CC build/bootloader_support/src/secure_boot_signatures.o
  55. CC build/coap/libcoap/src/address.o
  56. CC build/bootloader_support/src/bootloader_utility.o
  57. CC build/bootloader/bootloader_support/src/bootloader_flash.o
  58. CC build/coap/libcoap/src/async.o
  59. CC build/bootloader/bootloader_support/src/flash_qio_mode.o
  60. CC build/bootloader_support/src/bootloader_common.o
  61. CC build/bootloader/bootloader_support/src/secure_boot_signatures.o
  62. CC build/coap/libcoap/src/block.o
  63. CC build/bootloader/bootloader_support/src/bootloader_init.o
  64. CC build/bootloader_support/src/secure_boot.o
  65. CC build/coap/libcoap/src/coap_time.o
  66. CC build/bootloader_support/src/bootloader_clock.o
  67. CC build/bootloader/bootloader_support/src/bootloader_utility.o
  68. CC build/bootloader_support/src/flash_partitions.o
  69. CC build/coap/libcoap/src/debug.o
  70. CC build/bootloader_support/src/esp_image_format.o
  71. CC build/bootloader/bootloader_support/src/bootloader_common.o
  72. CC build/coap/libcoap/src/encode.o
  73. CC build/bootloader_support/src/bootloader_sha.o
  74. CC build/bootloader/bootloader_support/src/secure_boot.o
  75. CC build/bootloader_support/src/flash_encrypt.o
  76. CC build/bootloader/bootloader_support/src/bootloader_clock.o
  77. CC build/coap/libcoap/src/hashkey.o
  78. CC build/coap/libcoap/src/mem.o
  79. CC build/bootloader/bootloader_support/src/flash_partitions.o
  80. CC build/bootloader/bootloader_support/src/esp_image_format.o
  81. CC build/bootloader_support/src/bootloader_random.o
  82. CC build/coap/libcoap/src/net.o
  83. AR build/bootloader_support/libbootloader_support.a
  84. CC build/coap/libcoap/src/option.o
  85. CC build/bootloader/bootloader_support/src/bootloader_sha.o
  86. CC build/bootloader/bootloader_support/src/flash_encrypt.o
  87. CC build/bootloader/bootloader_support/src/bootloader_random.o
  88. CC build/console/linenoise/linenoise.o
  89. CC build/coap/libcoap/src/pdu.o
  90. AR build/bootloader/bootloader_support/libbootloader_support.a
  91. CC build/bootloader/log/log.o
  92. AR build/bootloader/log/liblog.a
  93. CC build/coap/libcoap/src/resource.o
  94. CC build/bootloader/spi_flash/spi_flash_rom_patch.o
  95. CC build/console/argtable3/argtable3.o
  96. AR build/bootloader/spi_flash/libspi_flash.a
  97. CC build/bootloader/micro-ecc/micro-ecc/uECC.o
  98. CC build/coap/libcoap/src/str.o
  99. CC build/coap/libcoap/src/subscribe.o
  100. CC build/coap/libcoap/src/uri.o
  101. AR build/bootloader/micro-ecc/libmicro-ecc.a
  102. CC build/bootloader/soc/esp32/soc_memory_layout.o
  103. CC build/bootloader/soc/esp32/rtc_pm.o
  104. CC build/console/split_argv.o
  105. CC build/bootloader/soc/esp32/rtc_periph.o
  106. CC build/coap/port/coap_io_socket.o
  107. CC build/bootloader/soc/esp32/cpu_util.o
  108. CC build/console/commands.o
  109. CC build/bootloader/soc/esp32/sdmmc_periph.o
  110. CC build/bootloader/soc/esp32/rtc_wdt.o
  111. AR build/console/libconsole.a
  112. CXX build/cxx/cxx_guards.o
  113. AR build/coap/libcoap.a
  114. CXX build/cxx/cxx_exception_stubs.o
  115. CC build/bootloader/soc/esp32/sdio_slave_periph.o
  116. CC build/bootloader/soc/esp32/rtc_time.o
  117. CC build/bootloader/soc/esp32/spi_periph.o
  118. CC build/bootloader/main/bootloader_start.o
  119. CC build/bootloader/soc/esp32/rtc_init.o
  120. AR build/bootloader/main/libmain.a
  121. CC build/bootloader/soc/esp32/rtc_clk_init.o
  122. CC build/bootloader/efuse/esp32/esp_efuse_table.o
  123. CC build/bootloader/soc/esp32/gpio_periph.o
  124. CC build/bootloader/efuse/src/esp_efuse_api.o
  125. CC build/bootloader/soc/esp32/rtc_sleep.o
  126. CC build/bootloader/efuse/src/esp_efuse_utility.o
  127. CC build/bootloader/soc/esp32/rtc_clk.o
  128. AR build/cxx/libcxx.a
  129. CC build/bootloader/soc/src//memory_layout_utils.o
  130. CC build/bootloader/efuse/src/esp_efuse_fields.o
  131. CC build/driver/spi_master.o
  132. AR build/bootloader/soc/libsoc.a
  133. CC build/driver/sigmadelta.o
  134. AR build/bootloader/efuse/libefuse.a
  135. LD build/bootloader/bootloader.elf
  136. CC build/efuse/esp32/esp_efuse_table.o
  137. AR build/asio/libasio.a
  138. CC build/efuse/src/esp_efuse_api.o
  139. CC build/driver/uart.o
  140. esptool.py v2.8-dev
  141. CC build/driver/sdspi_transaction.o
  142. CC build/efuse/src/esp_efuse_utility.o
  143. CC build/efuse/src/esp_efuse_fields.o
  144. CC build/driver/sdio_slave.o
  145. AR build/efuse/libefuse.a
  146. CC build/esp-tls/esp_tls.o
  147. CC build/esp-dsp/modules/dotprod/float/dsps_dotprod_f32_ansi.o
  148. CC build/esp-dsp/modules/dotprod/float/dsps_dotprode_f32_ansi.o
  149. CC build/esp-dsp/modules/dotprod/fixed/dsps_dotprod_s16_ansi.o
  150. CC build/esp-dsp/modules/matrix/float/dspm_mult_f32_ansi.o
  151. AR build/esp-tls/libesp-tls.a
  152. CC build/driver/i2s.o
  153. CC build/esp-dsp/modules/matrix/fixed/dspm_mult_s16_ansi.o
  154. CC build/driver/periph_ctrl.o
  155. CC build/esp-dsp/modules/math/mulc/float/dsps_mulc_f32_ansi.o
  156. CC build/esp32/panic.o
  157. CC build/esp-dsp/modules/math/addc/float/dsps_addc_f32_ansi.o
  158. CC build/esp-dsp/modules/math/add/float/dsps_add_f32_ansi.o
  159. CC build/esp-dsp/modules/math/mul/float/dsps_mul_f32_ansi.o
  160. CC build/esp_adc_cal/esp_adc_cal.o
  161. CC build/esp-dsp/modules/math/sub/float/dsps_sub_f32_ansi.o
  162. CC build/esp32/esp_adapter.o
  163. CC build/esp-dsp/modules/fft/float/dsps_fft2r_fc32_ansi.o
  164. AR build/esp_adc_cal/libesp_adc_cal.a
  165. CC build/esp32/event_default_handlers.o
  166. CC build/esp-dsp/modules/fft/fixed/dsps_fft2r_sc16_ansi.o
  167. CC build/esp-dsp/modules/support/misc/dsps_tone_gen.o
  168. CC build/driver/ledc.o
  169. CC build/esp32/task_wdt.o
  170. CC build/esp_event/default_event_loop.o
  171. CC build/esp-dsp/modules/support/misc/dsps_h_gen.o
  172. CC build/esp-dsp/modules/support/misc/dsps_d_gen.o
  173. CC build/esp_event/esp_event.o
  174. CC build/esp-dsp/modules/windows/hann/float/dsps_wind_hann_f32.o
  175. CC build/esp32/sleep_modes.o
  176. CC build/esp-dsp/modules/windows/blackman/float/dsps_wind_blackman_f32.o
  177. CC build/esp-dsp/modules/windows/blackman_harris/float/dsps_wind_blackman_harris_f32.o
  178. CC build/esp-dsp/modules/windows/blackman_nuttall/float/dsps_wind_blackman_nuttall_f32.o
  179. CC build/esp-dsp/modules/windows/nuttall/float/dsps_wind_nuttall_f32.o
  180. CC build/driver/spi_common.o
  181. CC build/esp_event/esp_event_private.o
  182. CC build/esp-dsp/modules/windows/flat_top/float/dsps_wind_flat_top_f32.o
  183. CC build/esp-dsp/modules/iir/biquad/dsps_biquad_gen_f32.o
  184. CC build/esp32/dbg_stubs.o
  185. AR build/esp_event/libesp_event.a
  186. CC build/esp-dsp/modules/iir/biquad/dsps_biquad_f32_ansi.o
  187. CC build/esp32/hw_random.o
  188. CC build/esp32/system_api.o
  189. CC build/esp-dsp/modules/fir/float/dsps_fird_f32_ansi.o
  190. CC build/driver/sdspi_host.o
  191. CC build/esp32/cache_sram_mmu.o
  192. CC build/esp-dsp/modules/fir/float/dsps_fird_init_f32.o
  193. CC build/esp-dsp/modules/fir/float/dsps_fir_f32_ansi.o
  194. CC build/esp-dsp/modules/fir/float/dsps_fir_init_f32.o
  195. CXX build/esp-dsp/modules/common/misc/dsps_pwroftwo.o
  196. CC build/esp_http_client/esp_http_client.o
  197. CC build/esp32/gdbstub.o
  198. CXX build/esp-dsp/modules/matrix/mat/mat.o
  199. CC build/driver/gpio.o
  200. CC build/esp32/int_wdt.o
  201. CC build/esp32/dport_access.o
  202. CC build/esp_http_client/lib/http_header.o
  203. /home/build/esp/esp-dsp/modules/matrix/mat/mat.cpp: In static member function 'static dspm::Mat dspm::Mat::bandSolve(dspm::Mat, dspm::Mat, int)':
  204. /home/build/esp/esp-dsp/modules/matrix/mat/mat.cpp:287:37: error: 'abs' is not a member of 'std'
  205.              while ((k < A.cols) && (std::abs(A(j,k)) > abs_tol)) {
  206.                                      ^
  207. /home/build/esp/esp-dsp/modules/matrix/mat/mat.cpp:287:37: note: suggested alternative:
  208. In file included from /home/build/esp/esp-idf/components/newlib/include/wchar.h:4:0,
  209.                  from /home/build/esp/crosstool-NG/builds/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/cwchar:44,
  210.                  from /home/build/esp/crosstool-NG/builds/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/postypes.h:40,
  211.                  from /home/build/esp/crosstool-NG/builds/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/bits/char_traits.h:40,
  212.                  from /home/build/esp/crosstool-NG/builds/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/string:40,
  213.                  from /home/build/esp/crosstool-NG/builds/xtensa-esp32-elf/xtensa-esp32-elf/include/c++/5.2.0/stdexcept:39,
  214.                  from /home/build/esp/esp-dsp/modules/matrix/mat/mat.cpp:15:
  215. /home/build/esp/esp-idf/components/newlib/include/stdlib.h:72:12: note:   'abs'
  216.  int _EXFUN(abs,(int));
  217.             ^
  218. CC build/driver/pcnt.o
  219. CC build/esp32/phy_init.o
  220. /home/build/esp/esp-idf/make/component_wrapper.mk:289: recipe for target 'modules/matrix/mat/mat.o' failed
  221. make[1]: *** [modules/matrix/mat/mat.o] Error 1
  222. /home/build/esp/esp-idf/make/project.mk:552: recipe for target 'component-esp-dsp-build' failed
  223. make: *** [component-esp-dsp-build] Error 2
  224. make: *** Waiting for unfinished jobs....
  225. CC build/driver/sdspi_crc.o
  226. CC build/esp_http_client/lib/http_auth.o
  227. CC build/esp_http_client/lib/http_utils.o
  228. CC build/driver/timer.o
  229. AR build/esp_http_client/libesp_http_client.a
  230. CC build/driver/rmt.o
  231. CC build/esp32/pm_trace.o
  232. CC build/esp32/cache_err_int.o
  233. CC build/driver/mcpwm.o
  234. CC build/esp32/esp_timer_esp32.o
  235. CC build/esp32/spiram_psram.o
  236. CC build/driver/sdmmc_transaction.o
  237. CC build/esp32/cpu_start.o
  238. CC build/esp32/clk.o
  239. CC build/esp32/freertos_hooks.o
  240. CC build/driver/can.o
  241. CC build/esp32/spiram.o
  242. CC build/driver/spi_slave.o
  243. CC build/driver/sdmmc_host.o
  244. CC build/esp32/crosscore_int.o
  245. CC build/esp32/fast_crypto_ops.o
  246. CC build/esp32/lib_printf.o
  247. CC build/esp32/ets_timer_legacy.o
  248. CC build/driver/i2c.o
  249. CC build/driver/rtc_module.o
  250. CC build/esp32/ipc.o
  251. CC build/esp32/intr_alloc.o
  252. CC build/esp32/restore.o
  253. CC build/esp32/reset_reason.o
  254. CC build/esp32/coexist.o
  255. CC build/esp32/pm_locks.o
  256. CC build/esp32/event_loop.o
  257. CC build/esp32/pm_esp32.o
  258. CC build/esp32/esp_err_to_name.o
  259. CC build/esp32/stack_check.o
  260. CC build/esp32/esp_timer.o
  261. CC build/esp32/wifi_init.o
  262. CC build/esp32/esp_himem.o
  263. AR build/driver/libdriver.a
  264. CC build/esp32/brownout.o
  265. CC build/esp32/hwcrypto/sha.o
  266. CC build/esp32/hwcrypto/aes.o
  267. AS build/esp32/dport_panic_highint_hdl.o
  268. AR build/esp32/libesp32.a

Matt141
Posts: 8
Joined: Fri Oct 04, 2019 2:24 pm

Re: ESP-ADF and ESP-DSP

Postby Matt141 » Fri Oct 04, 2019 2:27 pm

I am experiencing the same issue. I use the board lyraT 4.3, ESP-ADF and ESP-DSP and added the dsp component manually with the git clone command.

User avatar
thefury
Posts: 20
Joined: Thu Sep 05, 2019 5:25 pm

Re: ESP-ADF and ESP-DSP

Postby thefury » Mon Oct 07, 2019 10:23 pm

I appear to have found a fix for this particular issue: https://github.com/espressif/esp-dsp/pull/9

If you'd like to try it, you can make the same edit to that file in your local copy, I think.

tamhan
Posts: 8
Joined: Tue May 19, 2020 7:22 pm

Re: ESP-ADF and ESP-DSP

Postby tamhan » Thu May 21, 2020 1:32 pm

Sorry for thread necro. But I had similar issue.

If you have the env var ESP_IDF set, all kind of weird shit happen. For ESP_ADF based project, ONLY ESP_ADF var may be set.

Who is online

Users browsing this forum: No registered users and 37 guests