2024-04-04 01:58 AM - edited 2024-04-04 01:59 AM
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.
2024-04-05 12:39 AM
I up, if anyone have an idea ?
2024-04-05 01:32 PM - edited 2024-04-05 01:45 PM
You need help with C programming, not specific to STM32 or Bluetooth. Not a big deal.
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.
2024-04-08 12:12 AM
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
2024-04-08 12:34 AM
But that is still just standard C code - there are no magic additions or extensions.
The Cube IDE just uses the standard GCC toolchain.
2024-04-08 01:03 AM
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.
2024-04-10 01:38 PM
Correct. An experienced C/C++ person can find the root reason of this and fix.
2024-04-10 02:48 PM
@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?