├── _config.yml ├── example ├── picture │ └── example3.png ├── README.md ├── project │ ├── mdk │ │ ├── platform.h │ │ └── RTE │ │ │ └── Device │ │ │ ├── CMSDK_CM3 │ │ │ ├── RTE_Device.h │ │ │ └── system_CMSDK_CM3.c │ │ │ └── ARMCM3 │ │ │ ├── system_ARMCM3.c │ │ │ ├── ARMCM3_ac6.sct │ │ │ ├── startup_ARMCM3.s │ │ │ └── startup_ARMCM3.c │ └── main.c ├── byte_queue │ ├── byte_queue.h │ └── byte_queue.c ├── enhanced_byte_queue │ ├── enhanced_byte_queue.h │ └── enhanced_byte_queue.c └── trace │ ├── trace.h │ └── trace.c ├── cmsis-pack ├── GorgonMeducer.PLOOC.4.6.5.pack ├── GorgonMeducer.pidx └── GorgonMeducer.PLOOC.pdsc ├── CI └── PLOOC_template_gcc │ ├── Drivers │ ├── CMSIS │ │ ├── Device │ │ │ └── ST │ │ │ │ └── STM32F1xx │ │ │ │ └── Include │ │ │ │ ├── stm32f1xx.h │ │ │ │ ├── stm32f103xe.h │ │ │ │ └── system_stm32f1xx.h │ │ └── Include │ │ │ ├── cmsis_version.h │ │ │ ├── tz_context.h │ │ │ └── cmsis_compiler.h │ └── STM32F1xx_HAL_Driver │ │ ├── Src │ │ └── stm32f1xx_hal_gpio_ex.c │ │ └── Inc │ │ ├── stm32f1xx_hal_def.h │ │ ├── stm32f1xx_hal_flash.h │ │ └── stm32f1xx_hal_tim_ex.h │ ├── MDK-ARM │ └── PLOOC_template_gcc │ │ └── PLOOC_template_gcc.sct │ ├── Core │ ├── Inc │ │ ├── stm32f1xx_it.h │ │ └── main.h │ └── Src │ │ ├── stm32f1xx_hal_msp.c │ │ └── stm32f1xx_it.c │ ├── PLOOC_template_gcc.ioc │ ├── Makefile │ ├── STM32F103RCTx_FLASH.ld │ └── .mxproject ├── .github └── workflows │ └── c-cpp.yml ├── .gitignore ├── template ├── class │ ├── class_name.c │ └── class_name.h └── derived_class │ ├── class_name.h │ └── class_name.c ├── GorgonMeducer.PLOOC.pdsc ├── gen_pack.sh ├── plooc_class_simple_c90.h └── plooc_class_simple.h /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-architect -------------------------------------------------------------------------------- /example/picture/example3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GorgonMeducer/PLOOC/HEAD/example/picture/example3.png -------------------------------------------------------------------------------- /cmsis-pack/GorgonMeducer.PLOOC.4.6.5.pack: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GorgonMeducer/PLOOC/HEAD/cmsis-pack/GorgonMeducer.PLOOC.4.6.5.pack -------------------------------------------------------------------------------- /CI/PLOOC_template_gcc/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GorgonMeducer/PLOOC/HEAD/CI/PLOOC_template_gcc/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h -------------------------------------------------------------------------------- /CI/PLOOC_template_gcc/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GorgonMeducer/PLOOC/HEAD/CI/PLOOC_template_gcc/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h -------------------------------------------------------------------------------- /cmsis-pack/GorgonMeducer.pidx: -------------------------------------------------------------------------------- 1 | 2 | 3 | GorgonMeducer 4 | https://raw.githubusercontent.com/GorgonMeducer/PLOOC/master/cmsis-pack/ 5 | 2025-07-07 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /CI/PLOOC_template_gcc/MDK-ARM/PLOOC_template_gcc/PLOOC_template_gcc.sct: -------------------------------------------------------------------------------- 1 | ; ************************************************************* 2 | ; *** Scatter-Loading Description File generated by uVision *** 3 | ; ************************************************************* 4 | 5 | LR_IROM1 0x08000000 0x00040000 { ; load region size_region 6 | ER_IROM1 0x08000000 0x00040000 { ; load address = execution address 7 | *.o (RESET, +First) 8 | *(InRoot$$Sections) 9 | .ANY (+RO) 10 | .ANY (+XO) 11 | } 12 | RW_IRAM1 0x20000000 0x0000C000 { ; RW data 13 | .ANY (+RW +ZI) 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /.github/workflows/c-cpp.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | env: 10 | # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) 11 | BUILD_TYPE: Release 12 | 13 | jobs: 14 | build: 15 | runs-on: windows-latest 16 | 17 | steps: 18 | - uses: actions/checkout@v2 19 | 20 | - name: arm-none-eabi-gcc 21 | uses: ryanwinter/arm-none-eabi-gcc@master 22 | with: 23 | # GNU Embedded Toolchain for Arm release name, in the V-YYYY-qZ format (e.g. "9-2019-q4") 24 | release: '10-2021.10' 25 | 26 | - name: make-PLOOC_template_gcc 27 | run: cd ${{github.workspace}}/CI/PLOOC_template_gcc && make 28 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # Examples for PLOOC 2 | ## Introduction 3 | In order to show how PLOOC is easy and simple to use, examples are provided to demostrate diffrent aspects of the new OOPC method. Currently, the available examples are: 4 | 5 | - byte_queue 6 | - enhanced_byte_queue 7 | 8 | More examples will be added later... 9 | 10 | ## [Example 1: How to define a class](https://github.com/GorgonMeducer/PLOOC/tree/master/example/byte_queue) 11 | This example shows 12 | - How to define a class 13 | - How to add private member 14 | - How to add protected member 15 | - How to access class members 16 | - How to define user friendly interface 17 | 18 | ## [Example 2: How to access protected members](https://github.com/GorgonMeducer/PLOOC/tree/master/example/enhanced_byte_queue) 19 | - How to inherit from a base class 20 | - How to access protected members which are inherited from base 21 | - How to inherit a interface 22 | - How to override base methods 23 | 24 | ## [Example 3: How to implement Overload ](https://github.com/GorgonMeducer/PLOOC/tree/master/example/trace) 25 | 26 | - How to implement overload using PLOOC 27 | 28 | ![example3](./picture/example3.png?raw=true) 29 | 30 | 31 | Author: GorgonMeducer, under Apache 2.0 32 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Object files 5 | *.o 6 | *.ko 7 | *.obj 8 | *.elf 9 | 10 | # Linker output 11 | *.ilk 12 | *.map 13 | *.exp 14 | 15 | # Precompiled Headers 16 | *.gch 17 | *.pch 18 | 19 | # Libraries 20 | *.lib 21 | *.a 22 | *.la 23 | *.lo 24 | 25 | # Shared objects (inc. Windows DLLs) 26 | *.dll 27 | *.so 28 | *.so.* 29 | *.dylib 30 | 31 | # Executables 32 | *.exe 33 | *.out 34 | *.app 35 | *.i*86 36 | *.x86_64 37 | *.hex 38 | 39 | # Debug files 40 | *.dSYM/ 41 | *.su 42 | *.idb 43 | *.pdb 44 | 45 | # Kernel Module Compile Results 46 | *.mod* 47 | *.cmd 48 | .tmp_versions/ 49 | modules.order 50 | Module.symvers 51 | Mkfile.old 52 | dkms.conf 53 | *.iex 54 | *.crf 55 | *.axf 56 | *.lst 57 | *.dep 58 | *.gabwan01 59 | *.lnp 60 | *.scvd 61 | *.htm 62 | 63 | *@* 64 | 65 | example/project/mdk/Objects 66 | example/project/mdk/RTE/Compiler/.* 67 | example/project/mdk/RTE/Device/ARMCM3/.* 68 | example/project/mdk/plooc_example.uvguix.* 69 | CI/PLOOC_template_gcc/MDK-ARM/DebugConfig/PLOOC_template_gcc_STM32F103RC_1.0.0.dbgconf 70 | *@* 71 | *.uvguix.* 72 | RTE_Components.h 73 | 74 | example/project/mdk/RTE/Compiler/EventRecorderConf.h 75 | example/project/mdk/RTE/_arm_compiler_6_example/Pre_Include_Global.h 76 | example/project/mdk/RTE/CMSIS-View/EventRecorderConf.h 77 | -------------------------------------------------------------------------------- /CI/PLOOC_template_gcc/Drivers/CMSIS/Include/cmsis_version.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file cmsis_version.h 3 | * @brief CMSIS Core(M) Version definitions 4 | * @version V5.0.2 5 | * @date 19. April 2017 6 | ******************************************************************************/ 7 | /* 8 | * Copyright (c) 2009-2017 ARM Limited. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #if defined ( __ICCARM__ ) 26 | #pragma system_include /* treat file as system include file for MISRA check */ 27 | #elif defined (__clang__) 28 | #pragma clang system_header /* treat file as system include file */ 29 | #endif 30 | 31 | #ifndef __CMSIS_VERSION_H 32 | #define __CMSIS_VERSION_H 33 | 34 | /* CMSIS Version definitions */ 35 | #define __CM_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS Core(M) main version */ 36 | #define __CM_CMSIS_VERSION_SUB ( 1U) /*!< [15:0] CMSIS Core(M) sub version */ 37 | #define __CM_CMSIS_VERSION ((__CM_CMSIS_VERSION_MAIN << 16U) | \ 38 | __CM_CMSIS_VERSION_SUB ) /*!< CMSIS Core(M) version number */ 39 | #endif 40 | -------------------------------------------------------------------------------- /example/project/mdk/platform.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright(C)2009-2019 by GorgonMeducer * 3 | * * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); * 5 | * you may not use this file except in compliance with the License. * 6 | * You may obtain a copy of the License at * 7 | * * 8 | * http://www.apache.org/licenses/LICENSE-2.0 * 9 | * * 10 | * Unless required by applicable law or agreed to in writing, software * 11 | * distributed under the License is distributed on an "AS IS" BASIS, * 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 13 | * See the License for the specific language governing permissions and * 14 | * limitations under the License. * 15 | * * 16 | ****************************************************************************/ 17 | 18 | #ifndef __PLATFORM_H__ 19 | #define __PLATFORM_H__ 20 | 21 | 22 | /*============================ INCLUDES ======================================*/ 23 | #include 24 | 25 | /*============================ MACROS ========================================*/ 26 | /*============================ MACROFIED FUNCTIONS ===========================*/ 27 | /*============================ TYPES =========================================*/ 28 | /*============================ GLOBAL VARIABLES ==============================*/ 29 | /*============================ PROTOTYPES ====================================*/ 30 | 31 | extern void platform_init(void); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /CI/PLOOC_template_gcc/Core/Inc/stm32f1xx_it.h: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file stm32f1xx_it.h 5 | * @brief This file contains the headers of the interrupt handlers. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2021 STMicroelectronics. 10 | * All rights reserved.

11 | * 12 | * This software component is licensed by ST under BSD 3-Clause license, 13 | * the "License"; You may not use this file except in compliance with the 14 | * License. You may obtain a copy of the License at: 15 | * opensource.org/licenses/BSD-3-Clause 16 | * 17 | ****************************************************************************** 18 | */ 19 | /* USER CODE END Header */ 20 | 21 | /* Define to prevent recursive inclusion -------------------------------------*/ 22 | #ifndef __STM32F1xx_IT_H 23 | #define __STM32F1xx_IT_H 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /* Private includes ----------------------------------------------------------*/ 30 | /* USER CODE BEGIN Includes */ 31 | 32 | /* USER CODE END Includes */ 33 | 34 | /* Exported types ------------------------------------------------------------*/ 35 | /* USER CODE BEGIN ET */ 36 | 37 | /* USER CODE END ET */ 38 | 39 | /* Exported constants --------------------------------------------------------*/ 40 | /* USER CODE BEGIN EC */ 41 | 42 | /* USER CODE END EC */ 43 | 44 | /* Exported macro ------------------------------------------------------------*/ 45 | /* USER CODE BEGIN EM */ 46 | 47 | /* USER CODE END EM */ 48 | 49 | /* Exported functions prototypes ---------------------------------------------*/ 50 | void NMI_Handler(void); 51 | void HardFault_Handler(void); 52 | void MemManage_Handler(void); 53 | void BusFault_Handler(void); 54 | void UsageFault_Handler(void); 55 | void SVC_Handler(void); 56 | void DebugMon_Handler(void); 57 | void PendSV_Handler(void); 58 | void SysTick_Handler(void); 59 | /* USER CODE BEGIN EFP */ 60 | 61 | /* USER CODE END EFP */ 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | 67 | #endif /* __STM32F1xx_IT_H */ 68 | 69 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 70 | -------------------------------------------------------------------------------- /CI/PLOOC_template_gcc/Core/Inc/main.h: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file : main.h 5 | * @brief : Header for main.c file. 6 | * This file contains the common defines of the application. 7 | ****************************************************************************** 8 | * @attention 9 | * 10 | *

© Copyright (c) 2021 STMicroelectronics. 11 | * All rights reserved.

12 | * 13 | * This software component is licensed by ST under BSD 3-Clause license, 14 | * the "License"; You may not use this file except in compliance with the 15 | * License. You may obtain a copy of the License at: 16 | * opensource.org/licenses/BSD-3-Clause 17 | * 18 | ****************************************************************************** 19 | */ 20 | /* USER CODE END Header */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __MAIN_H 24 | #define __MAIN_H 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Includes ------------------------------------------------------------------*/ 31 | #include "stm32f1xx_hal.h" 32 | 33 | /* Private includes ----------------------------------------------------------*/ 34 | /* USER CODE BEGIN Includes */ 35 | 36 | /* USER CODE END Includes */ 37 | 38 | /* Exported types ------------------------------------------------------------*/ 39 | /* USER CODE BEGIN ET */ 40 | 41 | /* USER CODE END ET */ 42 | 43 | /* Exported constants --------------------------------------------------------*/ 44 | /* USER CODE BEGIN EC */ 45 | 46 | /* USER CODE END EC */ 47 | 48 | /* Exported macro ------------------------------------------------------------*/ 49 | /* USER CODE BEGIN EM */ 50 | 51 | /* USER CODE END EM */ 52 | 53 | /* Exported functions prototypes ---------------------------------------------*/ 54 | void Error_Handler(void); 55 | 56 | /* USER CODE BEGIN EFP */ 57 | 58 | /* USER CODE END EFP */ 59 | 60 | /* Private defines -----------------------------------------------------------*/ 61 | /* USER CODE BEGIN Private defines */ 62 | 63 | /* USER CODE END Private defines */ 64 | 65 | #ifdef __cplusplus 66 | } 67 | #endif 68 | 69 | #endif /* __MAIN_H */ 70 | 71 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 72 | -------------------------------------------------------------------------------- /example/project/mdk/RTE/Device/CMSDK_CM3/RTE_Device.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | * Copyright (c) 2016 ARM Ltd. 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. 5 | * In no event will the authors be held liable for any damages arising from 6 | * the use of this software. Permission is granted to anyone to use this 7 | * software for any purpose, including commercial applications, and to alter 8 | * it and redistribute it freely, subject to the following restrictions: 9 | * 10 | * 1. The origin of this software must not be misrepresented; you must not 11 | * claim that you wrote the original software. If you use this software in 12 | * a product, an acknowledgment in the product documentation would be 13 | * appreciated but is not required. 14 | * 15 | * 2. Altered source versions must be plainly marked as such, and must not be 16 | * misrepresented as being the original software. 17 | * 18 | * 3. This notice may not be removed or altered from any source distribution. 19 | * 20 | * $Date: 25. April 2016 21 | * $Revision: V1.0.0 22 | * 23 | * Project: RTE Device Configuration for ARM CMSDK_CM device 24 | * -------------------------------------------------------------------------- */ 25 | 26 | //-------- <<< Use Configuration Wizard in Context Menu >>> -------------------- 27 | 28 | #ifndef __RTE_DEVICE_H 29 | #define __RTE_DEVICE_H 30 | 31 | // USART0 (Universal synchronous asynchronous receiver transmitter) [Driver_USART0] 32 | // Configuration settings for Driver_USART0 in component ::CMSIS Driver:USART 33 | #define RTE_USART0 1 34 | 35 | 36 | // USART1 (Universal synchronous asynchronous receiver transmitter) [Driver_USART1] 37 | // Configuration settings for Driver_USART1 in component ::CMSIS Driver:USART 38 | #define RTE_USART1 0 39 | 40 | 41 | // USART2 (Universal synchronous asynchronous receiver transmitter) [Driver_USART2] 42 | // Configuration settings for Driver_USART2 in component ::CMSIS Driver:USART 43 | #define RTE_UART2 0 44 | 45 | 46 | // USART3 (Universal synchronous asynchronous receiver transmitter) [Driver_USART3] 47 | // Configuration settings for Driver_USART3 in component ::CMSIS Driver:USART 48 | #define RTE_UART3 0 49 | 50 | #endif /* __RTE_DEVICE_H */ 51 | -------------------------------------------------------------------------------- /CI/PLOOC_template_gcc/Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f10x.h 4 | * @author MCD Application Team 5 | * @brief CMSIS Cortex-M3 Device Peripheral Access Layer System Header File. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2017 STMicroelectronics. 10 | * All rights reserved.

11 | * 12 | * This software component is licensed by ST under BSD 3-Clause license, 13 | * the "License"; You may not use this file except in compliance with the 14 | * License. You may obtain a copy of the License at: 15 | * opensource.org/licenses/BSD-3-Clause 16 | * 17 | ****************************************************************************** 18 | */ 19 | 20 | /** @addtogroup CMSIS 21 | * @{ 22 | */ 23 | 24 | /** @addtogroup stm32f10x_system 25 | * @{ 26 | */ 27 | 28 | /** 29 | * @brief Define to prevent recursive inclusion 30 | */ 31 | #ifndef __SYSTEM_STM32F10X_H 32 | #define __SYSTEM_STM32F10X_H 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | /** @addtogroup STM32F10x_System_Includes 39 | * @{ 40 | */ 41 | 42 | /** 43 | * @} 44 | */ 45 | 46 | 47 | /** @addtogroup STM32F10x_System_Exported_types 48 | * @{ 49 | */ 50 | 51 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 52 | extern const uint8_t AHBPrescTable[16U]; /*!< AHB prescalers table values */ 53 | extern const uint8_t APBPrescTable[8U]; /*!< APB prescalers table values */ 54 | 55 | /** 56 | * @} 57 | */ 58 | 59 | /** @addtogroup STM32F10x_System_Exported_Constants 60 | * @{ 61 | */ 62 | 63 | /** 64 | * @} 65 | */ 66 | 67 | /** @addtogroup STM32F10x_System_Exported_Macros 68 | * @{ 69 | */ 70 | 71 | /** 72 | * @} 73 | */ 74 | 75 | /** @addtogroup STM32F10x_System_Exported_Functions 76 | * @{ 77 | */ 78 | 79 | extern void SystemInit(void); 80 | extern void SystemCoreClockUpdate(void); 81 | /** 82 | * @} 83 | */ 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | 89 | #endif /*__SYSTEM_STM32F10X_H */ 90 | 91 | /** 92 | * @} 93 | */ 94 | 95 | /** 96 | * @} 97 | */ 98 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 99 | -------------------------------------------------------------------------------- /example/project/mdk/RTE/Device/ARMCM3/system_ARMCM3.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file system_ARMCM3.c 3 | * @brief CMSIS Device System Source File for 4 | * ARMCM3 Device 5 | * @version V1.0.1 6 | * @date 15. November 2019 7 | ******************************************************************************/ 8 | /* 9 | * Copyright (c) 2009-2019 Arm Limited. All rights reserved. 10 | * 11 | * SPDX-License-Identifier: Apache-2.0 12 | * 13 | * Licensed under the Apache License, Version 2.0 (the License); you may 14 | * not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at 16 | * 17 | * www.apache.org/licenses/LICENSE-2.0 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 21 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | */ 25 | 26 | #include "ARMCM3.h" 27 | 28 | /*---------------------------------------------------------------------------- 29 | Define clocks 30 | *----------------------------------------------------------------------------*/ 31 | #define XTAL (50000000UL) /* Oscillator frequency */ 32 | 33 | #define SYSTEM_CLOCK (XTAL / 2U) 34 | 35 | /*---------------------------------------------------------------------------- 36 | Exception / Interrupt Vector table 37 | *----------------------------------------------------------------------------*/ 38 | extern const VECTOR_TABLE_Type __VECTOR_TABLE[240]; 39 | 40 | /*---------------------------------------------------------------------------- 41 | System Core Clock Variable 42 | *----------------------------------------------------------------------------*/ 43 | uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */ 44 | 45 | 46 | /*---------------------------------------------------------------------------- 47 | System Core Clock update function 48 | *----------------------------------------------------------------------------*/ 49 | void SystemCoreClockUpdate (void) 50 | { 51 | SystemCoreClock = SYSTEM_CLOCK; 52 | } 53 | 54 | /*---------------------------------------------------------------------------- 55 | System initialization function 56 | *----------------------------------------------------------------------------*/ 57 | void SystemInit (void) 58 | { 59 | 60 | #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) 61 | SCB->VTOR = (uint32_t) &(__VECTOR_TABLE[0]); 62 | #endif 63 | 64 | SystemCoreClock = SYSTEM_CLOCK; 65 | } 66 | -------------------------------------------------------------------------------- /CI/PLOOC_template_gcc/Core/Src/stm32f1xx_hal_msp.c: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file stm32f1xx_hal_msp.c 5 | * @brief This file provides code for the MSP Initialization 6 | * and de-Initialization codes. 7 | ****************************************************************************** 8 | * @attention 9 | * 10 | *

© Copyright (c) 2021 STMicroelectronics. 11 | * All rights reserved.

