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:
parent
5b4e732fa3
commit
9829145d8c
4
.gitignore
vendored
4
.gitignore
vendored
@ -50,3 +50,7 @@ build/
|
||||
|
||||
# openocd output file
|
||||
openocd.log
|
||||
|
||||
# PVS Studio temporary files
|
||||
.PVS-Studio/
|
||||
PVS-Studio.log
|
||||
|
22
.pvsconfig
Normal file
22
.pvsconfig
Normal file
@ -0,0 +1,22 @@
|
||||
# MLib macros we can't do much about.
|
||||
//-V:M_EACH:1048,1044
|
||||
//-V:ARRAY_DEF:760,747,568,776,729,712,654
|
||||
//-V:LIST_DEF:760,747,568,712,729,654,776
|
||||
//-V:BPTREE_DEF2:779,1086,557,773,512
|
||||
//-V:DICT_DEF2:779,524,776,760,1044,1001,729,590,568,747,685
|
||||
//-V:ALGO_DEF:1048,747,1044
|
||||
|
||||
# Non-severe malloc/null pointer deref warnings
|
||||
//-V::522:2,3
|
||||
|
||||
# Warning about headers with copyleft license
|
||||
//-V::1042
|
||||
|
||||
# Potentially null argument warnings
|
||||
//-V:memset:575
|
||||
//-V:memcpy:575
|
||||
//-V:strcpy:575
|
||||
//-V:strchr:575
|
||||
|
||||
# For loop warning on M_FOREACH
|
||||
//-V:for:1044
|
1
.pvsoptions
Normal file
1
.pvsoptions
Normal file
@ -0,0 +1 @@
|
||||
--rules-config .pvsconfig -e lib/fatfs -e lib/fnv1a-hash -e lib/FreeRTOS-Kernel -e lib/heatshrink -e lib/libusb_stm32 -e lib/littlefs -e lib/mbedtls -e lib/micro-ecc -e lib/microtar -e lib/mlib -e lib/qrcode -e lib/ST25RFAL002 -e lib/STM32CubeWB -e lib/u8g2 -e toolchain/
|
@ -3,7 +3,7 @@
|
||||
#include <applications/cli/cli.h>
|
||||
#include <lib/toolbox/args.h>
|
||||
|
||||
#include "ble.h"
|
||||
#include <ble/ble.h>
|
||||
#include "bt_settings.h"
|
||||
#include "bt_service/bt.h"
|
||||
|
||||
|
@ -244,6 +244,8 @@ if should_gen_cdb_and_link_dir(fwenv, BUILD_TARGETS):
|
||||
# without filtering, both updater & firmware commands would be generated
|
||||
fwenv.Replace(COMPILATIONDB_PATH_FILTER=fwenv.subst("*${FW_FLAVOR}*"))
|
||||
AlwaysBuild(fwcdb)
|
||||
Precious(fwcdb)
|
||||
NoClean(fwcdb)
|
||||
Alias(fwenv["FIRMWARE_BUILD_CFG"] + "_cdb", fwcdb)
|
||||
fw_artifacts.append(fwcdb)
|
||||
|
||||
|
@ -3,6 +3,11 @@ Import("env")
|
||||
env.Append(LINT_SOURCES=["firmware"])
|
||||
|
||||
libenv = env.Clone(FW_LIB_NAME="flipper${TARGET_HW}")
|
||||
libenv.Append(
|
||||
CPPPATH=[
|
||||
"#/lib/STM32CubeWB/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl",
|
||||
]
|
||||
)
|
||||
libenv.ApplyLibFlags()
|
||||
|
||||
|
||||
|
@ -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_
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
115
firmware/targets/f7/ble_glue/ble_const.h
Normal file
115
firmware/targets/f7/ble_glue/ble_const.h
Normal 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__ */
|
@ -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"
|
||||
|
||||
|
150
firmware/targets/f7/ble_glue/compiler.h
Normal file
150
firmware/targets/f7/ble_glue/compiler.h
Normal 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__ */
|
@ -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>
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "gap.h"
|
||||
|
||||
#include "ble.h"
|
||||
#include <ble/ble.h>
|
||||
|
||||
#include <furi_hal.h>
|
||||
#include <furi.h>
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "hid_service.h"
|
||||
#include "app_common.h"
|
||||
#include "ble.h"
|
||||
#include <ble/ble.h>
|
||||
|
||||
#include <furi.h>
|
||||
|
||||
|
@ -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 -----------------------------------------------------------*/
|
||||
|
63
firmware/targets/f7/ble_glue/osal.h
Normal file
63
firmware/targets/f7/ble_glue/osal.h
Normal 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__ */
|
@ -1,6 +1,6 @@
|
||||
#include "serial_service.h"
|
||||
#include "app_common.h"
|
||||
#include "ble.h"
|
||||
#include <ble/ble.h>
|
||||
|
||||
#include <furi.h>
|
||||
|
||||
|
@ -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>
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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>
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <stm32wbxx_ll_rtc.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include "ble.h"
|
||||
#include <ble/ble.h>
|
||||
|
||||
#define TAG "FuriHalVersion"
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "core_defines.h"
|
||||
#include <stdbool.h>
|
||||
#include <FreeRTOS.h>
|
||||
#include <task.h>
|
||||
@ -10,92 +11,6 @@ extern "C" {
|
||||
|
||||
#include <cmsis_compiler.h>
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(a, b) \
|
||||
({ \
|
||||
__typeof__(a) _a = (a); \
|
||||
__typeof__(b) _b = (b); \
|
||||
_a > _b ? _a : _b; \
|
||||
})
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a, b) \
|
||||
({ \
|
||||
__typeof__(a) _a = (a); \
|
||||
__typeof__(b) _b = (b); \
|
||||
_a < _b ? _a : _b; \
|
||||
})
|
||||
#endif
|
||||
|
||||
#ifndef ROUND_UP_TO
|
||||
#define ROUND_UP_TO(a, b) \
|
||||
({ \
|
||||
__typeof__(a) _a = (a); \
|
||||
__typeof__(b) _b = (b); \
|
||||
_a / _b + !!(_a % _b); \
|
||||
})
|
||||
#endif
|
||||
|
||||
#ifndef CLAMP
|
||||
#define CLAMP(x, upper, lower) (MIN(upper, MAX(x, lower)))
|
||||
#endif
|
||||
|
||||
#ifndef COUNT_OF
|
||||
#define COUNT_OF(x) (sizeof(x) / sizeof(x[0]))
|
||||
#endif
|
||||
|
||||
#ifndef FURI_SWAP
|
||||
#define FURI_SWAP(x, y) \
|
||||
do { \
|
||||
typeof(x) SWAP = x; \
|
||||
x = y; \
|
||||
y = SWAP; \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
#ifndef PLACE_IN_SECTION
|
||||
#define PLACE_IN_SECTION(x) __attribute__((section(x)))
|
||||
#endif
|
||||
|
||||
#ifndef ALIGN
|
||||
#define ALIGN(n) __attribute__((aligned(n)))
|
||||
#endif
|
||||
|
||||
#ifndef __weak
|
||||
#define __weak __attribute__((weak))
|
||||
#endif
|
||||
|
||||
#ifndef UNUSED
|
||||
#define UNUSED(X) (void)(X)
|
||||
#endif
|
||||
|
||||
#ifndef STRINGIFY
|
||||
#define STRINGIFY(x) #x
|
||||
#endif
|
||||
|
||||
#ifndef TOSTRING
|
||||
#define TOSTRING(x) STRINGIFY(x)
|
||||
#endif
|
||||
|
||||
#ifndef REVERSE_BYTES_U32
|
||||
#define REVERSE_BYTES_U32(x) \
|
||||
((((x)&0x000000FF) << 24) | (((x)&0x0000FF00) << 8) | (((x)&0x00FF0000) >> 8) | \
|
||||
(((x)&0xFF000000) >> 24))
|
||||
#endif
|
||||
|
||||
#ifndef FURI_BIT
|
||||
#define FURI_BIT(x, n) (((x) >> (n)) & 1)
|
||||
#endif
|
||||
|
||||
#ifndef FURI_BIT_SET
|
||||
#define FURI_BIT_SET(x, n) ((x) |= (1 << (n)))
|
||||
#endif
|
||||
|
||||
#ifndef FURI_BIT_CLEAR
|
||||
#define FURI_BIT_CLEAR(x, n) ((x) &= ~(1 << (n)))
|
||||
#endif
|
||||
|
||||
#ifndef FURI_IS_IRQ_MASKED
|
||||
#define FURI_IS_IRQ_MASKED() (__get_PRIMASK() != 0U)
|
||||
#endif
|
||||
|
97
furi/core/core_defines.h
Normal file
97
furi/core/core_defines.h
Normal file
@ -0,0 +1,97 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define FURI_RETURNS_NONNULL __attribute__((returns_nonnull))
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(a, b) \
|
||||
({ \
|
||||
__typeof__(a) _a = (a); \
|
||||
__typeof__(b) _b = (b); \
|
||||
_a > _b ? _a : _b; \
|
||||
})
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a, b) \
|
||||
({ \
|
||||
__typeof__(a) _a = (a); \
|
||||
__typeof__(b) _b = (b); \
|
||||
_a < _b ? _a : _b; \
|
||||
})
|
||||
#endif
|
||||
|
||||
#ifndef ROUND_UP_TO
|
||||
#define ROUND_UP_TO(a, b) \
|
||||
({ \
|
||||
__typeof__(a) _a = (a); \
|
||||
__typeof__(b) _b = (b); \
|
||||
_a / _b + !!(_a % _b); \
|
||||
})
|
||||
#endif
|
||||
|
||||
#ifndef CLAMP
|
||||
#define CLAMP(x, upper, lower) (MIN(upper, MAX(x, lower)))
|
||||
#endif
|
||||
|
||||
#ifndef COUNT_OF
|
||||
#define COUNT_OF(x) (sizeof(x) / sizeof(x[0]))
|
||||
#endif
|
||||
|
||||
#ifndef FURI_SWAP
|
||||
#define FURI_SWAP(x, y) \
|
||||
do { \
|
||||
typeof(x) SWAP = x; \
|
||||
x = y; \
|
||||
y = SWAP; \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
#ifndef PLACE_IN_SECTION
|
||||
#define PLACE_IN_SECTION(x) __attribute__((section(x)))
|
||||
#endif
|
||||
|
||||
#ifndef ALIGN
|
||||
#define ALIGN(n) __attribute__((aligned(n)))
|
||||
#endif
|
||||
|
||||
#ifndef __weak
|
||||
#define __weak __attribute__((weak))
|
||||
#endif
|
||||
|
||||
#ifndef UNUSED
|
||||
#define UNUSED(X) (void)(X)
|
||||
#endif
|
||||
|
||||
#ifndef STRINGIFY
|
||||
#define STRINGIFY(x) #x
|
||||
#endif
|
||||
|
||||
#ifndef TOSTRING
|
||||
#define TOSTRING(x) STRINGIFY(x)
|
||||
#endif
|
||||
|
||||
#ifndef REVERSE_BYTES_U32
|
||||
#define REVERSE_BYTES_U32(x) \
|
||||
((((x)&0x000000FF) << 24) | (((x)&0x0000FF00) << 8) | (((x)&0x00FF0000) >> 8) | \
|
||||
(((x)&0xFF000000) >> 24))
|
||||
#endif
|
||||
|
||||
#ifndef FURI_BIT
|
||||
#define FURI_BIT(x, n) (((x) >> (n)) & 1)
|
||||
#endif
|
||||
|
||||
#ifndef FURI_BIT_SET
|
||||
#define FURI_BIT_SET(x, n) ((x) |= (1 << (n)))
|
||||
#endif
|
||||
|
||||
#ifndef FURI_BIT_CLEAR
|
||||
#define FURI_BIT_CLEAR(x, n) ((x) &= ~(1 << (n)))
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -6,6 +6,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "core_defines.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -51,7 +52,7 @@ bool furi_record_destroy(const char* name);
|
||||
* @note Thread safe. Open and close must be executed from the same
|
||||
* thread. Suspends caller thread till record is available
|
||||
*/
|
||||
void* furi_record_open(const char* name);
|
||||
FURI_RETURNS_NONNULL void* furi_record_open(const char* name);
|
||||
|
||||
/** Close record
|
||||
*
|
||||
|
@ -2,19 +2,10 @@ Import("env")
|
||||
|
||||
env.Append(
|
||||
CPPPATH=[
|
||||
"#/lib/STM32CubeWB/Drivers/CMSIS/Device/ST",
|
||||
"#/lib/STM32CubeWB/Drivers/CMSIS/Device/ST/STM32WBxx/Include",
|
||||
"#/lib/STM32CubeWB/Drivers/CMSIS/Include",
|
||||
"#/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Inc",
|
||||
"#/lib/STM32CubeWB/Drivers/STM32WBxx_HAL_Driver/Inc/Legacy",
|
||||
"#/lib/STM32CubeWB/Middlewares/ST/STM32_WPAN",
|
||||
"#/lib/STM32CubeWB/Middlewares/ST/STM32_WPAN/ble",
|
||||
"#/lib/STM32CubeWB/Middlewares/ST/STM32_WPAN/ble/core",
|
||||
"#/lib/STM32CubeWB/Middlewares/ST/STM32_WPAN/ble/core/template",
|
||||
"#/lib/STM32CubeWB/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread",
|
||||
"#/lib/STM32CubeWB/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/shci",
|
||||
"#/lib/STM32CubeWB/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl",
|
||||
"#/lib/STM32CubeWB/Middlewares/ST/STM32_WPAN/utilities",
|
||||
],
|
||||
CPPDEFINES=[
|
||||
"STM32WB",
|
||||
@ -33,6 +24,16 @@ if env["RAM_EXEC"]:
|
||||
|
||||
|
||||
libenv = env.Clone(FW_LIB_NAME="stm32cubewb")
|
||||
libenv.Append(
|
||||
CPPPATH=[
|
||||
"#/lib/STM32CubeWB/Middlewares/ST/STM32_WPAN/ble",
|
||||
"#/lib/STM32CubeWB/Middlewares/ST/STM32_WPAN/ble/core",
|
||||
"#/lib/STM32CubeWB/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread",
|
||||
"#/lib/STM32CubeWB/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/shci",
|
||||
"#/lib/STM32CubeWB/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl",
|
||||
"#/lib/STM32CubeWB/Middlewares/ST/STM32_WPAN/utilities",
|
||||
]
|
||||
)
|
||||
libenv.ApplyLibFlags()
|
||||
|
||||
sources = libenv.GlobRecursive(
|
||||
|
@ -29,6 +29,7 @@ build_version = libenv.VersionBuilder(
|
||||
fw_version_json = libenv.InstallAs(
|
||||
"${BUILD_DIR}/${FIRMWARE_BUILD_CFG}.json", "version.json"
|
||||
)
|
||||
Alias("version_json", fw_version_json)
|
||||
env.Append(FW_VERSION_JSON=fw_version_json)
|
||||
|
||||
# Default(fw_version_json)
|
||||
@ -40,7 +41,7 @@ if not version_depends:
|
||||
|
||||
sources = libenv.GlobRecursive("*.c")
|
||||
|
||||
libenv.Append(CPPPATH=["."])
|
||||
libenv.Append(CPPPATH=[libenv.Dir(".")])
|
||||
|
||||
lib = libenv.StaticLibrary("${FW_LIB_NAME}", sources)
|
||||
libenv.Install("${LIB_DIST_DIR}", lib)
|
||||
|
Loading…
Reference in New Issue
Block a user