Question
In PlatformIO STM32F103 uses the framework stm32cubef1, which has many driver and not all of them are consider during compile by the PlatformIO.
For Example I want to enable driver required for CMSIS DSP,
- then
libarm_cortexM3l_math.a
is required, which is already present in...\framework-stm32cubef1\Drivers\CMSIS\Lib\GCC
- How enable or link this driver while compile? and what is correct way?
Current Work around[Working Good]
Step 1:
Copied the file libarm_cortexM3l_math.a
from location ...\framework-stm32cubef1\Drivers\CMSIS\Lib\GCC
into ..\lib\cmsis
Step 2:
In platformio.ini
file
[env:bluepill_f103c8_128k]
platform = ststm32
board = bluepill_f103c8_128k
framework = stm32cube
upload_protocol = cmsis-dap
debug_tool = cmsis-dap
build_flags =
-D ARM_MATH_CM3 ; Required for CMSIS-DSP library(arm_math.h)
-L lib/cmsis ; add the directory where libarm_cortexM3l_math.a is located
-l libarm_cortexM3l_math ; instruct the linker to link this library
Step 3:
In ‘main.c’ file,
......
......
#include "arm_math.h"
int16_t data_set[] = {1234, 5678, 9876, 4321, 3456, 7890, 6543, 2109, 8765, 1234, 5678, 9012, 2345, 6789, 4321, 8765, 1098, 3456, 7890, 6543};
int16_t array_size = 19;
......
......
int main(void)
{
......
......
int16_t _max_cmsis = 0;
uint32_t _max_cmsis_index = -1;
int16_t _min_cmsis = 0;
uint32_t _min_cmsis_index = -1;
arm_max_q15(data_set, array_size, &_max_cmsis, &_max_cmsis_index);
arm_min_q15(data_set, array_size, &_min_cmsis, &_min_cmsis_index);
......
......
}
......
......
Other Case
Mentioned to download from CMSIS Version 5 library, which is no longer maintained. Arm moved to different repo named as CMSIS-DSP