12 | * 13 | * This software component is licensed by ST under BSD 3-Clause license, 14 | * the "License"; You may not use this file except in compliance with the 15 | * License. You may obtain a copy of the License at: 16 | * opensource.org/licenses/BSD-3-Clause 17 | * 18 | ****************************************************************************** 19 | */ 20 | /* USER CODE END Header */ 21 | 22 | /* Includes ------------------------------------------------------------------*/ 23 | #include "main.h" 24 | /* USER CODE BEGIN Includes */ 25 | 26 | /* USER CODE END Includes */ 27 | 28 | /* Private typedef -----------------------------------------------------------*/ 29 | /* USER CODE BEGIN TD */ 30 | 31 | /* USER CODE END TD */ 32 | 33 | /* Private define ------------------------------------------------------------*/ 34 | /* USER CODE BEGIN Define */ 35 | 36 | /* USER CODE END Define */ 37 | 38 | /* Private macro -------------------------------------------------------------*/ 39 | /* USER CODE BEGIN Macro */ 40 | 41 | /* USER CODE END Macro */ 42 | 43 | /* Private variables ---------------------------------------------------------*/ 44 | /* USER CODE BEGIN PV */ 45 | 46 | /* USER CODE END PV */ 47 | 48 | /* Private function prototypes -----------------------------------------------*/ 49 | /* USER CODE BEGIN PFP */ 50 | 51 | /* USER CODE END PFP */ 52 | 53 | /* External functions --------------------------------------------------------*/ 54 | /* USER CODE BEGIN ExternalFunctions */ 55 | 56 | /* USER CODE END ExternalFunctions */ 57 | 58 | /* USER CODE BEGIN 0 */ 59 | 60 | /* USER CODE END 0 */ 61 | /** 62 | * Initializes the Global MSP. 63 | */ 64 | void HAL_MspInit(void) 65 | { 66 | /* USER CODE BEGIN MspInit 0 */ 67 | 68 | /* USER CODE END MspInit 0 */ 69 | 70 | __HAL_RCC_AFIO_CLK_ENABLE(); 71 | __HAL_RCC_PWR_CLK_ENABLE(); 72 | 73 | /* System interrupt init*/ 74 | 75 | /** DISABLE: JTAG-DP Disabled and SW-DP Disabled 76 | */ 77 | __HAL_AFIO_REMAP_SWJ_DISABLE(); 78 | 79 | /* USER CODE BEGIN MspInit 1 */ 80 | 81 | /* USER CODE END MspInit 1 */ 82 | } 83 | 84 | /* USER CODE BEGIN 1 */ 85 | 86 | /* USER CODE END 1 */ 87 | 88 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 89 | -------------------------------------------------------------------------------- /CI/PLOOC_template_gcc/PLOOC_template_gcc.ioc: -------------------------------------------------------------------------------- 1 | #MicroXplorer Configuration settings - do not modify 2 | File.Version=6 3 | GPIO.groupedBy= 4 | KeepUserPlacement=false 5 | Mcu.Family=STM32F1 6 | Mcu.IP0=NVIC 7 | Mcu.IP1=RCC 8 | Mcu.IP2=SYS 9 | Mcu.IPNb=3 10 | Mcu.Name=STM32F103R(C-D-E)Tx 11 | Mcu.Package=LQFP64 12 | Mcu.Pin0=VP_SYS_VS_ND 13 | Mcu.Pin1=VP_SYS_VS_Systick 14 | Mcu.PinsNb=2 15 | Mcu.ThirdPartyNb=0 16 | Mcu.UserConstants= 17 | Mcu.UserName=STM32F103RCTx 18 | MxCube.Version=6.3.0 19 | MxDb.Version=DB.6.0.30 20 | NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false 21 | NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false 22 | NVIC.ForceEnableDMAVector=true 23 | NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false 24 | NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false 25 | NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false 26 | NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false 27 | NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4 28 | NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false 29 | NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:true\:false\:true 30 | NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false 31 | PinOutPanel.RotationAngle=0 32 | ProjectManager.AskForMigrate=true 33 | ProjectManager.BackupPrevious=false 34 | ProjectManager.CompilerOptimize=6 35 | ProjectManager.ComputerToolchain=false 36 | ProjectManager.CoupleFile=true 37 | ProjectManager.CustomerFirmwarePackage= 38 | ProjectManager.DefaultFWLocation=true 39 | ProjectManager.DeletePrevious=true 40 | ProjectManager.DeviceId=STM32F103RCTx 41 | ProjectManager.FirmwarePackage=STM32Cube FW_F1 V1.8.4 42 | ProjectManager.FreePins=false 43 | ProjectManager.HalAssertFull=false 44 | ProjectManager.HeapSize=0x200 45 | ProjectManager.KeepUserCode=true 46 | ProjectManager.LastFirmware=true 47 | ProjectManager.LibraryCopy=1 48 | ProjectManager.MainLocation=Core/Src 49 | ProjectManager.NoMain=false 50 | ProjectManager.PreviousToolchain= 51 | ProjectManager.ProjectBuild=false 52 | ProjectManager.ProjectFileName=PLOOC_template_gcc.ioc 53 | ProjectManager.ProjectName=PLOOC_template_gcc 54 | ProjectManager.RegisterCallBack= 55 | ProjectManager.StackSize=0x400 56 | ProjectManager.TargetToolchain=MDK-ARM V5.32 57 | ProjectManager.ToolChainLocation= 58 | ProjectManager.UnderRoot=false 59 | ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false 60 | RCC.APB1Freq_Value=8000000 61 | RCC.APB2Freq_Value=8000000 62 | RCC.FamilyName=M 63 | RCC.IPParameters=APB1Freq_Value,APB2Freq_Value,FamilyName,PLLCLKFreq_Value,PLLMCOFreq_Value,TimSysFreq_Value 64 | RCC.PLLCLKFreq_Value=8000000 65 | RCC.PLLMCOFreq_Value=4000000 66 | RCC.TimSysFreq_Value=8000000 67 | VP_SYS_VS_ND.Mode=No_Debug 68 | VP_SYS_VS_ND.Signal=SYS_VS_ND 69 | VP_SYS_VS_Systick.Mode=SysTick 70 | VP_SYS_VS_Systick.Signal=SYS_VS_Systick 71 | board=custom 72 | -------------------------------------------------------------------------------- /CI/PLOOC_template_gcc/Drivers/CMSIS/Include/tz_context.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * @file tz_context.h 3 | * @brief Context Management for Armv8-M TrustZone 4 | * @version V1.0.1 5 | * @date 10. January 2018 6 | ******************************************************************************/ 7 | /* 8 | * Copyright (c) 2017-2018 Arm Limited. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #if defined ( __ICCARM__ ) 26 | #pragma system_include /* treat file as system include file for MISRA check */ 27 | #elif defined (__clang__) 28 | #pragma clang system_header /* treat file as system include file */ 29 | #endif 30 | 31 | #ifndef TZ_CONTEXT_H 32 | #define TZ_CONTEXT_H 33 | 34 | #include 35 | 36 | #ifndef TZ_MODULEID_T 37 | #define TZ_MODULEID_T 38 | /// \details Data type that identifies secure software modules called by a process. 39 | typedef uint32_t TZ_ModuleId_t; 40 | #endif 41 | 42 | /// \details TZ Memory ID identifies an allocated memory slot. 43 | typedef uint32_t TZ_MemoryId_t; 44 | 45 | /// Initialize secure context memory system 46 | /// \return execution status (1: success, 0: error) 47 | uint32_t TZ_InitContextSystem_S (void); 48 | 49 | /// Allocate context memory for calling secure software modules in TrustZone 50 | /// \param[in] module identifies software modules called from non-secure mode 51 | /// \return value != 0 id TrustZone memory slot identifier 52 | /// \return value 0 no memory available or internal error 53 | TZ_MemoryId_t TZ_AllocModuleContext_S (TZ_ModuleId_t module); 54 | 55 | /// Free context memory that was previously allocated with \ref TZ_AllocModuleContext_S 56 | /// \param[in] id TrustZone memory slot identifier 57 | /// \return execution status (1: success, 0: error) 58 | uint32_t TZ_FreeModuleContext_S (TZ_MemoryId_t id); 59 | 60 | /// Load secure context (called on RTOS thread context switch) 61 | /// \param[in] id TrustZone memory slot identifier 62 | /// \return execution status (1: success, 0: error) 63 | uint32_t TZ_LoadContext_S (TZ_MemoryId_t id); 64 | 65 | /// Store secure context (called on RTOS thread context switch) 66 | /// \param[in] id TrustZone memory slot identifier 67 | /// \return execution status (1: success, 0: error) 68 | uint32_t TZ_StoreContext_S (TZ_MemoryId_t id); 69 | 70 | #endif // TZ_CONTEXT_H 71 | -------------------------------------------------------------------------------- /example/project/mdk/RTE/Device/CMSDK_CM3/system_CMSDK_CM3.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file system_CMSDK_CM3.c 3 | * @brief CMSIS Device System Source File for 4 | * CMSDK_M3 Device 5 | * @version V4.00 6 | * @date 02. November 2015 7 | ******************************************************************************/ 8 | /* Copyright (c) 2011 - 2015 ARM LIMITED 9 | 10 | All rights reserved. 11 | Redistribution and use in source and binary forms, with or without 12 | modification, are permitted provided that the following conditions are met: 13 | - Redistributions of source code must retain the above copyright 14 | notice, this list of conditions and the following disclaimer. 15 | - Redistributions in binary form must reproduce the above copyright 16 | notice, this list of conditions and the following disclaimer in the 17 | documentation and/or other materials provided with the distribution. 18 | - Neither the name of ARM nor the names of its contributors may be used 19 | to endorse or promote products derived from this software without 20 | specific prior written permission. 21 | * 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 23 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE 26 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | POSSIBILITY OF SUCH DAMAGE. 33 | ---------------------------------------------------------------------------*/ 34 | 35 | 36 | #include "CMSDK_CM3.h" 37 | 38 | /*---------------------------------------------------------------------------- 39 | Define clocks 40 | *----------------------------------------------------------------------------*/ 41 | #define XTAL (50000000UL) /* Oscillator frequency */ 42 | 43 | #define SYSTEM_CLOCK (XTAL / 2) 44 | 45 | 46 | /*---------------------------------------------------------------------------- 47 | System Core Clock Variable 48 | *----------------------------------------------------------------------------*/ 49 | uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */ 50 | 51 | 52 | void SystemCoreClockUpdate (void) 53 | { 54 | SystemCoreClock = SYSTEM_CLOCK; 55 | } 56 | 57 | void SystemInit (void) 58 | { 59 | 60 | #ifdef UNALIGNED_SUPPORT_DISABLE 61 | SCB->CCR |= SCB_CCR_UNALIGN_TRP_Msk; 62 | #endif 63 | 64 | SystemCoreClock = SYSTEM_CLOCK; 65 | } 66 | -------------------------------------------------------------------------------- /example/project/mdk/RTE/Device/ARMCM3/ARMCM3_ac6.sct: -------------------------------------------------------------------------------- 1 | #! armclang -E --target=arm-arm-none-eabi -mcpu=cortex-m3 -xc 2 | ; command above MUST be in first line (no comment above!) 3 | 4 | /* 5 | ;-------- <<< Use Configuration Wizard in Context Menu >>> ------------------- 6 | */ 7 | 8 | /*--------------------- Flash Configuration ---------------------------------- 9 | ; Flash Configuration 10 | ; Flash Base Address <0x0-0xFFFFFFFF:8> 11 | ; Flash Size (in Bytes) <0x0-0xFFFFFFFF:8> 12 | ; 13 | *----------------------------------------------------------------------------*/ 14 | #define __ROM_BASE 0x00000000 15 | #define __ROM_SIZE 0x00080000 16 | 17 | /*--------------------- Embedded RAM Configuration --------------------------- 18 | ; RAM Configuration 19 | ; RAM Base Address <0x0-0xFFFFFFFF:8> 20 | ; RAM Size (in Bytes) <0x0-0xFFFFFFFF:8> 21 | ; 22 | *----------------------------------------------------------------------------*/ 23 | #define __RAM_BASE 0x20000000 24 | #define __RAM_SIZE 0x00040000 25 | 26 | /*--------------------- Stack / Heap Configuration --------------------------- 27 | ; Stack / Heap Configuration 28 | ; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> 29 | ; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> 30 | ; 31 | *----------------------------------------------------------------------------*/ 32 | #define __STACK_SIZE 0x00000200 33 | #define __HEAP_SIZE 0x00000C00 34 | 35 | /* 36 | ;------------- <<< end of configuration section >>> --------------------------- 37 | */ 38 | 39 | 40 | /*---------------------------------------------------------------------------- 41 | User Stack & Heap boundary definition 42 | *----------------------------------------------------------------------------*/ 43 | #define __STACK_TOP (__RAM_BASE + __RAM_SIZE) /* starts at end of RAM */ 44 | #define __HEAP_BASE (AlignExpr(+0, 8)) /* starts after RW_RAM section, 8 byte aligned */ 45 | 46 | 47 | /*---------------------------------------------------------------------------- 48 | Scatter File Definitions definition 49 | *----------------------------------------------------------------------------*/ 50 | #define __RO_BASE __ROM_BASE 51 | #define __RO_SIZE __ROM_SIZE 52 | 53 | #define __RW_BASE __RAM_BASE 54 | #define __RW_SIZE (__RAM_SIZE - __STACK_SIZE - __HEAP_SIZE) 55 | 56 | 57 | LR_ROM __RO_BASE __RO_SIZE { ; load region size_region 58 | ER_ROM __RO_BASE __RO_SIZE { ; load address = execution address 59 | *.o (RESET, +First) 60 | *(InRoot$$Sections) 61 | .ANY (+RO) 62 | .ANY (+XO) 63 | } 64 | 65 | RW_NOINIT __RW_BASE UNINIT __RW_SIZE { 66 | *(.bss.noinit) 67 | } 68 | 69 | RW_RAM AlignExpr(+0, 8) (__RW_SIZE - AlignExpr(ImageLength(RW_NOINIT), 8)) { 70 | *(+RW +ZI) 71 | } 72 | 73 | #if __HEAP_SIZE > 0 74 | ARM_LIB_HEAP __HEAP_BASE EMPTY __HEAP_SIZE { ; Reserve empty region for heap 75 | } 76 | #endif 77 | 78 | ARM_LIB_STACK __STACK_TOP EMPTY -__STACK_SIZE { ; Reserve empty region for stack 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /template/class/class_name.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright(C)2009-2019 by GorgonMeducer * 3 | * * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); * 5 | * you may not use this file except in compliance with the License. * 6 | * You may obtain a copy of the License at * 7 | * * 8 | * http://www.apache.org/licenses/LICENSE-2.0 * 9 | * * 10 | * Unless required by applicable law or agreed to in writing, software * 11 | * distributed under the License is distributed on an "AS IS" BASIS, * 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 13 | * See the License for the specific language governing permissions and * 14 | * limitations under the License. * 15 | * * 16 | ****************************************************************************/ 17 | 18 | 19 | /*============================ INCLUDES ======================================*/ 20 | #define ___CLASS_IMPLEMENT__ 21 | 22 | #include "./.h" 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | /*============================ MACROS ========================================*/ 30 | /*============================ MACROFIED FUNCTIONS ===========================*/ 31 | #ifndef ASSERT 32 | # define ASSERT(...) assert(__VA_ARGS__) 33 | #endif 34 | 35 | #undef this 36 | #define this (*ptThis) 37 | 38 | /*============================ TYPES =========================================*/ 39 | /*============================ LOCAL VARIABLES ===============================*/ 40 | /*============================ PROTOTYPES ====================================*/ 41 | /*============================ GLOBAL VARIABLES ==============================*/ 42 | const i__t = { 43 | .Init = &_init, 44 | .Depose = &_depose, 45 | 46 | /* other methods */ 47 | }; 48 | 49 | 50 | /*============================ IMPLEMENTATION ================================*/ 51 | 52 | /*! \brief the constructor of the class: */ 53 | _t * _init(_t *ptObj, _cfg_t *ptCFG) 54 | { 55 | /* initialise "this" (i.e. ptThis) to access class members */ 56 | class_internal(ptObj, ptThis, _t); 57 | 58 | ASSERT(NULL != ptObj && NULL != ptCFG); 59 | 60 | return ptObj; 61 | } 62 | 63 | /*! \brief the destructor of the class: */ 64 | void _depose(_t *ptObj) 65 | { 66 | /* initialise "this" (i.e. ptThis) to access class members */ 67 | class_internal(ptObj, ptThis, _t); 68 | 69 | 70 | } 71 | 72 | 73 | /*! \brief a method only visible for current class and derived class */ 74 | void _protected_method_example1(_t *ptObj) 75 | { 76 | /* initialise "this" (i.e. ptThis) to access class members */ 77 | class_internal(ptObj, ptThis, _t); 78 | 79 | 80 | } 81 | 82 | /*! \brief a method only visible for current class and derived class */ 83 | void _protected_method_example2(_t *ptObj) 84 | { 85 | /* initialise "this" (i.e. ptThis) to access class members */ 86 | class_internal(ptObj, ptThis, _t); 87 | 88 | 89 | } 90 | 91 | /* EOF */ -------------------------------------------------------------------------------- /template/class/class_name.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright(C)2009-2019 by GorgonMeducer * 3 | * * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); * 5 | * you may not use this file except in compliance with the License. * 6 | * You may obtain a copy of the License at * 7 | * * 8 | * http://www.apache.org/licenses/LICENSE-2.0 * 9 | * * 10 | * Unless required by applicable law or agreed to in writing, software * 11 | * distributed under the License is distributed on an "AS IS" BASIS, * 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 13 | * See the License for the specific language governing permissions and * 14 | * limitations under the License. * 15 | * * 16 | ****************************************************************************/ 17 | 18 | 19 | #ifndef ___H__ 20 | #define ___H__ 21 | 22 | /*============================ INCLUDES ======================================*/ 23 | #include 24 | #include 25 | 26 | 27 | /*============================ MACROS ========================================*/ 28 | /*============================ MACROFIED FUNCTIONS ===========================*/ 29 | /*============================ TYPES =========================================*/ 30 | 31 | /*! \NOTE: Make sure #include "plooc_class.h" is close to the class definition 32 | */ 33 | //#define __PLOOC_CLASS_USE_STRICT_TEMPLATE__ 34 | 35 | #if defined(___CLASS_IMPLEMENT__) 36 | # define __PLOOC_CLASS_IMPLEMENT__ 37 | #elif defined(___CLASS_INHERIT__) 38 | # define __PLOOC_CLASS_INHERIT__ 39 | #endif 40 | 41 | #include "plooc_class.h" 42 | 43 | 44 | //! \name class _t 45 | //! @{ 46 | declare_class(_t) 47 | 48 | def_class(_t, 49 | 50 | public_member( 51 | //!< place your public members here 52 | ) 53 | 54 | private_member( 55 | //!< place your private members here 56 | ) 57 | 58 | protected_member( 59 | //!< place your protected members here 60 | ) 61 | ) 62 | 63 | end_def_class(_t) /* do not remove this for forward compatibility */ 64 | //! @} 65 | 66 | 67 | typedef struct _cfg_t { 68 | 69 | //! put your configuration members here 70 | 71 | } _cfg_t; 72 | 73 | //! \name interface i__t 74 | //! @{ 75 | def_interface(i__t) 76 | _t * (*Init) (_t *ptObj, _cfg_t *ptCFG); 77 | void (*Depose) (_t *ptObj); 78 | /* other methods */ 79 | 80 | end_def_interface(i__t) /*do not remove this for forward compatibility */ 81 | //! @} 82 | 83 | /*============================ GLOBAL VARIABLES ==============================*/ 84 | extern const i__t ; 85 | 86 | /*============================ PROTOTYPES ====================================*/ 87 | 88 | /*! \brief the constructor of the class: */ 89 | extern 90 | _t * _init(_t *ptObj, _cfg_t *ptCFG); 91 | 92 | /*! \brief the destructor of the class: */ 93 | extern 94 | void _depose(_t *ptObj); 95 | 96 | protected_method( 97 | /*! \brief a method only visible for current class and derived class */ 98 | extern void _protected_method_example1(_t *ptObj); 99 | 100 | /*! \brief a method only visible for current class and derived class */ 101 | extern void _protected_method_example2(_t *ptObj); 102 | ) 103 | 104 | /*! \note it is very important to undef those macros */ 105 | #undef ___CLASS_INHERIT__ 106 | #undef ___CLASS_IMPLEMENT__ 107 | 108 | #endif 109 | /* EOF */ 110 | -------------------------------------------------------------------------------- /template/derived_class/class_name.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright(C)2009-2019 by GorgonMeducer * 3 | * * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); * 5 | * you may not use this file except in compliance with the License. * 6 | * You may obtain a copy of the License at * 7 | * * 8 | * http://www.apache.org/licenses/LICENSE-2.0 * 9 | * * 10 | * Unless required by applicable law or agreed to in writing, software * 11 | * distributed under the License is distributed on an "AS IS" BASIS, * 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 13 | * See the License for the specific language governing permissions and * 14 | * limitations under the License. * 15 | * * 16 | ****************************************************************************/ 17 | 18 | 19 | #ifndef ___H__ 20 | #define ___H__ 21 | 22 | /*============================ INCLUDES ======================================*/ 23 | #include 24 | #include 25 | 26 | #include ".h" 27 | 28 | /*============================ MACROS ========================================*/ 29 | /*============================ MACROFIED FUNCTIONS ===========================*/ 30 | /*============================ TYPES =========================================*/ 31 | 32 | /*! \NOTE: Make sure #include "plooc_class.h" is close to the class definition 33 | */ 34 | //#define __PLOOC_CLASS_USE_STRICT_TEMPLATE__ 35 | 36 | #if defined(___CLASS_IMPLEMENT__) 37 | # define __PLOOC_CLASS_IMPLEMENT__ 38 | #elif defined(___CLASS_INHERIT__) 39 | # define __PLOOC_CLASS_INHERIT__ 40 | #endif 41 | 42 | #include "plooc_class.h" 43 | 44 | 45 | //! \name class _t 46 | //! @{ 47 | declare_class(_t) 48 | 49 | def_class(_t, which(implement(_t)) 50 | 51 | public_member( 52 | //!< place your public members here 53 | ) 54 | 55 | private_member( 56 | //!< place your private members here 57 | ) 58 | 59 | protected_member( 60 | //!< place your protected members here 61 | ) 62 | ) 63 | 64 | end_def_class(_t) /* do not remove this for forward compatibility */ 65 | //! @} 66 | 67 | 68 | typedef struct _cfg_t { 69 | 70 | //! put your configuration members here 71 | 72 | } _cfg_t; 73 | 74 | //! \name interface i__t 75 | //! @{ 76 | def_interface(i__t) 77 | _t * (*Init) (_t *ptObj, _cfg_t *ptCFG); 78 | void (*Depose) (_t *ptObj); 79 | /* other methods */ 80 | 81 | end_def_interface(i__t) /*do not remove this for forward compatibility */ 82 | //! @} 83 | 84 | /*============================ GLOBAL VARIABLES ==============================*/ 85 | extern const i__t ; 86 | 87 | /*============================ PROTOTYPES ====================================*/ 88 | 89 | /*! \brief the constructor of the class: */ 90 | extern 91 | _t * _init(_t *ptObj, _cfg_t *ptCFG); 92 | 93 | /*! \brief the destructor of the class: */ 94 | extern 95 | void _depose(_t *ptObj); 96 | 97 | protected_method( 98 | /*! \brief a method only visible for current class and derived class */ 99 | extern void _protected_method_example1(_t *ptObj); 100 | 101 | /*! \brief a method only visible for current class and derived class */ 102 | extern void _protected_method_example2(_t *ptObj); 103 | ) 104 | 105 | /*! \note it is very important to undef those macros */ 106 | #undef ___CLASS_INHERIT__ 107 | #undef ___CLASS_IMPLEMENT__ 108 | 109 | #endif 110 | /* EOF */ 111 | -------------------------------------------------------------------------------- /template/derived_class/class_name.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright(C)2009-2019 by GorgonMeducer * 3 | * * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); * 5 | * you may not use this file except in compliance with the License. * 6 | * You may obtain a copy of the License at * 7 | * * 8 | * http://www.apache.org/licenses/LICENSE-2.0 * 9 | * * 10 | * Unless required by applicable law or agreed to in writing, software * 11 | * distributed under the License is distributed on an "AS IS" BASIS, * 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 13 | * See the License for the specific language governing permissions and * 14 | * limitations under the License. * 15 | * * 16 | ****************************************************************************/ 17 | 18 | 19 | /*============================ INCLUDES ======================================*/ 20 | 21 | #define ___CLASS_INHERIT__ 22 | #define ___CLASS_IMPLEMENT__ 23 | 24 | #include "./.h" 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | /*============================ MACROS ========================================*/ 32 | /*============================ MACROFIED FUNCTIONS ===========================*/ 33 | #ifndef ASSERT 34 | # define ASSERT(...) assert(__VA_ARGS__) 35 | #endif 36 | 37 | #undef this 38 | #define this (*ptThis) 39 | 40 | #undef base 41 | #define base (*ptBase) 42 | /*============================ TYPES =========================================*/ 43 | /*============================ LOCAL VARIABLES ===============================*/ 44 | /*============================ PROTOTYPES ====================================*/ 45 | /*============================ GLOBAL VARIABLES ==============================*/ 46 | const i__t = { 47 | .Init = &_init, 48 | .Depose = &_depose, 49 | 50 | /* other methods */ 51 | }; 52 | 53 | 54 | /*============================ IMPLEMENTATION ================================*/ 55 | 56 | /*! \brief the constructor of the class: */ 57 | _t * _init(_t *ptObj, _cfg_t *ptCFG) 58 | { 59 | /* initialise "this" (i.e. ptThis) to access class members */ 60 | class_internal(ptObj, ptThis, _t); 61 | 62 | /* initialise "base" (i.e. ptBase) to access protected members */ 63 | protected_internal(&this.use_as___t, ptBase, _t); 64 | 65 | 66 | ASSERT(NULL != ptObj && NULL != ptCFG); 67 | 68 | return ptObj; 69 | } 70 | 71 | /*! \brief the destructor of the class: */ 72 | void _depose(_t *ptObj) 73 | { 74 | /* initialise "this" (i.e. ptThis) to access class members */ 75 | class_internal(ptObj, ptThis, _t); 76 | 77 | /* initialise "base" (i.e. ptBase) to access protected members */ 78 | protected_internal(&this.use_as___t, ptBase, _t); 79 | 80 | 81 | } 82 | 83 | 84 | /*! \brief a method only visible for current class and derived class */ 85 | void _protected_method_example1(_t *ptObj) 86 | { 87 | /* initialise "this" (i.e. ptThis) to access class members */ 88 | class_internal(ptObj, ptThis, _t); 89 | 90 | /* initialise "base" (i.e. ptBase) to access protected members */ 91 | protected_internal(&this.use_as___t, ptBase, _t); 92 | 93 | 94 | 95 | } 96 | 97 | /*! \brief a method only visible for current class and derived class */ 98 | void _protected_method_example2(_t *ptObj) 99 | { 100 | /* initialise "this" (i.e. ptThis) to access class members */ 101 | class_internal(ptObj, ptThis, _t); 102 | 103 | /* initialise "base" (i.e. ptBase) to access protected members */ 104 | protected_internal(&this.use_as___t, ptBase, _t); 105 | 106 | 107 | 108 | } 109 | 110 | /* EOF */ -------------------------------------------------------------------------------- /CI/PLOOC_template_gcc/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f1xx_hal_gpio_ex.c 4 | * @author MCD Application Team 5 | * @brief GPIO Extension HAL module driver. 6 | * This file provides firmware functions to manage the following 7 | * functionalities of the General Purpose Input/Output (GPIO) extension peripheral. 8 | * + Extended features functions 9 | * 10 | @verbatim 11 | ============================================================================== 12 | ##### GPIO Peripheral extension features ##### 13 | ============================================================================== 14 | [..] GPIO module on STM32F1 family, manage also the AFIO register: 15 | (+) Possibility to use the EVENTOUT Cortex feature 16 | 17 | ##### How to use this driver ##### 18 | ============================================================================== 19 | [..] This driver provides functions to use EVENTOUT Cortex feature 20 | (#) Configure EVENTOUT Cortex feature using the function HAL_GPIOEx_ConfigEventout() 21 | (#) Activate EVENTOUT Cortex feature using the HAL_GPIOEx_EnableEventout() 22 | (#) Deactivate EVENTOUT Cortex feature using the HAL_GPIOEx_DisableEventout() 23 | 24 | @endverbatim 25 | ****************************************************************************** 26 | * @attention 27 | * 28 | *

