lbuque / bma_binding_micropython

BMA423 Sensor API binding for MicroPython
MIT License
0 stars 0 forks source link

build failed #1

Closed picpic020960 closed 2 years ago

picpic020960 commented 2 years ago

bonjour , some issue when building micropython :

`[233/247] Building C object esp-idf/ma...df_main.dir///frozen_content.c.obj FAILED: esp-idf/main/CMakeFiles/idf_main.dir///frozen_content.c.obj /home/pi/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc -DFFCONF_H=\"/home/pi/micropython/lib/oofatfs/ffconf.h\" -DLFS1_NO_ASSERT -DLFS1_NO_DEBUG -DLFS1_NO_ERROR -DLFS1_NO_MALLOC -DLFS1_NO_WARN -DLFS2_NO_ASSERT -DLFS2_NO_DEBUG -DLFS2_NO_ERROR -DLFS2_NO_MALLOC -DLFS2_NO_WARN -DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\" -DMICROPY_ESP_IDF_4=1 -DMICROPY_MODULE_FROZEN_MPY="(1)" -DMICROPY_QSTR_EXTRA_POOL=mp_qstr_frozen_const_pool -DMICROPY_VFS_FAT=1 -DMICROPY_VFS_LFS2=1 -D__DBINTERFACE_PRIVATE=1 -Dvirt_fd_t="void*" -Iconfig -I/home/pi/micropython -I/home/pi/micropython/lib/berkeley-db-1.xx/PORT/include -I/home/pi/micropython/extmod/bma_binding_micropython/src -I/home/pi/micropython/extmod/bma_binding_micropython/lib/BMA423-Sensor-API -I../ -I../boards/GENERIC -I. -I/home/pi/esp-idf/components/bt/host/nimble/nimble -I/home/pi/esp-idf/components/newlib/platform_include -I/home/pi/esp-idf/components/freertos/include -I/home/pi/esp-idf/components/heap/include -I/home/pi/esp-idf/components/log/include -I/home/pi/esp-idf/components/soc/esp32/include -I/home/pi/esp-idf/components/soc/include -I/home/pi/esp-idf/components/esp_rom/include -I/home/pi/esp-idf/components/esp_common/include -I/home/pi/esp-idf/components/xtensa/include -I/home/pi/esp-idf/components/xtensa/esp32/include -I/home/pi/esp-idf/components/esp32/include -I/home/pi/esp-idf/components/driver/include -I/home/pi/esp-idf/components/esp_ringbuf/include -I/home/pi/esp-idf/components/esp_event/include -I/home/pi/esp-idf/components/tcpip_adapter/include -I/home/pi/esp-idf/components/lwip/include/apps -I/home/pi/esp-idf/components/lwip/include/apps/sntp -I/home/pi/esp-idf/components/lwip/lwip/src/include -I/home/pi/esp-idf/components/lwip/port/esp32/include -I/home/pi/esp-idf/components/lwip/port/esp32/include/arch -I/home/pi/esp-idf/components/vfs/include -I/home/pi/esp-idf/components/esp_wifi/include -I/home/pi/esp-idf/components/esp_wifi/esp32/include -I/home/pi/esp-idf/components/esp_eth/include -I/home/pi/esp-idf/components/efuse/include -I/home/pi/esp-idf/components/efuse/esp32/include -I/home/pi/esp-idf/components/app_trace/include -I/home/pi/esp-idf/components/app_update/include -I/home/pi/esp-idf/components/spi_flash/include -I/home/pi/esp-idf/components/bootloader_support/include -I/home/pi/esp-idf/components/bt/include -I/home/pi/esp-idf/components/bt/common/osi/include -I/home/pi/esp-idf/components/bt/host/nimble/nimble/porting/nimble/include -I/home/pi/esp-idf/components/bt/host/nimble/port/include -I/home/pi/esp-idf/components/bt/host/nimble/nimble/nimble/include -I/home/pi/esp-idf/components/bt/host/nimble/nimble/nimble/host/include -I/home/pi/esp-idf/components/bt/host/nimble/nimble/nimble/host/services/ans/include -I/home/pi/esp-idf/components/bt/host/nimble/nimble/nimble/host/services/bas/include -I/home/pi/esp-idf/components/bt/host/nimble/nimble/nimble/host/services/gap/include -I/home/pi/esp-idf/components/bt/host/nimble/nimble/nimble/host/services/gatt/include -I/home/pi/esp-idf/components/bt/host/nimble/nimble/nimble/host/services/ias/include -I/home/pi/esp-idf/components/bt/host/nimble/nimble/nimble/host/services/lls/include -I/home/pi/esp-idf/components/bt/host/nimble/nimble/nimble/host/services/tps/include -I/home/pi/esp-idf/components/bt/host/nimble/nimble/nimble/host/util/include -I/home/pi/esp-idf/components/bt/host/nimble/nimble/nimble/host/store/ram/include -I/home/pi/esp-idf/components/bt/host/nimble/nimble/nimble/host/store/config/include -I/home/pi/esp-idf/components/bt/host/nimble/nimble/porting/npl/freertos/include -I/home/pi/esp-idf/components/bt/host/nimble/esp-hci/include -I/home/pi/esp-idf/components/nvs_flash/include -I/home/pi/esp-idf/components/mbedtls/port/include -I/home/pi/esp-idf/components/mbedtls/mbedtls/include -I/home/pi/esp-idf/components/esp_adc_cal/include -I/home/pi/esp-idf/components/mdns/include -I/home/pi/esp-idf/components/console -I/home/pi/esp-idf/components/sdmmc/include -I/home/pi/esp-idf/components/ulp/include -mlongcalls -Wno-frame-address -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -nostdlib -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -ggdb -Os -freorder-blocks -std=gnu99 -Wno-old-style-declaration -D_GNU_SOURCE -DIDF_VER=\"v4.0.2-dirty\" -DGCC_NOT_5_2_0 -DESP_PLATFORM -DNDEBUG -Wno-clobbered -Wno-deprecated-declarations -Wno-missing-field-initializers -MD -MT esp-idf/main/CMakeFiles/idf_main.dir///frozen_content.c.obj -MF esp-idf/main/CMakeFiles/idf_main.dir///frozen_content.c.obj.d -o esp-idf/main/CMakeFiles/idf_main.dir///frozen_content.c.obj -c frozen_content.c frozen_content.c:108:5: error: redeclaration of enumerator 'MP_QSTR_debug' MP_QSTR_debug, ^~~~~ In file included from /home/pi/micropython/py/obj.h:33, from /home/pi/micropython/py/objint.h:30, from frozen_content.c:16: ./genhdr/qstrdefs.generated.h:582:6: note: previous definition of 'MP_QSTR_debug' was here QDEF(MP_QSTR_debug, 21972, 5, "debug") ^~~~~ /home/pi/micropython/py/qstr.h:41:34: note: in definition of macro 'QDEF'

define QDEF(id, hash, len, str) id,

                              ^~

frozen_content.c:167:5: error: redeclaration of enumerator 'MP_QSTR_temperature' MP_QSTR_temperature, ^~~~~~~ In file included from /home/pi/micropython/py/obj.h:33, from /home/pi/micropython/py/objint.h:30, from frozen_content.c:16: ./genhdr/qstrdefs.generated.h:968:6: note: previous definition of 'MP_QSTR_temperature' was here QDEF(MP_QSTR_temperature, 57065, 11, "temperature") ^~~~~~~ /home/pi/micropython/py/qstr.h:41:34: note: in definition of macro 'QDEF'

define QDEF(id, hash, len, str) id,

                              ^~

frozen_content.c:326:5: error: redeclaration of enumerator 'MP_QSTR_y' MP_QSTR_y, ^~~~~ In file included from /home/pi/micropython/py/obj.h:33, from /home/pi/micropython/py/objint.h:30, from frozen_content.c:16: ./genhdr/qstrdefs.generated.h:1053:6: note: previous definition of 'MP_QSTR_y' was here QDEF(MP_QSTR_y, 46556, 1, "y") ^~~~~ /home/pi/micropython/py/qstr.h:41:34: note: in definition of macro 'QDEF'

define QDEF(id, hash, len, str) id,

                              ^~

[236/247] Building C object esp-idf/ma...nding_micropython/src/bma_bma423.c.obj /home/pi/micropython/extmod/bma_binding_micropython/src/bma_bma423.c: In function 'bma423_make_new': /home/pi/micropython/extmod/bma_binding_micropython/src/bma_bma423.c:273:18: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] args1[0] = MP_ROM_PTR(&irq_handler_obj); ^ /home/pi/micropython/extmod/bma_binding_micropython/src/bma_bma423.c:304:18: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] args1[0] = MP_ROM_PTR(&irq_handler_obj); ^ [238/247] Building C object esp-idf/ma...ython/lib/BMA423-Sensor-API/bma4.c.obj ninja: build stopped: subcommand failed. ninja failed with exit code 1 make: *** [Makefile:38: all] Error 2 ` thanks for help

