Amazonブログの「ESP32 でAWS IoT+Amazon Rekognition で動物と人を検知」を訂正した備忘録

AWS のオフィシャルブログに「Creating Object Recognition with Espressif ESP32」(Espressif ESP32 を使用したオブジェクト認識の作成)が10月に掲載された。

大変勉強になったが、そのままでは動かず、色々試してやっと動作。以下備忘録。

  • 1.IoTのポリシー(Esp32Policy)に下記追加が必要。esp32/sub/+ へのサブスクライブで拒否されていた。
    {
      "Effect": "Allow",
      "Action": "iot:Subscribe",
      "Resource": "arn:aws:iot:REGION:ACCOUNT_ID:topicfilter/esp32/sub/+"
    },
  • 2.Lambda のesp32-request-url  を修正。boto3利用時にS3v4署名 明記が必要。
# s3 = boto3.client('s3')
s3 = boto3.client('s3',config=Config(signature_version='s3v4'))
  • ESP32 のオプション設定で rtc_gpio_desc 有効化
  •  platformio run -t menuconfig にて、
    • Component config → Driver configurations → RTCIO configuration
    •  [*]Support array ‘rtc_gpio_desc' for ESP32
Component config → Driver configurations → RTCIO configuration

これで下記エラーが出なくなる。ここを参考にした。

components\cam\driver\twi.c: In function 'pinMode':
components\cam\driver\twi.c:61:24: error: 'rtc_gpio_desc' undeclared (first use in this function); did you mean 'rtc_io_desc'?
     uint32_t rtc_reg = rtc_gpio_desc[pin].reg;
  • 4) src/CMakeLists.txt の署名ファイル修正。コメントアウトする。
#if(CONFIG_EXAMPLE_EMBEDDED_CERTS)
#target_add_binary_data(${COMPONENT_TARGET} "certs/aws-root-ca.pem" TEXT)
#target_add_binary_data(${COMPONENT_TARGET} "certs/certificate.pem.crt" TEXT)
#target_add_binary_data(${COMPONENT_TARGET} "certs/private.pem.key" TEXT)
#endif()

これで下記エラーがなくなる。証明書をplatformio.ini とsrc/CMakeLists.txt の両方でインポートしているからおかしくなっているのが原因。

:/users/username/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32dev\esp-idf\.pio\build\esp32dev\aws-root-ca.pem.S.o: in function `aws_root_ca_pem':
(.rodata.embedded+0x0): multiple definition of `aws_root_ca_pem'; .pio\build\esp32dev\aws-root-ca.pem.o:(.rodata.embedded+0x0): first defined here
c:/users/username/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32dev\esp-idf\.pio\build\esp32dev\aws-root-ca.pem.S.o: in function `aws_root_ca_pem':
(.rodata.embedded+0x0): multiple definition of `_binary_aws_root_ca_pem_start'; .pio\build\esp32dev\aws-root-ca.pem.o:(.rodata.embedded+0x0): first defined here
c:/users/username/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32dev\esp-idf\.pio\build\esp32dev\aws-root-ca.pem.S.o: in function `_binary_aws_root_ca_pem_end':
(.rodata.embedded+0x4a5): multiple definition of `_binary_aws_root_ca_pem_end'; .pio\build\esp32dev\aws-root-ca.pem.o:(.rodata.embedded+0x4a5): first defined here
c:/users/username/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32dev\esp-idf\.pio\build\esp32dev\aws-root-ca.pem.S.o: in function `_binary_aws_root_ca_pem_end':
(.rodata.embedded+0x4a5): multiple definition of `aws_root_ca_pem_length'; .pio\build\esp32dev\aws-root-ca.pem.o:(.rodata.embedded+0x4a5): first defined here
c:/users/username/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32dev\esp-idf\.pio\build\esp32dev\certificate.pem.crt.S.o: in function `certificate_pem_crt':
(.rodata.embedded+0x0): multiple definition of `certificate_pem_crt'; .pio\build\esp32dev\certificate.pem.crt.o:(.rodata.embedded+0x0): first defined here
c:/users/username/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32dev\esp-idf\.pio\build\esp32dev\certificate.pem.crt.S.o: in function `certificate_pem_crt':
(.rodata.embedded+0x0): multiple definition of `_binary_certificate_pem_crt_start'; .pio\build\esp32dev\certificate.pem.crt.o:(.rodata.embedded+0x0): first defined here
c:/users/username/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32dev\esp-idf\.pio\build\esp32dev\certificate.pem.crt.S.o: in function `_binary_certificate_pem_crt_end':
(.rodata.embedded+0x4c5): multiple definition of `_binary_certificate_pem_crt_end'; .pio\build\esp32dev\certificate.pem.crt.o:(.rodata.embedded+0x4c5): first defined here
c:/users/username/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32dev\esp-idf\.pio\build\esp32dev\certificate.pem.crt.S.o: in function `_binary_certificate_pem_crt_end':
(.rodata.embedded+0x4c5): multiple definition of `certificate_pem_crt_length'; .pio\build\esp32dev\certificate.pem.crt.o:(.rodata.embedded+0x4c5): first defined here
c:/users/username/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32dev\esp-idf\.pio\build\esp32dev\private.pem.key.S.o: in function `private_pem_key':
(.rodata.embedded+0x0): multiple definition of `private_pem_key'; .pio\build\esp32dev\private.pem.key.o:(.rodata.embedded+0x0): first defined here
c:/users/username/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32dev\esp-idf\.pio\build\esp32dev\private.pem.key.S.o: in function `private_pem_key':
(.rodata.embedded+0x0): multiple definition of `_binary_private_pem_key_start'; .pio\build\esp32dev\private.pem.key.o:(.rodata.embedded+0x0): first defined here
c:/users/username/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32dev\esp-idf\.pio\build\esp32dev\private.pem.key.S.o: in function `_binary_private_pem_key_end':
(.rodata.embedded+0x690): multiple definition of `_binary_private_pem_key_end'; .pio\build\esp32dev\private.pem.key.o:(.rodata.embedded+0x690): first defined here
c:/users/username/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32dev\esp-idf\.pio\build\esp32dev\private.pem.key.S.o: in function `_binary_private_pem_key_end':
(.rodata.embedded+0x690): multiple definition of `private_pem_key_length'; .pio\build\esp32dev\private.pem.key.o:(.rodata.embedded+0x690): first defined here

主にこんなものか。あとstr_split で長さ0の入力で落ちるの修正など。

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

CAPTCHA