cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX 5.1.0 generates a code with errors if select custom template enabled and all other disabled

Vyacheslav
Senior II

Hi, STM engineers !

Using STM32CubeMX 5.1.0, selecting custom template - enabled and all other - disabled, Cube was generate code, but he does not compile.

First error is in app_conf.h

/**< Add in that list all tasks that may send a ACI/HCI command */
typedef enum
{
  CFG_IdleTask_Update_Parameter,
 
/**< Add in that list all tasks that never send a ACI/HCI command */
typedef enum
{
    CFG_FIRST_TASK_ID_WITH_NO_HCICMD = CFG_LAST_TASK_ID_WITH_HCICMD - 1,        /**< Shall be FIRST in the list */
    CFG_TASK_SYSTEM_HCI_ASYNCH_EVT_ID,
/* USER CODE BEGIN CFG_Task_Id_With_NO_HCI_Cmd_t */
 
/* USER CODE END CFG_Task_Id_With_NO_HCI_Cmd_t */
    CFG_LAST_TASK_ID_WITHO_NO_HCICMD                                            /**< Shall be LAST in the list */
} CFG_Task_Id_With_NO_HCI_Cmd_t;

As you see, typedef beginning on line 2 does not end, and on line 7 new typedef began.

The reason for the error is in the file "...STM32CubeMX\db\templates\stm32_wpan_app_conf_h.ftl".

This is peace of code from that file:

[#if (BT_SIG_BEACON = 1) || (BT_SIG_BLOOD_PRESSURE_SENSOR = 1) || (BT_SIG_HEALTH_THERMOMETER_SENSOR = 1) || (BT_SIG_HEART_RATE_SENSOR = 1) || (CUSTOM_OTA = 1) || (CUSTOM_P2P_SERVER = 1) || (CUSTOM_P2P_ROUTER = 1) || (CUSTOM_P2P_CLIENT = 1) || (BLE_TRANSPARENT_MODE_UART = 1) || (BLE_TRANSPARENT_MODE_VCP = 1)]
/* USER CODE BEGIN CFG_Task_Id_With_HCI_Cmd_t */
 
/* USER CODE END CFG_Task_Id_With_HCI_Cmd_t */
    CFG_LAST_TASK_ID_WITH_HCICMD,                                               /**< Shall be LAST in the list */
} CFG_Task_Id_With_HCI_Cmd_t;
[/#if]

And there is an error:

code "[/#if]" should move before

CFG_LAST_TASK_ID_WITH_HCICMD,

then the bracket is closed correctly and our typedef will ok like this:

/**< Add in that list all tasks that may send a ACI/HCI command */
typedef enum
{
  CFG_IdleTask_Update_Parameter,
    CFG_LAST_TASK_ID_WITH_HCICMD,                                               /**< Shall be LAST in the list */
} CFG_Task_Id_With_HCI_Cmd_t;

Bге I still doubt the correctness of the code because of the string "CFG_IdleTask_Update_Parameter", it is not written in capital letters.

Second error: file shci_tl.c exists in project folders tree, but do not included in project. It must be manually included in the project.

Third error: function APP_BLE_Init() exists only in app_ble.h file, but app_ble.c file dont exists in folder tree! Where is it ? I tried to find the answer::

In file "...STM32Cube\STM32CubeMX\db\mcu\config\STM32_WPAN-STM32WBxx_Configs.xml"

file app_ble.c includes begin from line 528:

<RefConfigFile Description="" Name="BLE_APP_BLE_C" Template="stm32_wpan_ble_app_ble_c.ftl">

But some conditions in which custom template not present (Semaphore_CUSTOM_TEMPLATE).

I think if to change string

<File Category="source" Name="App/app_ble.c" Version="1.0" Condition="!Semaphore_BLE_TRANSPARENT_MODE &amp; S_BLE_HOST &amp; (Semaphore_BT_SIG_BEACON | Semaphore_BT_SIG_BLOOD_PRESSURE_SENSOR | Semaphore_BT_SIG_HEALTH_THERMOMETER_SENSOR | Semaphore_BT_SIG_HEART_RATE_SENSOR | Semaphore_CUSTOM_P2P_SERVER)"/>

to

<File Category="source" Name="App/app_ble.c" Version="1.0" Condition="!Semaphore_BLE_TRANSPARENT_MODE &amp; S_BLE_HOST &amp; (Semaphore_BT_SIG_BEACON | Semaphore_BT_SIG_BLOOD_PRESSURE_SENSOR | Semaphore_BT_SIG_HEALTH_THERMOMETER_SENSOR | Semaphore_BT_SIG_HEART_RATE_SENSOR | Semaphore_CUSTOM_P2P_SERVER | Semaphore_CUSTOM_TEMPLATE)"/>

then the file app_ble.c will appear, but unfortunately he did not appear in the project and in the folder.

Where can I get app_ble.c file if I want a custom template?

Thanks.

1 REPLY 1
Vyacheslav
Senior II

In CubeMX v.5.2.0 errors are fixed, but now can`t select only "Custom Template", only if Blood Pressure Sensor or Health Thermometer Sensor or Heart Rate Sensor or Custom P2P Server is(are) enabled.

Sorry, but this is not good idea.