embeded/raspberry pi2021. 11. 17. 23:35

빠르긴 한데

터미널도 없어진건가?!

 

$ sudo fdisk /dev/sda -l
Disk /dev/sda: 1.9 GiB, 1977614336 bytes, 3862528 sectors
Disk model: SD  Transcend
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xdd604128

Device     Boot Start    End Sectors Size Id Type
/dev/sda1  *        1  32768   32768  16M  c W95 FAT32 (LBA)
/dev/sda2       32769 163840  131072  64M 83 Linux

 

$ ls -al /mnt
total 5462
drwxr-xr-x  3 root root   16384 Jan  1  1970  .
drwxr-xr-x 21 root root    4096 Aug 20  2020  ..
-rwxr-xr-x  1 root root   52296 Nov 16 17:32  bootcode.bin
-rwxr-xr-x  1 root root      65 Nov 16 17:32  cmdline.txt
-rwxr-xr-x  1 root root     199 Nov 16 17:32  config.txt
-rwxr-xr-x  1 root root 2869636 Nov 16 17:32  start.elf
drwxr-xr-x  2 root root    2048 Nov 17  2021 'System Volume Information'
-rwxr-xr-x  1 root root 2641736 Nov 16 17:32  zImagen

$ cat /mnt/config.txt
#---> Boot
kernel=zImagen
disable_overscan=1
boot_delay=0
enable_uart=1
disable_splash=1

#--> OverClock
#sdram_freq=700
#initial_turbo=1
#force_turbo=1
#over_voltage=6
#arm_freq=1400
#core_freq=600

$ cat /mnt/cmdline.txt
root=/dev/mmcblk0p2 rootwait console=tty1 console=ttyAMA0,115200

 

/mnt/etc $ cat inittab
# /etc/inittab
#
# Copyright (C) 2001 Erik Andersen <andersen@codepoet.org>
#
# Note: BusyBox init doesn't support runlevels.  The runlevels field is
# completely ignored by BusyBox init. If you want runlevels, use
# sysvinit.
#
# Format for each entry: <id>:<runlevels>:<action>:<process>
#
# id        == tty to run on, or empty for /dev/console
# runlevels == ignored
# action    == one of sysinit, respawn, askfirst, wait, and once
# process   == program to run

# Startup the system
::sysinit:/bin/mount -t proc proc /proc
::sysinit:/bin/mount -o remount,rw /
::sysinit:/bin/mkdir -p /dev/pts /dev/shm
::sysinit:/bin/mount -a
::sysinit:/sbin/swapon -a
null::sysinit:/bin/ln -sf /proc/self/fd /dev/fd
null::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin
null::sysinit:/bin/ln -sf /proc/self/fd/1 /dev/stdout
null::sysinit:/bin/ln -sf /proc/self/fd/2 /dev/stderr
::sysinit:/bin/hostname -F /etc/hostname
# now run any rc scripts
::sysinit:/etc/init.d/rcS

# Put a getty on the serial port
console::respawn:/sbin/getty -L  console 0 vt100 # GENERIC_SERIAL

# Stuff to do for the 3-finger salute
#::ctrlaltdel:/sbin/reboot

# Stuff to do before rebooting
::shutdown:/etc/init.d/rcK
::shutdown:/sbin/swapoff -a
::shutdown:/bin/umount -a -r

/mnt/etc/init.d $ ls -al
total 9
drwxr-xr-x 2 root root 1024 Nov 16 08:01 .
drwxr-xr-x 5 root root 1024 Jan  1  1970 ..
-rwxr-xr-x 1 root root  423 Nov 16 08:26 rcK
-rwxr-xr-x 1 root root  408 Nov 16 08:26 rcS
-rwxr-xr-x 1 root root 1012 Nov 16 08:26 S01syslogd
-rwxr-xr-x 1 root root 1004 Nov 16 08:26 S02klogd
-rwxr-xr-x 1 root root 1272 Nov 16 08:26 S20urandom
-rwxr-xr-x 1 root root   54 Nov 16 08:01 S21ftDev


/mnt/etc/init.d $ cat rcS
#!/bin/sh