© Copyright (c) 2016 STMicroelectronics. 29 | * All rights reserved.

30 | * 31 | * This software component is licensed by ST under BSD 3-Clause license, 32 | * the "License"; You may not use this file except in compliance with the 33 | * License. You may obtain a copy of the License at: 34 | * opensource.org/licenses/BSD-3-Clause 35 | * 36 | ****************************************************************************** 37 | */ 38 | 39 | /* Includes ------------------------------------------------------------------*/ 40 | #include "stm32f1xx_hal.h" 41 | 42 | /** @addtogroup STM32F1xx_HAL_Driver 43 | * @{ 44 | */ 45 | 46 | /** @defgroup GPIOEx GPIOEx 47 | * @brief GPIO HAL module driver 48 | * @{ 49 | */ 50 | 51 | #ifdef HAL_GPIO_MODULE_ENABLED 52 | 53 | /** @defgroup GPIOEx_Exported_Functions GPIOEx Exported Functions 54 | * @{ 55 | */ 56 | 57 | /** @defgroup GPIOEx_Exported_Functions_Group1 Extended features functions 58 | * @brief Extended features functions 59 | * 60 | @verbatim 61 | ============================================================================== 62 | ##### Extended features functions ##### 63 | ============================================================================== 64 | [..] This section provides functions allowing to: 65 | (+) Configure EVENTOUT Cortex feature using the function HAL_GPIOEx_ConfigEventout() 66 | (+) Activate EVENTOUT Cortex feature using the HAL_GPIOEx_EnableEventout() 67 | (+) Deactivate EVENTOUT Cortex feature using the HAL_GPIOEx_DisableEventout() 68 | 69 | @endverbatim 70 | * @{ 71 | */ 72 | 73 | /** 74 | * @brief Configures the port and pin on which the EVENTOUT Cortex signal will be connected. 75 | * @param GPIO_PortSource Select the port used to output the Cortex EVENTOUT signal. 76 | * This parameter can be a value of @ref GPIOEx_EVENTOUT_PORT. 77 | * @param GPIO_PinSource Select the pin used to output the Cortex EVENTOUT signal. 78 | * This parameter can be a value of @ref GPIOEx_EVENTOUT_PIN. 79 | * @retval None 80 | */ 81 | void HAL_GPIOEx_ConfigEventout(uint32_t GPIO_PortSource, uint32_t GPIO_PinSource) 82 | { 83 | /* Verify the parameters */ 84 | assert_param(IS_AFIO_EVENTOUT_PORT(GPIO_PortSource)); 85 | assert_param(IS_AFIO_EVENTOUT_PIN(GPIO_PinSource)); 86 | 87 | /* Apply the new configuration */ 88 | MODIFY_REG(AFIO->EVCR, (AFIO_EVCR_PORT) | (AFIO_EVCR_PIN), (GPIO_PortSource) | (GPIO_PinSource)); 89 | } 90 | 91 | /** 92 | * @brief Enables the Event Output. 93 | * @retval None 94 | */ 95 | void HAL_GPIOEx_EnableEventout(void) 96 | { 97 | SET_BIT(AFIO->EVCR, AFIO_EVCR_EVOE); 98 | } 99 | 100 | /** 101 | * @brief Disables the Event Output. 102 | * @retval None 103 | */ 104 | void HAL_GPIOEx_DisableEventout(void) 105 | { 106 | CLEAR_BIT(AFIO->EVCR, AFIO_EVCR_EVOE); 107 | } 108 | 109 | /** 110 | * @} 111 | */ 112 | 113 | /** 114 | * @} 115 | */ 116 | 117 | #endif /* HAL_GPIO_MODULE_ENABLED */ 118 | 119 | /** 120 | * @} 121 | */ 122 | 123 | /** 124 | * @} 125 | */ 126 | 127 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 128 | -------------------------------------------------------------------------------- /example/byte_queue/byte_queue.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright(C)2009-2019 by GorgonMeducer * 3 | * * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); * 5 | * you may not use this file except in compliance with the License. * 6 | * You may obtain a copy of the License at * 7 | * * 8 | * http://www.apache.org/licenses/LICENSE-2.0 * 9 | * * 10 | * Unless required by applicable law or agreed to in writing, software * 11 | * distributed under the License is distributed on an "AS IS" BASIS, * 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 13 | * See the License for the specific language governing permissions and * 14 | * limitations under the License. * 15 | * * 16 | ****************************************************************************/ 17 | 18 | 19 | #ifndef __PLOOC_EXAMPLE_BYTE_QUEUE_H__ 20 | #define __PLOOC_EXAMPLE_BYTE_QUEUE_H__ 21 | 22 | /*============================ INCLUDES ======================================*/ 23 | #include 24 | #include 25 | #include "plooc.h" 26 | 27 | /*============================ MACROS ========================================*/ 28 | /*============================ MACROFIED FUNCTIONS ===========================*/ 29 | /*============================ TYPES =========================================*/ 30 | typedef struct mem_t { 31 | uint8_t *pchBuffer; //!< queue buffer 32 | uint16_t hwSize; //!< buffer size 33 | }mem_t; 34 | 35 | /*! \NOTE: Make sure #include "plooc_class.h" is close to the class definition 36 | */ 37 | #define __PLOOC_CLASS_USE_STRICT_TEMPLATE__ 38 | 39 | #if defined(__BYTE_QUEUE_CLASS_IMPLEMENT) 40 | # define __PLOOC_CLASS_IMPLEMENT__ 41 | #elif defined(__BYTE_QUEUE_CLASS_INHERIT__) 42 | # define __PLOOC_CLASS_INHERIT__ 43 | #endif 44 | 45 | #include "plooc_class.h" 46 | 47 | 48 | //! \name class byte_queue_t 49 | //! @{ 50 | declare_class(byte_queue_t) 51 | 52 | def_class(byte_queue_t, 53 | 54 | private_member( 55 | implement(mem_t) //!< queue buffer 56 | void *pTarget; //!< user target 57 | ) 58 | 59 | protected_member( 60 | uint16_t hwHead; //!< head pointer 61 | uint16_t hwTail; //!< tail pointer 62 | uint16_t hwCount; //!< byte count 63 | ) 64 | ) 65 | 66 | end_def_class(byte_queue_t) /* do not remove this for forward compatibility */ 67 | //! @} 68 | 69 | 70 | typedef struct byte_queue_cfg_t { 71 | implement(mem_t) //!< queue buffer 72 | void * pTarget; //!< user target 73 | } byte_queue_cfg_t; 74 | 75 | //! \name interface i_byte_queue_t 76 | //! @{ 77 | def_interface(i_byte_queue_t) 78 | byte_queue_t * (*Init) (byte_queue_t *ptObj, byte_queue_cfg_t *ptCFG); 79 | void (*Depose) (byte_queue_t *ptObj); 80 | bool (*Enqueue) (byte_queue_t *ptObj, uint8_t chByte); 81 | bool (*Dequeue) (byte_queue_t *ptObj, uint8_t *pchByte); 82 | uint_fast16_t (*Count) (byte_queue_t *ptObj); 83 | struct { 84 | void * (*Get) (byte_queue_t *ptObj); 85 | void (*Set) (byte_queue_t *ptObj, void *pTarget); 86 | }Target; 87 | end_def_interface(i_byte_queue_t) /*do not remove this for forward compatibility */ 88 | //! @} 89 | 90 | /*============================ GLOBAL VARIABLES ==============================*/ 91 | extern const i_byte_queue_t BYTE_QUEUE; 92 | 93 | /*============================ PROTOTYPES ====================================*/ 94 | 95 | extern 96 | byte_queue_t * byte_queue_init(byte_queue_t *ptObj, byte_queue_cfg_t *ptCFG); 97 | 98 | extern 99 | void byte_queue_depose(byte_queue_t *ptObj); 100 | 101 | extern 102 | bool byte_queue_enqueue(byte_queue_t *ptObj, uint8_t chByte); 103 | 104 | extern 105 | bool byte_queue_dequeue(byte_queue_t *ptObj, uint8_t *pchByte); 106 | 107 | extern 108 | uint_fast16_t byte_queue_count(byte_queue_t *ptObj); 109 | 110 | extern 111 | void *byte_queue_target_get(byte_queue_t *ptObj); 112 | 113 | extern 114 | void byte_queue_target_set(byte_queue_t *ptObj, void *pTarget); 115 | 116 | /* protected methods that only derived class can see */ 117 | protected_method( 118 | extern mem_t byte_queue_buffer_get(byte_queue_t *ptObj); 119 | ) 120 | 121 | /*! \note it is very important to undef those macros */ 122 | #undef __BYTE_QUEUE_CLASS_INHERIT 123 | #undef __BYTE_QUEUE_CLASS_IMPLEMENT__ 124 | 125 | #endif 126 | /* EOF */ -------------------------------------------------------------------------------- /example/project/main.c: -------------------------------------------------------------------------------- 1 | 2 | /***************************************************************************** 3 | * Copyright(C)2009-2019 by GorgonMeducer * 4 | * * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); * 6 | * you may not use this file except in compliance with the License. * 7 | * You may obtain a copy of the License at * 8 | * * 9 | * http://www.apache.org/licenses/LICENSE-2.0 * 10 | * * 11 | * Unless required by applicable law or agreed to in writing, software * 12 | * distributed under the License is distributed on an "AS IS" BASIS, * 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 14 | * See the License for the specific language governing permissions and * 15 | * limitations under the License. * 16 | * * 17 | ****************************************************************************/ 18 | 19 | /*============================ INCLUDES ======================================*/ 20 | #include 21 | #include 22 | #include 23 | #include "platform.h" 24 | 25 | 26 | #include "byte_queue.h" 27 | #include "enhanced_byte_queue.h" 28 | #include "trace.h" 29 | #include 30 | /*============================ MACROS ========================================*/ 31 | 32 | #ifndef QUEUE_BUFFER_SIZE 33 | # define QUEUE_BUFFER_SIZE 256 34 | #endif 35 | 36 | #ifdef __NO_USE_LOG__ 37 | #define LOG_OUT(...) 38 | #else 39 | #define LOG_OUT(...) TRACE_TOSTR(__VA_ARGS__) 40 | #endif 41 | 42 | /*============================ MACROFIED FUNCTIONS ===========================*/ 43 | /*============================ TYPES =========================================*/ 44 | /*============================ GLOBAL VARIABLES ==============================*/ 45 | /*============================ LOCAL VARIABLES ===============================*/ 46 | /*============================ PROTOTYPES ====================================*/ 47 | /*============================ IMPLEMENTATION ================================*/ 48 | #include 49 | #include 50 | #include 51 | 52 | PLOOC_ALIGN(4) 53 | int main(void) 54 | { 55 | platform_init(); 56 | 57 | printf("Hello PLOOC!\r\n\r\n"); 58 | 59 | static uint8_t s_chQueueBuffer[QUEUE_BUFFER_SIZE]; 60 | 61 | enhanced_byte_queue_t *ptQueue = __new_class( enhanced_byte_queue, 62 | s_chQueueBuffer, 63 | sizeof(s_chQueueBuffer)); 64 | 65 | 66 | //! you can enqueue 67 | ENHANCED_BYTE_QUEUE.Enqueue(ptQueue, 'p'); 68 | ENHANCED_BYTE_QUEUE.Enqueue(ptQueue, 'L'); 69 | ENHANCED_BYTE_QUEUE.Enqueue(ptQueue, 'O'); 70 | ENHANCED_BYTE_QUEUE.Enqueue(ptQueue, 'O'); 71 | ENHANCED_BYTE_QUEUE.Enqueue(ptQueue, 'C'); 72 | 73 | ENHANCED_BYTE_QUEUE.use_as__i_byte_queue_t.Enqueue(&ptQueue->use_as__byte_queue_t, '.'); 74 | ENHANCED_BYTE_QUEUE.use_as__i_byte_queue_t.Enqueue(&ptQueue->use_as__byte_queue_t, '.'); 75 | ENHANCED_BYTE_QUEUE.use_as__i_byte_queue_t.Enqueue(&ptQueue->use_as__byte_queue_t, '.'); 76 | 77 | //! you can dequeue 78 | do { 79 | uint_fast16_t n = ENHANCED_BYTE_QUEUE.Count(ptQueue); 80 | uint8_t chByte; 81 | printf("There are %d byte in the queue!\r\n", n); 82 | printf("let's peek!\r\n"); 83 | 84 | while(ENHANCED_BYTE_QUEUE.Peek.PeekByte(ptQueue, &chByte)) { 85 | printf("%c\r\n", chByte); 86 | } 87 | printf("There are %d byte(s) in the queue!\r\n", 88 | ENHANCED_BYTE_QUEUE.Count(ptQueue)); 89 | printf("Let's remove all peeked byte(s) from queue... \r\n"); 90 | ENHANCED_BYTE_QUEUE.Peek.GetAllPeeked(ptQueue); 91 | printf("Now there are %d byte(s) in the queue!\r\n", 92 | ENHANCED_BYTE_QUEUE.Count(ptQueue)); 93 | } while(0); 94 | 95 | __free_class(enhanced_byte_queue, ptQueue); 96 | 97 | #if defined(__STDC_VERSION__) && __STDC_VERSION__ > 199901L 98 | LOG_OUT("\r\n-[Demo of overload]------------------------------\r\n"); 99 | LOG_OUT((uint32_t) 0x12345678); 100 | LOG_OUT("\r\n"); 101 | LOG_OUT(0x12345678); 102 | LOG_OUT("\r\n"); 103 | LOG_OUT("PI is "); 104 | LOG_OUT(3.1415926f); 105 | LOG_OUT("\r\n"); 106 | 107 | LOG_OUT("\r\nShow BYTE Array:\r\n"); 108 | LOG_OUT((uint8_t *)main, 100); 109 | 110 | LOG_OUT("\r\nShow Half-WORD Array:\r\n"); 111 | LOG_OUT((uint16_t *)(((intptr_t)&main) & ~0x1), 100/sizeof(uint16_t)); 112 | 113 | LOG_OUT("\r\nShow WORD Array:\r\n"); 114 | LOG_OUT((uint32_t *)(((intptr_t)&main) & ~0x3), 100/sizeof(uint32_t)); 115 | #endif 116 | 117 | while(1); 118 | } 119 | -------------------------------------------------------------------------------- /example/enhanced_byte_queue/enhanced_byte_queue.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright(C)2009-2019 by GorgonMeducer * 3 | * * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); * 5 | * you may not use this file except in compliance with the License. * 6 | * You may obtain a copy of the License at * 7 | * * 8 | * http://www.apache.org/licenses/LICENSE-2.0 * 9 | * * 10 | * Unless required by applicable law or agreed to in writing, software * 11 | * distributed under the License is distributed on an "AS IS" BASIS, * 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 13 | * See the License for the specific language governing permissions and * 14 | * limitations under the License. * 15 | * * 16 | ****************************************************************************/ 17 | 18 | 19 | #ifndef __PLOOC_EXAMPLE_ENHANCED_BYTE_QUEUE_H__ 20 | #define __PLOOC_EXAMPLE_ENHANCED_BYTE_QUEUE_H__ 21 | 22 | /*============================ INCLUDES ======================================*/ 23 | #include 24 | #include 25 | #include "plooc.h" 26 | #include "../byte_queue/byte_queue.h" 27 | 28 | /*============================ MACROS ========================================*/ 29 | /*============================ MACROFIED FUNCTIONS ===========================*/ 30 | /*============================ TYPES =========================================*/ 31 | 32 | /*! \NOTE: Make sure #include "plooc_class.h" is close to the class definition 33 | */ 34 | #define __PLOOC_CLASS_USE_STRICT_TEMPLATE__ 35 | 36 | #if defined(__ENHANCED_BYTE_QUEUE_CLASS_IMPLEMENT) 37 | # define __PLOOC_CLASS_IMPLEMENT__ 38 | # undef __ENHANCED_BYTE_QUEUE_CLASS_IMPLEMENT 39 | #elif defined(__ENHANCED_BYTE_QUEUE_CLASS_INHERIT__) 40 | # define __PLOOC_CLASS_INHERIT__ 41 | # undef __ENHANCED_BYTE_QUEUE_CLASS_INHERIT__ 42 | #endif 43 | 44 | #include "plooc_class.h" 45 | 46 | //! \name class byte_queue_t 47 | //! @{ 48 | declare_class(enhanced_byte_queue_t) 49 | 50 | def_class(enhanced_byte_queue_t, 51 | which(implement(byte_queue_t)) 52 | 53 | private_member( 54 | uint16_t hwPeek; 55 | uint16_t hwPeekCount; 56 | ) 57 | ) 58 | 59 | end_def_class(enhanced_byte_queue_t) /* do not remove this for forward compatibility */ 60 | //! @} 61 | 62 | typedef byte_queue_cfg_t enhanced_byte_queue_cfg_t; 63 | 64 | //! \name interface i_byte_queue_t 65 | //! @{ 66 | def_interface(i_enhanced_byte_queue_t) 67 | inherit(i_byte_queue_t) 68 | enhanced_byte_queue_t * (*Init) ( enhanced_byte_queue_t *ptObj, 69 | enhanced_byte_queue_cfg_t *ptCFG); 70 | void (*Depose) ( enhanced_byte_queue_t *ptObj); 71 | bool (*Enqueue) ( enhanced_byte_queue_t *ptObj, 72 | uint8_t chByte); 73 | bool (*Dequeue) ( enhanced_byte_queue_t *ptObj, 74 | uint8_t *pchByte); 75 | uint_fast16_t (*Count) ( enhanced_byte_queue_t *ptObj); 76 | struct { 77 | void * (*Get) ( enhanced_byte_queue_t *ptObj); 78 | void (*Set) ( enhanced_byte_queue_t *ptObj, 79 | void *pTarget); 80 | }Target; 81 | struct { 82 | bool (*PeekByte) ( enhanced_byte_queue_t *ptObj, 83 | uint8_t *pchByte); 84 | void (*Reset) ( enhanced_byte_queue_t *ptObj); 85 | void (*GetAllPeeked)(enhanced_byte_queue_t *ptObj); 86 | }Peek; 87 | end_def_interface(i_enhanced_byte_queue_t) /*do not remove this for forward compatibility */ 88 | //! @} 89 | 90 | /*============================ GLOBAL VARIABLES ==============================*/ 91 | extern const i_enhanced_byte_queue_t ENHANCED_BYTE_QUEUE; 92 | 93 | /*============================ PROTOTYPES ====================================*/ 94 | 95 | extern 96 | enhanced_byte_queue_t * enhanced_byte_queue_init(enhanced_byte_queue_t *ptObj, 97 | enhanced_byte_queue_cfg_t *ptCFG); 98 | 99 | extern 100 | void enhanced_byte_queue_depose(enhanced_byte_queue_t *ptObj); 101 | 102 | extern 103 | bool enhanced_byte_queue_enqueue(enhanced_byte_queue_t *ptObj, uint8_t chByte); 104 | 105 | extern 106 | bool enhanced_byte_queue_dequeue(enhanced_byte_queue_t *ptObj, uint8_t *pchByte); 107 | 108 | extern 109 | bool enhanced_byte_queue_peek(enhanced_byte_queue_t *ptObj, uint8_t *pchByte); 110 | 111 | extern 112 | void enhanced_byte_queue_peek_reset(enhanced_byte_queue_t *ptObj); 113 | 114 | extern 115 | void enhanced_byte_queue_peek_get_all_peeked(enhanced_byte_queue_t *ptObj); 116 | #endif 117 | /* EOF */ -------------------------------------------------------------------------------- /GorgonMeducer.PLOOC.pdsc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | GorgonMeducer 5 | PLOOC 6 | The Protected Low-overhead Object Oriented Programming with ANSI-C, a.k.a PLOOC ['plu:k] is a set of well-polished C macro templates for praticing the Object-Oriented programming. 7 | https://raw.githubusercontent.com/GorgonMeducer/PLOOC/master/cmsis-pack/ 8 | https://github.com/GorgonMeducer/PLOOC/issues 9 | LICENSE 10 | 11 | 15 | 16 | https://github.com/GorgonMeducer/PLOOC.git 17 | 18 | 19 | 20 | - Undefine some macros to avoid warnings. 21 | 22 | 23 | - Add private_method, protected_method and public_method 24 | - Add plooc_malloc_align and plooc_free 25 | - Other minor changes. 26 | 27 | 28 | - Improve compatibility with the latest C++ 29 | - Fix template 30 | 31 | 32 | - Add helper macros for heap 33 | - Add __new_class and __free_class for using malloc and free together with constructors and destructors, i.e. xxxx_init() and xxxx_depose(). 34 | - Update example project 35 | - Other minor update 36 | 37 | 38 | - Improving CMSIS-Pack 39 | - Add example 40 | - Add code template for base class and derived class 41 | - Other minor update 42 | 43 | 44 | - Add CMSIS-Pack 45 | - Other minor update 46 | 47 | 48 | 49 | 50 | 51 | 52 | OOPC 53 | 54 | 55 | 56 | 60 | 61 | 65 | 66 | 67 | 71 | 72 | 73 | 77 | 78 | 79 | This is a basic example demonstrating the development using PLOOC. 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | PLOOC 88 | Getting Started 89 | 90 | 91 | 92 | 93 | 97 | 98 | 99 | 100 | A low-overhead OOPC header-file-only template. 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 117 | 118 | 119 | -------------------------------------------------------------------------------- /cmsis-pack/GorgonMeducer.PLOOC.pdsc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | GorgonMeducer 5 | PLOOC 6 | The Protected Low-overhead Object Oriented Programming with ANSI-C, a.k.a PLOOC ['plu:k] is a set of well-polished C macro templates for praticing the Object-Oriented programming. 7 | https://raw.githubusercontent.com/GorgonMeducer/PLOOC/master/cmsis-pack/ 8 | https://github.com/GorgonMeducer/PLOOC/issues 9 | LICENSE 10 | 11 | 15 | 16 | https://github.com/GorgonMeducer/PLOOC.git 17 | 18 | 19 | 20 | - Undefine some macros to avoid warnings. 21 | 22 | 23 | - Add private_method, protected_method and public_method 24 | - Add plooc_malloc_align and plooc_free 25 | - Other minor changes. 26 | 27 | 28 | - Improve compatibility with the latest C++ 29 | - Fix template 30 | 31 | 32 | - Add helper macros for heap 33 | - Add __new_class and __free_class for using malloc and free together with constructors and destructors, i.e. xxxx_init() and xxxx_depose(). 34 | - Update example project 35 | - Other minor update 36 | 37 | 38 | - Improving CMSIS-Pack 39 | - Add example 40 | - Add code template for base class and derived class 41 | - Other minor update 42 | 43 | 44 | - Add CMSIS-Pack 45 | - Other minor update 46 | 47 | 48 | 49 | 50 | 51 | 52 | OOPC 53 | 54 | 55 | 56 | 60 | 61 | 65 | 66 | 67 | 71 | 72 | 73 | 77 | 78 | 79 | This is a basic example demonstrating the development using PLOOC. 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | PLOOC 88 | Getting Started 89 | 90 | 91 | 92 | 93 | 97 | 98 | 99 | 100 | A low-overhead OOPC header-file-only template. 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 117 | 118 | 119 | -------------------------------------------------------------------------------- /CI/PLOOC_template_gcc/Makefile: -------------------------------------------------------------------------------- 1 | ########################################################################################################################## 2 | # File automatically-generated by tool: [projectgenerator] version: [3.14.1] date: [Fri Dec 31 16:08:03 CST 2021] 3 | ########################################################################################################################## 4 | 5 | # ------------------------------------------------ 6 | # Generic Makefile (based on gcc) 7 | # 8 | # ChangeLog : 9 | # 2017-02-10 - Several enhancements + project update mode 10 | # 2015-07-22 - first version 11 | # ------------------------------------------------ 12 | 13 | ###################################### 14 | # target 15 | ###################################### 16 | TARGET = PLOOC_template_gcc 17 | 18 | 19 | ###################################### 20 | # building variables 21 | ###################################### 22 | # debug build? 23 | DEBUG = 1 24 | # optimization 25 | OPT = -Og 26 | 27 | 28 | ####################################### 29 | # paths 30 | ####################################### 31 | # Build path 32 | BUILD_DIR = build 33 | 34 | ###################################### 35 | # source 36 | ###################################### 37 | # C sources 38 | C_SOURCES = \ 39 | Core/Src/stm32f1xx_it.c \ 40 | Core/Src/stm32f1xx_hal_msp.c \ 41 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c \ 42 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c \ 43 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c \ 44 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c \ 45 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c \ 46 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c \ 47 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c \ 48 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c \ 49 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c \ 50 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c \ 51 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c \ 52 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c \ 53 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c \ 54 | Core/Src/system_stm32f1xx.c \ 55 | ../../example/trace/trace.c \ 56 | ../../example/byte_queue/byte_queue.c \ 57 | ../../example/enhanced_byte_queue/enhanced_byte_queue.c \ 58 | ../../example/project/main.c \ 59 | MDK-ARM/platform.c 60 | 61 | # ASM sources 62 | ASM_SOURCES = \ 63 | startup_stm32f103xe.s 64 | 65 | 66 | ####################################### 67 | # binaries 68 | ####################################### 69 | PREFIX = arm-none-eabi- 70 | # The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx) 71 | # either it can be added to the PATH environment variable. 72 | ifdef GCC_PATH 73 | CC = $(GCC_PATH)/$(PREFIX)gcc 74 | AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp 75 | CP = $(GCC_PATH)/$(PREFIX)objcopy 76 | SZ = $(GCC_PATH)/$(PREFIX)size 77 | else 78 | CC = $(PREFIX)gcc 79 | AS = $(PREFIX)gcc -x assembler-with-cpp 80 | CP = $(PREFIX)objcopy 81 | SZ = $(PREFIX)size 82 | endif 83 | HEX = $(CP) -O ihex 84 | BIN = $(CP) -O binary -S 85 | 86 | ####################################### 87 | # CFLAGS 88 | ####################################### 89 | # cpu 90 | CPU = -mcpu=cortex-m3 91 | 92 | # fpu 93 | # NONE for Cortex-M0/M0+/M3 94 | 95 | # float-abi 96 | 97 | 98 | # mcu 99 | MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI) 100 | 101 | # macros for gcc 102 | # AS defines 103 | AS_DEFS = 104 | 105 | # C defines 106 | C_DEFS = \ 107 | -DUSE_HAL_DRIVER \ 108 | -DSTM32F103xE 109 | 110 | 111 | # AS includes 112 | AS_INCLUDES = 113 | 114 | # C includes 115 | C_INCLUDES = \ 116 | -ICore/Inc \ 117 | -IDrivers/STM32F1xx_HAL_Driver/Inc \ 118 | -IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy \ 119 | -IDrivers/CMSIS/Device/ST/STM32F1xx/Include \ 120 | -IDrivers/CMSIS/Include \ 121 | -I../.. \ 122 | -I../../example/project/mdk \ 123 | -I../../example/trace \ 124 | -I../../example/byte_queue \ 125 | -I../../example/enhanced_byte_queue 126 | 127 | 128 | # compile gcc flags 129 | ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections 130 | 131 | CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections -fms-extensions 132 | 133 | ifeq ($(DEBUG), 1) 134 | CFLAGS += -g -gdwarf-2 135 | endif 136 | 137 | 138 | # Generate dependency information 139 | CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)" 140 | 141 | 142 | ####################################### 143 | # LDFLAGS 144 | ####################################### 145 | # link script 146 | LDSCRIPT = STM32F103RCTx_FLASH.ld 147 | 148 | # libraries 149 | LIBS = -lc -lm -lnosys 150 | LIBDIR = 151 | LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections 152 | 153 | # default action: build all 154 | all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin 155 | 156 | 157 | ####################################### 158 | # build the application 159 | ####################################### 160 | # list of objects 161 | OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o))) 162 | vpath %.c $(sort $(dir $(C_SOURCES))) 163 | # list of ASM program objects 164 | OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o))) 165 | vpath %.s $(sort $(dir $(ASM_SOURCES))) 166 | 167 | $(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR) 168 | $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@ 169 | 170 | $(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR) 171 | $(AS) -c $(CFLAGS) $< -o $@ 172 | 173 | $(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile 174 | $(CC) $(OBJECTS) $(LDFLAGS) -o $@ 175 | $(SZ) $@ 176 | 177 | $(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR) 178 | $(HEX) $< $@ 179 | 180 | $(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR) 181 | $(BIN) $< $@ 182 | 183 | $(BUILD_DIR): 184 | mkdir $@ 185 | 186 | ####################################### 187 | # clean up 188 | ####################################### 189 | clean: 190 | -rm -fR $(BUILD_DIR) 191 | 192 | ####################################### 193 | # dependencies 194 | ####################################### 195 | -include $(wildcard $(BUILD_DIR)/*.d) 196 | 197 | # *** EOF *** 198 | -------------------------------------------------------------------------------- /gen_pack.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Version: 1.1 3 | # Date: 2020-04-29 4 | # This bash script generates a CMSIS Software Pack: 5 | # 6 | # Pre-requisites: 7 | # - bash shell (for Windows: install git for Windows) 8 | # - 7z in path (zip archiving utility) 9 | # e.g. Ubuntu: sudo apt-get install p7zip-full p7zip-rar) 10 | # - PackChk in path with execute permission 11 | # (see CMSIS-Pack: CMSIS/Utilities//PackChk) 12 | # - xmllint in path (XML schema validation) 13 | # e.g. Ubuntu: sudo apt-get install libxml2-utils 14 | # Windows: download from https://www.zlatkovic.com/pub/libxml/ 15 | 16 | ############### EDIT BELOW ############### 17 | # Extend Path environment variable locally 18 | # 19 | if [ `uname -s` = "Linux" ] 20 | then 21 | CMSIS_PACK_PATH="/home/$USER/.arm/Packs/ARM/CMSIS/5.7.0/" 22 | PATH_TO_ADD="$CMSIS_PACK_PATH/CMSIS/Utilities/Linux64/" 23 | else 24 | CMSIS_PACK_PATH="/C/Users/gabriel/AppData/Local/Arm/Packs/ARM/CMSIS/5.7.0" 25 | PATH_TO_ADD="/C/Program Files (x86)/7-Zip/:$CMSIS_PACK_PATH/CMSIS/Utilities/Win32/:/C/xmllint/" 26 | fi 27 | [[ ":$PATH:" != *":$PATH_TO_ADD}:"* ]] && PATH="${PATH}:${PATH_TO_ADD}" 28 | echo $PATH_TO_ADD appended to PATH 29 | echo " " 30 | 31 | # Pack warehouse directory - destination 32 | PACK_WAREHOUSE=cmsis-pack/ 33 | 34 | # Temporary pack build directory 35 | PACK_BUILD=build/ 36 | 37 | # Specify directories included in pack relative to base directory 38 | # All directories: 39 | # PACK_DIRS=`ls -d */` 40 | # Do not include the build directory if it is local 41 | # PACK_DIRS=${PACK_DIRS//$PACK_BUILD/} 42 | # PACK_DIRS=${PACK_DIRS//$PACK_WAREHOUSE/} 43 | 44 | # alternative: specify directory names to be added to pack base directory 45 | PACK_DIRS=" 46 | example 47 | template 48 | " 49 | 50 | 51 | # Specify file names to be added to pack base directory 52 | PACK_BASE_FILES=" 53 | plooc.h 54 | plooc_class.h 55 | plooc_class_black_box.h 56 | plooc_class_simple.h 57 | plooc_class_strict.h 58 | LICENSE 59 | README.md 60 | " 61 | 62 | ############ DO NOT EDIT BELOW ########### 63 | echo Starting CMSIS-Pack Generation: `date` 64 | # Zip utility check 65 | ZIP=7z 66 | type -a $ZIP 67 | errorlevel=$? 68 | if [ $errorlevel -gt 0 ] 69 | then 70 | echo "Error: No 7zip Utility found" 71 | echo "Action: Add 7zip to your path" 72 | echo " " 73 | exit 74 | fi 75 | 76 | # Pack checking utility check 77 | PACKCHK=PackChk 78 | type -a $PACKCHK 79 | errorlevel=$? 80 | if [ $errorlevel != 0 ] 81 | then 82 | echo "Error: No PackChk Utility found" 83 | echo "Action: Add PackChk to your path" 84 | echo "Hint: Included in CMSIS Pack:" 85 | echo "/ARM/CMSIS//CMSIS/Utilities//" 86 | echo " " 87 | exit 88 | fi 89 | echo " " 90 | 91 | # XML syntax checking utility check 92 | XMLLINT=xmllint 93 | type -a $XMLLINT 94 | errorlevel=$? 95 | if [ $errorlevel != 0 ] 96 | then 97 | echo "Error: No xmllint found" 98 | echo "Action: Add xmllint to your path" 99 | echo " " 100 | exit 101 | fi 102 | echo " " 103 | 104 | # Locate Package Description file 105 | # check whether there is more than one pdsc file 106 | NUM_PDSCS=`ls -1 *.pdsc | wc -l` 107 | PACK_DESCRIPTION_FILE=`ls *.pdsc` 108 | if [ $NUM_PDSCS -lt 1 ] 109 | then 110 | echo "Error: No *.pdsc file found in current directory" 111 | echo " " 112 | elif [ $NUM_PDSCS -gt 1 ] 113 | then 114 | echo "Error: Only one PDSC file allowed in directory structure:" 115 | echo "Found:" 116 | echo "$PACK_DESCRIPTION_FILE" 117 | echo "Action: Delete unused pdsc files" 118 | echo " " 119 | exit 120 | fi 121 | 122 | SAVEIFS=$IFS 123 | IFS=. 124 | set $PACK_DESCRIPTION_FILE 125 | # Pack Vendor 126 | PACK_VENDOR=$1 127 | # Pack Name 128 | PACK_NAME=$2 129 | echo Generating Pack Version: for $PACK_VENDOR.$PACK_NAME 130 | echo " " 131 | IFS=$SAVEIFS 132 | 133 | #if $PACK_BUILD directory does not exist, create it. 134 | if [ ! -d $PACK_BUILD ]; then 135 | mkdir -p $PACK_BUILD 136 | fi 137 | 138 | 139 | 140 | # Copy files into build base directory: $PACK_BUILD 141 | # pdsc file is mandatory in base directory: 142 | cp -f ./$PACK_VENDOR.$PACK_NAME.pdsc ${PACK_BUILD} 143 | 144 | 145 | # directories 146 | echo Adding directories to pack: 147 | echo $PACK_DIRS 148 | echo " " 149 | for d in ${PACK_DIRS} 150 | do 151 | cp -r "$d" ${PACK_BUILD} 152 | done 153 | 154 | # files for base directory 155 | echo Adding files to pack: 156 | echo $PACK_BASE_FILES 157 | echo " " 158 | for f in $PACK_BASE_FILES 159 | do 160 | cp -f "$f" $PACK_BUILD/ 161 | done 162 | 163 | echo clean project... 164 | rm -rf $PACK_BUILD/example/project/mdk/Objects 165 | rm -rf $PACK_BUILD/example/project/mdk/Listings 166 | rm -rf $PACK_BUILD/example/project/mdk/*.uvguix.* 167 | 168 | 169 | # Run Schema Check (for Linux only): 170 | # sudo apt-get install libxml2-utils 171 | 172 | echo Running schema check for $PACK_VENDOR.$PACK_NAME.pdsc 173 | $XMLLINT --noout --schema ${CMSIS_PACK_PATH}/CMSIS/Utilities/PACK.xsd $PACK_BUILD/$PACK_VENDOR.$PACK_NAME.pdsc 174 | errorlevel=$? 175 | if [ $errorlevel -ne 0 ]; then 176 | echo "build aborted: Schema check of $PACK_VENDOR.$PACK_NAME.pdsc against PACK.xsd failed" 177 | echo " " 178 | exit 179 | fi 180 | 181 | # Run Pack Check and generate PackName file with version 182 | $PACKCHK $PACK_BUILD/$PACK_VENDOR.$PACK_NAME.pdsc -n PackName.txt -x M362 183 | errorlevel=$? 184 | if [ $errorlevel -ne 0 ]; then 185 | echo "build aborted: pack check failed" 186 | echo " " 187 | exit 188 | fi 189 | 190 | PACKNAME=`cat PackName.txt` 191 | rm -rf PackName.txt 192 | 193 | # Archiving 194 | # $ZIP a $PACKNAME 195 | echo creating pack file $PACKNAME 196 | #if $PACK_WAREHOUSE directory does not exist create it 197 | if [ ! -d $PACK_WAREHOUSE ]; then 198 | mkdir -p $PACK_WAREHOUSE 199 | fi 200 | pushd $PACK_WAREHOUSE 201 | PACK_WAREHOUSE=`pwd` 202 | popd 203 | pushd $PACK_BUILD 204 | "$ZIP" a $PACK_WAREHOUSE/$PACKNAME -tzip 205 | popd 206 | errorlevel=$? 207 | if [ $errorlevel -ne 0 ]; then 208 | echo "build aborted: archiving failed" 209 | exit 210 | fi 211 | 212 | cp -f ./$PACK_VENDOR.$PACK_NAME.pdsc ${PACK_WAREHOUSE} 213 | 214 | 215 | echo "build of pack succeeded" 216 | # Clean up 217 | echo "cleaning up ..." 218 | 219 | rm -rf $PACK_BUILD 220 | echo " " 221 | 222 | echo Completed CMSIS-Pack Generation: `date` -------------------------------------------------------------------------------- /example/byte_queue/byte_queue.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright(C)2009-2019 by GorgonMeducer * 3 | * * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); * 5 | * you may not use this file except in compliance with the License. * 6 | * You may obtain a copy of the License at * 7 | * * 8 | * http://www.apache.org/licenses/LICENSE-2.0 * 9 | * * 10 | * Unless required by applicable law or agreed to in writing, software * 11 | * distributed under the License is distributed on an "AS IS" BASIS, * 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 13 | * See the License for the specific language governing permissions and * 14 | * limitations under the License. * 15 | * * 16 | ****************************************************************************/ 17 | 18 | /*============================ INCLUDES ======================================*/ 19 | #define __BYTE_QUEUE_CLASS_IMPLEMENT 20 | 21 | #include "./byte_queue.h" 22 | #include 23 | #include 24 | #include 25 | 26 | /*============================ MACROS ========================================*/ 27 | /*============================ MACROFIED FUNCTIONS ===========================*/ 28 | #ifndef ASSERT 29 | # define ASSERT(...) 30 | #endif 31 | 32 | #undef this 33 | #define this (*ptThis) 34 | 35 | /*============================ TYPES =========================================*/ 36 | /*============================ LOCAL VARIABLES ===============================*/ 37 | /*============================ PROTOTYPES ====================================*/ 38 | /*============================ GLOBAL VARIABLES ==============================*/ 39 | const i_byte_queue_t BYTE_QUEUE = { 40 | .Init = &byte_queue_init, 41 | .Depose = &byte_queue_depose, 42 | .Enqueue = &byte_queue_enqueue, 43 | .Dequeue = &byte_queue_dequeue, 44 | .Count = &byte_queue_count, 45 | .Target = { 46 | .Get = &byte_queue_target_get, 47 | .Set = &byte_queue_target_set, 48 | }, 49 | }; 50 | 51 | /*============================ IMPLEMENTATION ================================*/ 52 | 53 | 54 | byte_queue_t * byte_queue_init(byte_queue_t *ptObj, byte_queue_cfg_t *ptCFG) 55 | { 56 | /* initialise "this" (i.e. ptThis) to access class members */ 57 | class_internal(ptObj, ptThis, byte_queue_t); 58 | 59 | ASSERT(NULL != ptObj && NULL != ptCFG); 60 | 61 | printf("construct byte_queue. \r\n"); 62 | 63 | /* access inherited member of mem_t directly */ 64 | if ( (NULL == ptCFG->use_as__mem_t.pchBuffer) 65 | || (0 == ptCFG->use_as__mem_t.hwSize)) { 66 | 67 | return NULL; 68 | } 69 | 70 | 71 | memset(ptObj, 0, sizeof(byte_queue_t)); //! clear object 72 | /* 73 | this.hwHead = 0; 74 | this.hwTail = 0; 75 | this.hwCount = 0; 76 | */ 77 | 78 | this.use_as__mem_t = ptCFG->use_as__mem_t; 79 | this.pTarget = ptCFG->pTarget; //!< user target 80 | 81 | return ptObj; 82 | } 83 | 84 | void byte_queue_depose(byte_queue_t *ptObj) 85 | { 86 | PLOOC_UNUSED_PARAM(ptObj); 87 | 88 | /*! nothing to do */ 89 | printf("destruct byte_queue. \r\n"); 90 | 91 | return ; 92 | } 93 | 94 | bool byte_queue_enqueue(byte_queue_t *ptObj, uint8_t chByte) 95 | { 96 | /* initialise "this" (i.e. ptThis) to access class members */ 97 | class_internal(ptObj, ptThis, byte_queue_t); 98 | 99 | ASSERT(NULL != ptObj); 100 | 101 | /* ------------------atomicity sensitive start---------------- */ 102 | if ( (this.hwHead == this.hwTail) 103 | && (0 != this.hwCount)) { 104 | //! queue is full 105 | return false; 106 | } 107 | this.use_as__mem_t.pchBuffer[this.hwHead++] = chByte; 108 | this.hwCount++; 109 | if (this.hwHead >= this.use_as__mem_t.hwSize) { 110 | this.hwHead = 0; 111 | } 112 | /* ------------------atomicity sensitive end---------------- */ 113 | 114 | return true; 115 | } 116 | 117 | bool byte_queue_dequeue(byte_queue_t *ptObj, uint8_t *pchByte) 118 | { 119 | /* initialise "this" (i.e. ptThis) to access class members */ 120 | class_internal(ptObj, ptThis, byte_queue_t); 121 | uint8_t chByte; 122 | ASSERT(NULL != ptObj); 123 | 124 | /* ------------------atomicity sensitive start---------------- */ 125 | if ( (this.hwHead == this.hwTail) 126 | && (0 == this.hwCount)) { 127 | //! queue is empty 128 | return false; 129 | } 130 | 131 | chByte = this.use_as__mem_t.pchBuffer[this.hwTail++]; 132 | this.hwCount--; 133 | if (this.hwTail >= this.use_as__mem_t.hwSize) { 134 | this.hwTail = 0; 135 | } 136 | /* ------------------atomicity sensitive end---------------- */ 137 | 138 | if (NULL != pchByte) { 139 | *pchByte = chByte; 140 | } 141 | 142 | return true; 143 | } 144 | 145 | uint_fast16_t byte_queue_count(byte_queue_t *ptObj) 146 | { 147 | class_internal(ptObj, ptThis, byte_queue_t); 148 | ASSERT(NULL != ptObj); 149 | 150 | return this.hwCount; 151 | } 152 | 153 | void *byte_queue_target_get(byte_queue_t *ptObj) 154 | { 155 | class_internal(ptObj, ptThis, byte_queue_t); 156 | ASSERT(NULL != ptObj); 157 | 158 | return this.pTarget; 159 | } 160 | 161 | void byte_queue_target_set(byte_queue_t *ptObj, void *pTarget) 162 | { 163 | class_internal(ptObj, ptThis, byte_queue_t); 164 | ASSERT(NULL != ptObj); 165 | 166 | this.pTarget = pTarget; 167 | } 168 | 169 | 170 | mem_t byte_queue_buffer_get(byte_queue_t *ptObj) 171 | { 172 | class_internal(ptObj, ptThis, byte_queue_t); 173 | ASSERT(NULL != ptObj); 174 | 175 | return this.use_as__mem_t; 176 | } 177 | 178 | /* EOF */ -------------------------------------------------------------------------------- /CI/PLOOC_template_gcc/Core/Src/stm32f1xx_it.c: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file stm32f1xx_it.c 5 | * @brief Interrupt Service Routines. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2021 STMicroelectronics. 10 | * All rights reserved.

