This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Error when making custom makefile for BL Mesh project

I am building a Bluetooth Mesh project and when trying to make a custom Makefile for the Mesh Light Control Example, but when compiling the project i get this error:

Compiling file: nrf_mesh.c
In file included from ../../nrf5_SDK_for_Mesh_v0.9.2-Alpha/mesh/include/core/packet.h:49:0,
                 from ../../nrf5_SDK_for_Mesh_v0.9.2-Alpha/mesh/include/core/bearer.h:43,
                 from ../../nrf5_SDK_for_Mesh_v0.9.2-Alpha/mesh/src/core/nrf_mesh.c:51:
../../nrf5_SDK_for_Mesh_v0.9.2-Alpha/mesh/src/core/nrf_mesh.c: In function 'nrf_mesh_process':
../../nrf5_SDK_for_Mesh_v0.9.2-Alpha/mesh/src/core/nrf_mesh.c:292:64: error: format '%d' expects argument of type 'int', but argument 6 has type 'uint32_t {aka long unsigned int}' [-Werror=format=]
                         __LOG(LOG_SRC_API, LOG_LEVEL_WARN, "[er%d] Could not process mesh packet...\n", status);

(I also get some additional errors looking almost identical, i didn't include them here as i think they will be resolved along this problem.)

I am trying to compile the project to check the makefile before modifying it with my own code. As the Mesh SDK is using Cmake, and i don't know Cmake i have been using the makefile.common from SDK V12.1.

Could this problem stem from the combination of the Mesh SDK and version 12.1 of the ordinary SDK? And how is it possible to fix this problem?

Parents
  • Hi SørenHN,

    If you were unaware, CMake can generate Makefiles for you (this is the default generator on Unix-like systems).

    Run it with:

    mesh/build $ cmake -G "Unix Makefiles" <other options> ..
    

    To your question, the compiler is confused about integer sizes in the printf-like formatting string. It's the SEGGER_RTT_printf() that handles this in the end and it "does the right thing". You can safely add a -Wno-format to your CFLAGS to suppress the warning.

    Best,
    Thomas

Reply
  • Hi SørenHN,

    If you were unaware, CMake can generate Makefiles for you (this is the default generator on Unix-like systems).

    Run it with:

    mesh/build $ cmake -G "Unix Makefiles" <other options> ..
    

    To your question, the compiler is confused about integer sizes in the printf-like formatting string. It's the SEGGER_RTT_printf() that handles this in the end and it "does the right thing". You can safely add a -Wno-format to your CFLAGS to suppress the warning.

    Best,
    Thomas

Children
Related