# Start all init scripts in /etc/init.d
# executing them in numerical order.
#
for i in /etc/init.d/S??* ;do

     # Ignore dangling symlinks (if any).
     [ ! -f "$i" ] && continue

     case "$i" in
        *.sh)
            # Source shell script for speed.
            (
                trap - INT QUIT TSTP
                set start
                . $i
            )
            ;;
        *)
            # No sh extension, so fork subprocess.
            $i start
            ;;
    esac
done

pi@raspberrypi:/mnt/etc/init.d $ cat S21ftDev
#! /bin/sh

/root/QmlTestApplication --platform eglfs

/mnt $ sudo ls -al root
total 17151
drwx------  2 root root     1024 Nov 16 08:01 .
drwxr-xr-x 19 root root     1024 Jan  1  1970 ..
-rwxr-xr-x  1 root root 17710284 Nov 16 08:01 QmlTestApplication


/mnt $ sudo file root/QmlTestApplication
root/QmlTestApplication: ELF 32-bit LSB executable, ARM, EABI5 version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 4.14.0, stripped

'embeded > raspberry pi' 카테고리의 다른 글

rpi 3b 2초 부팅 fs  (0) 2021.11.20
img 파일 마운트 하기  (0) 2021.11.20
라즈베리 피코 USB HID 키코드  (0) 2021.11.16
라즈베리 파이 피코 한글 키 입력?  (0) 2021.11.16
rpi pico usb sound  (0) 2021.11.08
Posted by 구차니
embeded/raspberry pi2021. 11. 16. 16:39

일단 테스트 해보니.. Keycode.LEFT_ARROW 하니 ctrl+shift+left_arrow 하듯 작동한다.

ascii 문자열로 출력하는 거라 방향키를 넣을 방법은 라이브러리를 수정하기 전에는 불가능 할 듯.

 

    PRINT_SCREEN = 0x46
    """Print Screen (SysRq)"""
    SCROLL_LOCK = 0x47
    """Scroll Lock"""
    PAUSE = 0x48
    """Pause (Break)"""

    INSERT = 0x49
    """Insert"""
    HOME = 0x4A
    """Home (often moves to beginning of line)"""
    PAGE_UP = 0x4B
    """Go back one page"""
    DELETE = 0x4C
    """Delete forward"""
    END = 0x4D
    """End (often moves to end of line)"""
    PAGE_DOWN = 0x4E
    """Go forward one page"""

    RIGHT_ARROW = 0x4F
    """Move the cursor right"""
    LEFT_ARROW = 0x50
    """Move the cursor left"""
    DOWN_ARROW = 0x51
    """Move the cursor down"""
    UP_ARROW = 0x52
    """Move the cursor up"""