11 | * 12 | * This software component is licensed by ST under BSD 3-Clause license, 13 | * the "License"; You may not use this file except in compliance with the 14 | * License. You may obtain a copy of the License at: 15 | * opensource.org/licenses/BSD-3-Clause 16 | * 17 | ****************************************************************************** 18 | */ 19 | /* USER CODE END Header */ 20 | 21 | /* Includes ------------------------------------------------------------------*/ 22 | #include "main.h" 23 | #include "stm32f1xx_it.h" 24 | /* Private includes ----------------------------------------------------------*/ 25 | /* USER CODE BEGIN Includes */ 26 | /* USER CODE END Includes */ 27 | 28 | /* Private typedef -----------------------------------------------------------*/ 29 | /* USER CODE BEGIN TD */ 30 | 31 | /* USER CODE END TD */ 32 | 33 | /* Private define ------------------------------------------------------------*/ 34 | /* USER CODE BEGIN PD */ 35 | 36 | /* USER CODE END PD */ 37 | 38 | /* Private macro -------------------------------------------------------------*/ 39 | /* USER CODE BEGIN PM */ 40 | 41 | /* USER CODE END PM */ 42 | 43 | /* Private variables ---------------------------------------------------------*/ 44 | /* USER CODE BEGIN PV */ 45 | 46 | /* USER CODE END PV */ 47 | 48 | /* Private function prototypes -----------------------------------------------*/ 49 | /* USER CODE BEGIN PFP */ 50 | 51 | /* USER CODE END PFP */ 52 | 53 | /* Private user code ---------------------------------------------------------*/ 54 | /* USER CODE BEGIN 0 */ 55 | 56 | /* USER CODE END 0 */ 57 | 58 | /* External variables --------------------------------------------------------*/ 59 | 60 | /* USER CODE BEGIN EV */ 61 | 62 | /* USER CODE END EV */ 63 | 64 | /******************************************************************************/ 65 | /* Cortex-M3 Processor Interruption and Exception Handlers */ 66 | /******************************************************************************/ 67 | /** 68 | * @brief This function handles Non maskable interrupt. 69 | */ 70 | void NMI_Handler(void) 71 | { 72 | /* USER CODE BEGIN NonMaskableInt_IRQn 0 */ 73 | 74 | /* USER CODE END NonMaskableInt_IRQn 0 */ 75 | /* USER CODE BEGIN NonMaskableInt_IRQn 1 */ 76 | while (1) 77 | { 78 | } 79 | /* USER CODE END NonMaskableInt_IRQn 1 */ 80 | } 81 | 82 | /** 83 | * @brief This function handles Hard fault interrupt. 84 | */ 85 | void HardFault_Handler(void) 86 | { 87 | /* USER CODE BEGIN HardFault_IRQn 0 */ 88 | 89 | /* USER CODE END HardFault_IRQn 0 */ 90 | while (1) 91 | { 92 | /* USER CODE BEGIN W1_HardFault_IRQn 0 */ 93 | /* USER CODE END W1_HardFault_IRQn 0 */ 94 | } 95 | } 96 | 97 | /** 98 | * @brief This function handles Memory management fault. 99 | */ 100 | void MemManage_Handler(void) 101 | { 102 | /* USER CODE BEGIN MemoryManagement_IRQn 0 */ 103 | 104 | /* USER CODE END MemoryManagement_IRQn 0 */ 105 | while (1) 106 | { 107 | /* USER CODE BEGIN W1_MemoryManagement_IRQn 0 */ 108 | /* USER CODE END W1_MemoryManagement_IRQn 0 */ 109 | } 110 | } 111 | 112 | /** 113 | * @brief This function handles Prefetch fault, memory access fault. 114 | */ 115 | void BusFault_Handler(void) 116 | { 117 | /* USER CODE BEGIN BusFault_IRQn 0 */ 118 | 119 | /* USER CODE END BusFault_IRQn 0 */ 120 | while (1) 121 | { 122 | /* USER CODE BEGIN W1_BusFault_IRQn 0 */ 123 | /* USER CODE END W1_BusFault_IRQn 0 */ 124 | } 125 | } 126 | 127 | /** 128 | * @brief This function handles Undefined instruction or illegal state. 129 | */ 130 | void UsageFault_Handler(void) 131 | { 132 | /* USER CODE BEGIN UsageFault_IRQn 0 */ 133 | 134 | /* USER CODE END UsageFault_IRQn 0 */ 135 | while (1) 136 | { 137 | /* USER CODE BEGIN W1_UsageFault_IRQn 0 */ 138 | /* USER CODE END W1_UsageFault_IRQn 0 */ 139 | } 140 | } 141 | 142 | /** 143 | * @brief This function handles System service call via SWI instruction. 144 | */ 145 | void SVC_Handler(void) 146 | { 147 | /* USER CODE BEGIN SVCall_IRQn 0 */ 148 | 149 | /* USER CODE END SVCall_IRQn 0 */ 150 | /* USER CODE BEGIN SVCall_IRQn 1 */ 151 | 152 | /* USER CODE END SVCall_IRQn 1 */ 153 | } 154 | 155 | /** 156 | * @brief This function handles Debug monitor. 157 | */ 158 | void DebugMon_Handler(void) 159 | { 160 | /* USER CODE BEGIN DebugMonitor_IRQn 0 */ 161 | 162 | /* USER CODE END DebugMonitor_IRQn 0 */ 163 | /* USER CODE BEGIN DebugMonitor_IRQn 1 */ 164 | 165 | /* USER CODE END DebugMonitor_IRQn 1 */ 166 | } 167 | 168 | /** 169 | * @brief This function handles Pendable request for system service. 170 | */ 171 | void PendSV_Handler(void) 172 | { 173 | /* USER CODE BEGIN PendSV_IRQn 0 */ 174 | 175 | /* USER CODE END PendSV_IRQn 0 */ 176 | /* USER CODE BEGIN PendSV_IRQn 1 */ 177 | 178 | /* USER CODE END PendSV_IRQn 1 */ 179 | } 180 | 181 | /** 182 | * @brief This function handles System tick timer. 183 | */ 184 | void SysTick_Handler(void) 185 | { 186 | /* USER CODE BEGIN SysTick_IRQn 0 */ 187 | 188 | /* USER CODE END SysTick_IRQn 0 */ 189 | HAL_IncTick(); 190 | /* USER CODE BEGIN SysTick_IRQn 1 */ 191 | 192 | /* USER CODE END SysTick_IRQn 1 */ 193 | } 194 | 195 | /******************************************************************************/ 196 | /* STM32F1xx Peripheral Interrupt Handlers */ 197 | /* Add here the Interrupt Handlers for the used peripherals. */ 198 | /* For the available peripheral interrupt handler names, */ 199 | /* please refer to the startup file (startup_stm32f1xx.s). */ 200 | /******************************************************************************/ 201 | 202 | /* USER CODE BEGIN 1 */ 203 | 204 | /* USER CODE END 1 */ 205 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 206 | -------------------------------------------------------------------------------- /CI/PLOOC_template_gcc/STM32F103RCTx_FLASH.ld: -------------------------------------------------------------------------------- 1 | /* 2 | ****************************************************************************** 3 | ** 4 | 5 | ** File : LinkerScript.ld 6 | ** 7 | ** Author : Auto-generated by System Workbench for STM32 8 | ** 9 | ** Abstract : Linker script for STM32F103RCTx series 10 | ** 256Kbytes FLASH and 48Kbytes RAM 11 | ** 12 | ** Set heap size, stack size and stack location according 13 | ** to application requirements. 14 | ** 15 | ** Set memory bank area and size if external memory is used. 16 | ** 17 | ** Target : STMicroelectronics STM32 18 | ** 19 | ** Distribution: The file is distributed “as is,” without any warranty 20 | ** of any kind. 21 | ** 22 | ***************************************************************************** 23 | ** @attention 24 | ** 25 | **

