Revert cubewb update

This commit is contained in:
Willy-JL
2023-04-25 13:00:40 +01:00
parent a0d6c6e63c
commit 83afd16746
10 changed files with 34 additions and 53 deletions

View File

@@ -20,7 +20,7 @@ DIST_SUFFIX = "XFW-0044_09042023"
COPRO_OB_DATA = "scripts/ob.data" COPRO_OB_DATA = "scripts/ob.data"
# Must match lib/STM32CubeWB version # Must match lib/STM32CubeWB version
COPRO_CUBE_VERSION = "1.15.0" COPRO_CUBE_VERSION = "1.13.3"
COPRO_CUBE_DIR = "lib/STM32CubeWB" COPRO_CUBE_DIR = "lib/STM32CubeWB"

View File

@@ -33,7 +33,6 @@ extern "C" {
#include <stdarg.h> #include <stdarg.h>
#include <core/common_defines.h> #include <core/common_defines.h>
#include <tl.h>
#include "app_conf.h" #include "app_conf.h"

View File

@@ -8,8 +8,6 @@
#define CFG_TX_POWER (0x19) /* +0dBm */ #define CFG_TX_POWER (0x19) /* +0dBm */
#define CFG_IDENTITY_ADDRESS GAP_PUBLIC_ADDR
/** /**
* Define Advertising parameters * Define Advertising parameters
*/ */

View File

@@ -33,8 +33,7 @@ PLACE_IN_SECTION("MB_MEM2")
ALIGN(4) static SHCI_C2_DEBUG_TracesConfig_t APPD_TracesConfig = {0, 0, 0, 0}; ALIGN(4) static SHCI_C2_DEBUG_TracesConfig_t APPD_TracesConfig = {0, 0, 0, 0};
PLACE_IN_SECTION("MB_MEM2") PLACE_IN_SECTION("MB_MEM2")
ALIGN(4) ALIGN(4)
static SHCI_C2_DEBUG_GeneralConfig_t APPD_GeneralConfig = static SHCI_C2_DEBUG_GeneralConfig_t APPD_GeneralConfig = {BLE_DTB_CFG, SYS_DBG_CFG1, {0, 0}};
{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 * THE DEBUG ON GPIO FOR CPU2 IS INTENDED TO BE USED ONLY ON REQUEST FROM ST SUPPORT

View File

@@ -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]; PLACE_IN_SECTION("MB_MEM2") ALIGN(4) static uint32_t ble_app_nvm[BLE_NVM_SRAM_SIZE];
_Static_assert( _Static_assert(
sizeof(SHCI_C2_Ble_Init_Cmd_Packet_t) == 57, sizeof(SHCI_C2_Ble_Init_Cmd_Packet_t) == 49,
"Ble stack config structure size mismatch (check new config options - last updated for v.1.15.0)"); "Ble stack config structure size mismatch");
typedef struct { typedef struct {
FuriMutex* hci_mtx; FuriMutex* hci_mtx;
@@ -88,12 +88,6 @@ bool ble_app_init() {
.min_tx_power = 0, .min_tx_power = 0,
.max_tx_power = 0, .max_tx_power = 0,
.rx_model_config = 1, .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); status = SHCI_C2_BLE_Init(&ble_init_cmd_packet);
if(status) { if(status) {

View File

@@ -23,7 +23,6 @@
#include <ble/core/ble_std.h> #include <ble/core/ble_std.h>
#include <ble/core/ble_defs.h> #include <ble/core/ble_defs.h>
#include "osal.h" #include "osal.h"
#include "compiler.h"
/* Default BLE variant */ /* Default BLE variant */
#ifndef BASIC_FEATURES #ifndef BASIC_FEATURES
@@ -35,9 +34,6 @@
#ifndef LL_ONLY #ifndef LL_ONLY
#define LL_ONLY 0 #define LL_ONLY 0
#endif #endif
#ifndef LL_ONLY_BASIC
#define LL_ONLY_BASIC 0
#endif
#ifndef BEACON_ONLY #ifndef BEACON_ONLY
#define BEACON_ONLY 0 #define BEACON_ONLY 0
#endif #endif

View File

@@ -5,7 +5,7 @@
***************************************************************************** *****************************************************************************
* @attention * @attention
* *
* Copyright (c) 2018-2023 STMicroelectronics. * Copyright (c) 2018-2022 STMicroelectronics.
* All rights reserved. * All rights reserved.
* *
* This software is licensed under terms that can be found in the LICENSE file * This software is licensed under terms that can be found in the LICENSE file
@@ -18,14 +18,6 @@
#ifndef COMPILER_H__ #ifndef COMPILER_H__
#define 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 * @brief This is the section dedicated to IAR toolchain
*/ */

View File

@@ -1,6 +1,5 @@
#include "gap.h" #include "gap.h"
#include "app_common.h"
#include <ble/ble.h> #include <ble/ble.h>
#include <furi_hal.h> #include <furi_hal.h>
@@ -101,7 +100,7 @@ static void gap_verify_connection_parameters(Gap* gap) {
SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification(void* pckt) { SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification(void* pckt) {
hci_event_pckt* event_pckt; hci_event_pckt* event_pckt;
evt_le_meta_event* meta_evt; evt_le_meta_event* meta_evt;
evt_blecore_aci* blue_evt; evt_blue_aci* blue_evt;
hci_le_phy_update_complete_event_rp0* evt_le_phy_update_complete; hci_le_phy_update_complete_event_rp0* evt_le_phy_update_complete;
uint8_t tx_phy; uint8_t tx_phy;
uint8_t rx_phy; uint8_t rx_phy;
@@ -113,7 +112,7 @@ SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification(void* pckt) {
furi_mutex_acquire(gap->state_mutex, FuriWaitForever); furi_mutex_acquire(gap->state_mutex, FuriWaitForever);
} }
switch(event_pckt->evt) { switch(event_pckt->evt) {
case HCI_DISCONNECTION_COMPLETE_EVT_CODE: { case EVT_DISCONN_COMPLETE: {
hci_disconnection_complete_event_rp0* disconnection_complete_event = hci_disconnection_complete_event_rp0* disconnection_complete_event =
(hci_disconnection_complete_event_rp0*)event_pckt->data; (hci_disconnection_complete_event_rp0*)event_pckt->data;
if(disconnection_complete_event->Connection_Handle == gap->service.connection_handle) { if(disconnection_complete_event->Connection_Handle == gap->service.connection_handle) {
@@ -132,10 +131,10 @@ SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification(void* pckt) {
gap->on_event_cb(event, gap->context); gap->on_event_cb(event, gap->context);
} break; } break;
case HCI_LE_META_EVT_CODE: case EVT_LE_META_EVENT:
meta_evt = (evt_le_meta_event*)event_pckt->data; meta_evt = (evt_le_meta_event*)event_pckt->data;
switch(meta_evt->subevent) { switch(meta_evt->subevent) {
case HCI_LE_CONNECTION_UPDATE_COMPLETE_SUBEVT_CODE: { case EVT_LE_CONN_UPDATE_COMPLETE: {
hci_le_connection_update_complete_event_rp0* event = hci_le_connection_update_complete_event_rp0* event =
(hci_le_connection_update_complete_event_rp0*)meta_evt->data; (hci_le_connection_update_complete_event_rp0*)meta_evt->data;
gap->connection_params.conn_interval = event->Conn_Interval; gap->connection_params.conn_interval = event->Conn_Interval;
@@ -149,7 +148,7 @@ SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification(void* pckt) {
break; break;
} }
case HCI_LE_PHY_UPDATE_COMPLETE_SUBEVT_CODE: case EVT_LE_PHY_UPDATE_COMPLETE:
evt_le_phy_update_complete = (hci_le_phy_update_complete_event_rp0*)meta_evt->data; evt_le_phy_update_complete = (hci_le_phy_update_complete_event_rp0*)meta_evt->data;
if(evt_le_phy_update_complete->Status) { if(evt_le_phy_update_complete->Status) {
FURI_LOG_E( FURI_LOG_E(
@@ -165,7 +164,7 @@ SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification(void* pckt) {
} }
break; break;
case HCI_LE_CONNECTION_COMPLETE_SUBEVT_CODE: { case EVT_LE_CONN_COMPLETE: {
hci_le_connection_complete_event_rp0* event = hci_le_connection_complete_event_rp0* event =
(hci_le_connection_complete_event_rp0*)meta_evt->data; (hci_le_connection_complete_event_rp0*)meta_evt->data;
gap->connection_params.conn_interval = event->Conn_Interval; gap->connection_params.conn_interval = event->Conn_Interval;
@@ -192,16 +191,16 @@ SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification(void* pckt) {
} }
break; break;
case HCI_VENDOR_SPECIFIC_DEBUG_EVT_CODE: case EVT_VENDOR:
blue_evt = (evt_blecore_aci*)event_pckt->data; blue_evt = (evt_blue_aci*)event_pckt->data;
switch(blue_evt->ecode) { switch(blue_evt->ecode) {
aci_gap_pairing_complete_event_rp0* pairing_complete; aci_gap_pairing_complete_event_rp0* pairing_complete;
case ACI_GAP_LIMITED_DISCOVERABLE_VSEVT_CODE: case EVT_BLUE_GAP_LIMITED_DISCOVERABLE:
FURI_LOG_I(TAG, "Limited discoverable event"); FURI_LOG_I(TAG, "Limited discoverable event");
break; break;
case ACI_GAP_PASS_KEY_REQ_VSEVT_CODE: { case EVT_BLUE_GAP_PASS_KEY_REQUEST: {
// Generate random PIN code // Generate random PIN code
uint32_t pin = rand() % 999999; //-V1064 uint32_t pin = rand() % 999999; //-V1064
aci_gap_pass_key_resp(gap->service.connection_handle, pin); aci_gap_pass_key_resp(gap->service.connection_handle, pin);
@@ -214,7 +213,7 @@ SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification(void* pckt) {
gap->on_event_cb(event, gap->context); gap->on_event_cb(event, gap->context);
} break; } break;
case ACI_ATT_EXCHANGE_MTU_RESP_VSEVT_CODE: { case EVT_BLUE_ATT_EXCHANGE_MTU_RESP: {
aci_att_exchange_mtu_resp_event_rp0* pr = (void*)blue_evt->data; aci_att_exchange_mtu_resp_event_rp0* pr = (void*)blue_evt->data;
FURI_LOG_I(TAG, "Rx MTU size: %d", pr->Server_RX_MTU); FURI_LOG_I(TAG, "Rx MTU size: %d", pr->Server_RX_MTU);
// Set maximum packet size given header size is 3 bytes // Set maximum packet size given header size is 3 bytes
@@ -223,28 +222,32 @@ SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification(void* pckt) {
gap->on_event_cb(event, gap->context); gap->on_event_cb(event, gap->context);
} break; } break;
case ACI_GAP_AUTHORIZATION_REQ_VSEVT_CODE: case EVT_BLUE_GAP_AUTHORIZATION_REQUEST:
FURI_LOG_D(TAG, "Authorization request event"); FURI_LOG_D(TAG, "Authorization request event");
break; break;
case ACI_GAP_SLAVE_SECURITY_INITIATED_VSEVT_CODE: case EVT_BLUE_GAP_SLAVE_SECURITY_INITIATED:
FURI_LOG_D(TAG, "Slave security initiated"); FURI_LOG_D(TAG, "Slave security initiated");
break; break;
case ACI_GAP_BOND_LOST_VSEVT_CODE: case EVT_BLUE_GAP_BOND_LOST:
FURI_LOG_D(TAG, "Bond lost event. Start rebonding"); FURI_LOG_D(TAG, "Bond lost event. Start rebonding");
aci_gap_allow_rebond(gap->service.connection_handle); aci_gap_allow_rebond(gap->service.connection_handle);
break; break;
case ACI_GAP_ADDR_NOT_RESOLVED_VSEVT_CODE: case EVT_BLUE_GAP_DEVICE_FOUND:
FURI_LOG_D(TAG, "Device found event");
break;
case EVT_BLUE_GAP_ADDR_NOT_RESOLVED:
FURI_LOG_D(TAG, "Address not resolved event"); FURI_LOG_D(TAG, "Address not resolved event");
break; break;
case ACI_GAP_KEYPRESS_NOTIFICATION_VSEVT_CODE: case EVT_BLUE_GAP_KEYPRESS_NOTIFICATION:
FURI_LOG_D(TAG, "Key press notification event"); FURI_LOG_D(TAG, "Key press notification event");
break; break;
case ACI_GAP_NUMERIC_COMPARISON_VALUE_VSEVT_CODE: { case EVT_BLUE_GAP_NUMERIC_COMPARISON_VALUE: {
uint32_t pin = uint32_t pin =
((aci_gap_numeric_comparison_value_event_rp0*)(blue_evt->data))->Numeric_Value; ((aci_gap_numeric_comparison_value_event_rp0*)(blue_evt->data))->Numeric_Value;
FURI_LOG_I(TAG, "Verify numeric comparison: %06lu", pin); FURI_LOG_I(TAG, "Verify numeric comparison: %06lu", pin);
@@ -254,7 +257,7 @@ SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification(void* pckt) {
break; break;
} }
case ACI_GAP_PAIRING_COMPLETE_VSEVT_CODE: case EVT_BLUE_GAP_PAIRING_CMPLT:
pairing_complete = (aci_gap_pairing_complete_event_rp0*)blue_evt->data; pairing_complete = (aci_gap_pairing_complete_event_rp0*)blue_evt->data;
if(pairing_complete->Status) { if(pairing_complete->Status) {
FURI_LOG_E( FURI_LOG_E(
@@ -271,11 +274,11 @@ SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification(void* pckt) {
} }
break; break;
case ACI_L2CAP_CONNECTION_UPDATE_RESP_VSEVT_CODE: case EVT_BLUE_GAP_PROCEDURE_COMPLETE:
FURI_LOG_D(TAG, "Procedure complete event"); FURI_LOG_D(TAG, "Procedure complete event");
break; break;
case ACI_L2CAP_CONNECTION_UPDATE_REQ_VSEVT_CODE: { case EVT_BLUE_L2CAP_CONNECTION_UPDATE_RESP: {
uint16_t result = uint16_t result =
((aci_l2cap_connection_update_resp_event_rp0*)(blue_evt->data))->Result; ((aci_l2cap_connection_update_resp_event_rp0*)(blue_evt->data))->Result;
if(result == 0) { if(result == 0) {
@@ -396,7 +399,7 @@ static void gap_init_svc(Gap* gap) {
CFG_ENCRYPTION_KEY_SIZE_MAX, CFG_ENCRYPTION_KEY_SIZE_MAX,
conf_used_fixed_pin, // 0x0 for no pin conf_used_fixed_pin, // 0x0 for no pin
0, 0,
CFG_IDENTITY_ADDRESS); PUBLIC_ADDR);
// Configure whitelist // Configure whitelist
aci_gap_configure_whitelist(); aci_gap_configure_whitelist();
} }
@@ -431,7 +434,7 @@ static void gap_advertise_start(GapState new_state) {
ADV_IND, ADV_IND,
min_interval, min_interval,
max_interval, max_interval,
CFG_IDENTITY_ADDRESS, PUBLIC_ADDR,
0, 0,
strlen(gap->service.adv_name), strlen(gap->service.adv_name),
(uint8_t*)gap->service.adv_name, (uint8_t*)gap->service.adv_name,

View File

@@ -14,7 +14,7 @@ IWDGSTOP:0x1:rw
IWDGSW:0x1:rw IWDGSW:0x1:rw
IPCCDBA:0x0:rw IPCCDBA:0x0:rw
ESE:0x1:r ESE:0x1:r
SFSA:0xD5:r SFSA:0xD7:r
FSD:0x0:r FSD:0x0:r
DDS:0x1:r DDS:0x1:r
C2OPT:0x1:r C2OPT:0x1:r
@@ -22,7 +22,7 @@ NBRSD:0x0:r
SNBRSA:0xD:r SNBRSA:0xD:r
BRSD:0x0:r BRSD:0x0:r
SBRSA:0x12:r SBRSA:0x12:r
SBRV:0x35400:r SBRV:0x35C00:r
PCROP1A_STRT:0x1FF:r PCROP1A_STRT:0x1FF:r
PCROP1A_END:0x0:r PCROP1A_END:0x0:r
PCROP_RDP:0x1:rw PCROP_RDP:0x1:rw