'embeded/i.mx 8m plus'에 해당되는 글 29건

  1. 2023.03.23 rpmsg-lite
  2. 2023.02.23 i.mx8m plus cortex-m7 part.2
  3. 2023.02.23 i.mx8m plus cortex-m7
  4. 2023.02.23 i.mx8m plus win iot 실행
  5. 2023.02.07 i.mx8 tensilica dsp
  6. 2023.02.02 i.mx8m plus win iot
  7. 2021.10.14 imx 8m plus NPU 에러 추적 5
  8. 2021.10.13 i.MX 8M PLUS tensorflow NPU
  9. 2021.10.13 i.MX 8M PLUS
embeded/i.mx 8m plus2023. 3. 23. 10:46

크아.. 볼게 너무 많아 ㅠㅠ

그런데 openAMP가 나오는게 먼가.. 쎄~~~하다 -_-

 

linux / cortex-A / rpmsg <-> rtos or baremetal / cortex-M / rpmsg-lite

 

성능 향상은 openAMP와는 넘사벽일 수도 있는 설정이 존재하고

Core A와 Core B 이기종(heterogeneous) 장치간의 통신을 지원한다.

[링크 : https://github.com/nxp-mcuxpresso/rpmsg-lite]

'embeded > i.mx 8m plus' 카테고리의 다른 글

nxp i.mx8mp win iot part 2  (0) 2023.05.26
nxp i.mx8mp win iot  (0) 2023.05.26
i.mx8m plus cortex-m7 part.2  (0) 2023.02.23
i.mx8m plus cortex-m7  (0) 2023.02.23
i.mx8m plus win iot 실행  (0) 2023.02.23
Posted by 구차니
embeded/i.mx 8m plus2023. 2. 23. 17:41

아래의 경로에서 build_all.sh 을 통해 리눅스에서 빌드를 시도하면 에러가 나는데

./nxp/imx8plus/cortex-m7/SDK_2_13_0_EVK-MMP/boards/evkmimx8mp/demo_apps/hello_world/armgcc$ ./build_all.sh 
CMake Error at /home/falinux/바탕화면/nxp/imx8plus/cortex-m7/SDK_2_13_0_EVK-MIMX8MP/tools/cmake_toolchain_files/armgcc.cmake:16 (MESSAGE):
  ***Please set ARMGCC_DIR in envionment variables***
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/CMakeDetermineSystem.cmake:91 (include)
  CMakeLists.txt:10 (ENABLE_LANGUAGE)

 

아래와 같이 추가해주면 일단 빌드가 문제없이 된다.

$ export ARMGCC_DIR=/usr

 

imx8 SD 카드의 boot 파티션에 release/hello_world.bin 을 복사해서 넣고

아래의 문장을 uboot 에서 따라하면

If the hello_world.bin is made from the debug/release target, which means the binary file will run at TCM, use the following commands to boot:
• fatload mmc 1:1 0x48000000 hello_world.bin;cp.b 0x48000000 0x7e0000 20000;
• bootaux 0x7e0000

출처 : Getting Started with MCUXpresso SDK for EVK-MIMX8MP

 

아래와 같이 /dev/ttyUSB3 포트를 통해서 hello world. 가 출력된다.

 

다만.. 이녀석은 TCM 에서 빌드되어 실행되기로 상정(?)된 파일이기 때문에 리눅스의 sysfs를 통해서 실행하려면

어떤 바이너리를 통해 실행해야 하려나?

b. If the hello_world.bin is made from the ddr_debug/ddr_release target, which means the binary file runs at DRAM, use the following commands:
• fatload mmc 1:1 0x80000000 hello_world.bin
• dcache flush
• bootaux 0x80000000

c. If the hello_world.bin is made from the flash_debug/flash_release target, which means the binary file runs at QSPI/XIP, use the following
commands:
• sf probe
• sf read 0x80000000 0 4
• fatload mmc 1:1 0x80000000 flash.bin
• dcache flush
• sf erase 0 0x100000
• sf write 0x48000000 0 0x100000
• bootaux 0x8000000

Note: If the Linux OS kernel runs together with M7, make sure the correct dtb file is used. This dtb file reserves resources used by M7 and avoids the Linux kernel from configuring them. Use the following command in U-Boot before running the kernel:
setenv fdtfile ‘imx8mp-evk-rpmsg.dtb’

 

 

+

ddr_release / flash_release의 파일을 실행하려고 했을 때

# echo start > /sys/class/remoteproc/remoteproc0/state
[  193.353375] remoteproc remoteproc0: powering up imx-rproc
[  193.359090] remoteproc remoteproc0: Booting fw image hello_world.elf, size 217076
[  193.366735] remoteproc remoteproc0: bad phdr da 0x80000000 mem 0x2a8
[  193.373157] remoteproc remoteproc0: Failed to load program segments: -22
[  193.380092] remoteproc remoteproc0: Boot failed: -22
-sh: echo: write error: Invalid argument
root@imx8mpevk:/lib/firmware# echo -n hello_world.bin > /sys/class/remoteproc/remoteproc0/firmware       
root@imx8mpevk:/lib/firmware# echo start > /sys/class/remoteproc/remoteproc0/state
[  204.092891] remoteproc remoteproc0: powering up imx-rproc
[  204.098514] remoteproc remoteproc0: Image is corrupted (bad magic)
[  204.104760] remoteproc remoteproc0: Boot failed: -22
-sh: echo: write error: Invalid argument

 

relase의 파일을 실행하려 했을 때. 되는거야 안되는거야.. 일단 cortex-m7용 디버그 포트로 출력은 안된다.

# echo -n hello_world.elf > /sys/class/remoteproc/remoteproc0/firmware 
# echo start > /sys/class/remoteproc/remoteproc0/state
[  366.495958] remoteproc remoteproc0: powering up imx-rproc
[  366.501775] remoteproc remoteproc0: Booting fw image hello_world.elf, size 217076

'embeded > i.mx 8m plus' 카테고리의 다른 글

nxp i.mx8mp win iot  (0) 2023.05.26
rpmsg-lite  (0) 2023.03.23
i.mx8m plus cortex-m7  (0) 2023.02.23
i.mx8m plus win iot 실행  (0) 2023.02.23
i.mx8 tensilica dsp  (0) 2023.02.07
Posted by 구차니
embeded/i.mx 8m plus2023. 2. 23. 16:27

아래 링크는 i.mx8m mini용 인듯 하니 imx9mp로 바꾸어서 시도하면 될 듯.

u-boot=> editenv fdt_file
edit: imx8mm-evk-rpmsg.dtb
u-boot=> boot

[링크 : https://community.nxp.com/t5/i-MX-Processors/imx-rpmsg-tty-not-working-on-IMX8M-EVK/m-p/1149859]

 

기본값은 imx8mp-evk.dtb이고 변경할 것은 imx8mp-evk-rpmsg.dtb

u-boot=> pri fdtfile 
fdtfile=imx8mp-evk.dtb


u-boot=> setenv fdtfile imx8mp-evk-rpmsg.dtb
u-boot=> boot

매번 바꾸기 귀찮으면 saveenv 하면 된다.

 

리눅스 에서 rproc 을 통해 MCU를 구동하려고 할 때, 설정된 파일이 존재하지 않으면 일단 아래와 같은 에러가 나고 죽는다.

root@imx8mpevk:/sys/class/remoteproc/remoteproc0# cat firmware 
rproc-imx-rproc-fw
root@imx8mpevk:/sys/class/remoteproc/remoteproc0# echo start > state
[   39.920224] remoteproc remoteproc0: powering up imx-rproc
[   39.925719] remoteproc remoteproc0: Direct firmware load for rproc-imx-rproc-fw failed with error -2
[   39.934945] remoteproc remoteproc0: Falling back to sysfs fallback for: rproc-imx-rproc-fw
[   39.943951] remoteproc remoteproc0: request_firmware failed: -2
[   39.949902] remoteproc remoteproc0: Boot failed: -2
-sh: echo: write error: No such file or directory

 

da request 어쩌구 하는데 powering up을 보면 imx-dsp-rproc

이 경우는 dtb에서 cortex-m7을 살리지 않아 tensilia DSP만 살아있어서 발생하는 에러로 추정.

root@imx8mpevk:/sys/class/remoteproc/remoteproc0# echo start > state
[  659.684024] remoteproc remoteproc0: powering up imx-dsp-rproc
[  659.690141] remoteproc remoteproc0: Booting fw image imx8mp_m7_TCM_rpmsg_lite_pingpong_rtos_linux_rem2
[  659.714561] remoteproc remoteproc0: Registered carveout doesn't fit da request
[  659.721820] remoteproc remoteproc0: Failed to process resources: -12
[  659.728265] remoteproc remoteproc0: Boot failed: -12
-sh: echo: write error: Cannot allocate memory

[링크 : https://community.nxp.com/t5/i-MX-Processors/imx8qmmek-rpmsg-remoteproc-remoteproc-and-rpmsg-fail/m-p/1401590]

 

실행이 되는거 같긴 한데...

디버그 시리얼 쪽으로도 무언가 출력되는게 안보이는데 머가 문제이려나..

그리고 시스템 자체가 멈춘다.. 뭐야.. (LF_v5.10.72-2.2.0_images_IMX8MPEVK)

root@imx8mpevk:/sys/class/remoteproc/remoteproc0# echo imx8mp_m7_TCM_hello_world.elf > firmware 
root@imx8mpevk:/sys/class/remoteproc/remoteproc0# echo start > state
[   48.529889] remoteproc remoteproc0: powering up imx-rproc
[   48.539233] remoteproc remoteproc0: Booting fw image imx8mp_m7_TCM_hello_world.elf, size 152688

 

+

# modprobe imx_rpmsg_pingpong
# modprobe imx_rpmsg_tty
# echo hello > /dev/ttyRPMSG30

[링크 : https://www.embeddedartists.com/wp-content/uploads/2019/03/iMX8M_Working_with_Cortex-M.pdf]

'embeded > i.mx 8m plus' 카테고리의 다른 글

rpmsg-lite  (0) 2023.03.23
i.mx8m plus cortex-m7 part.2  (0) 2023.02.23
i.mx8m plus win iot 실행  (0) 2023.02.23
i.mx8 tensilica dsp  (0) 2023.02.07
i.mx8m plus win iot  (0) 2023.02.02
Posted by 구차니
embeded/i.mx 8m plus2023. 2. 23. 15:01

음.. 하라는대로 했는데 USB 키보드가 인식이 안되서 먼가 해볼수가 없다.

드라이버를 좀더 추가해서 어떻게 해야하려나?

 

일단은 HDMI 연결하면 아래와 같이 먼가 하나 나오고

 

시리얼 포트로는 baudrate가 안 맞는건지 깨진 문자만 나온다.

 

------------------------------------------------------

※ NXP 로그인이 필요한 서비스임.

 

Step 1. 귀찮으니(!) BSP Prebuild Binaries 다운로드

[링크 : https://www.nxp.com/design/software/embedded-software/i-mx-software/windows-10-iot-enterprise-for-i-mx-applications-processors:IMXWIN10IOT]

 

Step 2. 귀찮으니(!) 위의 페이지에서 "i.MX Windows 10 IoT Enterprise Quick Start Guide​" 클릭!

[링크 : https://www.nxp.com/docs/en/quick-reference-guide/IMXWQSG.pdf]

 

Step 3. 귀찮으니(!) Step 2의 내용중 아래의 링크를 클릭하여 CFImager를 다운로드

[링크 : https://www.nxp.com/webapp/Download?colCode=CF_IMAGER]

 

Step 4. 2단계에서 받은 것을 압축해제

 

Step 5. 3 단계에서 받은 파일에서 CFImage.exe를 flash_bootloader.cmd 와 동일 경로상에 복사

 

Step 6. 윈도우에서, 시작 - cmd 로 콘솔 열고, flash_bootloader.cmd 경로에서 아래의 명령어 입력 f: 는 sd 카드 드라이브 이다.

flash_bootloader.cmd /device MX8M_PLUS_EVK /target_drive f:

 

FAT32로 포맷했는데 RAW로 바뀌길래 한번 확인해봐도.. 먼지 알 순 없다.

 

'embeded > i.mx 8m plus' 카테고리의 다른 글

i.mx8m plus cortex-m7 part.2  (0) 2023.02.23
i.mx8m plus cortex-m7  (0) 2023.02.23
i.mx8 tensilica dsp  (0) 2023.02.07
i.mx8m plus win iot  (0) 2023.02.02
imx 8m plus NPU 에러 추적  (5) 2021.10.14
Posted by 구차니
embeded/i.mx 8m plus2023. 2. 7. 14:59

21 page

NatureDSP Library is an extensive library, containing the most commonly used signal processing functions: FFT, FIR, vector, matrix, and common mathematics. API and programing guide is in hifi4_library/doc/NatureDSP_Signal_Library_ Reference_HiFi4.pdf, and performance data is in hifi4_library/doc/ NatureDSP_Signal_Library_Performance_HiFi4.pdf.

[링크 : https://www.nxp.com/docs/en/user-guide/IMX_DSP_USERS_GUIDE.pdf]

[링크 : https://github.com/nxp-imx/imx-audio-framework]

 

tensilica i.MX8M Plus 

[링크 : https://tensilicatools.com/platform/i-mx8mp/]

[링크 : https://tensilicatools.com/download/i-mx-8-hifi-4-sdk/] << 로그인 필요, tensilica 가입 필요

 

NatureDSP Library package is license restricted on the i.MX platform. License authorization is required from the NXP marketing for the users to access the source code.

[링크 : https://community.nxp.com/t5/i-MX-Processors/Where-are-the-NatureDSP-unit-tests/td-p/1577475]

[링크 : https://www.nxp.com/docs/en/user-guide/IMX_DSP_USERS_GUIDE.pdf]

'embeded > i.mx 8m plus' 카테고리의 다른 글

i.mx8m plus cortex-m7  (0) 2023.02.23
i.mx8m plus win iot 실행  (0) 2023.02.23
i.mx8m plus win iot  (0) 2023.02.02
imx 8m plus NPU 에러 추적  (5) 2021.10.14
i.MX 8M PLUS tensorflow NPU  (0) 2021.10.13
Posted by 구차니
embeded/i.mx 8m plus2023. 2. 2. 16:13

윈 IoT 라서 그런가.. 이미지가 4메가 정도 밖에 안하네

저 용량에 윈도우 시스템이 다 들어가는건가? 아니면 NT 커널과 쉘 정도만 들어가는걸까?

 

For i.MX 8M Plus EVK board:
flash_bootloader.cmd /device MX8M_PLUS_EVK> /target_drive <SD card driver letter, for example, f:>

[링크 : https://www.nxp.com/docs/en/quick-reference-guide/IMXWQSG.pdf]

'embeded > i.mx 8m plus' 카테고리의 다른 글

i.mx8m plus win iot 실행  (0) 2023.02.23
i.mx8 tensilica dsp  (0) 2023.02.07
imx 8m plus NPU 에러 추적  (5) 2021.10.14
i.MX 8M PLUS tensorflow NPU  (0) 2021.10.13
i.MX 8M PLUS  (0) 2021.10.13
Posted by 구차니
embeded/i.mx 8m plus2021. 10. 14. 15:57

어떤 라이브러리에서 하나 뒤져보는데 일단 tensorflow 소스에는 없고

file system에서 뒤져보는데 /usr/lib/libovxlib.so.1.1.0 파일에서 발견된다.

후.. 추적은 일단 포기

 

lrwxrwxrwx 1 root root      18 Mar  9  2018 /usr/lib/libovxlib.so.1 -> libovxlib.so.1.1.0
lrwxrwxrwx 1 root root      18 Mar  9  2018 /usr/lib/libovxlib.so.1.1 -> libovxlib.so.1.1.0
-rwxr-xr-x 1 root root 3705768 Mar  9  2018 /usr/lib/libovxlib.so.1.1.0

 

INFO: Loaded model my_model.tflite
INFO: resolved reporter
INFO: Created TensorFlow Lite delegate for NNAPI.
INFO: Use NNAPI acceleration.
WARNING: Operator RESIZE_BILINEAR (v3) refused by NNAPI delegate: Operator refused due performance reasons.
INFO: Applied NNAPI delegate.
W [vsi_nn_op_eltwise_setup:178]Output size mismatch, expect 917504, but got 50176
E [setup_node:448]Setup node[52] PRELU fail
W [vsi_nn_op_eltwise_setup:178]Output size mismatch, expect 917504, but got 50176
E [setup_node:448]Setup node[52] PRELU fail
ERROR: NN API returned error ANEURALNETWORKS_BAD_DATA at line 4151 while running computation.

ERROR: Node number 56 (TfLiteNnapiDelegate) failed to invoke.

ERROR: Failed to invoke tflite!

 

+

coco ssd mobilenet v1 - object detection은 정상적으로 작동한다

# time ./label_image -m 1.tflite -a 1
INFO: Loaded model 1.tflite
INFO: resolved reporter
INFO: Created TensorFlow Lite delegate for NNAPI.
INFO: Use NNAPI acceleration.
WARNING: Operator CUSTOM (v1) refused by NNAPI delegate: Unsupported operation type.
INFO: Applied NNAPI delegate.
INFO: invoked
INFO: average time: 13.178 ms
INFO: 0.00389769: 3 great white shark
INFO: 0.0038741: 2 goldfish

real    0m5.722s
user    0m5.573s
sys     0m0.136s

[링크 : https://www.tensorflow.org/lite/examples/object_detection/overview]

'embeded > i.mx 8m plus' 카테고리의 다른 글

i.mx8m plus win iot 실행  (0) 2023.02.23
i.mx8 tensilica dsp  (0) 2023.02.07
i.mx8m plus win iot  (0) 2023.02.02
i.MX 8M PLUS tensorflow NPU  (0) 2021.10.13
i.MX 8M PLUS  (0) 2021.10.13
Posted by 구차니
embeded/i.mx 8m plus2021. 10. 13. 14:38

LF_v5.10.52-2.1.0_images_IMX8MPEVK.zip 파일을 받아서 이미지를 sd 카드에 굽고

부팅해서 들어가보니 경로가 좀 다르다.

tensorflow 2.5.0 버전이면.. 쓸 수 있는 건가?

# cd /usr/bin/tensorflow-lite-2.5.0/examples
# ./benchmark_model --graph=mobilenet_v1_1.0_224_quant.tflite
STARTING!
Log parameter values verbosely: [0]
Graph: [mobilenet_v1_1.0_224_quant.tflite]
Use VXdelegate : [0]
Loaded model mobilenet_v1_1.0_224_quant.tflite
The input model file size (MB): 4.27635
Initialized session in 1.807ms.
Running benchmark for at least 1 iterations and at least 0.5 seconds but terminate if exceeding 150 seconds.
count=4 first=167959 curr=162606 min=162606 max=167959 avg=164253 std=2159

Running benchmark for at least 50 iterations and at least 1 seconds but terminate if exceeding 150 seconds.
count=50 first=162727 curr=163003 min=162308 max=163308 avg=162758 std=190

Inference timings in us: Init: 1807, First inference: 167959, Warmup (avg): 164253, Inference (avg): 162758
Note: as the benchmark tool itself affects memory footprint, the following is only APPROXIMATE to the actual memory footprint of the model at runtime. Take the information at your discretion.
Peak memory footprint (MB): init=2.51562 overall=8.64062

# ./benchmark_model --graph=mobilenet_v1_1.0_224_quant.tflite --use_nnapi=true
STARTING!
Log parameter values verbosely: [0]
Graph: [mobilenet_v1_1.0_224_quant.tflite]
Use NNAPI: [1]
NNAPI accelerators available: [vsi-npu]
Use VXdelegate : [0]
Loaded model mobilenet_v1_1.0_224_quant.tflite
INFO: Created TensorFlow Lite delegate for NNAPI.
Explicitly applied NNAPI delegate, and the model graph will be completely executed by the delegate.
The input model file size (MB): 4.27635
Initialized session in 4.183ms.
Running benchmark for at least 1 iterations and at least 0.5 seconds but terminate if exceeding 150 seconds.
count=1 curr=4649626

Running benchmark for at least 50 iterations and at least 1 seconds but terminate if exceeding 150 seconds.
count=360 first=2665 curr=2733 min=2632 max=2783 avg=2715.67 std=16

Inference timings in us: Init: 4183, First inference: 4649626, Warmup (avg): 4.64963e+06, Inference (avg): 2715.67
Note: as the benchmark tool itself affects memory footprint, the following is only APPROXIMATE to the actual memory footprint of the model at runtime. Take the information at your discretion.
Peak memory footprint (MB): init=2.59766 overall=30.1836

 

label_image로 해보면.. warm up이 먼진 모르겠지만 invoke() 함수 자체는 짧게 걸리는데

그 이전에 먼가 하는게 오래 걸리는지 cpu만으로 돌리는 것 보다 4초 이상 오래 걸린다.

# time ./label_image -w 1
INFO: Loaded model ./mobilenet_v1_1.0_224_quant.tflite
INFO: resolved reporter
INFO: invoked
INFO: average time: 43.865 ms
INFO: 0.764706: 653 military uniform
INFO: 0.121569: 907 Windsor tie
INFO: 0.0156863: 458 bow tie
INFO: 0.0117647: 466 bulletproof vest
INFO: 0.00784314: 835 suit

real    0m0.142s
user    0m0.385s
sys     0m0.020s

# time ./label_image -w 1 -a 1
INFO: Loaded model ./mobilenet_v1_1.0_224_quant.tflite
INFO: resolved reporter
INFO: Created TensorFlow Lite delegate for NNAPI.
INFO: Use NNAPI acceleration.
INFO: Applied NNAPI delegate.
INFO: invoked
INFO: average time: 2.797 ms
INFO: 0.768627: 653 military uniform
INFO: 0.105882: 907 Windsor tie
INFO: 0.0196078: 458 bow tie
INFO: 0.0117647: 466 bulletproof vest
INFO: 0.00784314: 835 suit

real    0m4.748s
user    0m4.648s
sys     0m0.092s

 

아래는 2.1.0 버전에 맞춰서 한 구버전 문서 내용 인 듯.

$ cd /usr/bin/tensorflow-lite-2.1.0/examples
$ ./benchmark_model --graph=mobilenet_v1_1.0_224_quant.tflite
$: ./benchmark_model --graph=mobilenet_v1_1.0_224_quant.tflite --use_nnapi=true

./lbl_img -i grace_hopper.bmp -l labels.txt -w 1
./lbl_img -i grace_hopper.bmp -l labels.txt -w 1 -a 1

[링크 : https://www.mouser.com/pdfDocs/AN12964.pdf]

 

 

+

망할 놈(?)들 도움말이랑 다르잖아?!

# ./label_image --help
ERROR: usage: ./label_image <flags>
Flags:
        --num_threads=1                 int32   optional        number of threads used for inference on CPU.
        --max_delegated_partitions=0    int32   optional        Max number of partitions to be delegated.
        --min_nodes_per_partition=0     int32   optional        The minimal number of TFLite graph nodes of a partition that has to be reached for it to be delegated.A negative value or 0 means to use the default choice of each delegate.
        --num_threads=1                 int32   optional        number of threads used for inference on CPU.
        --max_delegated_partitions=0    int32   optional        Max number of partitions to be delegated.
        --min_nodes_per_partition=0     int32   optional        The minimal number of TFLite graph nodes of a partition that has to be reached for it to be delegated.A negative value or 0 means to use the default choice of each delegate.
        --use_xnnpack=false             bool    optional        use XNNPack
        --use_nnapi=false               bool    optional        use nnapi delegate api
        --nnapi_execution_preference=   string  optional        execution preference for nnapi delegate. Should be one of the following: fast_single_answer, sustained_speed, low_power, undefined
        --nnapi_execution_priority=     string  optional        The model execution priority in nnapi, and it should be one of the following: default, low, medium and high. This requires Android 11+.
        --nnapi_accelerator_name=       string  optional        the name of the nnapi accelerator to use (requires Android Q+)
        --disable_nnapi_cpu=true        bool    optional        Disable the NNAPI CPU device
        --nnapi_allow_fp16=false        bool    optional        Allow fp32 computation to be run in fp16

 

    static struct option long_options[] = {
        {"accelerated", required_argument, nullptr, 'a'},
        {"allow_fp16", required_argument, nullptr, 'f'},
        {"count", required_argument, nullptr, 'c'},
        {"verbose", required_argument, nullptr, 'v'},
        {"image", required_argument, nullptr, 'i'},
        {"labels", required_argument, nullptr, 'l'},
        {"tflite_model", required_argument, nullptr, 'm'},
        {"profiling", required_argument, nullptr, 'p'},
        {"threads", required_argument, nullptr, 't'},
        {"input_mean", required_argument, nullptr, 'b'},
        {"input_std", required_argument, nullptr, 's'},
        {"num_results", required_argument, nullptr, 'r'},
        {"max_profiling_buffer_entries", required_argument, nullptr, 'e'},
        {"warmup_runs", required_argument, nullptr, 'w'},
        {"gl_backend", required_argument, nullptr, 'g'},
        {"hexagon_delegate", required_argument, nullptr, 'j'},
        {"xnnpack_delegate", required_argument, nullptr, 'x'},
        {nullptr, 0, nullptr, 0}};

[링크 : https://github.com/tensorflow/tensorflow/blob/v2.5.0/tensorflow/lite/examples/label_image/label_image.cc]

 

+

그러면.. 어떤식으로 라이브러리를 빌드해서 저게 가능해진거지?

# ldd label_image
        linux-vdso.so.1 (0x0000ffffa0989000)
        libtensorflow-lite.so.2.5.0 => /usr/lib/libtensorflow-lite.so.2.5.0 (0x0000ffffa05ab000)
        libm.so.6 => /lib/libm.so.6 (0x0000ffffa0501000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x0000ffffa032a000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x0000ffffa0305000)
        libc.so.6 => /lib/libc.so.6 (0x0000ffffa0190000)
        /lib/ld-linux-aarch64.so.1 (0x0000ffffa0957000)
        libtim-vx.so => /usr/lib/libtim-vx.so (0x0000ffffa00c7000)
        libdl.so.2 => /lib/libdl.so.2 (0x0000ffffa00b1000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x0000ffffa0082000)
        librt.so.1 => /lib/librt.so.1 (0x0000ffffa006a000)
        libovxlib.so.1.1.0 => /usr/lib/libovxlib.so.1.1.0 (0x0000ffff9fcd1000)
        libOpenVX.so.1 => /usr/lib/libOpenVX.so.1 (0x0000ffff9fa7e000)
        libVSC.so => /usr/lib/libVSC.so (0x0000ffff9eae2000)
        libGAL.so => /usr/lib/libGAL.so (0x0000ffff9e91b000)
        libArchModelSw.so => /usr/lib/libArchModelSw.so (0x0000ffff9e8f3000)
        libNNArchPerf.so => /usr/lib/libNNArchPerf.so (0x0000ffff9e8d0000)

 

 

+

PRELU 연산자 자체는 지원하는 것 같은데 output size mistach가 원인인가?

INFO: Use NNAPI acceleration.
WARNING: Operator RESIZE_BILINEAR (v3) refused by NNAPI delegate: Operator refused due performance reasons.
INFO: Applied NNAPI delegate.
W [vsi_nn_op_eltwise_setup:178]Output size mismatch, expect 917504, but got 50176
E [setup_node:448]Setup node[52] PRELU fail
W [vsi_nn_op_eltwise_setup:178]Output size mismatch, expect 917504, but got 50176
E [setup_node:448]Setup node[52] PRELU fail
ERROR: NN API returned error ANEURALNETWORKS_BAD_DATA at line 4151 while running computation.

ERROR: Node number 56 (TfLiteNnapiDelegate) failed to invoke.

ERROR: Failed to invoke tflite!

[링크 : https://www.nxp.com/docs/en/user-guide/IMX-MACHINE-LEARNING-UG.pdf]

 

 

+

warm up은 코드상으로 1회 invoke 하는 것인데 해당 작업이 4649ms 정도 소요되며

warm up 없이 1회 실행하면 대략 그 정도 시간이 소요된다.

root@imx8mpevk:/usr/bin/tensorflow-lite-2.5.0/examples# time ./label_image -a 1 -w 0 -p 1 -c 1
INFO: Loaded model ./mobilenet_v1_1.0_224_quant.tflite
INFO: resolved reporter
INFO: Created TensorFlow Lite delegate for NNAPI.
INFO: Use NNAPI acceleration.
INFO: Applied NNAPI delegate.
INFO: invoked
INFO: average time: 4649.78 ms
INFO: 0.768627: 653 military uniform
INFO: 0.105882: 907 Windsor tie
INFO: 0.0196078: 458 bow tie
INFO: 0.0117647: 466 bulletproof vest
INFO: 0.00784314: 835 suit

real    0m4.757s
user    0m4.655s
sys     0m0.096s
root@imx8mpevk:/usr/bin/tensorflow-lite-2.5.0/examples# time ./label_image -a 1 -w 0 -p 1 -c 4
INFO: Loaded model ./mobilenet_v1_1.0_224_quant.tflite
INFO: resolved reporter
INFO: Created TensorFlow Lite delegate for NNAPI.
INFO: Use NNAPI acceleration.
INFO: Applied NNAPI delegate.
INFO: invoked
INFO: average time: 1164.36 ms
INFO: 0.768627: 653 military uniform
INFO: 0.105882: 907 Windsor tie
INFO: 0.0196078: 458 bow tie
INFO: 0.0117647: 466 bulletproof vest
INFO: 0.00784314: 835 suit

real    0m4.768s
user    0m4.663s
sys     0m0.092s
root@imx8mpevk:/usr/bin/tensorflow-lite-2.5.0/examples# time ./label_image -a 1 -w 0 -p 1 -c 10000
INFO: Loaded model ./mobilenet_v1_1.0_224_quant.tflite
INFO: resolved reporter
INFO: Created TensorFlow Lite delegate for NNAPI.
INFO: Use NNAPI acceleration.
INFO: Applied NNAPI delegate.
INFO: invoked
INFO: average time: 3.30189 ms
INFO: 0.768627: 653 military uniform
INFO: 0.105882: 907 Windsor tie
INFO: 0.0196078: 458 bow tie
INFO: 0.0117647: 466 bulletproof vest
INFO: 0.00784314: 835 suit

real    0m33.128s
user    0m7.516s
sys     0m1.590s

 

openVX를 통해 처리하는 것 같은데 처음 처리하면 그래프 처리 결과를 스토리지에 저장한다고.

11.3 Hardware accelerators warmup time
For both Arm NN and TensorFlow Lite, the initial execution of model inference takes longer time, because of the model graph initialization needed by the GPU/NPU hardware accelerator. The initialization phase is known as warmup. This time duration can be decreased for subsequent application that runs by storing on disk the information resulted from the initial OpenVX graph processing. The following environment variables should be used for this purpose:
VIV_VX_ENABLE_CACHE_GRAPH_BINARY: flag to enable/disable OpenVX graph caching
VIV_VX_CACHE_BINARY_GRAPH_DIR: set location of the cached information on disk
For example, set these variables on the console in this way:
export VIV_VX_ENABLE_CACHE_GRAPH_BINARY="1"
export VIV_VX_CACHE_BINARY_GRAPH_DIR=`pwd`

[링크 : https://www.nxp.com/docs/en/user-guide/IMX-MACHINE-LEARNING-UG.pdf]

'embeded > i.mx 8m plus' 카테고리의 다른 글

i.mx8m plus win iot 실행  (0) 2023.02.23
i.mx8 tensilica dsp  (0) 2023.02.07
i.mx8m plus win iot  (0) 2023.02.02
imx 8m plus NPU 에러 추적  (5) 2021.10.14
i.MX 8M PLUS  (0) 2021.10.13
Posted by 구차니
embeded/i.mx 8m plus2021. 10. 13. 11:44

오잉? 저번에 볼 땐 8M PLUS에는 cortex-M 계열 없었던 것 같은데?!?!

[링크 : https://www.nxp.com/products/processors-and-microcontrollers/arm-processors/i-mx-applications-processors/i-mx-8-processors/i-mx-8m-plus-arm-cortex-a53-machine-learning-vision-multimedia-and-industrial-iot:IMX8MPLUS]

 

음.. 그냥 내 눈이 삐꾸인걸로 -_ㅠ

[링크 : https://www.nxp.com/products/processors-and-microcontrollers/arm-processors/i-mx-applications-processors/i-mx-8-processors:IMX8-SERIES]

 

아무튼 회사에 굴러(?) 다니는 이 녀석 사용해보려니

헐.. 무슨 디버그 포트가 이렇게 많이 인식 돼? 일단 나의 경우에는 리눅스가 COM27로 연결되었다.

[링크 : https://www.nxp.com/design/development-boards/i-mx-evaluation-and-development-boards/evaluation-kit-for-the-i-mx-8m-plus-applications-processor:8MPLUSLPD4-EVK]

 

패키지에 들어있던 종이 쪼가리구만 -_-

첫째랑 둘째는 누구꺼냐!?

Four UART connections will appear on the PC, the third port for the Cortex-A53 core and the fourth for Cortex-M7 core system debugging.

[링크 : https://www.nxp.com/docs/en/quick-reference-guide/8MPLUSEVKQSG.pdf]

 

Proejct - Tutorial에 Machine Learning

[링크 : https://www.nxp.com/document/guide/getting-started-with-the-i-mx-8m-plus-evk:GS-iMX-8M-Plus-EVK]

 

i.MX 8M PLUS 에는 전체 기능을 다 지원하는데

NPU를 써볼려면 eIQ를 이용해서 먼가 짓을 해야 하는 것 같고.

Cortex-M7도 있으니 (standalone 혹은 collaborative 하게 작동이 가능하다고) 이걸 이용해서 일종의 가속기화 하려나?

 

TFLite

[링크 : https://www.nxp.com/design/software/development-software/eiq-ml-development-environment/eiq-inference-with-tensorflow-lite:eIQTensorFlowLite]

 

TFLite for MCU

[링크 : https://www.nxp.com/design/software/development-software/eiq-ml-development-environment/eiq-inference-with-tensorflow-lite-micro:EIQ-TFLITE-MICRO]

 

위에서 다운로드 링크 누르니 이상한데(?)로 보내버리네

[링크 : https://mcuxpresso.nxp.com/en/welcome] cortex-M7 쓰려면 이게 필요한 듯. 이클립스 기반?

[링크 : https://source.codeaurora.org/external/imx/imx-manifest]

 

오오 i.MX 8M Plus!!

Cortex-A / GPU / NPU 오오오...

[링크 : https://www.nxp.com/docs/en/user-guide/IMX-MACHINE-LEARNING-UG.pdf]

 

 

+

이미지 받아보니 아래와 같이 구성되어 있다.

귀찮으면 fsl-image-validation-imx-imx8mmevk.sdcard 를 sd에 구워서 켜보면 될 듯.

 

imx_m4_demos에는 bin 파일이 있는데 이건 어떻게 올려서 쓰려나?

 

MCUXpresso 안쓰면 uboot에서 해당 파일을 직접 sd에 넣어 실행하는 수 밖에 없나?

4.2 Run applications using U-Boot

This section describes how to run applications using an SD card and pre-built U-Boot image for i.MX processor.
  1. Following the steps from section 2—Embedded Linux of this Getting Started guide, prepare an SD card with a pre-built U-Boot + Linux image from the Linux BSP package for the i.MX 8M Plus processor. If you have already loaded the SD card with a Linux image, you can skip this step.
  2. Insert the SD card in the host computer (Linux or Windows) and copy the application image (for example hello_world.bin) to the FAT partition of the SD card.
  3. Safely remove the SD card from the PC.
  4. Insert the SD card to the target board. Make sure to use the default boot SD slot and double check the Boot switch setup.
  5. Connect the DEBUG UART connector on the board to the PC through USB cable. The Windows OS installs the USB driver automatically, and the Ubuntu OS will find the serial devices as well.
    See Connect USB debug cable section in Out of box for more instructions on serial communication applications.
  6. Open a second terminal on the i.MX8M Plus EVK board’s second enumerated serial port. This is the Cortex®-M7’s serial console. Set the speed to 115200 bit/s, data bits 8, 1 stop bit (115200, 8N1), no parity.
  7. Power up the board and stop the boot process by pressing any key before the U-Boot countdown reaches zero. At the U-Boot prompt on the first terminal, type the following commands.
    => fatload mmc 0:1 0x48000000 hello_world.bin
    => cp.b 0x48000000 0x7e0000 0x20000
    => bootaux 0x7e0000
    These commands copy the image file from the first partition of the SD card into the Cortex®-M7’s TCM and releases the Cortex®-M7 from reset.

 

 

리눅스에서 /sys 등으로 접근할 순 없나?

wic 파일을 win32diskimager로 구우면 되려나?

[링크 : https://www.nxp.com/docs/en/user-guide/IMX_LINUX_USERS_GUIDE.pdf]

[링크 : https://www.nxp.com/part/8MPLUSLPD4-EVK#/]

 

MCUXpresso 로 imx8m quad 선택해서 빌드한다?

[링크 : https://www.embeddedartists.com/wp-content/uploads/2019/03/iMX8M_Working_with_Cortex-M.pdf]

'embeded > i.mx 8m plus' 카테고리의 다른 글

i.mx8m plus win iot 실행  (0) 2023.02.23
i.mx8 tensilica dsp  (0) 2023.02.07
i.mx8m plus win iot  (0) 2023.02.02
imx 8m plus NPU 에러 추적  (5) 2021.10.14
i.MX 8M PLUS tensorflow NPU  (0) 2021.10.13
Posted by 구차니