fbt: fixed include paths; added PVS-Studio configuration (#1615)

* fbt: fixed include paths for generated version header
* lib: STM32CubeWB: refactored & cleaned up WPAN include paths
* hal: linter fixes for new headers
* fbt: added version_json target
* Added .pvsconfig; split common_defines.h into 2 files
* Added PVS-Studio basic configuration files; updated .gitignore

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
hedger
2022-08-22 20:06:17 +03:00
committed by GitHub
parent 5b4e732fa3
commit 9829145d8c
30 changed files with 507 additions and 157 deletions

View File

@@ -16,36 +16,6 @@
/* bit value */
#define _BV(bit) (0x01 << (bit))
#if defined(STM32F0)
#include "STM32F0xx/Include/stm32f0xx.h"
#elif defined(STM32F1)
#include "STM32F1xx/Include/stm32f1xx.h"
#elif defined(STM32F2)
#include "STM32F2xx/Include/stm32f2xx.h"
#elif defined(STM32F3)
#include "STM32F3xx/Include/stm32f3xx.h"
#elif defined(STM32F4)
#include "STM32F4xx/Include/stm32f4xx.h"
#elif defined(STM32F7)
#include "STM32F7xx/Include/stm32f7xx.h"
#elif defined(STM32H7)
#include "STM32H7xx/Include/stm32h7xx.h"
#elif defined(STM32L0)
#include "STM32L0xx/Include/stm32l0xx.h"
#elif defined(STM32L1)
#include "STM32L1xx/Include/stm32l1xx.h"
#elif defined(STM32L4)
#include "STM32L4xx/Include/stm32l4xx.h"
#elif defined(STM32L5)
#include "STM32L5xx/Include/stm32l5xx.h"
#elif defined(STM32G0)
#include "STM32G0xx/Include/stm32g0xx.h"
#elif defined(STM32G4)
#include "STM32G4xx/Include/stm32g4xx.h"
#elif defined(STM32WB)
#include "STM32WBxx/Include/stm32wbxx.h"
#else
#error "STM32 family not defined"
#endif
#include "stm32wbxx.h"
#endif // _STM32_H_

View File

@@ -1,9 +1,10 @@
#pragma once
#include "hw.h"
#include "hw_conf.h"
#include "hw_if.h"
#include "ble_bufsize.h"
#include <interface/patterns/ble_thread/hw.h>
#include <ble/core/ble_bufsize.h>
#define CFG_TX_POWER (0x19) /* +0dBm */

View File

@@ -1,10 +1,11 @@
#include "utilities_common.h"
#include "app_common.h"
#include "app_debug.h"
#include "shci.h"
#include "tl.h"
#include "dbg_trace.h"
#include <interface/patterns/ble_thread/tl/tl.h>
#include <interface/patterns/ble_thread/tl/mbox_def.h>
#include <interface/patterns/ble_thread/shci/shci.h>
#include <utilities/dbg_trace.h>
#include <utilities/utilities_common.h>
#include <furi_hal.h>
typedef PACKED_STRUCT {

View File

@@ -1,6 +1,6 @@
#include "battery_service.h"
#include "app_common.h"
#include "ble.h"
#include <ble/ble.h>
#include <furi.h>
#include <furi_hal_power.h>

View File

@@ -1,8 +1,8 @@
#include "ble_app.h"
#include "hci_tl.h"
#include "ble.h"
#include "shci.h"
#include <ble/ble.h>
#include <interface/patterns/ble_thread/tl/hci_tl.h>
#include <interface/patterns/ble_thread/shci/shci.h>
#include "gap.h"
#include <furi_hal.h>

View File

@@ -0,0 +1,115 @@
/*****************************************************************************
* @file ble_const.h
* @author MDG
* @brief This file contains the definitions which are compiler dependent.
*****************************************************************************
* @attention
*
* Copyright (c) 2018-2022 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
*****************************************************************************
*/
#ifndef BLE_CONST_H__
#define BLE_CONST_H__
#include <stdint.h>
#include <string.h>
#include <ble/core/ble_std.h>
#include <ble/core/ble_defs.h>
#include "osal.h"
/* Default BLE variant */
#ifndef BASIC_FEATURES
#define BASIC_FEATURES 0
#endif
#ifndef SLAVE_ONLY
#define SLAVE_ONLY 0
#endif
#ifndef LL_ONLY
#define LL_ONLY 0
#endif
#ifndef BEACON_ONLY
#define BEACON_ONLY 0
#endif
/* Size of command/events buffers:
*
* To change the size of commands and events parameters used in the
* auto-generated files, you need to update 2 defines:
*
* - BLE_CMD_MAX_PARAM_LEN
* - BLE_EVT_MAX_PARAM_LEN
*
* These 2 defines are set below with default values and can be changed.
*
* To compute the value to support a characteristic of 512 bytes for a specific
* command or an event, you need to look in "ble_types.h".
*
* Here are 2 examples, one with a command and one with an event:
*
* - aci_gatt_update_char_value_ext_cp0
* ----------------------------------
*
* we have in the structure:
*
* uint8_t Value[(BLE_CMD_MAX_PARAM_LEN- 12)/sizeof(uint8_t)];
*
* so to support a 512 byte value, we need to have
*
* BLE_CMD_MAX_PARAM_LEN at least equal to: 512 + 12 = 524
*
* - aci_gatt_read_handle_value_rp0
* ------------------------------
*
* we have in the structure:
*
* uint8_t Value[((BLE_EVT_MAX_PARAM_LEN - 3) - 5)/sizeof(uint8_t)];
*
* so to support a 512 byte value, we need to have
*
* BLE_EVT_MAX_PARAM_LEN at least equal to: 512 + 3 + 5 = 520
*
* If you need several events or commands with 512-size values, you need to
* take the maximum values for BLE_EVT_MAX_PARAM_LEN and BLE_CMD_MAX_PARAM_LEN.
*
*/
/* Maximum parameter size of BLE commands.
* Change this value if needed. */
#define BLE_CMD_MAX_PARAM_LEN HCI_COMMAND_MAX_PARAM_LEN
/* Maximum parameter size of BLE responses/events.
* Change this value if needed. */
#define BLE_EVT_MAX_PARAM_LEN HCI_EVENT_MAX_PARAM_LEN
/* Callback function to send command and receive response */
struct hci_request {
uint16_t ogf;
uint16_t ocf;
int event;
void* cparam;
int clen;
void* rparam;
int rlen;
};
extern int hci_send_req(struct hci_request* req, uint8_t async);
#ifndef FALSE
#define FALSE 0
#endif
#ifndef MIN
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef MAX
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
#endif
#endif /* BLE_CONST_H__ */

View File

@@ -1,14 +1,14 @@
#include "ble_glue.h"
#include "app_common.h"
#include "ble_app.h"
#include "ble.h"
#include "tl.h"
#include "shci.h"
#include "shci_tl.h"
#include <ble/ble.h>
#include <interface/patterns/ble_thread/tl/tl.h>
#include <interface/patterns/ble_thread/shci/shci.h>
#include <interface/patterns/ble_thread/tl/shci_tl.h>
#include "app_debug.h"
#include <furi_hal.h>
#include <shci/shci.h>
#define TAG "Core2"

View File

@@ -0,0 +1,150 @@
/*****************************************************************************
* @file compiler.h
* @author MDG
* @brief This file contains the definitions which are compiler dependent.
*****************************************************************************
* @attention
*
* Copyright (c) 2018-2022 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
*****************************************************************************
*/
#ifndef COMPILER_H__
#define COMPILER_H__
/**
* @brief This is the section dedicated to IAR toolchain
*/
#if defined(__ICCARM__) || defined(__IAR_SYSTEMS_ASM__)
#ifndef __WEAK
#define __WEAK __weak
#endif
#define QUOTE_(a) #a
/**
* @brief PACKED
* Use the PACKED macro for variables that needs to be packed.
* Usage: PACKED(struct) myStruct_s
* PACKED(union) myStruct_s
*/
#define PACKED(decl) __packed decl
/**
* @brief SECTION
* Use the SECTION macro to assign data or code in a specific section.
* Usage: SECTION(".my_section")
*/
#define SECTION(name) _Pragma(QUOTE_(location = name))
/**
* @brief ALIGN_DEF
* Use the ALIGN_DEF macro to specify the alignment of a variable.
* Usage: ALIGN_DEF(4)
*/
#define ALIGN_DEF(v) _Pragma(QUOTE_(data_alignment = v))
/**
* @brief NO_INIT
* Use the NO_INIT macro to declare a not initialized variable.
* Usage: NO_INIT(int my_no_init_var)
* Usage: NO_INIT(uint16_t my_no_init_array[10])
*/
#define NO_INIT(var) __no_init var
/**
* @brief This is the section dedicated to GNU toolchain
*/
#else
#ifdef __GNUC__
#ifndef __WEAK
#define __WEAK __attribute__((weak))
#endif
/**
* @brief PACKED
* Use the PACKED macro for variables that needs to be packed.
* Usage: PACKED(struct) myStruct_s
* PACKED(union) myStruct_s
*/
#define PACKED(decl) decl __attribute__((packed))
/**
* @brief SECTION
* Use the SECTION macro to assign data or code in a specific section.
* Usage: SECTION(".my_section")
*/
#define SECTION(name) __attribute__((section(name)))
/**
* @brief ALIGN_DEF
* Use the ALIGN_DEF macro to specify the alignment of a variable.
* Usage: ALIGN_DEF(4)
*/
#define ALIGN_DEF(N) __attribute__((aligned(N)))
/**
* @brief NO_INIT
* Use the NO_INIT macro to declare a not initialized variable.
* Usage: NO_INIT(int my_no_init_var)
* Usage: NO_INIT(uint16_t my_no_init_array[10])
*/
#define NO_INIT(var) var __attribute__((section(".noinit")))
/**
* @brief This is the section dedicated to Keil toolchain
*/
#else
#ifdef __CC_ARM
#ifndef __WEAK
#define __WEAK __weak
#endif
/**
* @brief PACKED
* Use the PACKED macro for variables that needs to be packed.
* Usage: PACKED(struct) myStruct_s
* PACKED(union) myStruct_s
*/
#define PACKED(decl) decl __attribute__((packed))
/**
* @brief SECTION
* Use the SECTION macro to assign data or code in a specific section.
* Usage: SECTION(".my_section")
*/
#define SECTION(name) __attribute__((section(name)))
/**
* @brief ALIGN_DEF
* Use the ALIGN_DEF macro to specify the alignment of a variable.
* Usage: ALIGN_DEF(4)
*/
#define ALIGN_DEF(N) __attribute__((aligned(N)))
/**
* @brief NO_INIT
* Use the NO_INIT macro to declare a not initialized variable.
* Usage: NO_INIT(int my_no_init_var)
* Usage: NO_INIT(uint16_t my_no_init_array[10])
*/
#define NO_INIT(var) var __attribute__((section("NoInit")))
#else
#error Neither ICCARM, CC ARM nor GNUC C detected. Define your macros.
#endif
#endif
#endif
#endif /* COMPILER_H__ */

View File

@@ -1,6 +1,6 @@
#include "dev_info_service.h"
#include "app_common.h"
#include "ble.h"
#include <ble/ble.h>
#include <furi.h>
#include <m-string.h>

View File

@@ -1,6 +1,6 @@
#include "gap.h"
#include "ble.h"
#include <ble/ble.h>
#include <furi_hal.h>
#include <furi.h>

View File

@@ -1,6 +1,6 @@
#include "hid_service.h"
#include "app_common.h"
#include "ble.h"
#include <ble/ble.h>
#include <furi.h>

View File

@@ -19,7 +19,7 @@
/* Includes ------------------------------------------------------------------*/
#include "app_common.h"
#include "mbox_def.h"
#include <interface/patterns/ble_thread/tl/mbox_def.h>
/* Global variables ---------------------------------------------------------*/
/* Private defines -----------------------------------------------------------*/

View File

@@ -0,0 +1,63 @@
/*****************************************************************************
* @file osal.h
* @author MDG
* @brief This header file defines the OS abstraction layer used by
* the BLE stack. OSAL defines the set of functions which needs to be
* ported to target operating system and target platform.
* Actually, only memset, memcpy and memcmp wrappers are defined.
*****************************************************************************
* @attention
*
* Copyright (c) 2018-2022 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
*****************************************************************************
*/
#ifndef OSAL_H__
#define OSAL_H__
/**
* This function copies size number of bytes from a
* memory location pointed by src to a destination
* memory location pointed by dest
*
* @param[in] dest Destination address
* @param[in] src Source address
* @param[in] size size in the bytes
*
* @return Address of the destination
*/
extern void* Osal_MemCpy(void* dest, const void* src, unsigned int size);
/**
* This function sets first number of bytes, specified
* by size, to the destination memory pointed by ptr
* to the specified value
*
* @param[in] ptr Destination address
* @param[in] value Value to be set
* @param[in] size Size in the bytes
*
* @return Address of the destination
*/
extern void* Osal_MemSet(void* ptr, int value, unsigned int size);
/**
* This function compares n bytes of two regions of memory
*
* @param[in] s1 First buffer to compare.
* @param[in] s2 Second buffer to compare.
* @param[in] size Number of bytes to compare.
*
* @return 0 if the two buffers are equal, 1 otherwise
*/
extern int Osal_MemCmp(const void* s1, const void* s2, unsigned int size);
#endif /* OSAL_H__ */

View File

@@ -1,6 +1,6 @@
#include "serial_service.h"
#include "app_common.h"
#include "ble.h"
#include <ble/ble.h>
#include <furi.h>

View File

@@ -1,7 +1,8 @@
#include <furi_hal_bt.h>
#include <ble.h>
#include <ble/ble.h>
#include <interface/patterns/ble_thread/shci/shci.h>
#include <stm32wbxx.h>
#include <shci.h>
#include <furi_hal_version.h>
#include <furi_hal_bt_hid.h>

View File

@@ -4,7 +4,7 @@
#include <stm32wbxx_ll_cortex.h>
#include <stm32wbxx_ll_bus.h>
#include <furi.h>
#include <shci.h>
#include <interface/patterns/ble_thread/shci/shci.h>
#define TAG "FuriHalCrypto"

View File

@@ -1,8 +1,8 @@
#include <furi_hal_flash.h>
#include <furi_hal_bt.h>
#include <furi.h>
#include <ble.h>
#include <shci.h>
#include <ble/ble.h>
#include <interface/patterns/ble_thread/shci/shci.h>
#include <stm32wbxx.h>

View File

@@ -4,7 +4,7 @@
#include <furi_hal_bt.h>
#include <furi_hal_crypto.h>
#include <shci.h>
#include <interface/patterns/ble_thread/shci/shci.h>
#include <m-string.h>
#include <protobuf_version.h>

View File

@@ -6,7 +6,7 @@
#include <stm32wbxx_ll_rtc.h>
#include <stdio.h>
#include "ble.h"
#include <ble/ble.h>
#define TAG "FuriHalVersion"