|
| 1 | +From ef2495f6fa746df9f86f0db39fa00244d22feb3b Mon Sep 17 00:00:00 2001 |
| 2 | +From: Frederic Pillon < [email protected]> |
| 3 | +Date: Wed, 5 Apr 2023 10:18:52 +0200 |
| 4 | +Subject: [PATCH 1/4] chore: adapt STM32Cube_FW sources |
| 5 | + |
| 6 | +Compare to previous patch, do the minimum changes required |
| 7 | +to ease further update. |
| 8 | + |
| 9 | +Signed-off-by: Frederic Pillon < [email protected]> |
| 10 | +--- |
| 11 | + src/utility/STM32Cube_FW/app_conf_default.h | 47 +++++++++++++++------ |
| 12 | + src/utility/STM32Cube_FW/ble_bufsize.h | 11 ++++- |
| 13 | + src/utility/STM32Cube_FW/hw.h | 15 +++++-- |
| 14 | + src/utility/STM32Cube_FW/hw_ipcc.c | 4 +- |
| 15 | + src/utility/STM32Cube_FW/shci.c | 3 +- |
| 16 | + src/utility/STM32Cube_FW/shci_tl.c | 18 +++++++- |
| 17 | + src/utility/STM32Cube_FW/stm_list.c | 7 ++- |
| 18 | + src/utility/STM32Cube_FW/tl_mbox.c | 8 +++- |
| 19 | + 8 files changed, 90 insertions(+), 23 deletions(-) |
| 20 | + |
| 21 | +diff --git a/src/utility/STM32Cube_FW/app_conf_default.h b/src/utility/STM32Cube_FW/app_conf_default.h |
| 22 | +index 51bd33a..e89df14 100644 |
| 23 | +--- a/src/utility/STM32Cube_FW/app_conf_default.h |
| 24 | ++++ b/src/utility/STM32Cube_FW/app_conf_default.h |
| 25 | +@@ -1,9 +1,9 @@ |
| 26 | + /* USER CODE BEGIN Header */ |
| 27 | + /** |
| 28 | + ****************************************************************************** |
| 29 | +- * @file app_conf.h |
| 30 | ++ * @file app_conf_default.h |
| 31 | + * @author MCD Application Team |
| 32 | +- * @brief Application configuration file for STM32WPAN Middleware. |
| 33 | ++ * @brief Default application configuration file for STM32WPAN Middleware. |
| 34 | + ****************************************************************************** |
| 35 | + * @attention |
| 36 | + * |
| 37 | +@@ -19,18 +19,38 @@ |
| 38 | + /* USER CODE END Header */ |
| 39 | + |
| 40 | + /* Define to prevent recursive inclusion -------------------------------------*/ |
| 41 | +-#ifndef APP_CONF_H |
| 42 | +-#define APP_CONF_H |
| 43 | +- |
| 44 | ++#ifndef APP_CONF_DEFAULT_H |
| 45 | ++#define APP_CONF_DEFAULT_H |
| 46 | ++#if 0 |
| 47 | + #include "hw.h" |
| 48 | + #include "hw_conf.h" |
| 49 | + #include "hw_if.h" |
| 50 | + #include "ble_bufsize.h" |
| 51 | +- |
| 52 | ++#endif |
| 53 | + /****************************************************************************** |
| 54 | + * Application Config |
| 55 | + ******************************************************************************/ |
| 56 | + |
| 57 | ++/**< generic parameters ******************************************************/ |
| 58 | ++/* HCI related defines */ |
| 59 | ++ |
| 60 | ++#define ACI_HAL_SET_TX_POWER_LEVEL 0xFC0F |
| 61 | ++#define ACI_WRITE_CONFIG_DATA_OPCODE 0xFC0C |
| 62 | ++#define ACI_READ_CONFIG_DATA_OPCODE 0xFC0D |
| 63 | ++#define MAX_HCI_ACL_PACKET_SIZE (sizeof(TL_PacketHeader_t) + 5 + 251) |
| 64 | ++#define HCI_RESET 0x0C03 |
| 65 | ++ |
| 66 | ++#ifndef BLE_SHARED_MEM_BYTE_ORDER |
| 67 | ++ #define BLE_SHARED_MEM_BYTE_ORDER MSBFIRST |
| 68 | ++#endif |
| 69 | ++#define BLE_MODULE_SHARED_MEM_BUFFER_SIZE 128 |
| 70 | ++ |
| 71 | ++/** |
| 72 | ++ * Define Tx Power |
| 73 | ++ */ |
| 74 | ++#define CFG_TX_POWER (0x18) /* -0.15dBm */ |
| 75 | ++ |
| 76 | ++#if 0 |
| 77 | + /** |
| 78 | + * Define Secure Connections Support |
| 79 | + */ |
| 80 | +@@ -104,7 +124,7 @@ |
| 81 | + #define CFG_FW_SUBVERSION (1) |
| 82 | + #define CFG_FW_BRANCH (0) |
| 83 | + #define CFG_FW_BUILD (0) |
| 84 | +- |
| 85 | ++#endif |
| 86 | + /****************************************************************************** |
| 87 | + * BLE Stack |
| 88 | + ******************************************************************************/ |
| 89 | +@@ -152,13 +172,15 @@ |
| 90 | + * Prepare Write List size in terms of number of packet |
| 91 | + * This parameter is ignored by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY flag set |
| 92 | + */ |
| 93 | +-#define CFG_BLE_PREPARE_WRITE_LIST_SIZE BLE_PREP_WRITE_X_ATT(CFG_BLE_MAX_ATT_MTU) |
| 94 | ++// #define CFG_BLE_PREPARE_WRITE_LIST_SIZE BLE_PREP_WRITE_X_ATT(CFG_BLE_MAX_ATT_MTU) |
| 95 | ++#define CFG_BLE_PREPARE_WRITE_LIST_SIZE (0x3A) |
| 96 | + |
| 97 | + /** |
| 98 | + * Number of allocated memory blocks |
| 99 | + * This parameter is overwritten by the CPU2 with an hardcoded optimal value when the parameter CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY flag set |
| 100 | + */ |
| 101 | +-#define CFG_BLE_MBLOCK_COUNT (BLE_MBLOCKS_CALC(CFG_BLE_PREPARE_WRITE_LIST_SIZE, CFG_BLE_MAX_ATT_MTU, CFG_BLE_NUM_LINK)) |
| 102 | ++//#define CFG_BLE_MBLOCK_COUNT (BLE_MBLOCKS_CALC(CFG_BLE_PREPARE_WRITE_LIST_SIZE, CFG_BLE_MAX_ATT_MTU, CFG_BLE_NUM_LINK)) |
| 103 | ++#define CFG_BLE_MBLOCK_COUNT (0x79) |
| 104 | + |
| 105 | + /** |
| 106 | + * Enable or disable the Extended Packet length feature. Valid values are 0 or 1. |
| 107 | +@@ -250,7 +272,7 @@ |
| 108 | + * 0: LE Power Class 2-3 |
| 109 | + * other bits: complete with Options_extension flag |
| 110 | + */ |
| 111 | +-#define CFG_BLE_OPTIONS (SHCI_C2_BLE_INIT_OPTIONS_LL_HOST | SHCI_C2_BLE_INIT_OPTIONS_WITH_SVC_CHANGE_DESC | SHCI_C2_BLE_INIT_OPTIONS_DEVICE_NAME_RW | SHCI_C2_BLE_INIT_OPTIONS_EXT_ADV | SHCI_C2_BLE_INIT_OPTIONS_CS_ALGO2 | SHCI_C2_BLE_INIT_OPTIONS_FULL_GATTDB_NVM | SHCI_C2_BLE_INIT_OPTIONS_GATT_CACHING_NOTUSED | SHCI_C2_BLE_INIT_OPTIONS_POWER_CLASS_2_3) |
| 112 | ++#define CFG_BLE_OPTIONS (SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY) |
| 113 | + |
| 114 | + /** |
| 115 | + * BLE stack Options_extension flags to be configured with: |
| 116 | +@@ -323,6 +345,7 @@ |
| 117 | + |
| 118 | + #define CFG_BLE_CORE_VERSION (SHCI_C2_BLE_INIT_BLE_CORE_5_3) |
| 119 | + |
| 120 | ++#if 0 |
| 121 | + /****************************************************************************** |
| 122 | + * Transport Layer |
| 123 | + ******************************************************************************/ |
| 124 | +@@ -657,5 +680,5 @@ typedef enum |
| 125 | + #define CFG_OTP_BASE_ADDRESS OTP_AREA_BASE |
| 126 | + |
| 127 | + #define CFG_OTP_END_ADRESS OTP_AREA_END_ADDR |
| 128 | +- |
| 129 | +-#endif /*APP_CONF_H */ |
| 130 | ++#endif |
| 131 | ++#endif /*APP_CONF_DEFAULT_H */ |
| 132 | +diff --git a/src/utility/STM32Cube_FW/ble_bufsize.h b/src/utility/STM32Cube_FW/ble_bufsize.h |
| 133 | +index 7b7c170..53cf59a 100644 |
| 134 | +--- a/src/utility/STM32Cube_FW/ble_bufsize.h |
| 135 | ++++ b/src/utility/STM32Cube_FW/ble_bufsize.h |
| 136 | +@@ -75,15 +75,22 @@ |
| 137 | + ((pw) + MAX(BLE_MEM_BLOCK_X_MTU(mtu, n_link), \ |
| 138 | + BLE_MBLOCKS_SECURE_CONNECTIONS)) |
| 139 | + |
| 140 | ++/* |
| 141 | ++ * BLE_DEFAULT_MBLOCKS_COUNT: default memory blocks count |
| 142 | ++ */ |
| 143 | ++#define BLE_DEFAULT_MBLOCKS_COUNT(n_link) \ |
| 144 | ++ BLE_MBLOCKS_CALC(BLE_DEFAULT_PREP_WRITE_LIST_SIZE, \ |
| 145 | ++ BLE_DEFAULT_MAX_ATT_MTU, n_link) |
| 146 | ++ |
| 147 | + /* |
| 148 | + * BLE_FIXED_BUFFER_SIZE_BYTES: |
| 149 | + * A part of the RAM, is dynamically allocated by initializing all the pointers |
| 150 | + * defined in a global context variable "mem_alloc_ctx_p". |
| 151 | +- * This initialization is made in the Dynamic_allocator functions, which |
| 152 | ++ * This initialization is made in the Dynamic_allocator functions, which |
| 153 | + * assign a portion of RAM given by the external application to the above |
| 154 | + * mentioned "global pointers". |
| 155 | + * |
| 156 | +- * The size of this Dynamic RAM is made of 2 main components: |
| 157 | ++ * The size of this Dynamic RAM is made of 2 main components: |
| 158 | + * - a part that is parameters-dependent (num of links, GATT buffers, ...), |
| 159 | + * and which value is made explicit by the following macro; |
| 160 | + * - a part, that may be considered "fixed", i.e. independent from the above |
| 161 | +diff --git a/src/utility/STM32Cube_FW/hw.h b/src/utility/STM32Cube_FW/hw.h |
| 162 | +index 503fa2c..1472a5e 100644 |
| 163 | +--- a/src/utility/STM32Cube_FW/hw.h |
| 164 | ++++ b/src/utility/STM32Cube_FW/hw.h |
| 165 | +@@ -26,14 +26,23 @@ extern "C" { |
| 166 | + #endif |
| 167 | + |
| 168 | + /* Includes ------------------------------------------------------------------*/ |
| 169 | ++#include "stm32_def.h" |
| 170 | ++#include "stm32wbxx_ll_bus.h" |
| 171 | ++#include "stm32wbxx_ll_exti.h" |
| 172 | ++#include "stm32wbxx_ll_system.h" |
| 173 | ++#include "stm32wbxx_ll_rcc.h" |
| 174 | ++#include "stm32wbxx_ll_ipcc.h" |
| 175 | ++#include "stm32wbxx_ll_cortex.h" |
| 176 | ++#include "stm32wbxx_ll_utils.h" |
| 177 | ++#include "stm32wbxx_ll_pwr.h" |
| 178 | + |
| 179 | + /****************************************************************************** |
| 180 | + * HW IPCC |
| 181 | + ******************************************************************************/ |
| 182 | + void HW_IPCC_Enable( void ); |
| 183 | + void HW_IPCC_Init( void ); |
| 184 | +- void HW_IPCC_Rx_Handler( void ); |
| 185 | +- void HW_IPCC_Tx_Handler( void ); |
| 186 | ++#define HW_IPCC_Rx_Handler IPCC_C1_RX_IRQHandler |
| 187 | ++#define HW_IPCC_Tx_Handler IPCC_C1_TX_IRQHandler |
| 188 | + |
| 189 | + void HW_IPCC_BLE_Init( void ); |
| 190 | + void HW_IPCC_BLE_SendCmd( void ); |
| 191 | +@@ -76,7 +85,7 @@ extern "C" { |
| 192 | + void HW_IPCC_BLE_LLD_ReceiveRsp( void ); |
| 193 | + void HW_IPCC_BLE_LLD_SendRspAck( void ); |
| 194 | + |
| 195 | +- |
| 196 | ++ |
| 197 | + void HW_IPCC_TRACES_Init( void ); |
| 198 | + void HW_IPCC_TRACES_EvtNot( void ); |
| 199 | + |
| 200 | +diff --git a/src/utility/STM32Cube_FW/hw_ipcc.c b/src/utility/STM32Cube_FW/hw_ipcc.c |
| 201 | +index fd620b8..3461cbe 100644 |
| 202 | +--- a/src/utility/STM32Cube_FW/hw_ipcc.c |
| 203 | ++++ b/src/utility/STM32Cube_FW/hw_ipcc.c |
| 204 | +@@ -18,8 +18,9 @@ |
| 205 | + */ |
| 206 | + /* USER CODE END Header */ |
| 207 | + |
| 208 | ++#if defined(STM32WBxx) |
| 209 | + /* Includes ------------------------------------------------------------------*/ |
| 210 | +-#include "app_common.h" |
| 211 | ++#include "hw.h" |
| 212 | + #include "mbox_def.h" |
| 213 | + |
| 214 | + /* Global variables ---------------------------------------------------------*/ |
| 215 | +@@ -667,3 +668,4 @@ static void HW_IPCC_TRACES_EvtHandler( void ) |
| 216 | + } |
| 217 | + |
| 218 | + __weak void HW_IPCC_TRACES_EvtNot( void ){}; |
| 219 | ++#endif /* STM32WBxx */ |
| 220 | +diff --git a/src/utility/STM32Cube_FW/shci.c b/src/utility/STM32Cube_FW/shci.c |
| 221 | +index 301db76..cb7d7bd 100644 |
| 222 | +--- a/src/utility/STM32Cube_FW/shci.c |
| 223 | ++++ b/src/utility/STM32Cube_FW/shci.c |
| 224 | +@@ -16,7 +16,7 @@ |
| 225 | + ****************************************************************************** |
| 226 | + */ |
| 227 | + |
| 228 | +- |
| 229 | ++#if defined(STM32WBxx) |
| 230 | + /* Includes ------------------------------------------------------------------*/ |
| 231 | + #include "stm32_wpan_common.h" |
| 232 | + |
| 233 | +@@ -739,3 +739,4 @@ SHCI_CmdStatus_t SHCI_GetWirelessFwInfo( WirelessFwInfo_t* pWirelessInfo ) |
| 234 | + |
| 235 | + return (SHCI_Success); |
| 236 | + } |
| 237 | ++#endif /* STM32WBxx */ |
| 238 | +diff --git a/src/utility/STM32Cube_FW/shci_tl.c b/src/utility/STM32Cube_FW/shci_tl.c |
| 239 | +index 2b387b1..a336aa6 100644 |
| 240 | +--- a/src/utility/STM32Cube_FW/shci_tl.c |
| 241 | ++++ b/src/utility/STM32Cube_FW/shci_tl.c |
| 242 | +@@ -16,12 +16,13 @@ |
| 243 | + ****************************************************************************** |
| 244 | + */ |
| 245 | + |
| 246 | +- |
| 247 | ++#if defined(STM32WBxx) |
| 248 | + /* Includes ------------------------------------------------------------------*/ |
| 249 | + #include "stm32_wpan_common.h" |
| 250 | + |
| 251 | + #include "stm_list.h" |
| 252 | + #include "shci_tl.h" |
| 253 | ++#include "stm32_def.h" |
| 254 | + |
| 255 | + /* Private typedef -----------------------------------------------------------*/ |
| 256 | + typedef enum |
| 257 | +@@ -168,6 +169,20 @@ void shci_send( uint16_t cmd_code, uint8_t len_cmd_payload, uint8_t * p_cmd_payl |
| 258 | + return; |
| 259 | + } |
| 260 | + |
| 261 | ++void shci_notify_asynch_evt(void *pdata) |
| 262 | ++{ |
| 263 | ++ UNUSED(pdata); |
| 264 | ++ /* Need to parse data in future version */ |
| 265 | ++ shci_user_evt_proc(); |
| 266 | ++} |
| 267 | ++ |
| 268 | ++void shci_register_io_bus(tSHciIO *fops) |
| 269 | ++{ |
| 270 | ++ /* Register IO bus services */ |
| 271 | ++ fops->Init = TL_SYS_Init; |
| 272 | ++ fops->Send = TL_SYS_SendCmd; |
| 273 | ++} |
| 274 | ++ |
| 275 | + /* Private functions ---------------------------------------------------------*/ |
| 276 | + static void TlInit( TL_CmdPacket_t * p_cmdbuffer ) |
| 277 | + { |
| 278 | +@@ -251,3 +266,4 @@ __WEAK void shci_cmd_resp_release(uint32_t flag) |
| 279 | + |
| 280 | + return; |
| 281 | + } |
| 282 | ++#endif /* STM32WBxx */ |
| 283 | +diff --git a/src/utility/STM32Cube_FW/stm_list.c b/src/utility/STM32Cube_FW/stm_list.c |
| 284 | +index 4c92864..4e8c364 100644 |
| 285 | +--- a/src/utility/STM32Cube_FW/stm_list.c |
| 286 | ++++ b/src/utility/STM32Cube_FW/stm_list.c |
| 287 | +@@ -16,11 +16,13 @@ |
| 288 | + ****************************************************************************** |
| 289 | + */ |
| 290 | + |
| 291 | +- |
| 292 | ++#if defined(STM32WBxx) |
| 293 | + /****************************************************************************** |
| 294 | + * Include Files |
| 295 | + ******************************************************************************/ |
| 296 | +-#include "utilities_common.h" |
| 297 | ++#include "stdint.h" |
| 298 | ++#include "cmsis_gcc.h" |
| 299 | ++#include "stm32_wpan_common.h" |
| 300 | + |
| 301 | + #include "stm_list.h" |
| 302 | + |
| 303 | +@@ -204,3 +206,4 @@ void LST_get_prev_node (tListNode * ref_node, tListNode ** node) |
| 304 | + |
| 305 | + __set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/ |
| 306 | + } |
| 307 | ++#endif /* STM32WBxx */ |
| 308 | +diff --git a/src/utility/STM32Cube_FW/tl_mbox.c b/src/utility/STM32Cube_FW/tl_mbox.c |
| 309 | +index 27a998a..ff219b9 100644 |
| 310 | +--- a/src/utility/STM32Cube_FW/tl_mbox.c |
| 311 | ++++ b/src/utility/STM32Cube_FW/tl_mbox.c |
| 312 | +@@ -16,6 +16,7 @@ |
| 313 | + ****************************************************************************** |
| 314 | + */ |
| 315 | + |
| 316 | ++#if defined(STM32WBxx) |
| 317 | + /* Includes ------------------------------------------------------------------*/ |
| 318 | + #include "stm32_wpan_common.h" |
| 319 | + #include "hw.h" |
| 320 | +@@ -51,9 +52,10 @@ PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_BleLldTable_t TL_BleLldTable; |
| 321 | + PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_SysTable_t TL_SysTable; |
| 322 | + PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_MemManagerTable_t TL_MemManagerTable; |
| 323 | + PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_TracesTable_t TL_TracesTable; |
| 324 | ++#if 0 |
| 325 | + PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_Mac_802_15_4_t TL_Mac_802_15_4_Table; |
| 326 | + PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_ZigbeeTable_t TL_Zigbee_Table; |
| 327 | +- |
| 328 | ++#endif |
| 329 | + /**< tables */ |
| 330 | + PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static tListNode FreeBufQueue; |
| 331 | + PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static tListNode TracesEvtQueue; |
| 332 | +@@ -97,8 +99,11 @@ void TL_Init( void ) |
| 333 | + TL_RefTable.p_sys_table = &TL_SysTable; |
| 334 | + TL_RefTable.p_mem_manager_table = &TL_MemManagerTable; |
| 335 | + TL_RefTable.p_traces_table = &TL_TracesTable; |
| 336 | ++ |
| 337 | ++#if 0 |
| 338 | + TL_RefTable.p_mac_802_15_4_table = &TL_Mac_802_15_4_Table; |
| 339 | + TL_RefTable.p_zigbee_table = &TL_Zigbee_Table; |
| 340 | ++#endif |
| 341 | + HW_IPCC_Init(); |
| 342 | + |
| 343 | + return; |
| 344 | +@@ -846,3 +851,4 @@ static void OutputDbgTrace(TL_MB_PacketType_t packet_type, uint8_t* buffer) |
| 345 | + |
| 346 | + return; |
| 347 | + } |
| 348 | ++#endif /* STM32WBxx */ |
| 349 | +-- |
| 350 | +2.38.0.windows.1 |
| 351 | + |
0 commit comments