BMI270 Component for ESP IDF

turingturtle
Posts: 1
Joined: Sat Aug 10, 2024 11:42 pm

BMI270 Component for ESP IDF

Postby turingturtle » Mon Dec 30, 2024 12:47 pm

I have added the bmi270 component using the component manager in esp-idf (vscode extension) and the buidl works , but when I add any program from the expamples, in the main.c , it doesnt build and gives error.
Probably becuse of how I am setting the CMake file.

Please help to add this component to my project and build it.

[This is the link for the component](https://components.espressif.com/compon ... ions/1.1.0)

And here is the picture of my directory:
Screenshot 2024-12-30 163815.png
Screenshot 2024-12-30 163815.png (15.18 KiB) Viewed 333 times
Also her is my CMake file:

Code: Select all

    idf_component_register(SRCS "main.c"
                        INCLUDE_DIRS "."
                        )
I went through the test app in the bmi270 for cmake reffernce but didnt understand how to make it work.

Also for reference, the errors I get:

Code: Select all

    C:/Users/ashfa/ESP-COP-A/main/main.c: In function 'main':
    C:/Users/ashfa/ESP-COP-A/main/main.c:63:12: warning: missing initializer for field 'gyr' of 'struct bmi2_sens_data' [-Wmissing-field-initializers]
       63 |     struct bmi2_sens_data sens_data = { { 0 } };
          |            ^~~~~~~~~~~~~~
    In file included from C:/Users/ashfa/ESP-COP-A/managed_components/espressif2022__bmi270/bmi2.h:61,
                     from C:/Users/ashfa/ESP-COP-A/managed_components/espressif2022__bmi270/bmi270_legacy.h:59,
                     from C:/Users/ashfa/ESP-COP-A/main/main.c:10:
    C:/Users/ashfa/ESP-COP-A/managed_components/espressif2022__bmi270/bmi2_defs.h:1865:32: note: 'gyr' declared here
     1865 |     struct bmi2_sens_axes_data gyr;
          |                                ^~~
    C:/Users/ashfa/ESP-COP-A/main/main.c:73:12: error: implicit declaration of function 'bmi2_interface_init' [-Werror=implicit-function-declaration]
       73 |     rslt = bmi2_interface_init(&bmi, BMI2_SPI_INTF);
          |            ^~~~~~~~~~~~~~~~~~~
    C:/Users/ashfa/ESP-COP-A/main/main.c:74:5: error: implicit declaration of function 'bmi2_error_codes_print_result' [-Werror=implicit-function-declaration]
       74 |     bmi2_error_codes_print_result(rslt);
          |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    C:/Users/ashfa/ESP-COP-A/main/main.c:133:5: error: implicit declaration of function 'bmi2_coines_deinit' [-Werror=implicit-function-declaration]
      133 |     bmi2_coines_deinit();
          |     ^~~~~~~~~~~~~~~~~~
    cc1.exe: some warnings being treated as errors
    ninja: build stopped: subcommand failed.

yankeing
Posts: 9
Joined: Fri Nov 22, 2024 10:53 am

Re: BMI270 Component for ESP IDF

Postby yankeing » Tue Dec 31, 2024 3:58 pm

Hi. There is no need to deal with Cmake when you use add components to idf_component.yml. The issue looks like a usage issue, you can clone the BMI270 component separately and go into the test_apps directory (https://github.com/espressif2022/BMI270 ... /test_apps) and try to compile and download the test.

Who is online

Users browsing this forum: No registered users and 81 guests