lemariva / micropython-camera-driver

add camera support to MicroPython
https://lemariva.com
Apache License 2.0
460 stars 99 forks source link

Build with GENERIC_S3_SPIRAM_OCT, but no module camera #87

Open HonestQiao opened 1 year ago

HonestQiao commented 1 year ago

micropython/micropython/ports/esp32/boards/GENERIC_S3_SPIRAM_OCT/sdkconfig.board:

CONFIG_FLASHMODE_QIO=y
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y
CONFIG_ESPTOOLPY_AFTER_NORESET=y

CONFIG_SPIRAM_MEMTEST=

CONFIG_ESPTOOLPY_FLASHSIZE_4MB=
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-16MiB.csv"

# ESP32-CAMERA
CONFIG_OV2640_SUPPORT=y
#CONFIG_OV7725_SUPPORT=y

micropython/micropython/ports/esp32/boards/GENERIC_S3_SPIRAM_OCT/mpconfigboard.h

#define MICROPY_HW_BOARD_NAME               "ESP32S3 module (spiram octal)"
#define MICROPY_HW_MCU_NAME                 "ESP32S3"

#define MICROPY_PY_MACHINE_DAC              (0)

// Enable UART REPL for modules that have an external USB-UART and don't use native USB.
#define MICROPY_HW_ENABLE_UART_REPL         (1)

#define MICROPY_HW_I2C0_SCL                 (9)
#define MICROPY_HW_I2C0_SDA                 (8)

// Enable camera
#define MODULE_CAMERA_ENABLED (1)

// The offset only has an effect if a board has psram
// it allows the start of the range allocated to
#define MICROPY_ALLOCATE_HEAP_USING_MALLOC (1)
#define MICROPY_HEAP_SIZE_REDUCTION (512 * 1024)

micropython/examples/usercmodule/cam/modcamera:

#include <string.h>
#include "py/nlr.h"
#include "py/obj.h"
#include "modcamera.h"
#include "py/runtime.h"
#include "py/binary.h"

#define MODULE_CAMERA_ENABLED (1)
// #if MODULE_CAMERA_ENABLED

#include "esp_system.h"
#include "esp_spi_flash.h"
#include "esp_camera.h"
#include "esp_log.h"

...
...
...

// MP_REGISTER_MODULE(MP_QSTR_camera, mp_module_camera_system, MODULE_CAMERA_ENABLED);
MP_REGISTER_MODULE(MP_QSTR_camera, mp_module_camera_system)

// #endif

build:

cd micropython/micropython/ports/esp32
make BOARD=GENERIC_S3_SPIRAM_OCT USER_C_MODULES=/Users/HonestQiao/micropython/micropython/examples/usercmodule/cam/micropython.cmake PORT=/dev/cu.usbmodem14101 clean
make BOARD=GENERIC_S3_SPIRAM_OCT USER_C_MODULES=/Users/HonestQiao/micropython/micropython/examples/usercmodule/cam/micropython.cmake PORT=/dev/cu.usbmodem14101 all deploy

build and flash log: make_camera.log

but there doesn't has a camera module:

help("modules")

no "camera" in the list. import camera will throw error.