© COPYRIGHT(c) 2019 STMicroelectronics

26 | ** 27 | ** Redistribution and use in source and binary forms, with or without modification, 28 | ** are permitted provided that the following conditions are met: 29 | ** 1. Redistributions of source code must retain the above copyright notice, 30 | ** this list of conditions and the following disclaimer. 31 | ** 2. Redistributions in binary form must reproduce the above copyright notice, 32 | ** this list of conditions and the following disclaimer in the documentation 33 | ** and/or other materials provided with the distribution. 34 | ** 3. Neither the name of STMicroelectronics nor the names of its contributors 35 | ** may be used to endorse or promote products derived from this software 36 | ** without specific prior written permission. 37 | ** 38 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 39 | ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 40 | ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 41 | ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 42 | ** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 43 | ** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 44 | ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 45 | ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 46 | ** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 47 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | ** 49 | ***************************************************************************** 50 | */ 51 | 52 | /* Entry Point */ 53 | ENTRY(Reset_Handler) 54 | 55 | /* Highest address of the user mode stack */ 56 | _estack = 0x2000C000; /* end of RAM */ 57 | /* Generate a link error if heap and stack don't fit into RAM */ 58 | _Min_Heap_Size = 0x200; /* required amount of heap */ 59 | _Min_Stack_Size = 0x400; /* required amount of stack */ 60 | 61 | /* Specify the memory areas */ 62 | MEMORY 63 | { 64 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 48K 65 | FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 256K 66 | } 67 | 68 | /* Define output sections */ 69 | SECTIONS 70 | { 71 | /* The startup code goes first into FLASH */ 72 | .isr_vector : 73 | { 74 | . = ALIGN(4); 75 | KEEP(*(.isr_vector)) /* Startup code */ 76 | . = ALIGN(4); 77 | } >FLASH 78 | 79 | /* The program code and other data goes into FLASH */ 80 | .text : 81 | { 82 | . = ALIGN(4); 83 | *(.text) /* .text sections (code) */ 84 | *(.text*) /* .text* sections (code) */ 85 | *(.glue_7) /* glue arm to thumb code */ 86 | *(.glue_7t) /* glue thumb to arm code */ 87 | *(.eh_frame) 88 | 89 | KEEP (*(.init)) 90 | KEEP (*(.fini)) 91 | 92 | . = ALIGN(4); 93 | _etext = .; /* define a global symbols at end of code */ 94 | } >FLASH 95 | 96 | /* Constant data goes into FLASH */ 97 | .rodata : 98 | { 99 | . = ALIGN(4); 100 | *(.rodata) /* .rodata sections (constants, strings, etc.) */ 101 | *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ 102 | . = ALIGN(4); 103 | } >FLASH 104 | 105 | .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH 106 | .ARM : { 107 | __exidx_start = .; 108 | *(.ARM.exidx*) 109 | __exidx_end = .; 110 | } >FLASH 111 | 112 | .preinit_array : 113 | { 114 | PROVIDE_HIDDEN (__preinit_array_start = .); 115 | KEEP (*(.preinit_array*)) 116 | PROVIDE_HIDDEN (__preinit_array_end = .); 117 | } >FLASH 118 | .init_array : 119 | { 120 | PROVIDE_HIDDEN (__init_array_start = .); 121 | KEEP (*(SORT(.init_array.*))) 122 | KEEP (*(.init_array*)) 123 | PROVIDE_HIDDEN (__init_array_end = .); 124 | } >FLASH 125 | .fini_array : 126 | { 127 | PROVIDE_HIDDEN (__fini_array_start = .); 128 | KEEP (*(SORT(.fini_array.*))) 129 | KEEP (*(.fini_array*)) 130 | PROVIDE_HIDDEN (__fini_array_end = .); 131 | } >FLASH 132 | 133 | /* used by the startup to initialize data */ 134 | _sidata = LOADADDR(.data); 135 | 136 | /* Initialized data sections goes into RAM, load LMA copy after code */ 137 | .data : 138 | { 139 | . = ALIGN(4); 140 | _sdata = .; /* create a global symbol at data start */ 141 | *(.data) /* .data sections */ 142 | *(.data*) /* .data* sections */ 143 | 144 | . = ALIGN(4); 145 | _edata = .; /* define a global symbol at data end */ 146 | } >RAM AT> FLASH 147 | 148 | 149 | /* Uninitialized data section */ 150 | . = ALIGN(4); 151 | .bss : 152 | { 153 | /* This is used by the startup in order to initialize the .bss secion */ 154 | _sbss = .; /* define a global symbol at bss start */ 155 | __bss_start__ = _sbss; 156 | *(.bss) 157 | *(.bss*) 158 | *(COMMON) 159 | 160 | . = ALIGN(4); 161 | _ebss = .; /* define a global symbol at bss end */ 162 | __bss_end__ = _ebss; 163 | } >RAM 164 | 165 | /* User_heap_stack section, used to check that there is enough RAM left */ 166 | ._user_heap_stack : 167 | { 168 | . = ALIGN(8); 169 | PROVIDE ( end = . ); 170 | PROVIDE ( _end = . ); 171 | . = . + _Min_Heap_Size; 172 | . = . + _Min_Stack_Size; 173 | . = ALIGN(8); 174 | } >RAM 175 | 176 | 177 | 178 | /* Remove information from the standard libraries */ 179 | /DISCARD/ : 180 | { 181 | libc.a ( * ) 182 | libm.a ( * ) 183 | libgcc.a ( * ) 184 | } 185 | 186 | .ARM.attributes 0 : { *(.ARM.attributes) } 187 | } 188 | 189 | 190 | -------------------------------------------------------------------------------- /example/trace/trace.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright(C)2009-2019 by GorgonMeducer * 3 | * * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); * 5 | * you may not use this file except in compliance with the License. * 6 | * You may obtain a copy of the License at * 7 | * * 8 | * http://www.apache.org/licenses/LICENSE-2.0 * 9 | * * 10 | * Unless required by applicable law or agreed to in writing, software * 11 | * distributed under the License is distributed on an "AS IS" BASIS, * 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 13 | * See the License for the specific language governing permissions and * 14 | * limitations under the License. * 15 | * * 16 | ****************************************************************************/ 17 | 18 | 19 | #ifndef __PLOOC_EXAMPLE_TRACE_H__ 20 | #define __PLOOC_EXAMPLE_TRACE_H__ 21 | 22 | /*============================ INCLUDES ======================================*/ 23 | #include 24 | #include 25 | #include "plooc.h" 26 | 27 | /*============================ MACROS ========================================*/ 28 | 29 | #if defined(__clang__) \ 30 | || defined(__IAR_SYSTEMS_ICC__) \ 31 | || defined(__ARMCC_VERSION) 32 | 33 | #define __TRACE_TOSTRING_1(__OP1) \ 34 | _Generic((__OP1), \ 35 | const char *: TRACE.ToString.String, \ 36 | char *: TRACE.ToString.String, \ 37 | int8_t : TRACE.ToString.Int8, \ 38 | uint8_t : TRACE.ToString.UInt8, \ 39 | int16_t : TRACE.ToString.Int16, \ 40 | uint16_t: TRACE.ToString.UInt16, \ 41 | int32_t : TRACE.ToString.Int32, \ 42 | uint32_t: TRACE.ToString.UInt32, \ 43 | float : TRACE.ToString.Float, \ 44 | double : TRACE.ToString.Double \ 45 | )(__OP1) 46 | 47 | #define __TRACE_TOSTRING_2(__OP1, __OP2) \ 48 | _Generic((__OP1), \ 49 | uint32_t * : TRACE.ToString.Words, \ 50 | uint16_t * : TRACE.ToString.HWords, \ 51 | uint8_t * : TRACE.ToString.Bytes, \ 52 | int32_t * : TRACE.ToString.Words, \ 53 | int16_t * : TRACE.ToString.HWords, \ 54 | int8_t * : TRACE.ToString.Bytes \ 55 | )((__OP1), (__OP2)) 56 | 57 | #else /* for GCC */ 58 | #define __TRACE_TOSTRING_1(__OP1) \ 59 | _Generic((__OP1), \ 60 | const char *: TRACE.ToString.String, \ 61 | char *: TRACE.ToString.String, \ 62 | int8_t : TRACE.ToString.Int8, \ 63 | uint8_t : TRACE.ToString.UInt8, \ 64 | int16_t : TRACE.ToString.Int16, \ 65 | uint16_t: TRACE.ToString.UInt16, \ 66 | int32_t : TRACE.ToString.Int32, \ 67 | int : TRACE.ToString.Int32, /* for stupid gcc */ \ 68 | uint32_t: TRACE.ToString.UInt32, \ 69 | float : TRACE.ToString.Float, \ 70 | double : TRACE.ToString.Double \ 71 | )(__OP1) 72 | 73 | #define __TRACE_TOSTRING_2(__OP1, __OP2) \ 74 | _Generic((__OP1), \ 75 | uint32_t * : TRACE.ToString.Words, \ 76 | uint16_t * : TRACE.ToString.HWords, \ 77 | uint8_t * : TRACE.ToString.Bytes, \ 78 | int32_t * : TRACE.ToString.Words, \ 79 | int * : TRACE.ToString.Words, /* for stupid gcc */ \ 80 | int16_t * : TRACE.ToString.HWords, \ 81 | int8_t * : TRACE.ToString.Bytes \ 82 | )((__OP1), (__OP2)) 83 | #endif 84 | 85 | /*============================ MACROFIED FUNCTIONS ===========================*/ 86 | 87 | #define TRACE_TOSTR(...) __PLOOC_EVAL( __TRACE_TOSTRING_, \ 88 | __VA_ARGS__)(__VA_ARGS__) 89 | 90 | /*============================ TYPES =========================================*/ 91 | 92 | typedef int trace_low_level_io_write(uintptr_t pStream, uint_fast16_t hwSize); 93 | 94 | typedef struct trace_cfg_t { 95 | trace_low_level_io_write *fnWriteIO; 96 | } trace_cfg_t; 97 | 98 | //! \name interface i_byte_queue_t 99 | //! @{ 100 | def_interface(i_trace_t) 101 | void (*Init) (trace_cfg_t *ptCFG); 102 | struct { 103 | void (*Double) (double dfValue); 104 | void (*Float) (float fValue); 105 | void (*UInt32) (uint32_t wValue); 106 | void (*Int32) (int32_t nValue); 107 | void (*UInt16) (uint16_t hwValue); 108 | void (*Int16) (int16_t iValue); 109 | void (*UInt8) (uint8_t chValue); 110 | void (*Int8) (int8_t cValue); 111 | void (*String) (const char * pchString); 112 | 113 | void (*Words) (uint32_t *pwStream, uint_fast16_t hwSize); 114 | void (*HWords) (uint16_t *phwStream, uint_fast16_t hwSize); 115 | void (*Bytes) (uint8_t *pchStream, uint_fast16_t hwSize); 116 | }ToString; 117 | end_def_interface(i_trace_t) /*do not remove this for forward compatibility */ 118 | //! @} 119 | 120 | /*============================ GLOBAL VARIABLES ==============================*/ 121 | extern const i_trace_t TRACE; 122 | /*============================ PROTOTYPES ====================================*/ 123 | #endif 124 | /* EOF */ 125 | -------------------------------------------------------------------------------- /example/project/mdk/RTE/Device/ARMCM3/startup_ARMCM3.s: -------------------------------------------------------------------------------- 1 | ;/**************************************************************************//** 2 | ; * @file startup_ARMCM3.s 3 | ; * @brief CMSIS Core Device Startup File for 4 | ; * ARMCM3 Device 5 | ; * @version V1.0.1 6 | ; * @date 23. July 2019 7 | ; ******************************************************************************/ 8 | ;/* 9 | ; * Copyright (c) 2009-2019 Arm Limited. All rights reserved. 10 | ; * 11 | ; * SPDX-License-Identifier: Apache-2.0 12 | ; * 13 | ; * Licensed under the Apache License, Version 2.0 (the License); you may 14 | ; * not use this file except in compliance with the License. 15 | ; * You may obtain a copy of the License at 16 | ; * 17 | ; * www.apache.org/licenses/LICENSE-2.0 18 | ; * 19 | ; * Unless required by applicable law or agreed to in writing, software 20 | ; * distributed under the License is distributed on an AS IS BASIS, WITHOUT 21 | ; * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | ; * See the License for the specific language governing permissions and 23 | ; * limitations under the License. 24 | ; */ 25 | 26 | ;//-------- <<< Use Configuration Wizard in Context Menu >>> ------------------ 27 | 28 | 29 | ; Stack Configuration 30 | ; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> 31 | ; 32 | 33 | Stack_Size EQU 0x00000400 34 | 35 | AREA STACK, NOINIT, READWRITE, ALIGN=3 36 | __stack_limit 37 | Stack_Mem SPACE Stack_Size 38 | __initial_sp 39 | 40 | 41 | ; Heap Configuration 42 | ; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> 43 | ; 44 | 45 | Heap_Size EQU 0x00000C00 46 | 47 | IF Heap_Size != 0 ; Heap is provided 48 | AREA HEAP, NOINIT, READWRITE, ALIGN=3 49 | __heap_base 50 | Heap_Mem SPACE Heap_Size 51 | __heap_limit 52 | ENDIF 53 | 54 | 55 | PRESERVE8 56 | THUMB 57 | 58 | 59 | ; Vector Table Mapped to Address 0 at Reset 60 | 61 | AREA RESET, DATA, READONLY 62 | EXPORT __Vectors 63 | EXPORT __Vectors_End 64 | EXPORT __Vectors_Size 65 | 66 | __Vectors DCD __initial_sp ; Top of Stack 67 | DCD Reset_Handler ; Reset Handler 68 | DCD NMI_Handler ; -14 NMI Handler 69 | DCD HardFault_Handler ; -13 Hard Fault Handler 70 | DCD MemManage_Handler ; -12 MPU Fault Handler 71 | DCD BusFault_Handler ; -11 Bus Fault Handler 72 | DCD UsageFault_Handler ; -10 Usage Fault Handler 73 | DCD 0 ; Reserved 74 | DCD 0 ; Reserved 75 | DCD 0 ; Reserved 76 | DCD 0 ; Reserved 77 | DCD SVC_Handler ; -5 SVCall Handler 78 | DCD DebugMon_Handler ; -4 Debug Monitor Handler 79 | DCD 0 ; Reserved 80 | DCD PendSV_Handler ; -2 PendSV Handler 81 | DCD SysTick_Handler ; -1 SysTick Handler 82 | 83 | ; Interrupts 84 | DCD Interrupt0_Handler ; 0 Interrupt 0 85 | DCD Interrupt1_Handler ; 1 Interrupt 1 86 | DCD Interrupt2_Handler ; 2 Interrupt 2 87 | DCD Interrupt3_Handler ; 3 Interrupt 3 88 | DCD Interrupt4_Handler ; 4 Interrupt 4 89 | DCD Interrupt5_Handler ; 5 Interrupt 5 90 | DCD Interrupt6_Handler ; 6 Interrupt 6 91 | DCD Interrupt7_Handler ; 7 Interrupt 7 92 | DCD Interrupt8_Handler ; 8 Interrupt 8 93 | DCD Interrupt9_Handler ; 9 Interrupt 9 94 | 95 | SPACE (214 * 4) ; Interrupts 10 .. 224 are left out 96 | __Vectors_End 97 | __Vectors_Size EQU __Vectors_End - __Vectors 98 | 99 | 100 | AREA |.text|, CODE, READONLY 101 | 102 | ; Reset Handler 103 | 104 | Reset_Handler PROC 105 | EXPORT Reset_Handler [WEAK] 106 | IMPORT SystemInit 107 | IMPORT __main 108 | 109 | LDR R0, =SystemInit 110 | BLX R0 111 | LDR R0, =__main 112 | BX R0 113 | ENDP 114 | 115 | ; The default macro is not used for HardFault_Handler 116 | ; because this results in a poor debug illusion. 117 | HardFault_Handler PROC 118 | EXPORT HardFault_Handler [WEAK] 119 | B . 120 | ENDP 121 | 122 | ; Macro to define default exception/interrupt handlers. 123 | ; Default handler are weak symbols with an endless loop. 124 | ; They can be overwritten by real handlers. 125 | MACRO 126 | Set_Default_Handler $Handler_Name 127 | $Handler_Name PROC 128 | EXPORT $Handler_Name [WEAK] 129 | B . 130 | ENDP 131 | MEND 132 | 133 | 134 | ; Default exception/interrupt handler 135 | 136 | Set_Default_Handler NMI_Handler 137 | Set_Default_Handler MemManage_Handler 138 | Set_Default_Handler BusFault_Handler 139 | Set_Default_Handler UsageFault_Handler 140 | Set_Default_Handler SVC_Handler 141 | Set_Default_Handler DebugMon_Handler 142 | Set_Default_Handler PendSV_Handler 143 | Set_Default_Handler SysTick_Handler 144 | 145 | Set_Default_Handler Interrupt0_Handler 146 | Set_Default_Handler Interrupt1_Handler 147 | Set_Default_Handler Interrupt2_Handler 148 | Set_Default_Handler Interrupt3_Handler 149 | Set_Default_Handler Interrupt4_Handler 150 | Set_Default_Handler Interrupt5_Handler 151 | Set_Default_Handler Interrupt6_Handler 152 | Set_Default_Handler Interrupt7_Handler 153 | Set_Default_Handler Interrupt8_Handler 154 | Set_Default_Handler Interrupt9_Handler 155 | 156 | ALIGN 157 | 158 | 159 | ; User setup Stack & Heap 160 | 161 | IF :LNOT::DEF:__MICROLIB 162 | IMPORT __use_two_region_memory 163 | ENDIF 164 | 165 | EXPORT __stack_limit 166 | EXPORT __initial_sp 167 | IF Heap_Size != 0 ; Heap is provided 168 | EXPORT __heap_base 169 | EXPORT __heap_limit 170 | ENDIF 171 | 172 | END 173 | -------------------------------------------------------------------------------- /plooc_class_simple_c90.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright(C)2009-2019 by GorgonMeducer * 3 | * and SimonQian * 4 | * * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); * 6 | * you may not use this file except in compliance with the License. * 7 | * You may obtain a copy of the License at * 8 | * * 9 | * http://www.apache.org/licenses/LICENSE-2.0 * 10 | * * 11 | * Unless required by applicable law or agreed to in writing, software * 12 | * distributed under the License is distributed on an "AS IS" BASIS, * 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 14 | * See the License for the specific language governing permissions and * 15 | * limitations under the License. * 16 | * * 17 | ****************************************************************************/ 18 | 19 | 20 | /****************************************************************************** 21 | * HOW TO USE * 22 | ******************************************************************************/ 23 | //!Add following content to your module header file, e.g. xxxxxx.h 24 | //#include "plooc_class.h" 25 | 26 | /*============================ INCLUDES ======================================*/ 27 | //#include 28 | 29 | /*! \NOTE the uint_fast8_t used in this header file is defined in stdint.h 30 | if you don't have stdint.h supported in your toolchain, you should 31 | define uint_fast8_t all by yourself with following rule: 32 | a. if the target processor is 8 bits, define it as uint8_t 33 | b. if the target processor is 16 bits, define it as uint16_t 34 | c. if the target processor is 32 bits, define it as uint32_t 35 | d. if the target processor is 64 bits, define it as either uint32_t or 36 | uint64_t 37 | */ 38 | 39 | 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | /*============================ MACROS ========================================*/ 44 | #undef private_member 45 | #undef protected_member 46 | #undef public_member 47 | 48 | 49 | /*============================ MACROFIED FUNCTIONS ===========================*/ 50 | 51 | #ifndef __PLOOC_CLASS_SIMPLE_C90_H__ 52 | #define __PLOOC_CLASS_SIMPLE_C90_H__ 53 | 54 | # define __def_simple_class(__name) struct __name 55 | # define def_simple_class(__name) __def_simple_class(__name) 56 | # define define_simple_class(__name) def_simple_class(__name) 57 | # define declare_simple_class(__name) typedef struct __name __name; 58 | # define dcl_simple_class(__name) declare_simple_class(__name) 59 | 60 | #endif /* __PLOOC_CLASS_SIMPLE_H__ */ 61 | 62 | 63 | # define private_member(__member) __member 64 | # define protected_member(__member) __member 65 | # define public_member(__member) __member 66 | 67 | 68 | 69 | // code below is just try to be compatible with plooc_class_strict 70 | #undef declare_class 71 | #undef dcl_class 72 | #undef def_class 73 | #undef define_class 74 | #undef __def_class 75 | #undef end_def_class 76 | #undef end_define_class 77 | #undef __end_def_class 78 | #undef extern_class 79 | #undef __extern_class 80 | #undef end_extern_class 81 | #undef __end_extern_class 82 | 83 | 84 | #define __end_def_class(__name) 85 | 86 | #define __def_class(__name, __member) \ 87 | /*typedef struct __name __name; */ \ 88 | struct __name { \ 89 | __member \ 90 | }; 91 | 92 | 93 | #if defined(__PLOOC_CLASS_IMPLEMENT__) || defined(__PLOOC_CLASS_IMPLEMENT) 94 | 95 | # undef __class 96 | # define __class(__name) __name 97 | 98 | # undef class 99 | # define class(__name) __class(__name) 100 | 101 | 102 | # undef __class_internal 103 | # define __class_internal(__src, __des, __type) \ 104 | class(__type) *(__des) = (class(__type) *)(__src); 105 | 106 | # undef class_internal 107 | # define class_internal(__src, __des, __type) \ 108 | __class_internal(__src, __des, __type) 109 | 110 | #define __extern_class(__name, __member) 111 | 112 | #define __end_extern_class(__name) 113 | 114 | #elif defined(__PLOOC_CLASS_INHERIT__) || defined(__PLOOC_CLASS_INHERIT) 115 | 116 | # undef __class_protected 117 | # define __class_protected(__name) __name 118 | 119 | # undef class_protected 120 | # define class_protected(__name) __class_protected(__name) 121 | 122 | 123 | # undef __protected_internal 124 | # define __protected_internal(__src, __des, __type) \ 125 | class_protected(__type) *(__des)=(class_protected(__type) *)(__src); 126 | 127 | # undef protected_internal 128 | # define protected_internal(__src, __des, __type) \ 129 | __protected_internal(__src, __des, __type) 130 | 131 | #define __extern_class(__name, __member) 132 | 133 | #define __end_extern_class(__name) 134 | 135 | #else /* __PLOOC_CLASS_EXTERN */ 136 | 137 | #define __extern_class(__name, __member) __def_class(__name, __member) 138 | 139 | #define __end_extern_class(__name) 140 | 141 | #endif 142 | 143 | #undef which 144 | #define which(__type) __type 145 | 146 | #define def_class(__name, __member) __def_class(__name, __member) 147 | #define define_class(__name, __member) def_class(__name, __member) 148 | 149 | #define end_def_class(__name) __end_def_class(__name) 150 | #define end_define_class(__name) end_def_class(__name) 151 | 152 | #define declare_class(__name) typedef struct __name __name; 153 | #define dcl_class(__name) declare_class(__name) 154 | 155 | #define extern_class(__name, __member) __extern_class(__name, __member) 156 | 157 | #define end_extern_class(__name) __end_extern_class(__name) 158 | 159 | #undef __PLOOC_CLASS_IMPLEMENT__ 160 | #undef __PLOOC_CLASS_INHERIT__ 161 | #undef __PLOOC_CLASS_IMPLEMENT 162 | #undef __PLOOC_CLASS_INHERIT 163 | 164 | /*============================ TYPES =========================================*/ 165 | /*============================ GLOBAL VARIABLES ==============================*/ 166 | /*============================ LOCAL VARIABLES ===============================*/ 167 | /*============================ PROTOTYPES ====================================*/ 168 | 169 | #ifdef __cplusplus 170 | } 171 | #endif 172 | -------------------------------------------------------------------------------- /example/project/mdk/RTE/Device/ARMCM3/startup_ARMCM3.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * @file startup_ARMCM3.c 3 | * @brief CMSIS-Core(M) Device Startup File for a Cortex-M3 Device 4 | * @version V2.0.3 5 | * @date 31. March 2020 6 | ******************************************************************************/ 7 | /* 8 | * Copyright (c) 2009-2020 Arm Limited. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #if defined (ARMCM3) 26 | #include "ARMCM3.h" 27 | #else 28 | #error device not specified! 29 | #endif 30 | 31 | /*---------------------------------------------------------------------------- 32 | External References 33 | *----------------------------------------------------------------------------*/ 34 | extern uint32_t __INITIAL_SP; 35 | 36 | extern __NO_RETURN void __PROGRAM_START(void); 37 | 38 | /*---------------------------------------------------------------------------- 39 | Internal References 40 | *----------------------------------------------------------------------------*/ 41 | __NO_RETURN void Reset_Handler (void); 42 | void Default_Handler(void); 43 | 44 | /*---------------------------------------------------------------------------- 45 | Exception / Interrupt Handler 46 | *----------------------------------------------------------------------------*/ 47 | /* Exceptions */ 48 | void NMI_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 49 | void HardFault_Handler (void) __attribute__ ((weak)); 50 | void MemManage_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 51 | void BusFault_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 52 | void UsageFault_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 53 | void SVC_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 54 | void DebugMon_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 55 | void PendSV_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 56 | void SysTick_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 57 | 58 | void Interrupt0_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 59 | void Interrupt1_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 60 | void Interrupt2_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 61 | void Interrupt3_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 62 | void Interrupt4_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 63 | void Interrupt5_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 64 | void Interrupt6_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 65 | void Interrupt7_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 66 | void Interrupt8_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 67 | void Interrupt9_Handler (void) __attribute__ ((weak, alias("Default_Handler"))); 68 | 69 | 70 | /*---------------------------------------------------------------------------- 71 | Exception / Interrupt Vector table 72 | *----------------------------------------------------------------------------*/ 73 | 74 | #if defined ( __GNUC__ ) 75 | #pragma GCC diagnostic push 76 | #pragma GCC diagnostic ignored "-Wpedantic" 77 | #endif 78 | 79 | extern const VECTOR_TABLE_Type __VECTOR_TABLE[240]; 80 | const VECTOR_TABLE_Type __VECTOR_TABLE[240] __VECTOR_TABLE_ATTRIBUTE = { 81 | (VECTOR_TABLE_Type)(&__INITIAL_SP), /* Initial Stack Pointer */ 82 | Reset_Handler, /* Reset Handler */ 83 | NMI_Handler, /* -14 NMI Handler */ 84 | HardFault_Handler, /* -13 Hard Fault Handler */ 85 | MemManage_Handler, /* -12 MPU Fault Handler */ 86 | BusFault_Handler, /* -11 Bus Fault Handler */ 87 | UsageFault_Handler, /* -10 Usage Fault Handler */ 88 | 0, /* Reserved */ 89 | 0, /* Reserved */ 90 | 0, /* Reserved */ 91 | 0, /* Reserved */ 92 | SVC_Handler, /* -5 SVC Handler */ 93 | DebugMon_Handler, /* -4 Debug Monitor Handler */ 94 | 0, /* Reserved */ 95 | PendSV_Handler, /* -2 PendSV Handler */ 96 | SysTick_Handler, /* -1 SysTick Handler */ 97 | 98 | /* Interrupts */ 99 | Interrupt0_Handler, /* 0 Interrupt 0 */ 100 | Interrupt1_Handler, /* 1 Interrupt 1 */ 101 | Interrupt2_Handler, /* 2 Interrupt 2 */ 102 | Interrupt3_Handler, /* 3 Interrupt 3 */ 103 | Interrupt4_Handler, /* 4 Interrupt 4 */ 104 | Interrupt5_Handler, /* 5 Interrupt 5 */ 105 | Interrupt6_Handler, /* 6 Interrupt 6 */ 106 | Interrupt7_Handler, /* 7 Interrupt 7 */ 107 | Interrupt8_Handler, /* 8 Interrupt 8 */ 108 | Interrupt9_Handler /* 9 Interrupt 9 */ 109 | /* Interrupts 10 .. 223 are left out */ 110 | }; 111 | 112 | #if defined ( __GNUC__ ) 113 | #pragma GCC diagnostic pop 114 | #endif 115 | 116 | /*---------------------------------------------------------------------------- 117 | Reset Handler called on controller reset 118 | *----------------------------------------------------------------------------*/ 119 | __NO_RETURN void Reset_Handler(void) 120 | { 121 | SystemInit(); /* CMSIS System Initialization */ 122 | __PROGRAM_START(); /* Enter PreMain (C library entry point) */ 123 | } 124 | 125 | 126 | #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 127 | #pragma clang diagnostic push 128 | #pragma clang diagnostic ignored "-Wmissing-noreturn" 129 | #endif 130 | 131 | /*---------------------------------------------------------------------------- 132 | Hard Fault Handler 133 | *----------------------------------------------------------------------------*/ 134 | void HardFault_Handler(void) 135 | { 136 | while(1); 137 | } 138 | 139 | /*---------------------------------------------------------------------------- 140 | Default Handler for Exceptions / Interrupts 141 | *----------------------------------------------------------------------------*/ 142 | void Default_Handler(void) 143 | { 144 | while(1); 145 | } 146 | 147 | #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 148 | #pragma clang diagnostic pop 149 | #endif 150 | 151 | -------------------------------------------------------------------------------- /CI/PLOOC_template_gcc/.mxproject: -------------------------------------------------------------------------------- 1 | [PreviousLibFiles] 2 | LibFiles=Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h;Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/cmsis_armclang.h;Drivers/CMSIS/Include/cmsis_compiler.h;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/cmsis_iccarm.h;Drivers/CMSIS/Include/cmsis_version.h;Drivers/CMSIS/Include/core_armv8mbl.h;Drivers/CMSIS/Include/core_armv8mml.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/core_cm1.h;Drivers/CMSIS/Include/core_cm23.h;Drivers/CMSIS/Include/core_cm3.h;Drivers/CMSIS/Include/core_cm33.h;Drivers/CMSIS/Include/core_cm4.h;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/core_sc300.h;Drivers/CMSIS/Include/mpu_armv7.h;Drivers/CMSIS/Include/mpu_armv8.h;Drivers/CMSIS/Include/tz_context.h; 3 | 4 | [PreviousUsedMakefileFiles] 5 | SourceFiles=Core\Src\main.c;Core\Src\stm32f1xx_it.c;Core\Src\stm32f1xx_hal_msp.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c;Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;Core\Src/system_stm32f1xx.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c;Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;Core\Src/system_stm32f1xx.c;;; 6 | HeaderPath=Drivers\STM32F1xx_HAL_Driver\Inc;Drivers\STM32F1xx_HAL_Driver\Inc\Legacy;Drivers\CMSIS\Device\ST\STM32F1xx\Include;Drivers\CMSIS\Include;Core\Inc; 7 | CDefines=USE_HAL_DRIVER;STM32F103xE;USE_HAL_DRIVER;USE_HAL_DRIVER; 8 | 9 | [PreviousGenFiles] 10 | AdvancedFolderStructure=true 11 | HeaderFileListSize=3 12 | HeaderFiles#0=C:/Users/liang/Desktop/PLOOC/CI/PLOOC_template_gcc/Core/Inc/stm32f1xx_it.h 13 | HeaderFiles#1=C:/Users/liang/Desktop/PLOOC/CI/PLOOC_template_gcc/Core/Inc/stm32f1xx_hal_conf.h 14 | HeaderFiles#2=C:/Users/liang/Desktop/PLOOC/CI/PLOOC_template_gcc/Core/Inc/main.h 15 | HeaderFolderListSize=1 16 | HeaderPath#0=C:/Users/liang/Desktop/PLOOC/CI/PLOOC_template_gcc/Core/Inc 17 | HeaderFiles=; 18 | SourceFileListSize=3 19 | SourceFiles#0=C:/Users/liang/Desktop/PLOOC/CI/PLOOC_template_gcc/Core/Src/stm32f1xx_it.c 20 | SourceFiles#1=C:/Users/liang/Desktop/PLOOC/CI/PLOOC_template_gcc/Core/Src/stm32f1xx_hal_msp.c 21 | SourceFiles#2=C:/Users/liang/Desktop/PLOOC/CI/PLOOC_template_gcc/Core/Src/main.c 22 | SourceFolderListSize=1 23 | SourcePath#0=C:/Users/liang/Desktop/PLOOC/CI/PLOOC_template_gcc/Core/Src 24 | SourceFiles=; 25 | 26 | [PreviousUsedKeilFiles] 27 | SourceFiles=..\Core\Src\main.c;..\Core\Src\stm32f1xx_it.c;..\Core\Src\stm32f1xx_hal_msp.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c;..\Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;..\Core\Src/system_stm32f1xx.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;..\Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c;..\Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;..\Core\Src/system_stm32f1xx.c;;; 28 | HeaderPath=..\Drivers\STM32F1xx_HAL_Driver\Inc;..\Drivers\STM32F1xx_HAL_Driver\Inc\Legacy;..\Drivers\CMSIS\Device\ST\STM32F1xx\Include;..\Drivers\CMSIS\Include;..\Core\Inc; 29 | CDefines=USE_HAL_DRIVER;STM32F103xE;USE_HAL_DRIVER;USE_HAL_DRIVER; 30 | 31 | -------------------------------------------------------------------------------- /CI/PLOOC_template_gcc/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f1xx_hal_def.h 4 | * @author MCD Application Team 5 | * @brief This file contains HAL common defines, enumeration, macros and 6 | * structures definitions. 7 | ****************************************************************************** 8 | * @attention 9 | * 10 | *

