tool/metric: Makefile to run ccsm and process it, minimal inttypes.h for ccsm

This commit is contained in:
Matthias Ringwald 2019-08-29 21:07:09 +02:00
parent fda2bcc8f5
commit 7846277fa5
4 changed files with 125 additions and 0 deletions

3
tool/metrics/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
__pycache__
metrics.tsv
metrics.txt

30
tool/metrics/Makefile Normal file
View File

@ -0,0 +1,30 @@
C_HEADERS=/Projects/c_headers/include/
BTSTACK_ROOT=../..
VPATH=${BTSTACK_ROOT}/src
INCLUDES= \
-I ${BTSTACK_ROOT}/src \
-I ${BTSTACK_ROOT}/3rd-party/micro-ecc/ \
-I ${BTSTACK_ROOT}/3rd-party/md5 \
-I ${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/include/ \
-I ${BTSTACK_ROOT}/3rd-party/bluedroid/encoder/include/ \
-I ${BTSTACK_ROOT}/3rd-party/yxml \
-I .
SRC_FILES=$(wildcard ${BTSTACK_ROOT}/src/*.c)
SRC_BLE_FILES=$(wildcard ${BTSTACK_ROOT}/src/ble/*.c)
SRC_BLE_GATT_FILES_FILES=$(wildcard ${BTSTACK_ROOT}/src/ble/gatt-service/*.c)
SRC_CLASSIC_FILES=$(wildcard ${BTSTACK_ROOT}/src/classic/*.c)
SRCS = ${SRC_FILES} ${SRC_BLE_FILES} ${SRC_BLE_GATT_SERVICE_FILES} ${SRC_CLASSIC_FILES}
all: metrics.txt
metrics.tsv: ${SRCS}
ccsm --disable-file --disable-global --exclude-std-headers --exclude-file=.h$$ --output-format=tsv --output-metrics=HIS_.* $^ -- -isystem ${C_HEADERS}/c90 -isystem ${C_HEADERS}/c99 ${INCLUDES} > $@
metrics.txt: metrics.tsv metrics-ccsm.py
./metrics-ccsm.py > metrics.txt
clean:
rm -f metrics.tsv metrics.txt

View File

@ -0,0 +1,53 @@
//
// btstack_config.h for metric calculation
//
#ifndef __BTSTACK_CONFIG
#define __BTSTACK_CONFIG
// Port related features
#define HAVE_BTSTACK_STDIN
// BTstack features that can be enabled
#define ENABLE_BLE
#define ENABLE_CLASSIC
#define ENABLE_HFP_WIDE_BAND_SPEECH
#define ENABLE_LE_CENTRAL
#define ENABLE_LE_PERIPHERAL
#define ENABLE_LE_SECURE_CONNECTIONS
#define ENABLE_LE_DATA_CHANNELS
#define ENABLE_MICRO_ECC_FOR_LE_SECURE_CONNECTIONS
#define ENABLE_LE_DATA_LENGTH_EXTENSION
#define ENABLE_ATT_DELAYED_RESPONSE
#define ENABLE_LOG_ERROR
#define ENABLE_LOG_INFO
#define ENABLE_SCO_OVER_HCI
#define ENABLE_SDP_DES_DUMP
#define ENABLE_L2CAP_ENHANCED_RETRANSMISSION_MODE
// BTstack configuration. buffers, sizes, ...
#define HCI_ACL_PAYLOAD_SIZE (1691 + 4)
#define HCI_INCOMING_PRE_BUFFER_SIZE 14 // sizeof BNEP header, avoid memcpy
#define MAX_NR_LE_DEVICE_DB_ENTRIES 4
#define NVM_NUM_DEVICE_DB_ENTRIES 10
// Mesh Configuration
#define ENABLE_MESH
#define ENABLE_MESH_ADV_BEARER
#define ENABLE_MESH_GATT_BEARER
#define ENABLE_MESH_PB_ADV
#define ENABLE_MESH_PB_GATT
#define ENABLE_MESH_PROXY_SERVER
#define ENABLE_MESH_PROVISIONER
#define MAX_NR_MESH_TRANSPORT_KEYS 16
#define MAX_NR_MESH_VIRTUAL_ADDRESSES 16
#define MAX_NR_MESH_SUBNETS 2
// allow for one NetKey update
#define MAX_NR_MESH_NETWORK_KEYS (MAX_NR_MESH_SUBNETS+1)
#endif

39
tool/metrics/inttypes.h Normal file
View File

@ -0,0 +1,39 @@
/*
inttypes.h
IMPORTANT NOTE: This header is not intended to be functional. It is intended
purely to be an ANSI-compliant header which can be used when performing static
analyis of code (i.e. compiler independent)
Copyright (c) 2015 John Bailey
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#if !defined __INTTYPES_H
#define __INTTYPES_H
// assume 32-bit architecture
#define PRIu32 "I32u"
#define PRIx32 "I32x"
#endif