Skip to content

Commit

Permalink
[FL-3271] cubewb: updated to v1.16.0 (flipperdevices#2595)
Browse files Browse the repository at this point in the history
* cubewb: updated project to v1.16.0
* hal: updated api_symbols for f18
* FuriHal: add missing enterprise sleep and insomnia
* FuriHal: slightly more paranoic sleep mode

Co-authored-by: Aleksandr Kutuzov <[email protected]>
  • Loading branch information
hedger and skotopes authored Apr 20, 2023
1 parent 3932503 commit 4d015a1
Show file tree
Hide file tree
Showing 15 changed files with 124 additions and 77 deletions.
2 changes: 1 addition & 1 deletion fbt_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
COPRO_OB_DATA = "scripts/ob.data"

# Must match lib/STM32CubeWB version
COPRO_CUBE_VERSION = "1.13.3"
COPRO_CUBE_VERSION = "1.16.0"

COPRO_CUBE_DIR = "lib/STM32CubeWB"

Expand Down
40 changes: 20 additions & 20 deletions firmware/targets/f18/api_symbols.csv
Original file line number Diff line number Diff line change
Expand Up @@ -176,17 +176,17 @@ Header,+,lib/toolbox/tar/tar_archive.h,,
Header,+,lib/toolbox/value_index.h,,
Header,+,lib/toolbox/version.h,,
Function,-,LL_ADC_CommonDeInit,ErrorStatus,ADC_Common_TypeDef*
Function,-,LL_ADC_CommonInit,ErrorStatus,"ADC_Common_TypeDef*, LL_ADC_CommonInitTypeDef*"
Function,-,LL_ADC_CommonInit,ErrorStatus,"ADC_Common_TypeDef*, const LL_ADC_CommonInitTypeDef*"
Function,-,LL_ADC_CommonStructInit,void,LL_ADC_CommonInitTypeDef*
Function,-,LL_ADC_DeInit,ErrorStatus,ADC_TypeDef*
Function,-,LL_ADC_INJ_Init,ErrorStatus,"ADC_TypeDef*, LL_ADC_INJ_InitTypeDef*"
Function,-,LL_ADC_INJ_Init,ErrorStatus,"ADC_TypeDef*, const LL_ADC_INJ_InitTypeDef*"
Function,-,LL_ADC_INJ_StructInit,void,LL_ADC_INJ_InitTypeDef*
Function,-,LL_ADC_Init,ErrorStatus,"ADC_TypeDef*, LL_ADC_InitTypeDef*"
Function,-,LL_ADC_REG_Init,ErrorStatus,"ADC_TypeDef*, LL_ADC_REG_InitTypeDef*"
Function,-,LL_ADC_Init,ErrorStatus,"ADC_TypeDef*, const LL_ADC_InitTypeDef*"
Function,-,LL_ADC_REG_Init,ErrorStatus,"ADC_TypeDef*, const LL_ADC_REG_InitTypeDef*"
Function,-,LL_ADC_REG_StructInit,void,LL_ADC_REG_InitTypeDef*
Function,-,LL_ADC_StructInit,void,LL_ADC_InitTypeDef*
Function,-,LL_COMP_DeInit,ErrorStatus,COMP_TypeDef*
Function,+,LL_COMP_Init,ErrorStatus,"COMP_TypeDef*, LL_COMP_InitTypeDef*"
Function,+,LL_COMP_Init,ErrorStatus,"COMP_TypeDef*, const LL_COMP_InitTypeDef*"
Function,-,LL_COMP_StructInit,void,LL_COMP_InitTypeDef*
Function,-,LL_CRC_DeInit,ErrorStatus,CRC_TypeDef*
Function,-,LL_CRS_DeInit,ErrorStatus,
Expand All @@ -199,16 +199,16 @@ Function,-,LL_EXTI_StructInit,void,LL_EXTI_InitTypeDef*
Function,-,LL_GPIO_DeInit,ErrorStatus,GPIO_TypeDef*
Function,+,LL_GPIO_Init,ErrorStatus,"GPIO_TypeDef*, LL_GPIO_InitTypeDef*"
Function,-,LL_GPIO_StructInit,void,LL_GPIO_InitTypeDef*
Function,-,LL_I2C_DeInit,ErrorStatus,I2C_TypeDef*
Function,+,LL_I2C_Init,ErrorStatus,"I2C_TypeDef*, LL_I2C_InitTypeDef*"
Function,-,LL_I2C_DeInit,ErrorStatus,const I2C_TypeDef*
Function,+,LL_I2C_Init,ErrorStatus,"I2C_TypeDef*, const LL_I2C_InitTypeDef*"
Function,-,LL_I2C_StructInit,void,LL_I2C_InitTypeDef*
Function,-,LL_Init1msTick,void,uint32_t
Function,+,LL_LPTIM_DeInit,ErrorStatus,LPTIM_TypeDef*
Function,-,LL_LPTIM_Disable,void,LPTIM_TypeDef*
Function,+,LL_LPTIM_Init,ErrorStatus,"LPTIM_TypeDef*, LL_LPTIM_InitTypeDef*"
Function,+,LL_LPTIM_Init,ErrorStatus,"LPTIM_TypeDef*, const LL_LPTIM_InitTypeDef*"
Function,-,LL_LPTIM_StructInit,void,LL_LPTIM_InitTypeDef*
Function,-,LL_LPUART_DeInit,ErrorStatus,USART_TypeDef*
Function,+,LL_LPUART_Init,ErrorStatus,"USART_TypeDef*, LL_LPUART_InitTypeDef*"
Function,-,LL_LPUART_DeInit,ErrorStatus,const USART_TypeDef*
Function,+,LL_LPUART_Init,ErrorStatus,"USART_TypeDef*, const LL_LPUART_InitTypeDef*"
Function,-,LL_LPUART_StructInit,void,LL_LPUART_InitTypeDef*
Function,-,LL_PKA_DeInit,ErrorStatus,PKA_TypeDef*
Function,-,LL_PKA_Init,ErrorStatus,"PKA_TypeDef*, LL_PKA_InitTypeDef*"
Expand Down Expand Up @@ -253,23 +253,23 @@ Function,+,LL_SPI_Init,ErrorStatus,"SPI_TypeDef*, LL_SPI_InitTypeDef*"
Function,-,LL_SPI_StructInit,void,LL_SPI_InitTypeDef*
Function,-,LL_SetFlashLatency,ErrorStatus,uint32_t
Function,+,LL_SetSystemCoreClock,void,uint32_t
Function,-,LL_TIM_BDTR_Init,ErrorStatus,"TIM_TypeDef*, LL_TIM_BDTR_InitTypeDef*"
Function,-,LL_TIM_BDTR_Init,ErrorStatus,"TIM_TypeDef*, const LL_TIM_BDTR_InitTypeDef*"
Function,-,LL_TIM_BDTR_StructInit,void,LL_TIM_BDTR_InitTypeDef*
Function,+,LL_TIM_DeInit,ErrorStatus,TIM_TypeDef*
Function,-,LL_TIM_ENCODER_Init,ErrorStatus,"TIM_TypeDef*, LL_TIM_ENCODER_InitTypeDef*"
Function,-,LL_TIM_DeInit,ErrorStatus,TIM_TypeDef*
Function,-,LL_TIM_ENCODER_Init,ErrorStatus,"TIM_TypeDef*, const LL_TIM_ENCODER_InitTypeDef*"
Function,-,LL_TIM_ENCODER_StructInit,void,LL_TIM_ENCODER_InitTypeDef*
Function,-,LL_TIM_HALLSENSOR_Init,ErrorStatus,"TIM_TypeDef*, LL_TIM_HALLSENSOR_InitTypeDef*"
Function,-,LL_TIM_HALLSENSOR_Init,ErrorStatus,"TIM_TypeDef*, const LL_TIM_HALLSENSOR_InitTypeDef*"
Function,-,LL_TIM_HALLSENSOR_StructInit,void,LL_TIM_HALLSENSOR_InitTypeDef*
Function,-,LL_TIM_IC_Init,ErrorStatus,"TIM_TypeDef*, uint32_t, LL_TIM_IC_InitTypeDef*"
Function,-,LL_TIM_IC_Init,ErrorStatus,"TIM_TypeDef*, uint32_t, const LL_TIM_IC_InitTypeDef*"
Function,-,LL_TIM_IC_StructInit,void,LL_TIM_IC_InitTypeDef*
Function,+,LL_TIM_Init,ErrorStatus,"TIM_TypeDef*, LL_TIM_InitTypeDef*"
Function,+,LL_TIM_OC_Init,ErrorStatus,"TIM_TypeDef*, uint32_t, LL_TIM_OC_InitTypeDef*"
Function,+,LL_TIM_Init,ErrorStatus,"TIM_TypeDef*, const LL_TIM_InitTypeDef*"
Function,+,LL_TIM_OC_Init,ErrorStatus,"TIM_TypeDef*, uint32_t, const LL_TIM_OC_InitTypeDef*"
Function,-,LL_TIM_OC_StructInit,void,LL_TIM_OC_InitTypeDef*
Function,-,LL_TIM_StructInit,void,LL_TIM_InitTypeDef*
Function,-,LL_USART_ClockInit,ErrorStatus,"USART_TypeDef*, LL_USART_ClockInitTypeDef*"
Function,-,LL_USART_ClockInit,ErrorStatus,"USART_TypeDef*, const LL_USART_ClockInitTypeDef*"
Function,-,LL_USART_ClockStructInit,void,LL_USART_ClockInitTypeDef*
Function,-,LL_USART_DeInit,ErrorStatus,USART_TypeDef*
Function,+,LL_USART_Init,ErrorStatus,"USART_TypeDef*, LL_USART_InitTypeDef*"
Function,-,LL_USART_DeInit,ErrorStatus,const USART_TypeDef*
Function,+,LL_USART_Init,ErrorStatus,"USART_TypeDef*, const LL_USART_InitTypeDef*"
Function,-,LL_USART_StructInit,void,LL_USART_InitTypeDef*
Function,-,LL_mDelay,void,uint32_t
Function,-,SystemCoreClockUpdate,void,
Expand Down
38 changes: 19 additions & 19 deletions firmware/targets/f7/api_symbols.csv
Original file line number Diff line number Diff line change
Expand Up @@ -208,17 +208,17 @@ Header,+,lib/toolbox/tar/tar_archive.h,,
Header,+,lib/toolbox/value_index.h,,
Header,+,lib/toolbox/version.h,,
Function,-,LL_ADC_CommonDeInit,ErrorStatus,ADC_Common_TypeDef*
Function,-,LL_ADC_CommonInit,ErrorStatus,"ADC_Common_TypeDef*, LL_ADC_CommonInitTypeDef*"
Function,-,LL_ADC_CommonInit,ErrorStatus,"ADC_Common_TypeDef*, const LL_ADC_CommonInitTypeDef*"
Function,-,LL_ADC_CommonStructInit,void,LL_ADC_CommonInitTypeDef*
Function,-,LL_ADC_DeInit,ErrorStatus,ADC_TypeDef*
Function,-,LL_ADC_INJ_Init,ErrorStatus,"ADC_TypeDef*, LL_ADC_INJ_InitTypeDef*"
Function,-,LL_ADC_INJ_Init,ErrorStatus,"ADC_TypeDef*, const LL_ADC_INJ_InitTypeDef*"
Function,-,LL_ADC_INJ_StructInit,void,LL_ADC_INJ_InitTypeDef*
Function,-,LL_ADC_Init,ErrorStatus,"ADC_TypeDef*, LL_ADC_InitTypeDef*"
Function,-,LL_ADC_REG_Init,ErrorStatus,"ADC_TypeDef*, LL_ADC_REG_InitTypeDef*"
Function,-,LL_ADC_Init,ErrorStatus,"ADC_TypeDef*, const LL_ADC_InitTypeDef*"
Function,-,LL_ADC_REG_Init,ErrorStatus,"ADC_TypeDef*, const LL_ADC_REG_InitTypeDef*"
Function,-,LL_ADC_REG_StructInit,void,LL_ADC_REG_InitTypeDef*
Function,-,LL_ADC_StructInit,void,LL_ADC_InitTypeDef*
Function,-,LL_COMP_DeInit,ErrorStatus,COMP_TypeDef*
Function,+,LL_COMP_Init,ErrorStatus,"COMP_TypeDef*, LL_COMP_InitTypeDef*"
Function,+,LL_COMP_Init,ErrorStatus,"COMP_TypeDef*, const LL_COMP_InitTypeDef*"
Function,-,LL_COMP_StructInit,void,LL_COMP_InitTypeDef*
Function,-,LL_CRC_DeInit,ErrorStatus,CRC_TypeDef*
Function,-,LL_CRS_DeInit,ErrorStatus,
Expand All @@ -231,16 +231,16 @@ Function,-,LL_EXTI_StructInit,void,LL_EXTI_InitTypeDef*
Function,-,LL_GPIO_DeInit,ErrorStatus,GPIO_TypeDef*
Function,+,LL_GPIO_Init,ErrorStatus,"GPIO_TypeDef*, LL_GPIO_InitTypeDef*"
Function,-,LL_GPIO_StructInit,void,LL_GPIO_InitTypeDef*
Function,-,LL_I2C_DeInit,ErrorStatus,I2C_TypeDef*
Function,+,LL_I2C_Init,ErrorStatus,"I2C_TypeDef*, LL_I2C_InitTypeDef*"
Function,-,LL_I2C_DeInit,ErrorStatus,const I2C_TypeDef*
Function,+,LL_I2C_Init,ErrorStatus,"I2C_TypeDef*, const LL_I2C_InitTypeDef*"
Function,-,LL_I2C_StructInit,void,LL_I2C_InitTypeDef*
Function,-,LL_Init1msTick,void,uint32_t
Function,+,LL_LPTIM_DeInit,ErrorStatus,LPTIM_TypeDef*
Function,-,LL_LPTIM_Disable,void,LPTIM_TypeDef*
Function,+,LL_LPTIM_Init,ErrorStatus,"LPTIM_TypeDef*, LL_LPTIM_InitTypeDef*"
Function,+,LL_LPTIM_Init,ErrorStatus,"LPTIM_TypeDef*, const LL_LPTIM_InitTypeDef*"
Function,-,LL_LPTIM_StructInit,void,LL_LPTIM_InitTypeDef*
Function,-,LL_LPUART_DeInit,ErrorStatus,USART_TypeDef*
Function,+,LL_LPUART_Init,ErrorStatus,"USART_TypeDef*, LL_LPUART_InitTypeDef*"
Function,-,LL_LPUART_DeInit,ErrorStatus,const USART_TypeDef*
Function,+,LL_LPUART_Init,ErrorStatus,"USART_TypeDef*, const LL_LPUART_InitTypeDef*"
Function,-,LL_LPUART_StructInit,void,LL_LPUART_InitTypeDef*
Function,-,LL_PKA_DeInit,ErrorStatus,PKA_TypeDef*
Function,-,LL_PKA_Init,ErrorStatus,"PKA_TypeDef*, LL_PKA_InitTypeDef*"
Expand Down Expand Up @@ -285,23 +285,23 @@ Function,+,LL_SPI_Init,ErrorStatus,"SPI_TypeDef*, LL_SPI_InitTypeDef*"
Function,-,LL_SPI_StructInit,void,LL_SPI_InitTypeDef*
Function,-,LL_SetFlashLatency,ErrorStatus,uint32_t
Function,+,LL_SetSystemCoreClock,void,uint32_t
Function,-,LL_TIM_BDTR_Init,ErrorStatus,"TIM_TypeDef*, LL_TIM_BDTR_InitTypeDef*"
Function,-,LL_TIM_BDTR_Init,ErrorStatus,"TIM_TypeDef*, const LL_TIM_BDTR_InitTypeDef*"
Function,-,LL_TIM_BDTR_StructInit,void,LL_TIM_BDTR_InitTypeDef*
Function,+,LL_TIM_DeInit,ErrorStatus,TIM_TypeDef*
Function,-,LL_TIM_ENCODER_Init,ErrorStatus,"TIM_TypeDef*, LL_TIM_ENCODER_InitTypeDef*"
Function,-,LL_TIM_ENCODER_Init,ErrorStatus,"TIM_TypeDef*, const LL_TIM_ENCODER_InitTypeDef*"
Function,-,LL_TIM_ENCODER_StructInit,void,LL_TIM_ENCODER_InitTypeDef*
Function,-,LL_TIM_HALLSENSOR_Init,ErrorStatus,"TIM_TypeDef*, LL_TIM_HALLSENSOR_InitTypeDef*"
Function,-,LL_TIM_HALLSENSOR_Init,ErrorStatus,"TIM_TypeDef*, const LL_TIM_HALLSENSOR_InitTypeDef*"
Function,-,LL_TIM_HALLSENSOR_StructInit,void,LL_TIM_HALLSENSOR_InitTypeDef*
Function,-,LL_TIM_IC_Init,ErrorStatus,"TIM_TypeDef*, uint32_t, LL_TIM_IC_InitTypeDef*"
Function,-,LL_TIM_IC_Init,ErrorStatus,"TIM_TypeDef*, uint32_t, const LL_TIM_IC_InitTypeDef*"
Function,-,LL_TIM_IC_StructInit,void,LL_TIM_IC_InitTypeDef*
Function,+,LL_TIM_Init,ErrorStatus,"TIM_TypeDef*, LL_TIM_InitTypeDef*"
Function,+,LL_TIM_OC_Init,ErrorStatus,"TIM_TypeDef*, uint32_t, LL_TIM_OC_InitTypeDef*"
Function,+,LL_TIM_Init,ErrorStatus,"TIM_TypeDef*, const LL_TIM_InitTypeDef*"
Function,+,LL_TIM_OC_Init,ErrorStatus,"TIM_TypeDef*, uint32_t, const LL_TIM_OC_InitTypeDef*"
Function,-,LL_TIM_OC_StructInit,void,LL_TIM_OC_InitTypeDef*
Function,-,LL_TIM_StructInit,void,LL_TIM_InitTypeDef*
Function,-,LL_USART_ClockInit,ErrorStatus,"USART_TypeDef*, LL_USART_ClockInitTypeDef*"
Function,-,LL_USART_ClockInit,ErrorStatus,"USART_TypeDef*, const LL_USART_ClockInitTypeDef*"
Function,-,LL_USART_ClockStructInit,void,LL_USART_ClockInitTypeDef*
Function,-,LL_USART_DeInit,ErrorStatus,USART_TypeDef*
Function,+,LL_USART_Init,ErrorStatus,"USART_TypeDef*, LL_USART_InitTypeDef*"
Function,-,LL_USART_DeInit,ErrorStatus,const USART_TypeDef*
Function,+,LL_USART_Init,ErrorStatus,"USART_TypeDef*, const LL_USART_InitTypeDef*"
Function,-,LL_USART_StructInit,void,LL_USART_InitTypeDef*
Function,-,LL_mDelay,void,uint32_t
Function,-,SystemCoreClockUpdate,void,
Expand Down
1 change: 1 addition & 0 deletions firmware/targets/f7/ble_glue/app_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ extern "C" {
#include <stdarg.h>

#include <core/common_defines.h>
#include <tl.h>

#include "app_conf.h"

Expand Down
2 changes: 2 additions & 0 deletions firmware/targets/f7/ble_glue/app_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

#define CFG_TX_POWER (0x19) /* +0dBm */

#define CFG_IDENTITY_ADDRESS GAP_PUBLIC_ADDR

/**
* Define Advertising parameters
*/
Expand Down
3 changes: 2 additions & 1 deletion firmware/targets/f7/ble_glue/app_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ PLACE_IN_SECTION("MB_MEM2")
ALIGN(4) static SHCI_C2_DEBUG_TracesConfig_t APPD_TracesConfig = {0, 0, 0, 0};
PLACE_IN_SECTION("MB_MEM2")
ALIGN(4)
static SHCI_C2_DEBUG_GeneralConfig_t APPD_GeneralConfig = {BLE_DTB_CFG, SYS_DBG_CFG1, {0, 0}};
static SHCI_C2_DEBUG_GeneralConfig_t APPD_GeneralConfig =
{BLE_DTB_CFG, SYS_DBG_CFG1, {0, 0}, 0, 0, 0, 0, 0};

/**
* THE DEBUG ON GPIO FOR CPU2 IS INTENDED TO BE USED ONLY ON REQUEST FROM ST SUPPORT
Expand Down
10 changes: 8 additions & 2 deletions firmware/targets/f7/ble_glue/ble_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static TL_CmdPacket_t ble_app_cmd_buffer;
PLACE_IN_SECTION("MB_MEM2") ALIGN(4) static uint32_t ble_app_nvm[BLE_NVM_SRAM_SIZE];

_Static_assert(
sizeof(SHCI_C2_Ble_Init_Cmd_Packet_t) == 49,
"Ble stack config structure size mismatch");
sizeof(SHCI_C2_Ble_Init_Cmd_Packet_t) == 58,
"Ble stack config structure size mismatch (check new config options - last updated for v.1.16.0)");

typedef struct {
FuriMutex* hci_mtx;
Expand Down Expand Up @@ -88,6 +88,12 @@ bool ble_app_init() {
.min_tx_power = 0,
.max_tx_power = 0,
.rx_model_config = 1,
/* New stack (13.3->16.0)*/
.max_adv_set_nbr = 1, // Only used if SHCI_C2_BLE_INIT_OPTIONS_EXT_ADV is set
.max_adv_data_len = 31, // Only used if SHCI_C2_BLE_INIT_OPTIONS_EXT_ADV is set
.tx_path_compens = 0, // RF TX Path Compensation, * 0.1 dB
.rx_path_compens = 0, // RF RX Path Compensation, * 0.1 dB
.ble_core_version = 11, // BLE Core Version: 11(5.2), 12(5.3)
}};
status = SHCI_C2_BLE_Init(&ble_init_cmd_packet);
if(status) {
Expand Down
4 changes: 4 additions & 0 deletions firmware/targets/f7/ble_glue/ble_const.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <ble/core/ble_std.h>
#include <ble/core/ble_defs.h>
#include "osal.h"
#include "compiler.h"

/* Default BLE variant */
#ifndef BASIC_FEATURES
Expand All @@ -34,6 +35,9 @@
#ifndef LL_ONLY
#define LL_ONLY 0
#endif
#ifndef LL_ONLY_BASIC
#define LL_ONLY_BASIC 0
#endif
#ifndef BEACON_ONLY
#define BEACON_ONLY 0
#endif
Expand Down
2 changes: 2 additions & 0 deletions firmware/targets/f7/ble_glue/ble_glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,9 @@ void shci_cmd_resp_release(uint32_t flag) {
void shci_cmd_resp_wait(uint32_t timeout) {
UNUSED(timeout);
if(ble_glue) {
furi_hal_power_insomnia_enter();
furi_semaphore_acquire(ble_glue->shci_sem, FuriWaitForever);
furi_hal_power_insomnia_exit();
}
}

Expand Down
10 changes: 9 additions & 1 deletion firmware/targets/f7/ble_glue/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*****************************************************************************
* @attention
*
* Copyright (c) 2018-2022 STMicroelectronics.
* Copyright (c) 2018-2023 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
Expand All @@ -18,6 +18,14 @@
#ifndef COMPILER_H__
#define COMPILER_H__

#ifndef __PACKED_STRUCT
#define __PACKED_STRUCT PACKED(struct)
#endif

#ifndef __PACKED_UNION
#define __PACKED_UNION PACKED(union)
#endif

/**
* @brief This is the section dedicated to IAR toolchain
*/
Expand Down
Loading

0 comments on commit 4d015a1

Please sign in to comment.