-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from hit9/dev
Added benchmark of stm32
- Loading branch information
Showing
73 changed files
with
80,356 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
default: build | ||
|
||
bp: | ||
bitproto c drone.bitproto bpbench/bp | ||
cd bpbench && cp bp/*.h Core/Inc | ||
cd bpbench && cp bp/*.c Core/Src | ||
|
||
bp-optimization-mode: | ||
bitproto c drone.bitproto bpbench/bp -O -F "Drone" | ||
cd bpbench && cp bp/*.h Core/Inc | ||
cd bpbench && cp bp/*.c Core/Src | ||
|
||
build: bp | ||
make -C bpbench | ||
|
||
build-cc-o2: bp | ||
make -C bpbench OPT=-O2 | ||
|
||
build-cc-o3: bp | ||
make -C bpbench OPT=-O3 | ||
|
||
build-optimization-mode: bp-optimization-mode | ||
make -C bpbench | ||
|
||
build-optimization-mode-o2: bp-optimization-mode | ||
make -C bpbench OPT=-O2 | ||
|
||
flash: | ||
st-flash write ./bpbench/build/bpbench.bin 0x08000000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
bitproto benchmark on STM32 | ||
=========================== | ||
|
||
This directory contains a simple benchmark for bitproto encoding and decoding on STM32. | ||
|
||
The project `bpbench <bpbench>`_ is based on code generated by | ||
`stm32cubemx <https://www.st.com/en/development-tools/stm32cubemx.html>`_ , | ||
tested on microcontrollers: `stm32f103zet6 <https://www.st.com/en/microcontrollers-microprocessors/stm32f103ze.html>`_ | ||
and `stm32f103ve6 <https://www.st.com/en/microcontrollers-microprocessors/stm32f103ve.html>`_. | ||
|
||
Benchmark result | ||
---------------- | ||
|
||
* Microcontroller: `STM32F103ZE <https://www.st.com/en/microcontrolles-microprocessors/stm32f103ze.html>`_, | ||
Arm Cortex-M3 MCU, 72 MHz | ||
* bitproto file: `drone.bitproto <drone.bitproto>`_. | ||
|
||
Standard Mode | ||
^^^^^^^^^^^^^ | ||
|
||
The "standard mode" means to run bitproto compiler **without** | ||
the optimization mode flag ``-O``, that is to use `the bitproto c lib <../../lib/c>`_. | ||
|
||
.. list-table:: | ||
:header-rows: 1 | ||
|
||
* - GCC Optimization Flag | ||
- Number of calls | ||
- Encode cost per call | ||
- Decode cost per call | ||
* - No ``-O`` | ||
- 10000 | ||
- 170μs | ||
- 163μs | ||
* - ``-O2`` | ||
- 10000 | ||
- 135μs | ||
- 131μs | ||
* - ``-O3`` | ||
- 10000 | ||
- 127μs | ||
- 119μs | ||
|
||
Optimization Mode | ||
^^^^^^^^^^^^^^^^^ | ||
|
||
The "optimization mode" means to run bitproto compiler **with** | ||
the optimization mode flag ``-O``, that is not to use `the bitproto c lib <../../lib/c>`_. | ||
|
||
.. list-table:: | ||
:header-rows: 1 | ||
|
||
* - GCC Optimization Flag | ||
- Number of calls | ||
- Encode cost per call | ||
- Decode cost per call | ||
* - No ``-O`` | ||
- 10000 | ||
- 9μs | ||
- 9μs | ||
* - ``-O2`` | ||
- 10000 | ||
- 9μs | ||
- 9μs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
BasedOnStyle: Google | ||
IndentWidth: 4 | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
build | ||
.mxproject | ||
Core/Inc/*_bp.h | ||
Core/Src/*_bp.c | ||
bp/*_bp.c | ||
bp/*_bp.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* USER CODE BEGIN Header */ | ||
/** | ||
****************************************************************************** | ||
* @file : main.h | ||
* @brief : Header for main.c file. | ||
* This file contains the common defines of the application. | ||
****************************************************************************** | ||
* @attention | ||
* | ||
* <h2><center>© Copyright (c) 2021 STMicroelectronics. | ||
* All rights reserved.</center></h2> | ||
* | ||
* This software component is licensed by ST under BSD 3-Clause license, | ||
* the "License"; You may not use this file except in compliance with the | ||
* License. You may obtain a copy of the License at: | ||
* opensource.org/licenses/BSD-3-Clause | ||
* | ||
****************************************************************************** | ||
*/ | ||
/* USER CODE END Header */ | ||
|
||
/* Define to prevent recursive inclusion -------------------------------------*/ | ||
#ifndef __MAIN_H | ||
#define __MAIN_H | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/* Includes ------------------------------------------------------------------*/ | ||
#include "stm32f1xx_hal.h" | ||
|
||
/* Private includes ----------------------------------------------------------*/ | ||
/* USER CODE BEGIN Includes */ | ||
|
||
/* USER CODE END Includes */ | ||
|
||
/* Exported types ------------------------------------------------------------*/ | ||
/* USER CODE BEGIN ET */ | ||
|
||
/* USER CODE END ET */ | ||
|
||
/* Exported constants --------------------------------------------------------*/ | ||
/* USER CODE BEGIN EC */ | ||
|
||
/* USER CODE END EC */ | ||
|
||
/* Exported macro ------------------------------------------------------------*/ | ||
/* USER CODE BEGIN EM */ | ||
|
||
/* USER CODE END EM */ | ||
|
||
/* Exported functions prototypes ---------------------------------------------*/ | ||
void Error_Handler(void); | ||
void simple_printf(const char *fmt, ...); | ||
|
||
/* USER CODE BEGIN EFP */ | ||
|
||
/* USER CODE END EFP */ | ||
|
||
/* Private defines -----------------------------------------------------------*/ | ||
/* USER CODE BEGIN Private defines */ | ||
|
||
/* USER CODE END Private defines */ | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* __MAIN_H */ | ||
|
||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
Oops, something went wrong.