[링크 : https://circuitpython.readthedocs.io/projects/hid/en/latest/_modules/adafruit_hid/keycode.html]

'embeded > raspberry pi' 카테고리의 다른 글

img 파일 마운트 하기  (0) 2021.11.20
rpi 3b 2초 부팅 이미지 테스트  (0) 2021.11.17
라즈베리 파이 피코 한글 키 입력?  (0) 2021.11.16
rpi pico usb sound  (0) 2021.11.08
rpi3 2초만에 부팅하기  (0) 2021.10.30
Posted by 구차니
embeded/raspberry pi2021. 11. 16. 16:31

예제 코드를 보다보니 layout 어쩌구 나와서

from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS

 

소스를 뒤져보는데 흐음...

        b"\x04"  # a
        b"\x05"  # b
        b"\x06"  # c
        b"\x07"  # d
        b"\x08"  # e

[링크 : https://github.com/adafruit/Adafruit_CircuitPython_HID/blob/main/adafruit_hid/keyboard_layout_us.py]

 

걍 한영키 눌러 놓고 아래와 같이 입력하도록 해두니 잘 된다.

"동해물과 백두산이 마르고 딿도록" (딿은 의도적으로 쌍디귿 나오게 하려고 입력한 값)

keys_pressed = ["ehdgoanfrhk qorentksdl akfmrh Ekfgehfhr"]

 

한글 키보드라고 해도.. 키코드는 별개의 문제였구나..

'embeded > raspberry pi' 카테고리의 다른 글

rpi 3b 2초 부팅 이미지 테스트  (0) 2021.11.17
라즈베리 피코 USB HID 키코드  (0) 2021.11.16
rpi pico usb sound  (0) 2021.11.08
rpi3 2초만에 부팅하기  (0) 2021.10.30
rpi 4는 USB to Ethernet이 아닌가?  (0) 2021.09.29
Posted by 구차니
embeded/raspberry pi2021. 11. 8. 15:41

라즈베리 파이 pico의 GPIO를 이용하여

MEMS 마이크의 PDM 출력을 이용해 PDM을 PCM으로 변환하고(openPDM2PCM)

USB device 장치로 인식시켜 사운드 카드로 만드는 프로젝트

 

걍 ADC로 하는건 없나?

 

[링크 : https://www.hackster.io/sandeep-mistry/create-a-usb-microphone-with-the-raspberry-pi-pico-cc9bd5]

[링크 : https://github.com/ArmDeveloperEcosystem/microphone-library-for-pico]

'embeded > raspberry pi' 카테고리의 다른 글

라즈베리 피코 USB HID 키코드  (0) 2021.11.16
라즈베리 파이 피코 한글 키 입력?  (0) 2021.11.16
rpi3 2초만에 부팅하기  (0) 2021.10.30
rpi 4는 USB to Ethernet이 아닌가?  (0) 2021.09.29
rpi zero otg  (0) 2021.09.27
Posted by 구차니
embeded/FPGA - ALTERA2021. 11. 1. 15:11

altera/intel fpga의 soft mcu가 risc-v 채택해서 nios V로 제공되는데

[링크 : https://www.intel.com/content/www/us/en/products/details/fpga/nios-processor/v.html]

 

하드웨어 요구사항이 높네.. 아쉽게도 내가 가징 de0-nano의 cyclone IV로는 무리인듯.

2.1. Hardware and Software Requirements

Intel uses the following hardware and software to build a Nios® V/m processor system:
  • Supported Intel FPGA devices:
    • Intel® Cyclone® 10 GX
    • Intel® Arria® 10
    • Intel® Stratix® 10
    • Intel® Agilex™
  • Intel® Quartus® Prime Pro Edition software version 21.3 or later

[링크 : https://www.intel.com/content/www/us/en/programmable/documentation/jmv1629188568604.html]

'embeded > FPGA - ALTERA' 카테고리의 다른 글

altera - partial reconfigure  (0) 2023.04.24
altera nios 2 epcs to ram  (0) 2023.03.28
IOFS - Intel Open FPGA Stack  (0) 2021.07.06
oneAPI Quartus pro 필요?  (0) 2021.04.06
cyclone V openCL?  (0) 2021.03.26
Posted by 구차니
embeded/raspberry pi2021. 10. 30. 07:38

buildroot를 손본 것 같은데 한번 시도해볼까?

[링크 : https://www.tomshardware.com/news/raspberry-pi-3-2-second-boot-time]

[링크 : https://github.com/furkantokac/buildroot]

 

+

21.11.16

빌드하는데 30분! 이미지는 81MB로 무지 작다.

sdcard.img:          DOS/MBR boot sector; partition 1 : ID=0xc, active, start-CHS (0x0,0,2), end-CHS (0x2,10,9), startsector 1, 32768 sectors; partition 2 : ID=0x83, start-CHS (0x2,10,10), end-CHS (0xa,50,41), startsector 32769, 131072 sectors

-rw-r--r-- 1 falinux falinux  81M 11월 16 17:32 sdcard.img

'embeded > raspberry pi' 카테고리의 다른 글

라즈베리 파이 피코 한글 키 입력?  (0) 2021.11.16
rpi pico usb sound  (0) 2021.11.08
rpi 4는 USB to Ethernet이 아닌가?  (0) 2021.09.29
rpi zero otg  (0) 2021.09.27
스피커가 부실했군..  (0) 2021.09.26
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 구차니
embeded/odroid2021. 9. 29. 17:50

ADC 제외하고는 3.3V

라즈베리와 동일한 전압레벨이니 ok

[링크 : https://wiki.odroid.com/odroid-c2/hardware/expansion_connectors]

 

이런저런 경고가 뜨지만 무시하고 설치!

$ sudo apt install software-properties-common
$ sudo add-apt-repository ppa:hardkernel/ppa
$ sudo apt update
$ sudo apt install odroid-wiringpi
$ gpio readall
 +-----+-----+---------+------+---+--- C2 ---+---+------+---------+-----+-----+
 | I/O | wPi |   Name  | Mode | V | Physical | V | Mode |  Name   | wPi | I/O |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 |     |     |    3.3V |      |   |  1 || 2  |   |      | 5V      |     |     |
 | 205 |   8 |   SDA.1 |   IN | 1 |  3 || 4  |   |      | 5V      |     |     |
 | 206 |   9 |   SCL.1 |   IN | 1 |  5 || 6  |   |      | 0V      |     |     |
 | 249 |   7 |  IO.249 |   IN | 1 |  7 || 8  |   |      | TxD1    | 15  |     |
 |     |     |      0V |      |   |  9 || 10 |   |      | RxD1    | 16  |     |
 | 247 |   0 |  IO.247 |   IN | 1 | 11 || 12 | 1 | IN   | IO.238  | 1   | 238 |
 | 239 |   2 |  IO.239 |   IN | 1 | 13 || 14 |   |      | 0V      |     |     |
 | 237 |   3 |  IO.237 |   IN | 1 | 15 || 16 | 1 | IN   | IO.236  | 4   | 236 |
 |     |     |    3.3V |      |   | 17 || 18 | 1 | IN   | IO.233  | 5   | 233 |
 | 235 |  12 |  IO.235 |   IN | 1 | 19 || 20 |   |      | 0V      |     |     |
 | 232 |  13 |  IO.232 |   IN | 1 | 21 || 22 | 1 | IN   | IO.231  | 6   | 231 |
 | 230 |  14 |  IO.230 |   IN | 1 | 23 || 24 | 1 | IN   | IO.229  | 10  | 229 |
 |     |     |      0V |      |   | 25 || 26 | 1 | OUT  | IO.225  | 11  | 225 |
 |     |  30 |   SDA.2 |      |   | 27 || 28 |   |      | SCL.2   | 31  |     |
 | 228 |  21 |  IO.228 |   IN | 1 | 29 || 30 |   |      | 0V      |     |     |
 | 219 |  22 |  IO.219 |   IN | 1 | 31 || 32 | 1 | IN   | IO.224  | 26  | 224 |
 | 234 |  23 |  IO.234 |   IN | 0 | 33 || 34 |   |      | 0V      |     |     |
 | 214 |  24 |  IO.214 |   IN | 1 | 35 || 36 | 1 | IN   | IO.218  | 27  | 218 |
 |     |  25 |   AIN.1 |      |   | 37 || 38 |   |      | 1V8     | 28  |     |
 |     |     |      0V |      |   | 39 || 40 |   |      | AIN.0   | 29  |     |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 | I/O | wPi |   Name  | Mode | V | Physical | V | Mode |  Name   | wPi | I/O |
 +-----+-----+---------+------+---+--- C2 ---+---+------+---------+-----+-----+

Err:3 http://deb.odroid.in/c2 bionic InRelease
  The following signatures were invalid: EXPKEYSIG 5360FB9DAB19BAC9 Mauro Ribeiro (mdrjr) <mauro.ribeiro@hardkernel.com>

Reading package lists... Done
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://deb.odroid.in/c2 bionic InRelease: The following signatures were invalid: EXPKEYSIG 5360FB9DAB19BAC9 Mauro Ribeiro (mdrjr) <mauro.ribeiro@hardkernel.com>
W: Failed to fetch http://deb.odroid.in/c2/dists/bionic/InRelease  The following signatures were invalid: EXPKEYSIG 5360FB9DAB19BAC9 Mauro Ribeiro (mdrjr) <mauro.ribeiro@hardkernel.com>
W: Some index files failed to download. They have been ignored, or old ones used instead.

[링크 : https://wiki.odroid.com/odroid-c2/application_note/gpio/wiringpi]

'embeded > odroid' 카테고리의 다른 글

ordroid c2 - mrs 명령어 고찰  (0) 2023.09.05
wayland on odroid-c2  (0) 2021.11.22
g_mass_storage rpi - odroid c2  (0) 2021.09.28
g_mass_storage ins/rm 실패  (0) 2021.09.28
odroid c2 ubuntu 18.04, 20.04 kernel 버전 정보  (0) 2021.09.27
Posted by 구차니