Decawave / uwb-apps

Apache License 2.0
33 stars 31 forks source link

Unable to build dwm1001_desense example #10

Open tuannv-github opened 3 years ago

tuannv-github commented 3 years ago
newt target create dwm1001_desense
newt target set dwm1001_desense app=apps/desense
newt target set dwm1001_desense bsp=@decawave-uwb-core/hw/bsp/dwm1001
newt target set dwm1001_desense build_profile=debug
newt run dwm1001_desense 0

When I try to build the dwm1001_desense example with above commands, I ran into the following problem.

Compiling repos/decawave-uwb-core/lib/uwb_rf_tests/desense/src/desense.c
Error: repos/decawave-uwb-core/lib/uwb_rf_tests/desense/src/desense.c: In function 'send_test':
repos/decawave-uwb-core/lib/uwb_rf_tests/desense/src/desense.c:235:29: error: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'uint32_t {aka long unsigned int}' [-Werror=format=]
         printf("%s:%d TEST %"PRIu32"\n", __func__, __LINE__, desense->num_test_sent);
                             ^
repos/decawave-uwb-core/lib/uwb_rf_tests/desense/src/desense.c: In function 'rx_complete_cb':
repos/decawave-uwb-core/lib/uwb_rf_tests/desense/src/desense.c:507:70: error: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'uint32_t {aka long unsigned int}' [-Werror=format=]
                         printf("WARNING Error allocating memory for %"PRIu32" packets\n", req->test_params.n_test);
                                                                      ^
repos/decawave-uwb-core/lib/uwb_rf_tests/desense/src/desense.c: In function 'uwb_desense_pkg_init':
repos/decawave-uwb-core/lib/uwb_rf_tests/desense/src/desense.c:867:26: error: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'uint32_t {aka long unsigned int}' [-Werror=format=]
     printf("{\"utime\": %"PRIu32",\"msg\": \"uwb_desense_pkg_init\"}\n",
                          ^
cc1: all warnings being treated as errors

I know PRIu32 is used to print uint32_t, so these errors is strange.

tuannv-github commented 3 years ago

I've seen that you have removed dwm1001_desense example recently. BTW, I wonder what could be the reasons.

chepo92 commented 3 years ago

I'm having the same error with twr_tag_tdma example

Error: repos/decawave-uwb-dw1000/hw/drivers/uwb/uwb_dw1000/src/dw1000_pkg.c: In function 'dw1000_pkg_down':
repos/decawave-uwb-dw1000/hw/drivers/uwb/uwb_dw1000/src/dw1000_pkg.c:99:13: error: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'uint32_t {aka long unsigned int}' [-Werror=format=]
     DIAGMSG("{\"utime\": %"PRIu32",\"msg\": \"dw1000_pkg_down\"}\n", dpl_cputime_ticks_to_usecs(dpl_cputime_get32()));
             ^
repos/decawave-uwb-dw1000/hw/drivers/uwb/uwb_dw1000/src/dw1000_pkg.c:44:29: note: in definition of macro 'DIAGMSG'
 #define DIAGMSG(s,u) printf(s,u)
chepo92 commented 3 years ago

Solved by running

repos/decawave-uwb-core/setup.sh
# Rerun newt install
newt install

and

cd repos/apache-mynewt-core/
git apply ../decawave-uwb-core/patches/apache-mynewt-core/mynewt_1_7_0_*
tuannv-github commented 3 years ago

Solved by running

repos/decawave-uwb-core/setup.sh
# Rerun newt install
newt install

and

cd repos/apache-mynewt-core/
git apply ../decawave-uwb-core/patches/apache-mynewt-core/mynewt_1_7_0_*

Thanks. It works.