© Copyright (c) 2017 STMicroelectronics. 11 | * All rights reserved.

12 | * 13 | * This software component is licensed by ST under BSD 3-Clause license, 14 | * the "License"; You may not use this file except in compliance with the 15 | * License. You may obtain a copy of the License at: 16 | * opensource.org/licenses/BSD-3-Clause 17 | * 18 | ****************************************************************************** 19 | */ 20 | 21 | /* Define to prevent recursive inclusion -------------------------------------*/ 22 | #ifndef __STM32F1xx_HAL_DEF 23 | #define __STM32F1xx_HAL_DEF 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /* Includes ------------------------------------------------------------------*/ 30 | #include "stm32f1xx.h" 31 | #include "Legacy/stm32_hal_legacy.h" 32 | #include 33 | 34 | /* Exported types ------------------------------------------------------------*/ 35 | 36 | /** 37 | * @brief HAL Status structures definition 38 | */ 39 | typedef enum 40 | { 41 | HAL_OK = 0x00U, 42 | HAL_ERROR = 0x01U, 43 | HAL_BUSY = 0x02U, 44 | HAL_TIMEOUT = 0x03U 45 | } HAL_StatusTypeDef; 46 | 47 | /** 48 | * @brief HAL Lock structures definition 49 | */ 50 | typedef enum 51 | { 52 | HAL_UNLOCKED = 0x00U, 53 | HAL_LOCKED = 0x01U 54 | } HAL_LockTypeDef; 55 | 56 | /* Exported macro ------------------------------------------------------------*/ 57 | #define HAL_MAX_DELAY 0xFFFFFFFFU 58 | 59 | #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) != 0U) 60 | #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == 0U) 61 | 62 | #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \ 63 | do{ \ 64 | (__HANDLE__)->__PPP_DMA_FIELD__ = &(__DMA_HANDLE__); \ 65 | (__DMA_HANDLE__).Parent = (__HANDLE__); \ 66 | } while(0U) 67 | 68 | #define UNUSED(X) (void)X /* To avoid gcc/g++ warnings */ 69 | 70 | /** @brief Reset the Handle's State field. 71 | * @param __HANDLE__ specifies the Peripheral Handle. 72 | * @note This macro can be used for the following purpose: 73 | * - When the Handle is declared as local variable; before passing it as parameter 74 | * to HAL_PPP_Init() for the first time, it is mandatory to use this macro 75 | * to set to 0 the Handle's "State" field. 76 | * Otherwise, "State" field may have any random value and the first time the function 77 | * HAL_PPP_Init() is called, the low level hardware initialization will be missed 78 | * (i.e. HAL_PPP_MspInit() will not be executed). 79 | * - When there is a need to reconfigure the low level hardware: instead of calling 80 | * HAL_PPP_DeInit() then HAL_PPP_Init(), user can make a call to this macro then HAL_PPP_Init(). 81 | * In this later function, when the Handle's "State" field is set to 0, it will execute the function 82 | * HAL_PPP_MspInit() which will reconfigure the low level hardware. 83 | * @retval None 84 | */ 85 | #define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0U) 86 | 87 | #if (USE_RTOS == 1U) 88 | /* Reserved for future use */ 89 | #error "USE_RTOS should be 0 in the current HAL release" 90 | #else 91 | #define __HAL_LOCK(__HANDLE__) \ 92 | do{ \ 93 | if((__HANDLE__)->Lock == HAL_LOCKED) \ 94 | { \ 95 | return HAL_BUSY; \ 96 | } \ 97 | else \ 98 | { \ 99 | (__HANDLE__)->Lock = HAL_LOCKED; \ 100 | } \ 101 | }while (0U) 102 | 103 | #define __HAL_UNLOCK(__HANDLE__) \ 104 | do{ \ 105 | (__HANDLE__)->Lock = HAL_UNLOCKED; \ 106 | }while (0U) 107 | #endif /* USE_RTOS */ 108 | 109 | #if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) /* ARM Compiler V6 */ 110 | #ifndef __weak 111 | #define __weak __attribute__((weak)) 112 | #endif 113 | #ifndef __packed 114 | #define __packed __attribute__((packed)) 115 | #endif 116 | #elif defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */ 117 | #ifndef __weak 118 | #define __weak __attribute__((weak)) 119 | #endif /* __weak */ 120 | #ifndef __packed 121 | #define __packed __attribute__((__packed__)) 122 | #endif /* __packed */ 123 | #endif /* __GNUC__ */ 124 | 125 | 126 | /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */ 127 | #if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) /* ARM Compiler V6 */ 128 | #ifndef __ALIGN_BEGIN 129 | #define __ALIGN_BEGIN 130 | #endif 131 | #ifndef __ALIGN_END 132 | #define __ALIGN_END __attribute__ ((aligned (4))) 133 | #endif 134 | #elif defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */ 135 | #ifndef __ALIGN_END 136 | #define __ALIGN_END __attribute__ ((aligned (4))) 137 | #endif /* __ALIGN_END */ 138 | #ifndef __ALIGN_BEGIN 139 | #define __ALIGN_BEGIN 140 | #endif /* __ALIGN_BEGIN */ 141 | #else 142 | #ifndef __ALIGN_END 143 | #define __ALIGN_END 144 | #endif /* __ALIGN_END */ 145 | #ifndef __ALIGN_BEGIN 146 | #if defined (__CC_ARM) /* ARM Compiler V5*/ 147 | #define __ALIGN_BEGIN __align(4) 148 | #elif defined (__ICCARM__) /* IAR Compiler */ 149 | #define __ALIGN_BEGIN 150 | #endif /* __CC_ARM */ 151 | #endif /* __ALIGN_BEGIN */ 152 | #endif /* __GNUC__ */ 153 | 154 | 155 | /** 156 | * @brief __RAM_FUNC definition 157 | */ 158 | #if defined ( __CC_ARM ) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) 159 | /* ARM Compiler V4/V5 and V6 160 | -------------------------- 161 | RAM functions are defined using the toolchain options. 162 | Functions that are executed in RAM should reside in a separate source module. 163 | Using the 'Options for File' dialog you can simply change the 'Code / Const' 164 | area of a module to a memory space in physical RAM. 165 | Available memory areas are declared in the 'Target' tab of the 'Options for Target' 166 | dialog. 167 | */ 168 | #define __RAM_FUNC 169 | 170 | #elif defined ( __ICCARM__ ) 171 | /* ICCARM Compiler 172 | --------------- 173 | RAM functions are defined using a specific toolchain keyword "__ramfunc". 174 | */ 175 | #define __RAM_FUNC __ramfunc 176 | 177 | #elif defined ( __GNUC__ ) 178 | /* GNU Compiler 179 | ------------ 180 | RAM functions are defined using a specific toolchain attribute 181 | "__attribute__((section(".RamFunc")))". 182 | */ 183 | #define __RAM_FUNC __attribute__((section(".RamFunc"))) 184 | 185 | #endif 186 | 187 | /** 188 | * @brief __NOINLINE definition 189 | */ 190 | #if defined ( __CC_ARM ) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) || defined ( __GNUC__ ) 191 | /* ARM V4/V5 and V6 & GNU Compiler 192 | ------------------------------- 193 | */ 194 | #define __NOINLINE __attribute__ ( (noinline) ) 195 | 196 | #elif defined ( __ICCARM__ ) 197 | /* ICCARM Compiler 198 | --------------- 199 | */ 200 | #define __NOINLINE _Pragma("optimize = no_inline") 201 | 202 | #endif 203 | 204 | #ifdef __cplusplus 205 | } 206 | #endif 207 | 208 | #endif /* ___STM32F1xx_HAL_DEF */ 209 | 210 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 211 | -------------------------------------------------------------------------------- /example/enhanced_byte_queue/enhanced_byte_queue.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright(C)2009-2019 by GorgonMeducer * 3 | * * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); * 5 | * you may not use this file except in compliance with the License. * 6 | * You may obtain a copy of the License at * 7 | * * 8 | * http://www.apache.org/licenses/LICENSE-2.0 * 9 | * * 10 | * Unless required by applicable law or agreed to in writing, software * 11 | * distributed under the License is distributed on an "AS IS" BASIS, * 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 13 | * See the License for the specific language governing permissions and * 14 | * limitations under the License. * 15 | * * 16 | ****************************************************************************/ 17 | 18 | /*============================ INCLUDES ======================================*/ 19 | #define __ENHANCED_BYTE_QUEUE_CLASS_IMPLEMENT 20 | #define __BYTE_QUEUE_CLASS_INHERIT__ 21 | #include "./enhanced_byte_queue.h" 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | /*============================ MACROS ========================================*/ 28 | /*============================ MACROFIED FUNCTIONS ===========================*/ 29 | #ifndef ASSERT 30 | # define ASSERT(...) 31 | #endif 32 | 33 | #undef this 34 | #define this (*ptThis) 35 | 36 | #undef base 37 | #define base (*ptBase) 38 | /*============================ TYPES =========================================*/ 39 | /*============================ LOCAL VARIABLES ===============================*/ 40 | /*============================ PROTOTYPES ====================================*/ 41 | /*============================ GLOBAL VARIABLES ==============================*/ 42 | const i_enhanced_byte_queue_t ENHANCED_BYTE_QUEUE = { 43 | 44 | /*! override base interface */ 45 | .use_as__i_byte_queue_t = { 46 | .Init = (byte_queue_t * (*)(byte_queue_t *, byte_queue_cfg_t *)) 47 | &enhanced_byte_queue_init, 48 | .Depose = (void (*) (byte_queue_t *ptObj)) 49 | &enhanced_byte_queue_depose, 50 | .Enqueue = (bool (*)(byte_queue_t *, uint8_t )) 51 | &enhanced_byte_queue_enqueue, 52 | .Dequeue = (bool (*)(byte_queue_t *, uint8_t *)) 53 | &enhanced_byte_queue_dequeue, 54 | .Count = &byte_queue_count, 55 | .Target = { 56 | .Get = &byte_queue_target_get, 57 | .Set = &byte_queue_target_set, 58 | }, 59 | }, 60 | .Init = &enhanced_byte_queue_init, 61 | .Depose = &enhanced_byte_queue_depose, 62 | .Enqueue = &enhanced_byte_queue_enqueue, 63 | .Dequeue = &enhanced_byte_queue_dequeue, 64 | .Count = (uint_fast16_t(*)(enhanced_byte_queue_t *)) 65 | &byte_queue_count, 66 | .Target = { 67 | .Get = (void *(*)(enhanced_byte_queue_t *)) 68 | &byte_queue_target_get, 69 | .Set = (void (*)(enhanced_byte_queue_t *, void *)) 70 | &byte_queue_target_set, 71 | }, 72 | .Peek = { 73 | .PeekByte = &enhanced_byte_queue_peek, 74 | .Reset = &enhanced_byte_queue_peek_reset, 75 | .GetAllPeeked = &enhanced_byte_queue_peek_get_all_peeked, 76 | }, 77 | }; 78 | 79 | /*============================ IMPLEMENTATION ================================*/ 80 | 81 | enhanced_byte_queue_t * enhanced_byte_queue_init(enhanced_byte_queue_t *ptObj, 82 | byte_queue_cfg_t *ptCFG) 83 | { 84 | class_internal(ptObj, ptThis, enhanced_byte_queue_t); 85 | //! call base constructor 86 | if (NULL == byte_queue_init(&this.use_as__byte_queue_t, ptCFG)) { 87 | return NULL; 88 | } 89 | 90 | printf("construct enhanced_byte_queue. \r\n"); 91 | 92 | this.hwPeek = 0; 93 | this.hwPeekCount = 0; 94 | 95 | return ptObj; 96 | } 97 | void enhanced_byte_queue_depose(enhanced_byte_queue_t *ptObj) 98 | { 99 | printf("destruct enhanced_byte_queue. \r\n"); 100 | 101 | //! call base destructor 102 | byte_queue_depose(&(ptObj->use_as__byte_queue_t)); 103 | 104 | } 105 | 106 | bool enhanced_byte_queue_enqueue(enhanced_byte_queue_t *ptObj, uint8_t chByte) 107 | { 108 | /* initialise "this" (i.e. ptThis) to access class members */ 109 | class_internal(ptObj, ptThis, enhanced_byte_queue_t); 110 | /* initialise "base" (i.e. ptBase) to access protected members */ 111 | protected_internal(&this.use_as__byte_queue_t, ptBase, byte_queue_t); 112 | ASSERT(NULL != ptObj); 113 | 114 | /* ------------------atomicity sensitive start---------------- */ 115 | if (!byte_queue_enqueue(&this.use_as__byte_queue_t, chByte)) { 116 | return false; 117 | } 118 | this.hwPeekCount++; 119 | /* ------------------atomicity sensitive end---------------- */ 120 | 121 | return true; 122 | } 123 | 124 | bool enhanced_byte_queue_dequeue(enhanced_byte_queue_t *ptObj, uint8_t *pchByte) 125 | { 126 | /* initialise "this" (i.e. ptThis) to access class members */ 127 | class_internal(ptObj, ptThis, enhanced_byte_queue_t); 128 | /* initialise "base" (i.e. ptBase) to access protected members */ 129 | protected_internal(&this.use_as__byte_queue_t, ptBase, byte_queue_t); 130 | ASSERT(NULL != ptObj); 131 | 132 | /* ------------------atomicity sensitive start---------------- */ 133 | if (!byte_queue_dequeue(&this.use_as__byte_queue_t, pchByte)) { 134 | return false; 135 | } 136 | this.hwPeek = base.hwTail; 137 | this.hwPeekCount = base.hwCount; 138 | /* ------------------atomicity sensitive end---------------- */ 139 | 140 | return true; 141 | } 142 | 143 | bool enhanced_byte_queue_peek(enhanced_byte_queue_t *ptObj, uint8_t *pchByte) 144 | { 145 | /* initialise "this" (i.e. ptThis) to access class members */ 146 | class_internal(ptObj, ptThis, enhanced_byte_queue_t); 147 | /* initialise "base" (i.e. ptBase) to access protected members */ 148 | protected_internal(&this.use_as__byte_queue_t, ptBase, byte_queue_t); 149 | uint8_t chByte; 150 | ASSERT(NULL != ptObj); 151 | mem_t tBuffer; 152 | 153 | /* ------------------atomicity sensitive start---------------- */ 154 | if ( (this.hwPeek == base.hwHead) 155 | && (0 == this.hwPeekCount)) { 156 | //! empty 157 | return false; 158 | } 159 | tBuffer = byte_queue_buffer_get(&this.use_as__byte_queue_t); 160 | chByte = tBuffer.pchBuffer[this.hwPeek++]; 161 | this.hwPeekCount--; 162 | if (this.hwPeek >= tBuffer.hwSize) { 163 | this.hwPeek = 0; 164 | } 165 | /* ------------------atomicity sensitive end---------------- */ 166 | 167 | if (NULL != pchByte) { 168 | *pchByte = chByte; 169 | } 170 | 171 | return true; 172 | } 173 | 174 | void enhanced_byte_queue_peek_reset(enhanced_byte_queue_t *ptObj) 175 | { 176 | /* initialise "this" (i.e. ptThis) to access class members */ 177 | class_internal(ptObj, ptThis, enhanced_byte_queue_t); 178 | /* initialise "base" (i.e. ptBase) to access protected members */ 179 | protected_internal(&this.use_as__byte_queue_t, ptBase, byte_queue_t); 180 | 181 | ASSERT(NULL != ptObj); 182 | /* ------------------atomicity sensitive start---------------- */ 183 | this.hwPeek = base.hwTail; 184 | this.hwPeekCount = base.hwCount; 185 | /* ------------------atomicity sensitive end---------------- */ 186 | } 187 | 188 | void enhanced_byte_queue_peek_get_all_peeked(enhanced_byte_queue_t *ptObj) 189 | { 190 | /* initialise "this" (i.e. ptThis) to access class members */ 191 | class_internal(ptObj, ptThis, enhanced_byte_queue_t); 192 | /* initialise "base" (i.e. ptBase) to access protected members */ 193 | protected_internal(&this.use_as__byte_queue_t, ptBase, byte_queue_t); 194 | 195 | ASSERT(NULL != ptObj); 196 | /* ------------------atomicity sensitive start---------------- */ 197 | base.hwCount = this.hwPeekCount; 198 | base.hwTail = this.hwPeek; 199 | /* ------------------atomicity sensitive end---------------- */ 200 | } 201 | 202 | /* EOF */ -------------------------------------------------------------------------------- /example/trace/trace.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyrig;ht(C)2009-2019 by GorgonMeducer * 3 | * * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); * 5 | * you may not use this file except in compliance with the License. * 6 | * You may obtain a copy of the License at * 7 | * * 8 | * http://www.apache.org/licenses/LICENSE-2.0 * 9 | * * 10 | * Unless required by applicable law or agreed to in writing, software * 11 | * distributed under the License is distributed on an "AS IS" BASIS, * 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 13 | * See the License for the specific language governing permissions and * 14 | * limitations under the License. * 15 | * * 16 | ****************************************************************************/ 17 | 18 | /*============================ INCLUDES ======================================*/ 19 | #include "./trace.h" 20 | #include 21 | #include 22 | #include 23 | 24 | #if defined(__clang__) 25 | # pragma clang diagnostic push 26 | # pragma clang diagnostic ignored "-Wunknown-warning-option" 27 | # pragma clang diagnostic ignored "-Wreserved-identifier" 28 | # pragma clang diagnostic ignored "-Wsign-compare" 29 | #endif 30 | /*============================ MACROS ========================================*/ 31 | #ifndef TRACE_DISPLAY_WIDTH 32 | # define TRACE_DISPLAY_WIDTH 16 33 | #endif 34 | 35 | #undef this 36 | #define this (*ptThis) 37 | 38 | /*============================ MACROFIED FUNCTIONS ===========================*/ 39 | #ifndef ASSERT 40 | # define ASSERT(...) 41 | #endif 42 | 43 | 44 | /*============================ TYPES =========================================*/ 45 | /*============================ LOCAL VARIABLES ===============================*/ 46 | /*============================ PROTOTYPES ====================================*/ 47 | static void __trace_init(trace_cfg_t *ptCFG); 48 | static void __trace_string(const char * pchString); 49 | static void __trace_uint32_to_string(uint32_t); 50 | static void __trace_int32_to_string(int32_t); 51 | static void __trace_uint16_to_string(uint16_t); 52 | static void __trace_int16_to_string(int16_t); 53 | static void __trace_uint8_to_string(uint8_t); 54 | static void __trace_int8_to_string(int8_t); 55 | static void __trace_float_to_string(float fValue); 56 | static void __trace_double_to_string(double fValue); 57 | static void __trace_byte_stream(uint8_t *, uint_fast16_t); 58 | static void __trace_hword_stream(uint16_t *, uint_fast16_t); 59 | static void __trace_word_stream(uint32_t *, uint_fast16_t); 60 | 61 | /*============================ GLOBAL VARIABLES ==============================*/ 62 | const i_trace_t TRACE = { 63 | .Init = &__trace_init, 64 | .ToString = { 65 | .String = &__trace_string, 66 | .UInt32 = &__trace_uint32_to_string, 67 | .Int32 = &__trace_int32_to_string, 68 | .UInt16 = &__trace_uint16_to_string, 69 | .Int16 = &__trace_int16_to_string, 70 | .UInt8 = &__trace_uint8_to_string, 71 | .Int8 = &__trace_int8_to_string, 72 | .Float = &__trace_float_to_string, 73 | .Double = &__trace_double_to_string, 74 | .Bytes = &__trace_byte_stream, 75 | .HWords = &__trace_hword_stream, 76 | .Words = &__trace_word_stream, 77 | }, 78 | }; 79 | 80 | /*============================ IMPLEMENTATION ================================*/ 81 | 82 | static void __trace_init(trace_cfg_t *ptCFG) 83 | { 84 | PLOOC_UNUSED_PARAM(ptCFG); 85 | } 86 | 87 | static void __trace_string(const char * pchString) 88 | { 89 | printf("%s", pchString); 90 | } 91 | 92 | static void __trace_uint32_to_string(uint32_t wValue) 93 | { 94 | printf("0x%08x", wValue); 95 | } 96 | 97 | static void __trace_int32_to_string(int32_t nValue) 98 | { 99 | printf("%d", nValue); 100 | } 101 | 102 | static void __trace_uint16_to_string(uint16_t hwValue) 103 | { 104 | printf("0x%04x", hwValue); 105 | } 106 | 107 | static void __trace_int16_to_string(int16_t iValue) 108 | { 109 | printf("%d", iValue); 110 | } 111 | 112 | static void __trace_uint8_to_string(uint8_t chValue) 113 | { 114 | printf("0x%02x", chValue); 115 | } 116 | 117 | static void __trace_int8_to_string(int8_t cValue) 118 | { 119 | printf("%d", cValue); 120 | } 121 | 122 | static void __trace_float_to_string(float fValue) 123 | { 124 | printf("%f", fValue); 125 | } 126 | 127 | static void __trace_double_to_string(double dfValue) 128 | { 129 | printf("%f", dfValue); 130 | } 131 | 132 | #define __OUTPUT_STREAM(__TYPE, __ADDR, __SIZE, __FORMAT_STR, __BLANK) \ 133 | do { \ 134 | int_fast8_t n = 0; \ 135 | uint_fast16_t __Size = (__SIZE); \ 136 | __TYPE *pSrc = (__TYPE *)(__ADDR); \ 137 | uint8_t *pchSrc; \ 138 | while(__Size > (TRACE_DISPLAY_WIDTH / sizeof(__TYPE))) { \ 139 | for (n = 0; n < (TRACE_DISPLAY_WIDTH / sizeof(__TYPE)); n++) { \ 140 | printf(__FORMAT_STR, pSrc[n]); \ 141 | } \ 142 | \ 143 | printf("\t"); \ 144 | pchSrc = (uint8_t *)pSrc; \ 145 | \ 146 | for (n = 0; n < TRACE_DISPLAY_WIDTH; n++) { \ 147 | char c = pchSrc[n]; \ 148 | if (c >= 127 || c < 32) { \ 149 | c = '.'; \ 150 | } \ 151 | printf("%c", c); \ 152 | } \ 153 | \ 154 | printf("\r\n"); \ 155 | \ 156 | pSrc += (TRACE_DISPLAY_WIDTH / sizeof(__TYPE)); \ 157 | __Size -= (TRACE_DISPLAY_WIDTH / sizeof(__TYPE)); \ 158 | } \ 159 | \ 160 | if (__Size > 0) { \ 161 | for (n = 0; n < __Size; n++) { \ 162 | printf(__FORMAT_STR, pSrc[n]); \ 163 | } \ 164 | for ( n = 0; \ 165 | n < (TRACE_DISPLAY_WIDTH/sizeof(__TYPE) - __Size); \ 166 | n++) { \ 167 | printf(__BLANK); \ 168 | } \ 169 | printf("\t"); \ 170 | pchSrc = (uint8_t *)pSrc; \ 171 | for (n = 0; n < __Size * sizeof(__TYPE); n++) { \ 172 | char c = pchSrc[n]; \ 173 | if (c > 127 || c < 32) { \ 174 | c = '.'; \ 175 | } \ 176 | printf("%c", c); \ 177 | } \ 178 | \ 179 | printf("\r\n"); \ 180 | } \ 181 | } while(0) 182 | 183 | static void __trace_word_stream(uint32_t *pwStream, uint_fast16_t hwSize) 184 | { 185 | __OUTPUT_STREAM(uint32_t, pwStream, hwSize, "%08X ", " "); 186 | } 187 | 188 | static void __trace_hword_stream(uint16_t *phwStream, uint_fast16_t hwSize) 189 | { 190 | __OUTPUT_STREAM(uint16_t, phwStream, hwSize, "%04X ", " "); 191 | } 192 | 193 | static void __trace_byte_stream(uint8_t *pchStream, uint_fast16_t hwSize) 194 | { 195 | __OUTPUT_STREAM(uint8_t, pchStream, hwSize, "%02X ", " "); 196 | } 197 | 198 | /* EOF */ -------------------------------------------------------------------------------- /CI/PLOOC_template_gcc/Drivers/CMSIS/Include/cmsis_compiler.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file cmsis_compiler.h 3 | * @brief CMSIS compiler generic header file 4 | * @version V5.0.4 5 | * @date 10. January 2018 6 | ******************************************************************************/ 7 | /* 8 | * Copyright (c) 2009-2018 Arm Limited. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #ifndef __CMSIS_COMPILER_H 26 | #define __CMSIS_COMPILER_H 27 | 28 | #include 29 | 30 | /* 31 | * Arm Compiler 4/5 32 | */ 33 | #if defined ( __CC_ARM ) 34 | #include "cmsis_armcc.h" 35 | 36 | 37 | /* 38 | * Arm Compiler 6 (armclang) 39 | */ 40 | #elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 41 | #include "cmsis_armclang.h" 42 | 43 | 44 | /* 45 | * GNU Compiler 46 | */ 47 | #elif defined ( __GNUC__ ) 48 | #include "cmsis_gcc.h" 49 | 50 | 51 | /* 52 | * IAR Compiler 53 | */ 54 | #elif defined ( __ICCARM__ ) 55 | #include 56 | 57 | 58 | /* 59 | * TI Arm Compiler 60 | */ 61 | #elif defined ( __TI_ARM__ ) 62 | #include 63 | 64 | #ifndef __ASM 65 | #define __ASM __asm 66 | #endif 67 | #ifndef __INLINE 68 | #define __INLINE inline 69 | #endif 70 | #ifndef __STATIC_INLINE 71 | #define __STATIC_INLINE static inline 72 | #endif 73 | #ifndef __STATIC_FORCEINLINE 74 | #define __STATIC_FORCEINLINE __STATIC_INLINE 75 | #endif 76 | #ifndef __NO_RETURN 77 | #define __NO_RETURN __attribute__((noreturn)) 78 | #endif 79 | #ifndef __USED 80 | #define __USED __attribute__((used)) 81 | #endif 82 | #ifndef __WEAK 83 | #define __WEAK __attribute__((weak)) 84 | #endif 85 | #ifndef __PACKED 86 | #define __PACKED __attribute__((packed)) 87 | #endif 88 | #ifndef __PACKED_STRUCT 89 | #define __PACKED_STRUCT struct __attribute__((packed)) 90 | #endif 91 | #ifndef __PACKED_UNION 92 | #define __PACKED_UNION union __attribute__((packed)) 93 | #endif 94 | #ifndef __UNALIGNED_UINT32 /* deprecated */ 95 | struct __attribute__((packed)) T_UINT32 { uint32_t v; }; 96 | #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) 97 | #endif 98 | #ifndef __UNALIGNED_UINT16_WRITE 99 | __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; }; 100 | #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void*)(addr))->v) = (val)) 101 | #endif 102 | #ifndef __UNALIGNED_UINT16_READ 103 | __PACKED_STRUCT T_UINT16_READ { uint16_t v; }; 104 | #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v) 105 | #endif 106 | #ifndef __UNALIGNED_UINT32_WRITE 107 | __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; }; 108 | #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val)) 109 | #endif 110 | #ifndef __UNALIGNED_UINT32_READ 111 | __PACKED_STRUCT T_UINT32_READ { uint32_t v; }; 112 | #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v) 113 | #endif 114 | #ifndef __ALIGNED 115 | #define __ALIGNED(x) __attribute__((aligned(x))) 116 | #endif 117 | #ifndef __RESTRICT 118 | #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored. 119 | #define __RESTRICT 120 | #endif 121 | 122 | 123 | /* 124 | * TASKING Compiler 125 | */ 126 | #elif defined ( __TASKING__ ) 127 | /* 128 | * The CMSIS functions have been implemented as intrinsics in the compiler. 129 | * Please use "carm -?i" to get an up to date list of all intrinsics, 130 | * Including the CMSIS ones. 131 | */ 132 | 133 | #ifndef __ASM 134 | #define __ASM __asm 135 | #endif 136 | #ifndef __INLINE 137 | #define __INLINE inline 138 | #endif 139 | #ifndef __STATIC_INLINE 140 | #define __STATIC_INLINE static inline 141 | #endif 142 | #ifndef __STATIC_FORCEINLINE 143 | #define __STATIC_FORCEINLINE __STATIC_INLINE 144 | #endif 145 | #ifndef __NO_RETURN 146 | #define __NO_RETURN __attribute__((noreturn)) 147 | #endif 148 | #ifndef __USED 149 | #define __USED __attribute__((used)) 150 | #endif 151 | #ifndef __WEAK 152 | #define __WEAK __attribute__((weak)) 153 | #endif 154 | #ifndef __PACKED 155 | #define __PACKED __packed__ 156 | #endif 157 | #ifndef __PACKED_STRUCT 158 | #define __PACKED_STRUCT struct __packed__ 159 | #endif 160 | #ifndef __PACKED_UNION 161 | #define __PACKED_UNION union __packed__ 162 | #endif 163 | #ifndef __UNALIGNED_UINT32 /* deprecated */ 164 | struct __packed__ T_UINT32 { uint32_t v; }; 165 | #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) 166 | #endif 167 | #ifndef __UNALIGNED_UINT16_WRITE 168 | __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; }; 169 | #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val)) 170 | #endif 171 | #ifndef __UNALIGNED_UINT16_READ 172 | __PACKED_STRUCT T_UINT16_READ { uint16_t v; }; 173 | #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v) 174 | #endif 175 | #ifndef __UNALIGNED_UINT32_WRITE 176 | __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; }; 177 | #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val)) 178 | #endif 179 | #ifndef __UNALIGNED_UINT32_READ 180 | __PACKED_STRUCT T_UINT32_READ { uint32_t v; }; 181 | #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v) 182 | #endif 183 | #ifndef __ALIGNED 184 | #define __ALIGNED(x) __align(x) 185 | #endif 186 | #ifndef __RESTRICT 187 | #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored. 188 | #define __RESTRICT 189 | #endif 190 | 191 | 192 | /* 193 | * COSMIC Compiler 194 | */ 195 | #elif defined ( __CSMC__ ) 196 | #include 197 | 198 | #ifndef __ASM 199 | #define __ASM _asm 200 | #endif 201 | #ifndef __INLINE 202 | #define __INLINE inline 203 | #endif 204 | #ifndef __STATIC_INLINE 205 | #define __STATIC_INLINE static inline 206 | #endif 207 | #ifndef __STATIC_FORCEINLINE 208 | #define __STATIC_FORCEINLINE __STATIC_INLINE 209 | #endif 210 | #ifndef __NO_RETURN 211 | // NO RETURN is automatically detected hence no warning here 212 | #define __NO_RETURN 213 | #endif 214 | #ifndef __USED 215 | #warning No compiler specific solution for __USED. __USED is ignored. 216 | #define __USED 217 | #endif 218 | #ifndef __WEAK 219 | #define __WEAK __weak 220 | #endif 221 | #ifndef __PACKED 222 | #define __PACKED @packed 223 | #endif 224 | #ifndef __PACKED_STRUCT 225 | #define __PACKED_STRUCT @packed struct 226 | #endif 227 | #ifndef __PACKED_UNION 228 | #define __PACKED_UNION @packed union 229 | #endif 230 | #ifndef __UNALIGNED_UINT32 /* deprecated */ 231 | @packed struct T_UINT32 { uint32_t v; }; 232 | #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) 233 | #endif 234 | #ifndef __UNALIGNED_UINT16_WRITE 235 | __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; }; 236 | #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val)) 237 | #endif 238 | #ifndef __UNALIGNED_UINT16_READ 239 | __PACKED_STRUCT T_UINT16_READ { uint16_t v; }; 240 | #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v) 241 | #endif 242 | #ifndef __UNALIGNED_UINT32_WRITE 243 | __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; }; 244 | #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val)) 245 | #endif 246 | #ifndef __UNALIGNED_UINT32_READ 247 | __PACKED_STRUCT T_UINT32_READ { uint32_t v; }; 248 | #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v) 249 | #endif 250 | #ifndef __ALIGNED 251 | #warning No compiler specific solution for __ALIGNED. __ALIGNED is ignored. 252 | #define __ALIGNED(x) 253 | #endif 254 | #ifndef __RESTRICT 255 | #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored. 256 | #define __RESTRICT 257 | #endif 258 | 259 | 260 | #else 261 | #error Unknown compiler. 262 | #endif 263 | 264 | 265 | #endif /* __CMSIS_COMPILER_H */ 266 | 267 | -------------------------------------------------------------------------------- /plooc_class_simple.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * Copyright(C)2009-2019 by GorgonMeducer * 3 | * and SimonQian * 4 | * * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); * 6 | * you may not use this file except in compliance with the License. * 7 | * You may obtain a copy of the License at * 8 | * * 9 | * http://www.apache.org/licenses/LICENSE-2.0 * 10 | * * 11 | * Unless required by applicable law or agreed to in writing, software * 12 | * distributed under the License is distributed on an "AS IS" BASIS, * 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 14 | * See the License for the specific language governing permissions and * 15 | * limitations under the License. * 16 | * * 17 | ****************************************************************************/ 18 | 19 | /****************************************************************************** 20 | * HOW TO USE * 21 | ******************************************************************************/ 22 | //!Add following content to your module header file, e.g. xxxxxx.h 23 | //#include "plooc_class.h" 24 | 25 | /*============================ INCLUDES ======================================*/ 26 | //#include 27 | 28 | /*! \NOTE the uint_fast8_t used in this header file is defined in stdint.h 29 | if you don't have stdint.h supported in your toolchain, you should 30 | define uint_fast8_t all by yourself with following rule: 31 | a. if the target processor is 8 bits, define it as uint8_t 32 | b. if the target processor is 16 bits, define it as uint16_t 33 | c. if the target processor is 32 bits, define it as uint32_t 34 | d. if the target processor is 64 bits, define it as either uint32_t or 35 | uint64_t 36 | */ 37 | 38 | 39 | #ifdef __cplusplus 40 | extern "C" { 41 | #endif 42 | /*============================ MACROS ========================================*/ 43 | #undef private_member 44 | #undef protected_member 45 | #undef public_member 46 | 47 | 48 | /*============================ MACROFIED FUNCTIONS ===========================*/ 49 | 50 | #ifndef __PLOOC_CLASS_SIMPLE_H__ 51 | #define __PLOOC_CLASS_SIMPLE_H__ 52 | 53 | # define __def_simple_class(__name) struct __name 54 | # define def_simple_class(__name) __def_simple_class(__name) 55 | # define define_simple_class(__name) def_simple_class(__name) 56 | # define declare_simple_class(__name) typedef struct __name __name; 57 | # define dcl_simple_class(__name) declare_simple_class(__name) 58 | 59 | #endif /* __PLOOC_CLASS_SIMPLE_H__ */ 60 | 61 | #if defined(__OOC_DEBUG__) 62 | 63 | # define private_member(...) PLOOC_VISIBLE(__VA_ARGS__) 64 | # define protected_member(...) PLOOC_VISIBLE(__VA_ARGS__) 65 | # define public_member(...) PLOOC_VISIBLE(__VA_ARGS__) 66 | 67 | #elif defined(__PLOOC_CLASS_IMPLEMENT__) || defined(__PLOOC_CLASS_IMPLEMENT) 68 | 69 | # define private_member(...) PLOOC_VISIBLE(__VA_ARGS__) 70 | # define protected_member(...) PLOOC_VISIBLE(__VA_ARGS__) 71 | # define public_member(...) PLOOC_VISIBLE(__VA_ARGS__) 72 | 73 | #elif defined(__PLOOC_CLASS_INHERIT__) || defined(__PLOOC_CLASS_INHERIT) 74 | 75 | # define private_member(...) PLOOC_INVISIBLE(__VA_ARGS__) 76 | # define protected_member(...) PLOOC_VISIBLE(__VA_ARGS__) 77 | # define public_member(...) PLOOC_VISIBLE(__VA_ARGS__) 78 | 79 | #else /* __PLOOC_CLASS_EXTERN */ 80 | 81 | # define private_member(...) PLOOC_INVISIBLE(__VA_ARGS__) 82 | # define protected_member(...) PLOOC_INVISIBLE(__VA_ARGS__) 83 | # define public_member(...) PLOOC_VISIBLE(__VA_ARGS__) 84 | 85 | #endif 86 | 87 | // code below is just try to be compatible with plooc_class_strict 88 | #undef declare_class 89 | #undef dcl_class 90 | #undef def_class 91 | #undef define_class 92 | #undef __def_class 93 | #undef end_def_class 94 | #undef end_define_class 95 | #undef __end_def_class 96 | #undef extern_class 97 | #undef __extern_class 98 | #undef end_extern_class 99 | #undef __end_extern_class 100 | 101 | 102 | #define __end_def_class(...) 103 | 104 | #define __def_class(__name, ...) \ 105 | typedef struct __name __name; \ 106 | struct __name { \ 107 | __VA_ARGS__ \ 108 | }; 109 | 110 | 111 | #if defined(__PLOOC_CLASS_IMPLEMENT__) || defined(__PLOOC_CLASS_IMPLEMENT) 112 | 113 | # undef __class 114 | # define __class(__name) __name 115 | 116 | # undef class 117 | # define class(__name) __class(__name) 118 | 119 | # undef __with_class 120 | # define __with_class(__type, __src, ...) \ 121 | { \ 122 | class(__type)*_ =(class(__type) *)(__src); \ 123 | PLOOC_UNUSED_PARAM(_); \ 124 | __VA_ARGS__; \ 125 | } \ 126 | for (class(__type)*_ =(class(__type) *)(__src); NULL != _; _ = NULL) 127 | 128 | # undef with_class 129 | # define with_class(__type, __src, ...) \ 130 | __with_class(__type, __src, __VA_ARGS__) 131 | 132 | # undef __class_internal 133 | # define __class_internal(__src, __des, __type, ...) \ 134 | class(__type) *(__des) = (class(__type) *)(__src); \ 135 | PLOOC_UNUSED_PARAM(__des); \ 136 | __with_class(__type, (__src), __VA_ARGS__) 137 | 138 | # undef class_internal 139 | # define class_internal(__src, __des, __type,...) \ 140 | __class_internal(__src, __des, __type, __VA_ARGS__) 141 | 142 | #define __extern_class(...) 143 | 144 | #define __end_extern_class(...) 145 | 146 | #elif defined(__PLOOC_CLASS_INHERIT__) || defined(__PLOOC_CLASS_INHERIT) 147 | 148 | # undef __class_protected 149 | # define __class_protected(__name) __name 150 | 151 | # undef class_protected 152 | # define class_protected(__name) __class_protected(__name) 153 | 154 | 155 | 156 | # undef __with_protected 157 | # define __with_protected(__type, __src, ...) \ 158 | { \ 159 | class_protected(__type)*_ =(class_protected(__type) *)(__src); \ 160 | PLOOC_UNUSED_PARAM(_); \ 161 | __VA_ARGS__; \ 162 | } 163 | 164 | # undef with_protected 165 | # define with_protected(__type, __src, ...) \ 166 | __with_protected(__type, __src, __VA_ARGS__) 167 | 168 | 169 | # undef __protected_internal 170 | # define __protected_internal(__src, __des, __type, ...) \ 171 | class_protected(__type) *(__des)=(class_protected(__type) *)(__src);\ 172 | PLOOC_UNUSED_PARAM(__des); \ 173 | __with_protected(__type, __src, __VA_ARGS__) 174 | 175 | # undef protected_internal 176 | # define protected_internal(__src, __des, __type, ...) \ 177 | __protected_internal(__src, __des, __type, __VA_ARGS__) 178 | 179 | #define __extern_class(...) 180 | 181 | #define __end_extern_class(...) 182 | 183 | #else /* __PLOOC_CLASS_EXTERN */ 184 | 185 | #define __extern_class(...) __def_class(__VA_ARGS__) 186 | 187 | #define __end_extern_class(...) 188 | 189 | #endif 190 | 191 | #undef which 192 | #define which(...) PLOOC_VISIBLE(__VA_ARGS__) 193 | 194 | #define def_class(__name, ...) __def_class(__name, __VA_ARGS__) 195 | #define define_class(__name, ...) def_class(__name, __VA_ARGS__) 196 | 197 | #define end_def_class(...) __end_def_class(__VA_ARGS__) 198 | #define end_define_class(...) end_def_class(__VA_ARGS__) 199 | 200 | #define dcl_class(__name) typedef struct __name __name; 201 | #define declare_class(__name) typedef struct __name __name; 202 | 203 | #define extern_class(__name, ...) __extern_class(__name, __VA_ARGS__) 204 | 205 | #define end_extern_class(__name, ...) __end_extern_class(__name, __VA_ARGS__) 206 | 207 | #undef __PLOOC_CLASS_IMPLEMENT__ 208 | #undef __PLOOC_CLASS_INHERIT__ 209 | #undef __PLOOC_CLASS_IMPLEMENT 210 | #undef __PLOOC_CLASS_INHERIT 211 | /*============================ TYPES =========================================*/ 212 | /*============================ GLOBAL VARIABLES ==============================*/ 213 | /*============================ LOCAL VARIABLES ===============================*/ 214 | /*============================ PROTOTYPES ====================================*/ 215 | 216 | #ifdef __cplusplus 217 | } 218 | #endif 219 | -------------------------------------------------------------------------------- /CI/PLOOC_template_gcc/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f1xx_hal_flash.h 4 | * @author MCD Application Team 5 | * @brief Header file of Flash HAL module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2016 STMicroelectronics. 10 | * All rights reserved.

