You are here

Help needed compiling vesc express for esp32 mini D1

4 posts / 0 new
Last post
mrendu43
Offline
Last seen: 2 months 2 weeks ago
VESC Free
Joined: 2021-03-05 13:44
Posts: 25
Help needed compiling vesc express for esp32 mini D1

Hello.

Im trying to compile vesc express firmware for my esp32 mini d1.

I managed to setup toolchain and get the code compiling but i get some error that i dont know how to solve.

Only change i have made is set target to esp32 insted of esp32c3.

here re the errors from command prompt.

Untitled.png

 

meashman
Offline
Last seen: 10 months 1 week ago
Joined: 2021-11-06 23:15
Posts: 5

I also get errors when trying to compile vesc express build from the source code.

esp-idf/bt/CMakeFiles/__idf_bt.dir/host/bluedroid/btc/profile/std/gap/btc_gap_ble.c.obj FAILED

C:/Espressif/frameworks/esp-idf-v5.1.1/components/bt/host/bluedroid/stack/include/stack/bt_types.h:35:34: error: 'strncpy' specified bound 33 equals destination size [-Werror=stringop-truncation]
   35 | #define BCM_STRNCPY_S(x1,x2,x3)  strncpy((x1),(x2),(x3))
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~

C:/Espressif/frameworks/esp-idf-v5.1.1/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_ble.c:89:9: note: in expansion of macro 'BCM_STRNCPY_S'
   89 |         BCM_STRNCPY_S(param.get_dev_name_cmpl.name, name, BTC_MAX_LOC_BD_NAME_LEN + 1);
      |         ^~~~~~~~~~~~~
cc1.exe: some warnings being treated as errors

 

 

meashman
Offline
Last seen: 10 months 1 week ago
Joined: 2021-11-06 23:15
Posts: 5

Anyone?

 

mvturnho
Offline
Last seen: 4 months 1 week ago
VESC Free
Joined: 2024-09-30 10:01
Posts: 1

Hi im not trying to be a wise-ass but did you try asking chatgpt? 

 

Error Summary

You're getting:

error: 'strncpy' specified bound 33 equals destination size [-Werror=stringop-truncation] 

Which refers to this line:

#define BCM_STRNCPY_S(x1,x2,x3) strncpy((x1),(x2),(x3)) // ... BCM_STRNCPY_S(param.get_dev_name_cmpl.name, name, BTC_MAX_LOC_BD_NAME_LEN + 1); 

What's the problem?

You're using strncpy with a length that is exactly equal to the destination buffer size. GCC warns that this might truncate the string without adding a null-terminator, which could lead to undefined behavior. Because your project treats all warnings as errors (-Werror), the build fails.


Solutions

✅ Option 1: Suppress the specific warning

If you trust this code is safe, you can disable this warning being treated as an error:

Add this to your CMakeLists.txt:


add_compile_options(-Wno-error=stringop-truncation) 

Or if you're using idf.py with menuconfig:


 

idf.py menuconfig

Go to:


 

Compiler Options → Enable -Werror → [ ] (disable it or exclude this specific warning)


✅ Option 2: Fix the source (if you're editing ESP-IDF source)

If you’re modifying ESP-IDF or building from source and can patch it, add a manual null-terminator:


 

strncpy(dest, src, SIZE - 1); dest[SIZE - 1] = '\0';

But this may not be practical if you're using the original ESP-IDF sources as-is.


Recommendation

If you're not modifying bt_types.h yourself, the best way is to just suppress that warning using Option 1 above — this is a known and safe workaround used by many ESP-IDF developers.

Let me know if you want a patch or help adding the compiler flag.