From 7efeb919405262ad352b5616128b92f7b6bd4404 Mon Sep 17 00:00:00 2001 From: lyon Date: Mon, 3 Jan 2022 17:15:39 +0800 Subject: [PATCH] add platform for CI proejct --- .../Core/Src/stm32f1xx_it.c | 16 +-- .../MDK-ARM/perf_counter_template_gcc.uvoptx | 112 +++++++++++++----- .../MDK-ARM/perf_counter_template_gcc.uvprojx | 51 ++++++-- CI/perf_counter_template_gcc/platform.c | 71 +++++++++++ 4 files changed, 202 insertions(+), 48 deletions(-) create mode 100644 CI/perf_counter_template_gcc/platform.c diff --git a/CI/perf_counter_template_gcc/Core/Src/stm32f1xx_it.c b/CI/perf_counter_template_gcc/Core/Src/stm32f1xx_it.c index 35e31ba..173e9a6 100644 --- a/CI/perf_counter_template_gcc/Core/Src/stm32f1xx_it.c +++ b/CI/perf_counter_template_gcc/Core/Src/stm32f1xx_it.c @@ -181,16 +181,16 @@ void PendSV_Handler(void) /** * @brief This function handles System tick timer. */ -void SysTick_Handler(void) -{ - /* USER CODE BEGIN SysTick_IRQn 0 */ +//void SysTick_Handler(void) +//{ +// /* USER CODE BEGIN SysTick_IRQn 0 */ - /* USER CODE END SysTick_IRQn 0 */ - HAL_IncTick(); - /* USER CODE BEGIN SysTick_IRQn 1 */ +// /* USER CODE END SysTick_IRQn 0 */ +// HAL_IncTick(); +// /* USER CODE BEGIN SysTick_IRQn 1 */ - /* USER CODE END SysTick_IRQn 1 */ -} +// /* USER CODE END SysTick_IRQn 1 */ +//} /******************************************************************************/ /* STM32F1xx Peripheral Interrupt Handlers */ diff --git a/CI/perf_counter_template_gcc/MDK-ARM/perf_counter_template_gcc.uvoptx b/CI/perf_counter_template_gcc/MDK-ARM/perf_counter_template_gcc.uvoptx index 8ae579c..ff27cb6 100644 --- a/CI/perf_counter_template_gcc/MDK-ARM/perf_counter_template_gcc.uvoptx +++ b/CI/perf_counter_template_gcc/MDK-ARM/perf_counter_template_gcc.uvoptx @@ -203,7 +203,7 @@ Application/User/Core - 0 + 1 0 0 0 @@ -214,18 +214,6 @@ 0 0 0 - ../Core/Src/main.c - main.c - 0 - 0 - - - 2 - 3 - 1 - 0 - 0 - 0 ../Core/Src/stm32f1xx_it.c stm32f1xx_it.c 0 @@ -233,7 +221,7 @@ 2 - 4 + 3 1 0 0 @@ -253,7 +241,7 @@ 0 3 - 5 + 4 1 0 0 @@ -265,7 +253,7 @@ 3 - 6 + 5 1 0 0 @@ -277,7 +265,7 @@ 3 - 7 + 6 1 0 0 @@ -289,7 +277,7 @@ 3 - 8 + 7 1 0 0 @@ -301,7 +289,7 @@ 3 - 9 + 8 1 0 0 @@ -313,7 +301,7 @@ 3 - 10 + 9 1 0 0 @@ -325,7 +313,7 @@ 3 - 11 + 10 1 0 0 @@ -337,7 +325,7 @@ 3 - 12 + 11 1 0 0 @@ -349,7 +337,7 @@ 3 - 13 + 12 1 0 0 @@ -361,7 +349,7 @@ 3 - 14 + 13 1 0 0 @@ -373,7 +361,7 @@ 3 - 15 + 14 1 0 0 @@ -385,7 +373,7 @@ 3 - 16 + 15 1 0 0 @@ -397,7 +385,7 @@ 3 - 17 + 16 1 0 0 @@ -417,7 +405,7 @@ 0 4 - 18 + 17 1 0 0 @@ -429,6 +417,74 @@ + + perf_counter + 1 + 0 + 0 + 0 + + 5 + 18 + 1 + 0 + 0 + 0 + ..\platform.c + platform.c + 0 + 0 + + + 5 + 19 + 1 + 0 + 0 + 0 + ..\..\..\perf_counter.c + perf_counter.c + 0 + 0 + + + 5 + 20 + 1 + 0 + 0 + 0 + ..\..\..\example\stdout_USART.c + stdout_USART.c + 0 + 0 + + + 5 + 21 + 1 + 0 + 0 + 0 + ..\..\..\example\main.c + main.c + 0 + 0 + + + 5 + 22 + 2 + 0 + 0 + 0 + ..\..\..\systick_wrapper_ual.s + systick_wrapper_ual.s + 0 + 0 + + + ::CMSIS 0 diff --git a/CI/perf_counter_template_gcc/MDK-ARM/perf_counter_template_gcc.uvprojx b/CI/perf_counter_template_gcc/MDK-ARM/perf_counter_template_gcc.uvprojx index 6962b42..291462e 100644 --- a/CI/perf_counter_template_gcc/MDK-ARM/perf_counter_template_gcc.uvprojx +++ b/CI/perf_counter_template_gcc/MDK-ARM/perf_counter_template_gcc.uvprojx @@ -10,7 +10,9 @@ perf_counter_template_gcc 0x4 ARM-ADS - 0 + 6160000::V6.16::ARMCLANG + 6160000::V6.16::ARMCLANG + 1 STM32F103RC @@ -205,7 +207,7 @@ 0 0 1 - 1 + 0 0 0 0 @@ -312,7 +314,7 @@ 1 - 4 + 2 0 0 1 @@ -327,7 +329,7 @@ 1 0 0 - 5 + 3 3 1 1 @@ -338,7 +340,7 @@ USE_HAL_DRIVER,STM32F103xE - ../Core/Inc;../Drivers/STM32F1xx_HAL_Driver/Inc;../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy;../Drivers/CMSIS/Device/ST/STM32F1xx/Include;../Drivers/CMSIS/Include + ../Core/Inc;../Drivers/STM32F1xx_HAL_Driver/Inc;../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy;../Drivers/CMSIS/Device/ST/STM32F1xx/Include;../Drivers/CMSIS/Include;..\..\.. @@ -392,11 +394,6 @@ Application/User/Core - - main.c - 1 - ../Core/Src/main.c - stm32f1xx_it.c 1 @@ -489,6 +486,36 @@ + + perf_counter + + + platform.c + 1 + ..\platform.c + + + perf_counter.c + 1 + ..\..\..\perf_counter.c + + + stdout_USART.c + 1 + ..\..\..\example\stdout_USART.c + + + main.c + 1 + ..\..\..\example\main.c + + + systick_wrapper_ual.s + 2 + ..\..\..\systick_wrapper_ual.s + + + ::CMSIS @@ -499,8 +526,8 @@ - - + + diff --git a/CI/perf_counter_template_gcc/platform.c b/CI/perf_counter_template_gcc/platform.c new file mode 100644 index 0000000..48ba4bf --- /dev/null +++ b/CI/perf_counter_template_gcc/platform.c @@ -0,0 +1,71 @@ +/**************************************************************************** +* Copyright 2021 Gorgon Meducer (Email:embedded_zhuoran@hotmail.com) * +* * +* Licensed under the Apache License, Version 2.0 (the "License"); * +* you may not use this file except in compliance with the License. * +* You may obtain a copy of the License at * +* * +* http://www.apache.org/licenses/LICENSE-2.0 * +* * +* Unless required by applicable law or agreed to in writing, software * +* distributed under the License is distributed on an "AS IS" BASIS, * +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * +* See the License for the specific language governing permissions and * +* limitations under the License. * +* * +****************************************************************************/ + +#include +#include +#include +#include "perf_counter.h" +//#include "ARMCM0.h" // Keil::Board Support:V2M-MPS2:Common +#include "main.h" +#include + +extern +void uart_config(uint32_t wUARTFrequency); + + +__attribute__((weak)) +void systimer_1ms_handler(void) +{ + HAL_IncTick(); +} + +static volatile uint32_t s_wMSCounter = 0; + +/*---------------------------------------------------------------------------- + SysTick / Timer0 IRQ Handler + *----------------------------------------------------------------------------*/ + +void SysTick_Handler (void) +{ + if (s_wMSCounter) { + s_wMSCounter--; + } + + systimer_1ms_handler(); +} + +void delay_ms(uint32_t wMillisecond) +{ + s_wMSCounter = wMillisecond; + while( s_wMSCounter > 0 ); +} + + +/*! \brief initialise platform before main() + */ +__attribute__((constructor(101))) +void platform_init(void) +{ + SystemCoreClockUpdate(); + + uart_config(25000000ul); + + /* Generate interrupt each 1 ms */ + SysTick_Config(SystemCoreClock / 1000); +} + +