11 | * 12 | * This software component is licensed by ST under BSD 3-Clause license, 13 | * the "License"; You may not use this file except in compliance with the 14 | * License. You may obtain a copy of the License at: 15 | * opensource.org/licenses/BSD-3-Clause 16 | * 17 | ****************************************************************************** 18 | */ 19 | 20 | /* Define to prevent recursive inclusion -------------------------------------*/ 21 | #ifndef __STM32F1xx_HAL_FLASH_H 22 | #define __STM32F1xx_HAL_FLASH_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "stm32f1xx_hal_def.h" 30 | 31 | /** @addtogroup STM32F1xx_HAL_Driver 32 | * @{ 33 | */ 34 | 35 | /** @addtogroup FLASH 36 | * @{ 37 | */ 38 | 39 | /** @addtogroup FLASH_Private_Constants 40 | * @{ 41 | */ 42 | #define FLASH_TIMEOUT_VALUE 50000U /* 50 s */ 43 | /** 44 | * @} 45 | */ 46 | 47 | /** @addtogroup FLASH_Private_Macros 48 | * @{ 49 | */ 50 | 51 | #define IS_FLASH_TYPEPROGRAM(VALUE) (((VALUE) == FLASH_TYPEPROGRAM_HALFWORD) || \ 52 | ((VALUE) == FLASH_TYPEPROGRAM_WORD) || \ 53 | ((VALUE) == FLASH_TYPEPROGRAM_DOUBLEWORD)) 54 | 55 | #if defined(FLASH_ACR_LATENCY) 56 | #define IS_FLASH_LATENCY(__LATENCY__) (((__LATENCY__) == FLASH_LATENCY_0) || \ 57 | ((__LATENCY__) == FLASH_LATENCY_1) || \ 58 | ((__LATENCY__) == FLASH_LATENCY_2)) 59 | 60 | #else 61 | #define IS_FLASH_LATENCY(__LATENCY__) ((__LATENCY__) == FLASH_LATENCY_0) 62 | #endif /* FLASH_ACR_LATENCY */ 63 | /** 64 | * @} 65 | */ 66 | 67 | /* Exported types ------------------------------------------------------------*/ 68 | /** @defgroup FLASH_Exported_Types FLASH Exported Types 69 | * @{ 70 | */ 71 | 72 | /** 73 | * @brief FLASH Procedure structure definition 74 | */ 75 | typedef enum 76 | { 77 | FLASH_PROC_NONE = 0U, 78 | FLASH_PROC_PAGEERASE = 1U, 79 | FLASH_PROC_MASSERASE = 2U, 80 | FLASH_PROC_PROGRAMHALFWORD = 3U, 81 | FLASH_PROC_PROGRAMWORD = 4U, 82 | FLASH_PROC_PROGRAMDOUBLEWORD = 5U 83 | } FLASH_ProcedureTypeDef; 84 | 85 | /** 86 | * @brief FLASH handle Structure definition 87 | */ 88 | typedef struct 89 | { 90 | __IO FLASH_ProcedureTypeDef ProcedureOnGoing; /*!< Internal variable to indicate which procedure is ongoing or not in IT context */ 91 | 92 | __IO uint32_t DataRemaining; /*!< Internal variable to save the remaining pages to erase or half-word to program in IT context */ 93 | 94 | __IO uint32_t Address; /*!< Internal variable to save address selected for program or erase */ 95 | 96 | __IO uint64_t Data; /*!< Internal variable to save data to be programmed */ 97 | 98 | HAL_LockTypeDef Lock; /*!< FLASH locking object */ 99 | 100 | __IO uint32_t ErrorCode; /*!< FLASH error code 101 | This parameter can be a value of @ref FLASH_Error_Codes */ 102 | } FLASH_ProcessTypeDef; 103 | 104 | /** 105 | * @} 106 | */ 107 | 108 | /* Exported constants --------------------------------------------------------*/ 109 | /** @defgroup FLASH_Exported_Constants FLASH Exported Constants 110 | * @{ 111 | */ 112 | 113 | /** @defgroup FLASH_Error_Codes FLASH Error Codes 114 | * @{ 115 | */ 116 | 117 | #define HAL_FLASH_ERROR_NONE 0x00U /*!< No error */ 118 | #define HAL_FLASH_ERROR_PROG 0x01U /*!< Programming error */ 119 | #define HAL_FLASH_ERROR_WRP 0x02U /*!< Write protection error */ 120 | #define HAL_FLASH_ERROR_OPTV 0x04U /*!< Option validity error */ 121 | 122 | /** 123 | * @} 124 | */ 125 | 126 | /** @defgroup FLASH_Type_Program FLASH Type Program 127 | * @{ 128 | */ 129 | #define FLASH_TYPEPROGRAM_HALFWORD 0x01U /*!ACR |= FLASH_ACR_HLFCYA) 183 | 184 | /** 185 | * @brief Disable the FLASH half cycle access. 186 | * @note half cycle access can only be used with a low-frequency clock of less than 187 | 8 MHz that can be obtained with the use of HSI or HSE but not of PLL. 188 | * @retval None 189 | */ 190 | #define __HAL_FLASH_HALF_CYCLE_ACCESS_DISABLE() (FLASH->ACR &= (~FLASH_ACR_HLFCYA)) 191 | 192 | /** 193 | * @} 194 | */ 195 | 196 | #if defined(FLASH_ACR_LATENCY) 197 | /** @defgroup FLASH_EM_Latency FLASH Latency 198 | * @brief macros to handle FLASH Latency 199 | * @{ 200 | */ 201 | 202 | /** 203 | * @brief Set the FLASH Latency. 204 | * @param __LATENCY__ FLASH Latency 205 | * The value of this parameter depend on device used within the same series 206 | * @retval None 207 | */ 208 | #define __HAL_FLASH_SET_LATENCY(__LATENCY__) (FLASH->ACR = (FLASH->ACR&(~FLASH_ACR_LATENCY)) | (__LATENCY__)) 209 | 210 | 211 | /** 212 | * @brief Get the FLASH Latency. 213 | * @retval FLASH Latency 214 | * The value of this parameter depend on device used within the same series 215 | */ 216 | #define __HAL_FLASH_GET_LATENCY() (READ_BIT((FLASH->ACR), FLASH_ACR_LATENCY)) 217 | 218 | /** 219 | * @} 220 | */ 221 | 222 | #endif /* FLASH_ACR_LATENCY */ 223 | /** @defgroup FLASH_Prefetch FLASH Prefetch 224 | * @brief macros to handle FLASH Prefetch buffer 225 | * @{ 226 | */ 227 | /** 228 | * @brief Enable the FLASH prefetch buffer. 229 | * @retval None 230 | */ 231 | #define __HAL_FLASH_PREFETCH_BUFFER_ENABLE() (FLASH->ACR |= FLASH_ACR_PRFTBE) 232 | 233 | /** 234 | * @brief Disable the FLASH prefetch buffer. 235 | * @retval None 236 | */ 237 | #define __HAL_FLASH_PREFETCH_BUFFER_DISABLE() (FLASH->ACR &= (~FLASH_ACR_PRFTBE)) 238 | 239 | /** 240 | * @} 241 | */ 242 | 243 | /** 244 | * @} 245 | */ 246 | 247 | /* Include FLASH HAL Extended module */ 248 | #include "stm32f1xx_hal_flash_ex.h" 249 | 250 | /* Exported functions --------------------------------------------------------*/ 251 | /** @addtogroup FLASH_Exported_Functions 252 | * @{ 253 | */ 254 | 255 | /** @addtogroup FLASH_Exported_Functions_Group1 256 | * @{ 257 | */ 258 | /* IO operation functions *****************************************************/ 259 | HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data); 260 | HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint64_t Data); 261 | 262 | /* FLASH IRQ handler function */ 263 | void HAL_FLASH_IRQHandler(void); 264 | /* Callbacks in non blocking modes */ 265 | void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue); 266 | void HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue); 267 | 268 | /** 269 | * @} 270 | */ 271 | 272 | /** @addtogroup FLASH_Exported_Functions_Group2 273 | * @{ 274 | */ 275 | /* Peripheral Control functions ***********************************************/ 276 | HAL_StatusTypeDef HAL_FLASH_Unlock(void); 277 | HAL_StatusTypeDef HAL_FLASH_Lock(void); 278 | HAL_StatusTypeDef HAL_FLASH_OB_Unlock(void); 279 | HAL_StatusTypeDef HAL_FLASH_OB_Lock(void); 280 | void HAL_FLASH_OB_Launch(void); 281 | 282 | /** 283 | * @} 284 | */ 285 | 286 | /** @addtogroup FLASH_Exported_Functions_Group3 287 | * @{ 288 | */ 289 | /* Peripheral State and Error functions ***************************************/ 290 | uint32_t HAL_FLASH_GetError(void); 291 | 292 | /** 293 | * @} 294 | */ 295 | 296 | /** 297 | * @} 298 | */ 299 | 300 | /* Private function -------------------------------------------------*/ 301 | /** @addtogroup FLASH_Private_Functions 302 | * @{ 303 | */ 304 | HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout); 305 | #if defined(FLASH_BANK2_END) 306 | HAL_StatusTypeDef FLASH_WaitForLastOperationBank2(uint32_t Timeout); 307 | #endif /* FLASH_BANK2_END */ 308 | 309 | /** 310 | * @} 311 | */ 312 | 313 | /** 314 | * @} 315 | */ 316 | 317 | /** 318 | * @} 319 | */ 320 | 321 | #ifdef __cplusplus 322 | } 323 | #endif 324 | 325 | #endif /* __STM32F1xx_HAL_FLASH_H */ 326 | 327 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 328 | 329 | -------------------------------------------------------------------------------- /CI/PLOOC_template_gcc/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f1xx_hal_tim_ex.h 4 | * @author MCD Application Team 5 | * @brief Header file of TIM HAL Extended module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2016 STMicroelectronics. 10 | * All rights reserved.