lbuque commented 2 years ago

Please try to delete the build-xxx (eg build-GENERIC) directory and try to compile again.

picpic020960 commented 2 years ago

OK : fine ! now test then added to lv_micropython

picpic020960 commented 2 years ago

with your example loaded in twatch V1 , issue : Traceback (most recent call last): File "<stdin>", line 26, in <module> ValueError: only accepts 0 or 1

line 26 is : b.activity(activity_cb)

Twatch V1 + MicroPython v1.19.1-269-g94a19f106-dirty on 2022-09-07; ESP32 module with ESP32

edit : step_counter = OK

picpic020960 commented 2 years ago

your example is OK with your .bin but KO with my build So i thinks the source is not at level with your bin. Possible to obtain good source for added to lv_micropython ? Thanks for help !

lbuque commented 2 years ago

I'm having this problem again, I'll try to fix it sometime.

picpic020960 commented 2 years ago

OK !

` STATIC mp_obj_t activity(size_t n_args, const mp_obj_t pos_args, mp_map_t kw_args) { bma423_if_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); int8_t rslt;

mp_arg_val_t args[MP_ARRAY_SIZE(handler_args)];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(handler_args),
                 handler_args, args);

if (0 == args[ARG_int_line - **0**].u_int || 1 == args[ARG_int_line - **0**].u_int) {
    if (self->int_obj[args[ARG_int_line - **0**].u_int] != MP_OBJ_NULL) {
        /* set activity handler */
        self->int_handler[args[ARG_int_line - **0**].u_int].activity_handler = args[ARG_handler].u_obj;
        /* Enable activity feature */
        rslt = bma423_feature_enable(BMA423_STEP_ACT, BMA4_ENABLE, &self->bma423);
        bma4_error_codes_print_result("bma423_feature_enable", rslt);
        self->int_map |= BMA423_ACTIVITY_INT;
        rslt = bma423_map_interrupt(args[ARG_int_line - **0**].u_int, self->int_map, BMA4_ENABLE, &self->bma423);
        bma4_error_codes_print_result("bma423_map_interrupt", rslt);
    } else {
        mp_raise_ValueError("Interrupt not enabled");
    }
} else {
    mp_raise_ValueError("only accepts 0 or 1");
}

return mp_const_none;

} STATIC MP_DEFINE_CONST_FUN_OBJ_KW(activity_obj, 2, activity);`

lbuque commented 2 years ago

@picpic020960

Thank you for your query.

It has been fixed. (2746c655664bf2f659921d77d4226fadd6a54e45)