cancel
Showing results for 
Search instead for 
Did you mean: 

Architecture problem using BLE library

Hi everyone,

I design the BLE (bluetooth low energy) part of my software, for that, I use BlueNRG-1, BlueNRG-2 DK SW package, provided by ST.

I included the library (.a) and others source code files (.c) and headers (.h) in my project.

But I feel something is wrong, (for example) some .h that I include from the library redefine some macros that were already define by the code generation of the IDE.

an example of a case when I follow a basic tutorial on how to setup a basic server on the board, using the library

I need to use a function, the prototype of the latter is in a file that I include in my main.c

 

 

 

#include "C:\Users\xxxxxxxx\ST\BlueNRG-1_2 DK 3.2.3(v2.0)\Library\Bluetooth_LE\inc\bluenrg1_stack.h"

 

In this file.h, there is a macro definition :

#define IS_UART_BAUDRATE(__BAUDRATE__) ((__BAUDRATE__) < 20000000U)

But this line of code is already in "Drivers\STM32U5xx_HAL_Driver\Inc\stm32u5xx_hal_uart.h"

Thats an example, but the include of bluenrg1_stack.h redefine a lot of macros, throw a lot of errors and warning.

I feel like its not the good way to do, I dont know what I am missing or doing wrong.

If you need more information to help me, please feel free to ask, I'll provide them.

 

7 REPLIES 7

I up, if anyone have an idea ?

Pavel A.
Evangelist III

You need help with C programming, not specific to STM32 or Bluetooth. Not a big deal. 

https://www.fiverr.com/categories/programming-tech/software-development/help-consultation?ref=programming_language%3Ac_c

https://www.fiverr.com/categories/programming-tech/electronics-engineering/embedded-systems-iot?ref=platform%3Astm32

Windows 10/11 has a convenient tool for sharing screen and remote assistance, called Quick Assist. Or use whatever else you like to communicate with your consultant.

If you read my post, my problem is more about the code generated by stm32 environment (and some macros of the library that redefine generated code). There is no warning or error of C programming that I dont understand here, but more the stm32CubeIDE context

But that is still just standard C code - there are no magic additions or extensions.

The Cube IDE just uses the standard GCC toolchain.

My question was more about the proper way to include a library in stm32

You usually dont expect hundreds of macros and initialization function to be redefined when you compile a project including a (.a) file.

Correct. An experienced C/C++ person can find the root reason of this and fix. 

 


@q3z85d41xqz036d wrote:

hundreds of macros and initialization function to be redefined 


Maybe you've included both the pre-built binary (.a) and all the sources for that binary?