11 | * 12 | * This software component is licensed by ST under BSD 3-Clause license, 13 | * the "License"; You may not use this file except in compliance with the 14 | * License. You may obtain a copy of the License at: 15 | * opensource.org/licenses/BSD-3-Clause 16 | * 17 | ****************************************************************************** 18 | */ 19 | 20 | /* Define to prevent recursive inclusion -------------------------------------*/ 21 | #ifndef STM32F1xx_HAL_TIM_EX_H 22 | #define STM32F1xx_HAL_TIM_EX_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "stm32f1xx_hal_def.h" 30 | 31 | /** @addtogroup STM32F1xx_HAL_Driver 32 | * @{ 33 | */ 34 | 35 | /** @addtogroup TIMEx 36 | * @{ 37 | */ 38 | 39 | /* Exported types ------------------------------------------------------------*/ 40 | /** @defgroup TIMEx_Exported_Types TIM Extended Exported Types 41 | * @{ 42 | */ 43 | 44 | /** 45 | * @brief TIM Hall sensor Configuration Structure definition 46 | */ 47 | 48 | typedef struct 49 | { 50 | uint32_t IC1Polarity; /*!< Specifies the active edge of the input signal. 51 | This parameter can be a value of @ref TIM_Input_Capture_Polarity */ 52 | 53 | uint32_t IC1Prescaler; /*!< Specifies the Input Capture Prescaler. 54 | This parameter can be a value of @ref TIM_Input_Capture_Prescaler */ 55 | 56 | uint32_t IC1Filter; /*!< Specifies the input capture filter. 57 | This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */ 58 | 59 | uint32_t Commutation_Delay; /*!< Specifies the pulse value to be loaded into the Capture Compare Register. 60 | This parameter can be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */ 61 | } TIM_HallSensor_InitTypeDef; 62 | /** 63 | * @} 64 | */ 65 | /* End of exported types -----------------------------------------------------*/ 66 | 67 | /* Exported constants --------------------------------------------------------*/ 68 | /** @defgroup TIMEx_Exported_Constants TIM Extended Exported Constants 69 | * @{ 70 | */ 71 | 72 | /** @defgroup TIMEx_Remap TIM Extended Remapping 73 | * @{ 74 | */ 75 | /** 76 | * @} 77 | */ 78 | 79 | /** 80 | * @} 81 | */ 82 | /* End of exported constants -------------------------------------------------*/ 83 | 84 | /* Exported macro ------------------------------------------------------------*/ 85 | /** @defgroup TIMEx_Exported_Macros TIM Extended Exported Macros 86 | * @{ 87 | */ 88 | 89 | /** 90 | * @} 91 | */ 92 | /* End of exported macro -----------------------------------------------------*/ 93 | 94 | /* Private macro -------------------------------------------------------------*/ 95 | /** @defgroup TIMEx_Private_Macros TIM Extended Private Macros 96 | * @{ 97 | */ 98 | 99 | /** 100 | * @} 101 | */ 102 | /* End of private macro ------------------------------------------------------*/ 103 | 104 | /* Exported functions --------------------------------------------------------*/ 105 | /** @addtogroup TIMEx_Exported_Functions TIM Extended Exported Functions 106 | * @{ 107 | */ 108 | 109 | /** @addtogroup TIMEx_Exported_Functions_Group1 Extended Timer Hall Sensor functions 110 | * @brief Timer Hall Sensor functions 111 | * @{ 112 | */ 113 | /* Timer Hall Sensor functions **********************************************/ 114 | HAL_StatusTypeDef HAL_TIMEx_HallSensor_Init(TIM_HandleTypeDef *htim, TIM_HallSensor_InitTypeDef *sConfig); 115 | HAL_StatusTypeDef HAL_TIMEx_HallSensor_DeInit(TIM_HandleTypeDef *htim); 116 | 117 | void HAL_TIMEx_HallSensor_MspInit(TIM_HandleTypeDef *htim); 118 | void HAL_TIMEx_HallSensor_MspDeInit(TIM_HandleTypeDef *htim); 119 | 120 | /* Blocking mode: Polling */ 121 | HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start(TIM_HandleTypeDef *htim); 122 | HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop(TIM_HandleTypeDef *htim); 123 | /* Non-Blocking mode: Interrupt */ 124 | HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_IT(TIM_HandleTypeDef *htim); 125 | HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_IT(TIM_HandleTypeDef *htim); 126 | /* Non-Blocking mode: DMA */ 127 | HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_DMA(TIM_HandleTypeDef *htim, uint32_t *pData, uint16_t Length); 128 | HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_DMA(TIM_HandleTypeDef *htim); 129 | /** 130 | * @} 131 | */ 132 | 133 | /** @addtogroup TIMEx_Exported_Functions_Group2 Extended Timer Complementary Output Compare functions 134 | * @brief Timer Complementary Output Compare functions 135 | * @{ 136 | */ 137 | /* Timer Complementary Output Compare functions *****************************/ 138 | /* Blocking mode: Polling */ 139 | HAL_StatusTypeDef HAL_TIMEx_OCN_Start(TIM_HandleTypeDef *htim, uint32_t Channel); 140 | HAL_StatusTypeDef HAL_TIMEx_OCN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel); 141 | 142 | /* Non-Blocking mode: Interrupt */ 143 | HAL_StatusTypeDef HAL_TIMEx_OCN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel); 144 | HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel); 145 | 146 | /* Non-Blocking mode: DMA */ 147 | HAL_StatusTypeDef HAL_TIMEx_OCN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length); 148 | HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel); 149 | /** 150 | * @} 151 | */ 152 | 153 | /** @addtogroup TIMEx_Exported_Functions_Group3 Extended Timer Complementary PWM functions 154 | * @brief Timer Complementary PWM functions 155 | * @{ 156 | */ 157 | /* Timer Complementary PWM functions ****************************************/ 158 | /* Blocking mode: Polling */ 159 | HAL_StatusTypeDef HAL_TIMEx_PWMN_Start(TIM_HandleTypeDef *htim, uint32_t Channel); 160 | HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel); 161 | 162 | /* Non-Blocking mode: Interrupt */ 163 | HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel); 164 | HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel); 165 | /* Non-Blocking mode: DMA */ 166 | HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length); 167 | HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel); 168 | /** 169 | * @} 170 | */ 171 | 172 | /** @addtogroup TIMEx_Exported_Functions_Group4 Extended Timer Complementary One Pulse functions 173 | * @brief Timer Complementary One Pulse functions 174 | * @{ 175 | */ 176 | /* Timer Complementary One Pulse functions **********************************/ 177 | /* Blocking mode: Polling */ 178 | HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start(TIM_HandleTypeDef *htim, uint32_t OutputChannel); 179 | HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop(TIM_HandleTypeDef *htim, uint32_t OutputChannel); 180 | 181 | /* Non-Blocking mode: Interrupt */ 182 | HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel); 183 | HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel); 184 | /** 185 | * @} 186 | */ 187 | 188 | /** @addtogroup TIMEx_Exported_Functions_Group5 Extended Peripheral Control functions 189 | * @brief Peripheral Control functions 190 | * @{ 191 | */ 192 | /* Extended Control functions ************************************************/ 193 | HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent(TIM_HandleTypeDef *htim, uint32_t InputTrigger, 194 | uint32_t CommutationSource); 195 | HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent_IT(TIM_HandleTypeDef *htim, uint32_t InputTrigger, 196 | uint32_t CommutationSource); 197 | HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent_DMA(TIM_HandleTypeDef *htim, uint32_t InputTrigger, 198 | uint32_t CommutationSource); 199 | HAL_StatusTypeDef HAL_TIMEx_MasterConfigSynchronization(TIM_HandleTypeDef *htim, 200 | TIM_MasterConfigTypeDef *sMasterConfig); 201 | HAL_StatusTypeDef HAL_TIMEx_ConfigBreakDeadTime(TIM_HandleTypeDef *htim, 202 | TIM_BreakDeadTimeConfigTypeDef *sBreakDeadTimeConfig); 203 | HAL_StatusTypeDef HAL_TIMEx_RemapConfig(TIM_HandleTypeDef *htim, uint32_t Remap); 204 | /** 205 | * @} 206 | */ 207 | 208 | /** @addtogroup TIMEx_Exported_Functions_Group6 Extended Callbacks functions 209 | * @brief Extended Callbacks functions 210 | * @{ 211 | */ 212 | /* Extended Callback **********************************************************/ 213 | void HAL_TIMEx_CommutCallback(TIM_HandleTypeDef *htim); 214 | void HAL_TIMEx_CommutHalfCpltCallback(TIM_HandleTypeDef *htim); 215 | void HAL_TIMEx_BreakCallback(TIM_HandleTypeDef *htim); 216 | /** 217 | * @} 218 | */ 219 | 220 | /** @addtogroup TIMEx_Exported_Functions_Group7 Extended Peripheral State functions 221 | * @brief Extended Peripheral State functions 222 | * @{ 223 | */ 224 | /* Extended Peripheral State functions ***************************************/ 225 | HAL_TIM_StateTypeDef HAL_TIMEx_HallSensor_GetState(TIM_HandleTypeDef *htim); 226 | HAL_TIM_ChannelStateTypeDef HAL_TIMEx_GetChannelNState(TIM_HandleTypeDef *htim, uint32_t ChannelN); 227 | /** 228 | * @} 229 | */ 230 | 231 | /** 232 | * @} 233 | */ 234 | /* End of exported functions -------------------------------------------------*/ 235 | 236 | /* Private functions----------------------------------------------------------*/ 237 | /** @addtogroup TIMEx_Private_Functions TIMEx Private Functions 238 | * @{ 239 | */ 240 | void TIMEx_DMACommutationCplt(DMA_HandleTypeDef *hdma); 241 | void TIMEx_DMACommutationHalfCplt(DMA_HandleTypeDef *hdma); 242 | /** 243 | * @} 244 | */ 245 | /* End of private functions --------------------------------------------------*/ 246 | 247 | /** 248 | * @} 249 | */ 250 | 251 | /** 252 | * @} 253 | */ 254 | 255 | #ifdef __cplusplus 256 | } 257 | #endif 258 | 259 | 260 | #endif /* STM32F1xx_HAL_TIM_EX_H */ 261 | 262 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 263 | --------------------------------------------------------------------------------