summaryrefslogtreecommitdiff
path: root/Project
diff options
context:
space:
mode:
Diffstat (limited to 'Project')
-rw-r--r--Project/inc/main.h41
-rw-r--r--Project/inc/stm32f0xx_conf.h84
-rw-r--r--Project/inc/stm32f0xx_it.h53
-rw-r--r--Project/ld/_flash.ld33
-rw-r--r--Project/ld/_sram.ld26
-rw-r--r--Project/ld/stm32f072x8.ld4
-rw-r--r--Project/src/main.c289
-rw-r--r--Project/src/platform/stm32f0-gcc/freertos/FreeRTOSConfig.h157
-rw-r--r--Project/src/platform/stm32f0-gcc/freertos/port.c368
-rw-r--r--Project/src/platform/stm32f0-gcc/freertos/portmacro.h157
-rw-r--r--Project/src/platform/stm32f0-gcc/startup/handlers_cm.c113
-rw-r--r--Project/src/platform/stm32f0-gcc/startup/stack.cpp7
-rw-r--r--Project/src/platform/stm32f0-gcc/startup/startup.cpp96
-rw-r--r--Project/src/stm32f0xx_it.c249
-rw-r--r--Project/src/system_stm32f0xx.c402
15 files changed, 0 insertions, 2079 deletions
diff --git a/Project/inc/main.h b/Project/inc/main.h
deleted file mode 100644
index ce89a06..0000000
--- a/Project/inc/main.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- ******************************************************************************
- * @file STM32L152_Ex01_3TKeys_EVAL\inc\main.h
- * @author MCD Application Team
- * @version V1.1.0
- * @date 24-February-2014
- * @brief Header for main.c module
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
- *
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.st.com/software_license_agreement_liberty_v2
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************
- */
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __MAIN_H
-#define __MAIN_H
-
-
-/* Exported types ------------------------------------------------------------*/
-/* Exported variables --------------------------------------------------------*/
-/* Exported macros -----------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-
-
-#endif /* __MAIN_H */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/Project/inc/stm32f0xx_conf.h b/Project/inc/stm32f0xx_conf.h
deleted file mode 100644
index adbf30b..0000000
--- a/Project/inc/stm32f0xx_conf.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- ******************************************************************************
- * @file Projects\Demonstration\stm32f0xx_conf.h
- * @author MCD Application Team
- * @version V1.0.0
- * @date 17-January-2014
- * @brief Library configuration file.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
- *
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.st.com/software_license_agreement_liberty_v2
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************
- */
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __STM32F0XX_CONF_H
-#define __STM32F0XX_CONF_H
-
-
-/* Includes ------------------------------------------------------------------*/
-/* Comment the line below to disable peripheral header file inclusion */
-#include "stm32f0xx_adc.h"
-//#include "stm32f0xx_can.h"
-//#include "stm32f0xx_cec.h"
-//#include "stm32f0xx_crc.h"
-//#include "stm32f0xx_crs.h"
-//#include "stm32f0xx_comp.h"
-//#include "stm32f0xx_dac.h"
-//#include "stm32f0xx_dbgmcu.h"
-#include "stm32f0xx_dma.h"
-//#include "stm32f0xx_exti.h"
-//#include "stm32f0xx_flash.h"
-#include "stm32f0xx_gpio.h"
-#include "stm32f0xx_syscfg.h"
-//#include "stm32f0xx_i2c.h"
-//#include "stm32f0xx_iwdg.h"
-#include "stm32f0xx_pwr.h"
-#include "stm32f0xx_rcc.h"
-#include "stm32f0xx_rtc.h"
-#include "stm32f0xx_spi.h"
-#include "stm32f0xx_tim.h"
-//#include "stm32f0xx_usart.h"
-//#include "stm32f0xx_wwdg.h"
-#include "stm32f0xx_misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */
-
-/* Exported types ------------------------------------------------------------*/
-/* Exported constants --------------------------------------------------------*/
-/* Uncomment the line below to expanse the "assert_param" macro in the
- Standard Peripheral Library drivers code */
-/*#define USE_FULL_ASSERT 1*/
-
-/* Exported macro ------------------------------------------------------------*/
-#ifdef USE_FULL_ASSERT
-
-/**
- * @brief The assert_param macro is used for function's parameters check.
- * @param expr: If expr is false, it calls assert_failed function which reports
- * the name of the source file and the source line number of the call
- * that failed. If expr is true, it returns no value.
- * @retval None
- */
- #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__))
-/* Exported functions ------------------------------------------------------- */
- void assert_failed(uint8_t* file, uint32_t line);
-#else
- #define assert_param(expr) ((void)0)
-#endif /* USE_FULL_ASSERT */
-
-#endif /* __STM32F0XX_CONF_H */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/Project/inc/stm32f0xx_it.h b/Project/inc/stm32f0xx_it.h
deleted file mode 100644
index 4abda02..0000000
--- a/Project/inc/stm32f0xx_it.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- ******************************************************************************
- * @file Projects\Demonstration\stm32f0xx_it.h
- * @author MCD Application Team
- * @version V1.0.0
- * @date 17-January-2014
- * @brief This file contains the headers of the interrupt handlers.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
- *
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.st.com/software_license_agreement_liberty_v2
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************
- */
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __STM32F0XX_IT_H
-#define __STM32F0XX_IT_H
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-
-/* Includes ------------------------------------------------------------------*/
-#include "main.h"
-
-/* Exported types ------------------------------------------------------------*/
-/* Exported constants --------------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-
-void NMI_Handler(void);
-void HardFault_Handler(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __STM32F0XX_IT_H */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/Project/ld/_flash.ld b/Project/ld/_flash.ld
deleted file mode 100644
index ec94ea7..0000000
--- a/Project/ld/_flash.ld
+++ /dev/null
@@ -1,33 +0,0 @@
-SECTIONS {
- . = ORIGIN(FLASH);
- .text : {
- KEEP(*(.stack))
- KEEP(*(.vectors))
- KEEP(*(.vectors*))
- KEEP(*(.text))
- . = ALIGN(4);
- *(.text*)
- . = ALIGN(4);
- KEEP(*(.rodata))
- *(.rodata*)
- . = ALIGN(4);
- } >FLASH
-
- .preinit_array ALIGN(4): {
- __preinit_array_start = .;
- KEEP(*(.preinit_array))
- __preinit_array_end = .;
- } >FLASH
-
- .init_array ALIGN(4): {
- __init_array_start = .;
- KEEP(*(.init_array))
- __init_array_end = .;
- } >FLASH
-
- .fini_array ALIGN(4): {
- __fini_array_start = .;
- KEEP(*(.fini_array))
- __fini_array_end = .;
- } >FLASH
-}
diff --git a/Project/ld/_sram.ld b/Project/ld/_sram.ld
deleted file mode 100644
index 4993c63..0000000
--- a/Project/ld/_sram.ld
+++ /dev/null
@@ -1,26 +0,0 @@
-SECTIONS {
- __stacktop = ORIGIN(SRAM) + LENGTH(SRAM);
- __data_load = LOADADDR(.data);
- . = ORIGIN(SRAM);
-
- .data ALIGN(4) : {
- __data_start = .;
- *(.data)
- *(.data*)
- . = ALIGN(4);
- __data_end = .;
- } >SRAM AT >FLASH
-
- .bss ALIGN(4) (NOLOAD) : {
- __bss_start = .;
- *(.bss)
- *(.bss*)
- . = ALIGN(4);
- __bss_end = .;
- *(.noinit)
- *(.noinit*)
- } >SRAM
-
- . = ALIGN(4);
- __heap_start = .;
-}
diff --git a/Project/ld/stm32f072x8.ld b/Project/ld/stm32f072x8.ld
deleted file mode 100644
index 7600040..0000000
--- a/Project/ld/stm32f072x8.ld
+++ /dev/null
@@ -1,4 +0,0 @@
-MEMORY {
- FLASH(rx) : ORIGIN = 0x08000000, LENGTH = 64K
- SRAM(rwx) : ORIGIN = 0x20000000, LENGTH = 16K
-}
diff --git a/Project/src/main.c b/Project/src/main.c
deleted file mode 100644
index aa8c111..0000000
--- a/Project/src/main.c
+++ /dev/null
@@ -1,289 +0,0 @@
-/**
- ******************************************************************************
- * @file STM32L152_Ex01_3TKeys_EVAL\src\main.c
- * @author MCD Application Team
- * @version V1.1.0
- * @date 24-February-2014
- * @brief Basic example of how to use the STMTouch Driver.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
- *
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.st.com/software_license_agreement_liberty_v2
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************
- */
-
-/*
- Здесь необходимо создать большой комментарий о характеристиках железа МК. Или
-же лучше создать отдельный файл и сделать на него ссылку. Кстати, такой файл
-создает программа STM32CubeMX.
-
-И вообще, нужно создать глобальную папку проекта, где будет лежать все по
-полочкам ( схема, программа, текстовые файлы, документация и тд )
-*/
-
-// Это программа для версии NixieClock_v2, которая является модифицированной версией предыдущей
-// NixieLUT
-
-/* Includes ------------------------------------------------------------------*/
-#include "time.h"
-#include "main.h"
-
-// FreeRTOS includes
-#include "FreeRTOS.h"
-#include "task.h"
-#include "queue.h"
-#include "semphr.h"
-
-#include "ltimers.h"
-#include "head_task.h"
-#include "button_task.h"
-#include "button_handler.h"
-#include "nixie_driver_task.h"
-#include "light_sensor_task.h"
-
-#ifdef LED_DRIVER
-#include "led_driver_task.h"
-#endif
-
-#include "indicate_modes_task.h"
-#include "tsl_user.h"
-#include "time.h"
-#include "stm32f0xx_usart.h"
-
-
-/* Private typedefs ----------------------------------------------------------*/
-/* Private defines -----------------------------------------------------------*/
-/* Private macros ------------------------------------------------------------*/
-
-// Задаем размеры кучи для каждой задачи отдельно
-// - как правильно определить необходимый минимум для кучи задачи?
-
-#define STACK_SIZE_HEAD ((unsigned short) 230)
-#define STACK_SIZE_NIXIE_DRIVER ((unsigned short) 80)
-#define STACK_SIZE_BUTTON ((unsigned short) 200)
-#define STACK_SIZE_LIGHT_SENSOR ((unsigned short) 70)
-#ifdef LED_DRIVER
-#define STACK_SIZE_LED_DRIVER ((unsigned short) 70)
-#endif
-#define STACK_SIZE_INDICATE_MODES ((unsigned short) 250)
-
-/* Private functions prototype ---------------------------------------------- */
-
-static void USART1Init(void)
-{
- RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);
- RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);
- GPIO_PinAFConfig(GPIOA, GPIO_PinSource9, GPIO_AF_1);
- GPIO_PinAFConfig(GPIOA, GPIO_PinSource10, GPIO_AF_1);
- GPIO_InitTypeDef GPIO_InitStructure;
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_Level_3;
- GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
- GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;
- GPIO_Init(GPIOA, &GPIO_InitStructure);
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
- GPIO_Init(GPIOA, &GPIO_InitStructure);
- USART_InitTypeDef usart_init = {0};
- usart_init.USART_BaudRate = 115200;
- usart_init.USART_WordLength = USART_WordLength_8b;
- usart_init.USART_StopBits = USART_StopBits_1;
- usart_init.USART_Parity = USART_Parity_No;
- usart_init.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
- usart_init.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
- USART_Init(USART1, &usart_init);
- USART_Cmd(USART1, ENABLE);
-}
-
-static void USART4Init(void)
-{
- RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART4, ENABLE);
- RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);
- GPIO_PinAFConfig(GPIOA, GPIO_PinSource0, GPIO_AF_4);
- GPIO_PinAFConfig(GPIOA, GPIO_PinSource1, GPIO_AF_4);
- GPIO_InitTypeDef GPIO_InitStructure;
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_Level_3;
- GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
- GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;
- GPIO_Init(GPIOA, &GPIO_InitStructure);
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;
- GPIO_Init(GPIOA, &GPIO_InitStructure);
- USART_InitTypeDef usart_init = {0};
- usart_init.USART_BaudRate = 9600;
- usart_init.USART_WordLength = USART_WordLength_8b;
- usart_init.USART_StopBits = USART_StopBits_1;
- usart_init.USART_Parity = USART_Parity_No;
- usart_init.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
- usart_init.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
- USART_Init(USART4, &usart_init);
- USART_Cmd(USART4, ENABLE);
-}
-
-static void WIFI_IO_GPIOInit(void)
-{
- RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);
- RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB, ENABLE);
- GPIO_InitTypeDef GPIO_InitStructure;
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15;
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_Level_3;
- GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
- GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;
- GPIO_Init(GPIOA, &GPIO_InitStructure);
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
- GPIO_Init(GPIOB, &GPIO_InitStructure);
- GPIO_SetBits(GPIOB, GPIO_Pin_0); // WIFI_EN
- GPIO_ResetBits(GPIOA, GPIO_Pin_15); // WIFI_IO0
-}
-
-static void USART3Init(void)
-{
- RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE);
- RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB, ENABLE);
- GPIO_PinAFConfig(GPIOB, GPIO_PinSource1, GPIO_AF_4);
- GPIO_PinAFConfig(GPIOB, GPIO_PinSource10, GPIO_AF_4);
- GPIO_PinAFConfig(GPIOB, GPIO_PinSource11, GPIO_AF_4);
- GPIO_PinAFConfig(GPIOB, GPIO_PinSource13, GPIO_AF_4);
- GPIO_InitTypeDef GPIO_InitStructure;
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_Level_3;
- GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
- GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;
- GPIO_Init(GPIOB, &GPIO_InitStructure);
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
- GPIO_Init(GPIOB, &GPIO_InitStructure);
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;
- GPIO_Init(GPIOB, &GPIO_InitStructure);
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13;
- GPIO_Init(GPIOB, &GPIO_InitStructure);
- USART_InitTypeDef usart_init = {0};
- usart_init.USART_BaudRate = 115200;
- usart_init.USART_WordLength = USART_WordLength_8b;
- usart_init.USART_StopBits = USART_StopBits_1;
- usart_init.USART_Parity = USART_Parity_No;
- usart_init.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
- usart_init.USART_HardwareFlowControl = USART_HardwareFlowControl_RTS_CTS;
- USART_Init(USART3, &usart_init);
- USART_Cmd(USART3, ENABLE);
-}
-
-// ----------------------------------------------------------------------------
-// Инициализация до создания задач
-// ----------------------------------------------------------------------------
-void InitAll ( void )
-{
- SystemInit();
- WIFI_IO_GPIOInit();
- USART1Init();
- USART3Init();
- USART4Init();
- InitLTimers();
- LightSensorInit();
-#if 0
- NixieDriverInit();
- HeadTaskInit();
- IndicateModesInit();
-#endif
-#ifdef LED_DRIVER
- LED_DriverInit();
-#endif
- TSL_user_Init();
- TimeInit();
- ButtonInit();
-}
-
-static void TestUart(void *arg)
-{
- (void) arg;
- while (1) {
- if (USART3->ISR & USART_ISR_RXNE) {
- const uint16_t data = USART_ReceiveData(USART3);
- USART_SendData(USART1, data);
- }
- if (USART1->ISR & USART_ISR_RXNE) {
- const uint16_t data = USART_ReceiveData(USART1);
- USART_SendData(USART3, data);
- }
- }
-}
-
-BaseType_t TaskSuccess;
-
-// Главный цикл ------------------------------------------------------------- //
-int main ()
-{
- InitAll ();
- // Создаем задачи FreeRTOS ----------------------------------------------- //
-
- // ВНИМАНИЕ !!!
- // Необходимо проверять кучу при создании задачи! ( и очереди )
-
- // Если в программе используется подключаемая библиотека, которая использует
- // ОСРВ, то задача должна там и создаватья. То есть это нужно оформить в
- // в виде специальной функции
- TaskSuccess = xTaskCreate(Button_Task, "Button_Task", STACK_SIZE_BUTTON, NULL, tskIDLE_PRIORITY + 2, NULL);
- configASSERT(TaskSuccess);
- TaskSuccess = xTaskCreate(LightSensor_Task, "LightSensor_Task", STACK_SIZE_LIGHT_SENSOR, NULL, tskIDLE_PRIORITY + 2, NULL);
- configASSERT(TaskSuccess);
-#if 0
- TaskSuccess = xTaskCreate(Head_Task, "Head_Task", STACK_SIZE_HEAD, NULL, tskIDLE_PRIORITY + 2, NULL);
- configASSERT(TaskSuccess);
- TaskSuccess = xTaskCreate(IndicateModes_Task, "IndicateModes_Task", STACK_SIZE_INDICATE_MODES, NULL, tskIDLE_PRIORITY + 2, NULL);
- configASSERT(TaskSuccess);
- TaskSuccess = xTaskCreate(NixieDriver_Task, "NixieDriver_Task", STACK_SIZE_NIXIE_DRIVER, NULL, tskIDLE_PRIORITY + 2, NULL);
- configASSERT(TaskSuccess);
-#endif
-#ifdef LED_DRIVER
- TaskSuccess = xTaskCreate(LED_Driver_Task, "LED_Driver_Task", STACK_SIZE_LED_DRIVER, NULL, tskIDLE_PRIORITY + 2, NULL);
- configASSERT(TaskSuccess);
-#endif
- TaskSuccess = xTaskCreate(TestUart, "TestUart", 200, NULL, tskIDLE_PRIORITY + 2, NULL);
- configASSERT(TaskSuccess);
- vTaskStartScheduler(); // И запускаем диспетчер задач ( он же планировщик )
-} // end of main
-
-
-
-#ifdef USE_FULL_ASSERT
-/**
- * @brief Reports the name of the source file and the source line number
- * where the assert_param error has occurred.
- * @param file: pointer to the source file name
- * @param line: assert_param error line source number
- * @retval None
- */
-void assert_failed ( uint8_t* file, uint32_t line )
-{
- /* User can add his own implementation to report the file name and line number,
- ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
-
- /* Infinite loop */
- for (;;)
- {
- }
-}
-#endif
-
-
-// Специальные ф-ии FreeRTOS ------------------------------------------------ //
-void vApplicationMallocFailedHook ( void ) { for( ;; ); }
-void vApplicationStackOverflowHook ( TaskHandle_t pxTask, char *pcTaskName ) { for( ;; ); }
-void vApplicationIdleHook ( void ) { }
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/Project/src/platform/stm32f0-gcc/freertos/FreeRTOSConfig.h b/Project/src/platform/stm32f0-gcc/freertos/FreeRTOSConfig.h
deleted file mode 100644
index 031cb01..0000000
--- a/Project/src/platform/stm32f0-gcc/freertos/FreeRTOSConfig.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd.
- All rights reserved
-
- VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
-
- ***************************************************************************
- * *
- * FreeRTOS provides completely free yet professionally developed, *
- * robust, strictly quality controlled, supported, and cross *
- * platform software that has become a de facto standard. *
- * *
- * Help yourself get started quickly and support the FreeRTOS *
- * project by purchasing a FreeRTOS tutorial book, reference *
- * manual, or both from: http://www.FreeRTOS.org/Documentation *
- * *
- * Thank you! *
- * *
- ***************************************************************************
-
- This file is part of the FreeRTOS distribution.
-
- FreeRTOS is free software; you can redistribute it and/or modify it under
- the terms of the GNU General Public License (version 2) as published by the
- Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
-
- >>! NOTE: The modification to the GPL is included to allow you to distribute
- >>! a combined work that includes FreeRTOS without being obliged to provide
- >>! the source code for proprietary components outside of the FreeRTOS
- >>! kernel.
-
- FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. Full license text is available from the following
- link: http://www.freertos.org/a00114.html
-
- 1 tab == 4 spaces!
-
- ***************************************************************************
- * *
- * Having a problem? Start by reading the FAQ "My application does *
- * not run, what could be wrong?" *
- * *
- * http://www.FreeRTOS.org/FAQHelp.html *
- * *
- ***************************************************************************
-
- http://www.FreeRTOS.org - Documentation, books, training, latest versions,
- license and Real Time Engineers Ltd. contact details.
-
- http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
- including FreeRTOS+Trace - an indispensable productivity tool, a DOS
- compatible FAT file system, and our tiny thread aware UDP/IP stack.
-
- http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
- Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
- licenses offer ticketed support, indemnification and middleware.
-
- http://www.SafeRTOS.com - High Integrity Systems also provide a safety
- engineered and independently SIL3 certified version for use in safety and
- mission critical applications that require provable dependability.
-
- 1 tab == 4 spaces!
-*/
-
-
-/* The following #error directive is to remind users that a batch file must be
- * executed prior to this project being built. The batch file *cannot* be
- * executed from within CCS4! Once it has been executed, re-open or refresh
- * the CCS4 project and remove the #error line below.
- */
-//#error Ensure CreateProjectDirectoryStructure.bat has been executed before building. See comment immediately above.
-
-
-#ifndef FREERTOS_CONFIG_H
-#define FREERTOS_CONFIG_H
-
-/*-----------------------------------------------------------
- * Application specific definitions.
- *
- * These definitions should be adjusted for your particular hardware and
- * application requirements.
- *
- * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
- * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
- *
- * See http://www.freertos.org/a00110.html.
- *----------------------------------------------------------*/
-
-#define configUSE_PREEMPTION 1 // 1 - Вытесняющаяя многозадачность, 0 - Кооперативная
-#define configUSE_IDLE_HOOK 1
-#define configUSE_TICK_HOOK 0
-#define configCPU_CLOCK_HZ ( 48000000UL ) // tros было 24000000UL
-#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
-#define configMAX_PRIORITIES ( 5 )
-
-#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 70 ) // trots, was 70
-#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 10 * 1024 ) ) // trots, was 10 // Уменьшил MEM_SIZE в файле lwipopts.h
-
-#define configMAX_TASK_NAME_LEN ( 10 )
-#define configUSE_TRACE_FACILITY 0
-#define configUSE_16_BIT_TICKS 0
-#define configIDLE_SHOULD_YIELD 1
-#define configUSE_MUTEXES 1
-#define configQUEUE_REGISTRY_SIZE 0
-#define configGENERATE_RUN_TIME_STATS 0
-#define configCHECK_FOR_STACK_OVERFLOW 2 // trots was 2
-#define configUSE_RECURSIVE_MUTEXES 0
-#define configUSE_MALLOC_FAILED_HOOK 1
-#define configUSE_APPLICATION_TASK_TAG 0
-#define configUSE_COUNTING_SEMAPHORES 0
-
-/* Co-routine definitions. */
-#define configUSE_CO_ROUTINES 0 // Чтобы использовать программные таймеры, нужно единичку (там прототипы содержатся)
-#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
-
-/* Software timer definitions. */
-#define configUSE_TIMERS 1
-#define configTIMER_TASK_PRIORITY ( 3 )
-#define configTIMER_QUEUE_LENGTH 5
-#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE )
-
-/* Set the following definitions to 1 to include the API function, or zero
-to exclude the API function. */
-#define INCLUDE_vTaskPrioritySet 1
-#define INCLUDE_uxTaskPriorityGet 1
-#define INCLUDE_vTaskDelete 1
-#define INCLUDE_vTaskCleanUpResources 1
-#define INCLUDE_vTaskSuspend 1
-#define INCLUDE_vTaskDelayUntil 1
-#define INCLUDE_vTaskDelay 1
-
-/* Use the system definition, if there is one */
-#ifdef __NVIC_PRIO_BITS
- #define configPRIO_BITS __NVIC_PRIO_BITS
-#else
- #define configPRIO_BITS 4 /* 15 priority levels */
-#endif
-
-#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 15
-#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 11
-
-/* The lowest priority. */
-#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
-/* Priority 5, or 95 as only the top four bits are implemented. */
-/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
-See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
-#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
-
-#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }
-
-#define vPortSVCHandler SVCALL_handler
-#define xPortPendSVHandler PENDSV_handler
-#define xPortSysTickHandler SYSTICK_handler
-
-#endif /* FREERTOS_CONFIG_H */
-
diff --git a/Project/src/platform/stm32f0-gcc/freertos/port.c b/Project/src/platform/stm32f0-gcc/freertos/port.c
deleted file mode 100644
index 423ae1e..0000000
--- a/Project/src/platform/stm32f0-gcc/freertos/port.c
+++ /dev/null
@@ -1,368 +0,0 @@
-/*
- FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.
- All rights reserved
-
- VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
-
- This file is part of the FreeRTOS distribution.
-
- FreeRTOS is free software; you can redistribute it and/or modify it under
- the terms of the GNU General Public License (version 2) as published by the
- Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
-
- ***************************************************************************
- >>! NOTE: The modification to the GPL is included to allow you to !<<
- >>! distribute a combined work that includes FreeRTOS without being !<<
- >>! obliged to provide the source code for proprietary components !<<
- >>! outside of the FreeRTOS kernel. !<<
- ***************************************************************************
-
- FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. Full license text is available on the following
- link: http://www.freertos.org/a00114.html
-
- ***************************************************************************
- * *
- * FreeRTOS provides completely free yet professionally developed, *
- * robust, strictly quality controlled, supported, and cross *
- * platform software that is more than just the market leader, it *
- * is the industry's de facto standard. *
- * *
- * Help yourself get started quickly while simultaneously helping *
- * to support the FreeRTOS project by purchasing a FreeRTOS *
- * tutorial book, reference manual, or both: *
- * http://www.FreeRTOS.org/Documentation *
- * *
- ***************************************************************************
-
- http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
- the FAQ page "My application does not run, what could be wrong?". Have you
- defined configASSERT()?
-
- http://www.FreeRTOS.org/support - In return for receiving this top quality
- embedded software for free we request you assist our global community by
- participating in the support forum.
-
- http://www.FreeRTOS.org/training - Investing in training allows your team to
- be as productive as possible as early as possible. Now you can receive
- FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
- Ltd, and the world's leading authority on the world's leading RTOS.
-
- http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
- including FreeRTOS+Trace - an indispensable productivity tool, a DOS
- compatible FAT file system, and our tiny thread aware UDP/IP stack.
-
- http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
- Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
-
- http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
- Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
- licenses offer ticketed support, indemnification and commercial middleware.
-
- http://www.SafeRTOS.com - High Integrity Systems also provide a safety
- engineered and independently SIL3 certified version for use in safety and
- mission critical applications that require provable dependability.
-
- 1 tab == 4 spaces!
-*/
-
-/*-----------------------------------------------------------
- * Implementation of functions defined in portable.h for the ARM CM0 port.
- *----------------------------------------------------------*/
-
-/* Scheduler includes. */
-#include "FreeRTOS.h"
-#include "task.h"
-
-/* Constants required to manipulate the NVIC. */
-#define portNVIC_SYSTICK_CTRL ( ( volatile uint32_t *) 0xe000e010 )
-#define portNVIC_SYSTICK_LOAD ( ( volatile uint32_t *) 0xe000e014 )
-#define portNVIC_INT_CTRL ( ( volatile uint32_t *) 0xe000ed04 )
-#define portNVIC_SYSPRI2 ( ( volatile uint32_t *) 0xe000ed20 )
-#define portNVIC_SYSTICK_CLK 0x00000004
-#define portNVIC_SYSTICK_INT 0x00000002
-#define portNVIC_SYSTICK_ENABLE 0x00000001
-#define portNVIC_PENDSVSET 0x10000000
-#define portMIN_INTERRUPT_PRIORITY ( 255UL )
-#define portNVIC_PENDSV_PRI ( portMIN_INTERRUPT_PRIORITY << 16UL )
-#define portNVIC_SYSTICK_PRI ( portMIN_INTERRUPT_PRIORITY << 24UL )
-
-/* Constants required to set up the initial stack. */
-#define portINITIAL_XPSR ( 0x01000000 )
-
-/* Let the user override the pre-loading of the initial LR with the address of
-prvTaskExitError() in case is messes up unwinding of the stack in the
-debugger. */
-#ifdef configTASK_RETURN_ADDRESS
- #define portTASK_RETURN_ADDRESS configTASK_RETURN_ADDRESS
-#else
- #define portTASK_RETURN_ADDRESS prvTaskExitError
-#endif
-
-/* Each task maintains its own interrupt status in the critical nesting
-variable. */
-static UBaseType_t uxCriticalNesting = 0xaaaaaaaa;
-
-/*
- * Setup the timer to generate the tick interrupts.
- */
-static void prvSetupTimerInterrupt( void );
-
-/*
- * Exception handlers.
- */
-void PENDSV_handler( void ) __attribute__ (( naked ));
-void SYSTICK_handler( void );
-void SVCALL_handler( void );
-
-/*
- * Start first task is a separate function so it can be tested in isolation.
- */
-static void vPortStartFirstTask( void ) __attribute__ (( naked ));
-
-/*
- * Used to catch tasks that attempt to return from their implementing function.
- */
-static void prvTaskExitError( void );
-
-/*-----------------------------------------------------------*/
-
-/*
- * See header file for description.
- */
-StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters )
-{
- /* Simulate the stack frame as it would be created by a context switch
- interrupt. */
- pxTopOfStack--; /* Offset added to account for the way the MCU uses the stack on entry/exit of interrupts. */
- *pxTopOfStack = portINITIAL_XPSR; /* xPSR */
- pxTopOfStack--;
- *pxTopOfStack = ( StackType_t ) pxCode; /* PC */
- pxTopOfStack--;
- *pxTopOfStack = ( StackType_t ) portTASK_RETURN_ADDRESS; /* LR */
- pxTopOfStack -= 5; /* R12, R3, R2 and R1. */
- *pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */
- pxTopOfStack -= 8; /* R11..R4. */
-
- return pxTopOfStack;
-}
-/*-----------------------------------------------------------*/
-
-static void prvTaskExitError( void )
-{
- /* A function that implements a task must not exit or attempt to return to
- its caller as there is nothing to return to. If a task wants to exit it
- should instead call vTaskDelete( NULL ).
-
- Artificially force an assert() to be triggered if configASSERT() is
- defined, then stop here so application writers can catch the error. */
- configASSERT( uxCriticalNesting == ~0UL );
- portDISABLE_INTERRUPTS();
- for( ;; );
-}
-/*-----------------------------------------------------------*/
-
-void SVCALL_handler( void )
-{
- /* This function is no longer used, but retained for backward
- compatibility. */
-}
-/*-----------------------------------------------------------*/
-
-void vPortStartFirstTask( void )
-{
- /* The MSP stack is not reset as, unlike on M3/4 parts, there is no vector
- table offset register that can be used to locate the initial stack value.
- Not all M0 parts have the application vector table at address 0. */
- __asm volatile(
- " ldr r2, pxCurrentTCBConst2 \n" /* Obtain location of pxCurrentTCB. */
- " ldr r3, [r2] \n"
- " ldr r0, [r3] \n" /* The first item in pxCurrentTCB is the task top of stack. */
- " add r0, #32 \n" /* Discard everything up to r0. */
- " msr psp, r0 \n" /* This is now the new top of stack to use in the task. */
- " movs r0, #2 \n" /* Switch to the psp stack. */
- " msr CONTROL, r0 \n"
- " pop {r0-r5} \n" /* Pop the registers that are saved automatically. */
- " mov lr, r5 \n" /* lr is now in r5. */
- " cpsie i \n" /* The first task has its context and interrupts can be enabled. */
- " pop {pc} \n" /* Finally, pop the PC to jump to the user defined task code. */
- " \n"
- " .align 2 \n"
- "pxCurrentTCBConst2: .word pxCurrentTCB "
- );
-}
-/*-----------------------------------------------------------*/
-
-/*
- * See header file for description.
- */
-BaseType_t xPortStartScheduler( void )
-{
- /* Make PendSV, CallSV and SysTick the same priroity as the kernel. */
- *(portNVIC_SYSPRI2) |= portNVIC_PENDSV_PRI;
- *(portNVIC_SYSPRI2) |= portNVIC_SYSTICK_PRI;
-
- /* Start the timer that generates the tick ISR. Interrupts are disabled
- here already. */
- prvSetupTimerInterrupt();
-
- /* Initialise the critical nesting count ready for the first task. */
- uxCriticalNesting = 0;
-
- /* Start the first task. */
- vPortStartFirstTask();
-
- /* Should never get here as the tasks will now be executing! Call the task
- exit error function to prevent compiler warnings about a static function
- not being called in the case that the application writer overrides this
- functionality by defining configTASK_RETURN_ADDRESS. */
- prvTaskExitError();
-
- /* Should not get here! */
- return 0;
-}
-/*-----------------------------------------------------------*/
-
-void vPortEndScheduler( void )
-{
- /* Not implemented in ports where there is nothing to return to.
- Artificially force an assert. */
- configASSERT( uxCriticalNesting == 1000UL );
-}
-/*-----------------------------------------------------------*/
-
-void vPortYield( void )
-{
- /* Set a PendSV to request a context switch. */
- *( portNVIC_INT_CTRL ) = portNVIC_PENDSVSET;
-
- /* Barriers are normally not required but do ensure the code is completely
- within the specified behaviour for the architecture. */
- __asm volatile( "dsb" );
- __asm volatile( "isb" );
-}
-/*-----------------------------------------------------------*/
-
-void vPortEnterCritical( void )
-{
- portDISABLE_INTERRUPTS();
- uxCriticalNesting++;
- __asm volatile( "dsb" );
- __asm volatile( "isb" );
-}
-/*-----------------------------------------------------------*/
-
-void vPortExitCritical( void )
-{
- configASSERT( uxCriticalNesting );
- uxCriticalNesting--;
- if( uxCriticalNesting == 0 )
- {
- portENABLE_INTERRUPTS();
- }
-}
-/*-----------------------------------------------------------*/
-
-uint32_t ulSetInterruptMaskFromISR( void )
-{
- __asm volatile(
- " mrs r0, PRIMASK \n"
- " cpsid i \n"
- " bx lr "
- );
-
- /* To avoid compiler warnings. This line will never be reached. */
- return 0;
-}
-/*-----------------------------------------------------------*/
-
-void vClearInterruptMaskFromISR( uint32_t ulMask )
-{
- __asm volatile(
- " msr PRIMASK, r0 \n"
- " bx lr "
- );
-
- /* Just to avoid compiler warning. */
- ( void ) ulMask;
-}
-/*-----------------------------------------------------------*/
-
-void PENDSV_handler( void )
-{
- /* This is a naked function. */
-
- __asm volatile
- (
- " mrs r0, psp \n"
- " \n"
- " ldr r3, pxCurrentTCBConst \n" /* Get the location of the current TCB. */
- " ldr r2, [r3] \n"
- " \n"
- " sub r0, r0, #32 \n" /* Make space for the remaining low registers. */
- " str r0, [r2] \n" /* Save the new top of stack. */
- " stmia r0!, {r4-r7} \n" /* Store the low registers that are not saved automatically. */
- " mov r4, r8 \n" /* Store the high registers. */
- " mov r5, r9 \n"
- " mov r6, r10 \n"
- " mov r7, r11 \n"
- " stmia r0!, {r4-r7} \n"
- " \n"
- " push {r3, r14} \n"
- " cpsid i \n"
- " bl vTaskSwitchContext \n"
- " cpsie i \n"
- " pop {r2, r3} \n" /* lr goes in r3. r2 now holds tcb pointer. */
- " \n"
- " ldr r1, [r2] \n"
- " ldr r0, [r1] \n" /* The first item in pxCurrentTCB is the task top of stack. */
- " add r0, r0, #16 \n" /* Move to the high registers. */
- " ldmia r0!, {r4-r7} \n" /* Pop the high registers. */
- " mov r8, r4 \n"
- " mov r9, r5 \n"
- " mov r10, r6 \n"
- " mov r11, r7 \n"
- " \n"
- " msr psp, r0 \n" /* Remember the new top of stack for the task. */
- " \n"
- " sub r0, r0, #32 \n" /* Go back for the low registers that are not automatically restored. */
- " ldmia r0!, {r4-r7} \n" /* Pop low registers. */
- " \n"
- " bx r3 \n"
- " \n"
- " .align 2 \n"
- "pxCurrentTCBConst: .word pxCurrentTCB "
- );
-}
-/*-----------------------------------------------------------*/
-
-void SYSTICK_handler( void )
-{
-uint32_t ulPreviousMask;
-
- ulPreviousMask = portSET_INTERRUPT_MASK_FROM_ISR();
- {
- /* Increment the RTOS tick. */
- if( xTaskIncrementTick() != pdFALSE )
- {
- /* Pend a context switch. */
- *(portNVIC_INT_CTRL) = portNVIC_PENDSVSET;
- }
- }
- portCLEAR_INTERRUPT_MASK_FROM_ISR( ulPreviousMask );
-}
-/*-----------------------------------------------------------*/
-
-/*
- * Setup the systick timer to generate the tick interrupts at the required
- * frequency.
- */
-void prvSetupTimerInterrupt( void )
-{
- /* Configure SysTick to interrupt at the requested rate. */
- *(portNVIC_SYSTICK_LOAD) = ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) - 1UL;
- *(portNVIC_SYSTICK_CTRL) = portNVIC_SYSTICK_CLK | portNVIC_SYSTICK_INT | portNVIC_SYSTICK_ENABLE;
-}
-/*-----------------------------------------------------------*/
-
diff --git a/Project/src/platform/stm32f0-gcc/freertos/portmacro.h b/Project/src/platform/stm32f0-gcc/freertos/portmacro.h
deleted file mode 100644
index 54c219e..0000000
--- a/Project/src/platform/stm32f0-gcc/freertos/portmacro.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.
- All rights reserved
-
- VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
-
- This file is part of the FreeRTOS distribution.
-
- FreeRTOS is free software; you can redistribute it and/or modify it under
- the terms of the GNU General Public License (version 2) as published by the
- Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
-
- ***************************************************************************
- >>! NOTE: The modification to the GPL is included to allow you to !<<
- >>! distribute a combined work that includes FreeRTOS without being !<<
- >>! obliged to provide the source code for proprietary components !<<
- >>! outside of the FreeRTOS kernel. !<<
- ***************************************************************************
-
- FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. Full license text is available on the following
- link: http://www.freertos.org/a00114.html
-
- ***************************************************************************
- * *
- * FreeRTOS provides completely free yet professionally developed, *
- * robust, strictly quality controlled, supported, and cross *
- * platform software that is more than just the market leader, it *
- * is the industry's de facto standard. *
- * *
- * Help yourself get started quickly while simultaneously helping *
- * to support the FreeRTOS project by purchasing a FreeRTOS *
- * tutorial book, reference manual, or both: *
- * http://www.FreeRTOS.org/Documentation *
- * *
- ***************************************************************************
-
- http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
- the FAQ page "My application does not run, what could be wrong?". Have you
- defined configASSERT()?
-
- http://www.FreeRTOS.org/support - In return for receiving this top quality
- embedded software for free we request you assist our global community by
- participating in the support forum.
-
- http://www.FreeRTOS.org/training - Investing in training allows your team to
- be as productive as possible as early as possible. Now you can receive
- FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
- Ltd, and the world's leading authority on the world's leading RTOS.
-
- http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
- including FreeRTOS+Trace - an indispensable productivity tool, a DOS
- compatible FAT file system, and our tiny thread aware UDP/IP stack.
-
- http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
- Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
-
- http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
- Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
- licenses offer ticketed support, indemnification and commercial middleware.
-
- http://www.SafeRTOS.com - High Integrity Systems also provide a safety
- engineered and independently SIL3 certified version for use in safety and
- mission critical applications that require provable dependability.
-
- 1 tab == 4 spaces!
-*/
-
-
-#ifndef PORTMACRO_H
-#define PORTMACRO_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*-----------------------------------------------------------
- * Port specific definitions.
- *
- * The settings in this file configure FreeRTOS correctly for the
- * given hardware and compiler.
- *
- * These settings should not be altered.
- *-----------------------------------------------------------
- */
-
-/* Type definitions. */
-#define portCHAR char
-#define portFLOAT float
-#define portDOUBLE double
-#define portLONG long
-#define portSHORT short
-#define portSTACK_TYPE uint32_t
-#define portBASE_TYPE long
-
-typedef portSTACK_TYPE StackType_t;
-typedef long BaseType_t;
-typedef unsigned long UBaseType_t;
-
-#if( configUSE_16_BIT_TICKS == 1 )
- typedef uint16_t TickType_t;
- #define portMAX_DELAY ( TickType_t ) 0xffff
-#else
- typedef uint32_t TickType_t;
- #define portMAX_DELAY ( TickType_t ) 0xffffffffUL
-
- /* 32-bit tick type on a 32-bit architecture, so reads of the tick count do
- not need to be guarded with a critical section. */
- #define portTICK_TYPE_IS_ATOMIC 1
-#endif
-/*-----------------------------------------------------------*/
-
-/* Architecture specifics. */
-#define portSTACK_GROWTH ( -1 )
-#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
-#define portBYTE_ALIGNMENT 8
-/*-----------------------------------------------------------*/
-
-
-/* Scheduler utilities. */
-extern void vPortYield( void );
-#define portNVIC_INT_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000ed04 ) )
-#define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
-#define portYIELD() vPortYield()
-#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT
-#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
-/*-----------------------------------------------------------*/
-
-
-/* Critical section management. */
-extern void vPortEnterCritical( void );
-extern void vPortExitCritical( void );
-extern uint32_t ulSetInterruptMaskFromISR( void ) __attribute__((naked));
-extern void vClearInterruptMaskFromISR( uint32_t ulMask ) __attribute__((naked));
-
-#define portSET_INTERRUPT_MASK_FROM_ISR() ulSetInterruptMaskFromISR()
-#define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) vClearInterruptMaskFromISR( x )
-#define portDISABLE_INTERRUPTS() __asm volatile ( " cpsid i " )
-#define portENABLE_INTERRUPTS() __asm volatile ( " cpsie i " )
-#define portENTER_CRITICAL() vPortEnterCritical()
-#define portEXIT_CRITICAL() vPortExitCritical()
-
-/*-----------------------------------------------------------*/
-
-/* Task function macros as described on the FreeRTOS.org WEB site. */
-#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )
-#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
-
-#define portNOP()
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* PORTMACRO_H */
-
diff --git a/Project/src/platform/stm32f0-gcc/startup/handlers_cm.c b/Project/src/platform/stm32f0-gcc/startup/handlers_cm.c
deleted file mode 100644
index 95b59a9..0000000
--- a/Project/src/platform/stm32f0-gcc/startup/handlers_cm.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/**
- * Handlers setup code for Cortex-M.
- */
-
-typedef void (*ptr_func_t)();
-
-// Undefined handler is pointing to this function, this stop MCU.
-// This function name must by not mangled, so must be C,
-// because alias("..") is working only with C code
-void __stop() { while (1); }
-
-// Handlers for Cortex-M core.
-// These handler are with attribute 'weak' and can be overwritten
-// by non-weak function, default is __stop() function
-__attribute__((weak, alias("__stop"))) void RESET_handler();
-__attribute__((weak, alias("__stop"))) void NMI_handler();
-__attribute__((weak, alias("__stop"))) void HARDFAULT_handler();
-__attribute__((weak, alias("__stop"))) void MEMMANAGE_handler();
-__attribute__((weak, alias("__stop"))) void BUSFAULT_handler();
-__attribute__((weak, alias("__stop"))) void USAGEFAULT_handler();
-__attribute__((weak, alias("__stop"))) void SVCALL_handler();
-__attribute__((weak, alias("__stop"))) void DEBUGMONITOR_handler();
-__attribute__((weak, alias("__stop"))) void PENDSV_handler();
-__attribute__((weak, alias("__stop"))) void SYSTICK_handler();
-
-// Handlers for peripherals' interrupts
-__attribute__((weak, alias("__stop"))) void WWDG_handler();
-__attribute__((weak, alias("__stop"))) void PVD_VDDIO2_handler();
-__attribute__((weak, alias("__stop"))) void RTC_handler();
-__attribute__((weak, alias("__stop"))) void FLASH_handler();
-__attribute__((weak, alias("__stop"))) void RCC_CRS_handler();
-__attribute__((weak, alias("__stop"))) void EXTI0_1_handler();
-__attribute__((weak, alias("__stop"))) void EXTI2_3_handler();
-__attribute__((weak, alias("__stop"))) void EXTI4_15_handler();
-__attribute__((weak, alias("__stop"))) void TSC_handler();
-__attribute__((weak, alias("__stop"))) void DMA_0064_handler();
-__attribute__((weak, alias("__stop"))) void DMA_DMA2_0068_handler();
-__attribute__((weak, alias("__stop"))) void DMA_DMA2_006C_handler();
-__attribute__((weak, alias("__stop"))) void ADC_COMP_handler();
-__attribute__((weak, alias("__stop"))) void TIM1_0074_handler();
-__attribute__((weak, alias("__stop"))) void TIM1_0078_handler();
-__attribute__((weak, alias("__stop"))) void TIM2_handler();
-__attribute__((weak, alias("__stop"))) void TIM3_handler();
-__attribute__((weak, alias("__stop"))) void TIM6_DAC_handler();
-__attribute__((weak, alias("__stop"))) void TIM7_handler();
-__attribute__((weak, alias("__stop"))) void TIM14_handler();
-__attribute__((weak, alias("__stop"))) void TIM15_handler();
-__attribute__((weak, alias("__stop"))) void TIM16_handler();
-__attribute__((weak, alias("__stop"))) void TIM17_handler();
-__attribute__((weak, alias("__stop"))) void I2C1_handler();
-__attribute__((weak, alias("__stop"))) void I2C2_handler();
-__attribute__((weak, alias("__stop"))) void SPI1_handler();
-__attribute__((weak, alias("__stop"))) void SPI2_handler();
-__attribute__((weak, alias("__stop"))) void USART1_handler();
-__attribute__((weak, alias("__stop"))) void USART2_handler();
-__attribute__((weak, alias("__stop"))) void USART_00B3_handler();
-__attribute__((weak, alias("__stop"))) void CEC_CAN_handler();
-__attribute__((weak, alias("__stop"))) void USB_handler();
-
-// Dummy handler (for unused vectors)
-__attribute__((weak, alias("__stop"))) void DUMMY_handler();
-
-// Vector table for handlers
-// This array will be placed in ".vectors" section defined in linker script.
-__attribute__((section(".vectors"), used)) ptr_func_t __isr_vectors[] = {
- RESET_handler,
- NMI_handler,
- HARDFAULT_handler,
- MEMMANAGE_handler,
- BUSFAULT_handler,
- USAGEFAULT_handler,
- DUMMY_handler,
- DUMMY_handler,
- DUMMY_handler,
- DUMMY_handler,
- SVCALL_handler,
- DEBUGMONITOR_handler,
- DUMMY_handler,
- PENDSV_handler,
- SYSTICK_handler,
- WWDG_handler,
- PVD_VDDIO2_handler,
- RTC_handler,
- FLASH_handler,
- RCC_CRS_handler,
- EXTI0_1_handler,
- EXTI2_3_handler,
- EXTI4_15_handler,
- TSC_handler,
- DMA_0064_handler,
- DMA_DMA2_0068_handler,
- DMA_DMA2_006C_handler,
- ADC_COMP_handler,
- TIM1_0074_handler,
- TIM1_0078_handler,
- TIM2_handler,
- TIM3_handler,
- TIM6_DAC_handler,
- TIM7_handler,
- TIM14_handler,
- TIM15_handler,
- TIM16_handler,
- TIM17_handler,
- I2C1_handler,
- I2C2_handler,
- SPI1_handler,
- SPI2_handler,
- USART1_handler,
- USART2_handler,
- USART_00B3_handler,
- CEC_CAN_handler,
- USB_handler,
-};
diff --git a/Project/src/platform/stm32f0-gcc/startup/stack.cpp b/Project/src/platform/stm32f0-gcc/startup/stack.cpp
deleted file mode 100644
index d10595c..0000000
--- a/Project/src/platform/stm32f0-gcc/startup/stack.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-// stack definition code
-
-// top of stack
-extern unsigned __stacktop;
-
-// initial stack pointer is first address of program
-__attribute__((section(".stack"), used)) unsigned *__stack_init = &__stacktop;
diff --git a/Project/src/platform/stm32f0-gcc/startup/startup.cpp b/Project/src/platform/stm32f0-gcc/startup/startup.cpp
deleted file mode 100644
index 95276ae..0000000
--- a/Project/src/platform/stm32f0-gcc/startup/startup.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-// very simple startup code with definition of handlers for all cortex-m cores
-
-typedef void (*ptr_func_t)();
-
-// main application
-extern "C" int main();
-
-// location of these variables is defined in linker script
-extern unsigned __data_start;
-extern unsigned __data_end;
-extern unsigned __data_load;
-
-extern unsigned __bss_start;
-extern unsigned __bss_end;
-
-extern unsigned __heap_start;
-
-extern ptr_func_t __preinit_array_start[];
-extern ptr_func_t __preinit_array_end[];
-
-extern ptr_func_t __init_array_start[];
-extern ptr_func_t __init_array_end[];
-
-extern ptr_func_t __fini_array_start[];
-extern ptr_func_t __fini_array_end[];
-
-
-/** Copy default data to DATA section
- */
-void copy_data() {
- unsigned *src = &__data_load;
- unsigned *dst = &__data_start;
- while (dst < &__data_end) {
- *dst++ = *src++;
- }
-}
-
-/** Erase BSS section
- */
-void zero_bss() {
- unsigned *dst = &__bss_start;
- while (dst < &__bss_end) {
- *dst++ = 0;
- }
-}
-
-/** Fill heap memory
- */
-void fill_heap(unsigned fill=0x45455246) {
- unsigned *dst = &__heap_start;
- unsigned *msp_reg;
- __asm__("mrs %0, msp\n" : "=r" (msp_reg) );
- while (dst < msp_reg) {
- *dst++ = fill;
- }
-}
-
-/** Call constructors for static objects
- */
-void call_init_array() {
- auto array = __preinit_array_start;
- while (array < __preinit_array_end) {
- (*array)();
- array++;
- }
-
- array = __init_array_start;
- while (array < __init_array_end) {
- (*array)();
- array++;
- }
-}
-
-/** Call destructors for static objects
- */
-void call_fini_array() {
- auto array = __fini_array_start;
- while (array < __fini_array_end) {
- (*array)();
- array++;
- }
-}
-
-// reset handler
-extern "C" void RESET_handler() {
- copy_data();
- zero_bss();
- fill_heap();
- call_init_array();
- // run application
- main();
- // call destructors for static instances
- call_fini_array();
- // stop
- while (true);
-}
diff --git a/Project/src/stm32f0xx_it.c b/Project/src/stm32f0xx_it.c
deleted file mode 100644
index 9327bed..0000000
--- a/Project/src/stm32f0xx_it.c
+++ /dev/null
@@ -1,249 +0,0 @@
-/**
- ******************************************************************************
- * @file Projects\Demonstration\stm32f0xx_it.c
- * @author MCD Application Team
- * @version V1.0.0
- * @date 17-January-2014
- * @brief Main Interrupt Service Routines.
- * This file provides template for all exceptions handler and
- * peripherals interrupt service routine.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
- *
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.st.com/software_license_agreement_liberty_v2
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************
- */
-
-/* Includes ------------------------------------------------------------------*/
-#include "stm32f0xx_it.h"
-#include "stm32f0xx_conf.h"
-
-#include "ltimers.h"
-#include "ltimers_config.h"
-
-#include "nixie_driver_config.h"
-#include "nixie_driver_process.h"
-#include "led_driver_process.h"
-#include "led_driver_config.h"
-
-#include "tsl_types.h"
-#include "tsl_user.h"
-#include "tsl_time_stm32f0xx.h"
-
-
-/** @addtogroup STM32F072B_DISCOVERY
- * @{
- */
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-
-/* Private function prototypes -----------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-/******************************************************************************/
-/* Cortex-M0 Processor Exceptions Handlers */
-/******************************************************************************/
-
-/**
- * @brief This function handles NMI exception.
- * @param None
- * @retval None
- */
-void NMI_Handler(void)
-{
-}
-
-/**
- * @brief This function handles Hard Fault exception.
- * @param None
- * @retval None
- */
-void HardFault_Handler(void)
-{
- /* Go to infinite loop when Hard Fault exception occurs */
- while (1)
- {
- }
-}
-
-/**
- * @brief This function handles SVCall exception.
- * @param None
- * @retval None
- * @ Используется в файле portasm.s
- */
-//void SVC_Handler(void)
-//{
-//}
-
-/**
- * @brief This function handles PendSVC exception.
- * @param None
- * @retval None
- * @ Используется в файле portasm.s
- */
-//void PendSV_Handler(void)
-//{
-//}
-
-/**
- * @brief This function handles SysTick Handler.
- * @param None
- * @retval None
- */
-//void SysTick_Handler(void)
-//{
-// TimingDelay_Decrement();
-// TSL_tim_ProcessIT();
-//}
-
-/******************************************************************************/
-/* STM32F0xx Peripherals Interrupt Handlers */
-/* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */
-/* available peripheral interrupt handler's name please refer to the startup */
-/* file (startup_stm32f0xx.s). */
-/******************************************************************************/
-
-// ----------------------------------------------------------------------------
-// Обработчик прерывания таймера общего назначения для тиков в 1 мс
-// ----------------------------------------------------------------------------
-void LTIMER_IRQHandler ( void )
-{
- if ( TIM_GetITStatus ( LTIMER_TIMx, TIM_IT_Update ) != RESET )
- {
- TIM_ClearITPendingBit ( LTIMER_TIMx, TIM_IT_Update );
-
- ProcessLTimers ();
- }
-}
-
-void TIM17_handler(void) { LTIMER_IRQHandler(); }
-
-
-// ----------------------------------------------------------------------------
-// Обработчик прерывания таймера для работы NixieDriver
-// Это прерывание имеет самый высокий приоритет, чтобы обеспечить стабильную
-// частоту динамической индикации ламп Nixie
-// ----------------------------------------------------------------------------
-void NIX_DRIVER_TIM_IRQHandler ( void )
-{
- if ( TIM_GetITStatus ( NIX_DRIVER_TIMx, TIM_IT_Update ) != RESET )
- {
- TIM_ClearITPendingBit ( NIX_DRIVER_TIMx, TIM_IT_Update );
-
- ProcessNixieDriverFromISR ();
- }
-}
-
-void TIM16_handler(void) { NIX_DRIVER_TIM_IRQHandler(); }
-
-
-// ----------------------------------------------------------------------------
-// Обработчик прерывания таймера для работы LED_Driver
-// ----------------------------------------------------------------------------
-void LED_TIM_IRQHandler ( void )
-{
- if ( TIM_GetITStatus ( LED_TIMx, TIM_IT_Update ) != RESET )
- {
- TIM_ClearITPendingBit ( LED_TIMx, TIM_IT_Update );
-
- LEDDriverProcessFromISR ();
- }
-}
-
-void TIM3_handler(void) { LED_TIM_IRQHandler(); }
-
-
-// ----------------------------------------------------------------------------
-// - поставить этому прерыванию наивысший приоритет, чтобы передавать 2 байта
-// подряд гарантированно без промежутка времени (или не так важно? может ли
-// между двумя байтами задержка повлиять на вывод данных на лампы?)
-// ----------------------------------------------------------------------------
-
-void NIX_SPIx_IRQHandler ( void )
-{
- /* SPI in Master Receiver mode--------------------------------------- */
- if ( SPI_I2S_GetITStatus ( NIX_SPIx, SPI_I2S_IT_TXE ) == SET )
- {
- // Обязательно надо считать, чтобы сбросить флаг
- SPI_I2S_ReceiveData16 ( NIX_SPIx );
- SPI_I2S_ITConfig ( NIX_SPIx, SPI_I2S_IT_TXE, DISABLE );
- //NixieDriverCheckDPPins();
- NIX_DRIVER_SET_ST_PIN;
- }
-}
-
-void SPI1_handler(void) { NIX_SPIx_IRQHandler(); }
-
-
-// ----------------------------------------------------------------------------
-//
-// ----------------------------------------------------------------------------
-#ifdef LED_DRIVER
-void LED_SPIx_IRQHandler ( void )
-{
- /* SPI in Master Receiver mode--------------------------------------- */
- if ( SPI_I2S_GetITStatus ( LED_SPIx, SPI_I2S_IT_RXNE ) == SET )
- {
- //empty_data = SPI_I2S_ReceiveData16 ( LED_SPIx );
- // Обязательно надо считать, чтобы сбросить флаг
- SPI_I2S_ReceiveData16 ( LED_SPIx );
- LED_ST_PIN_SET;
- }
-}
-
-void SPI2_handler(void) { LED_SPIx_IRQHandler(); }
-#endif
-
-
-// ----------------------------------------------------------------------------
-/**
- * @brief This function handles Touch Sensing Controller Handler.
- * @param None
- * @retval None
- */
-// ----------------------------------------------------------------------------
-extern __IO uint32_t Gv_EOA;
-
-void TSC_IRQHandler ( void )
-{
-#if TSLPRM_TSC_IODEF > 0 // Default = Input Floating
- /* Set IO default in Output PP Low to discharge all capacitors */
- TSC->CR &= (uint32_t)(~(1 << 4));
-#endif
- TSC->ICR |= 0x03; /* Clear EOAF and MCEF flags */
- Gv_EOA = 1; /* To inform the main loop routine of the End Of Acquisition */
-}
-
-void TSC_handler(void) { TSC_IRQHandler(); }
-
-
-// ----------------------------------------------------------------------------
-//
-// ----------------------------------------------------------------------------
-void TS_TIM_IRQHandler ( void )
-{
- TIM_ClearITPendingBit ( TS_TIMx, TIM_IT_Update );
- TSL_tim_ProcessIT();
-}
-
-void TIM15_handler(void) { TS_TIM_IRQHandler(); }
-
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/Project/src/system_stm32f0xx.c b/Project/src/system_stm32f0xx.c
deleted file mode 100644
index e9db4f2..0000000
--- a/Project/src/system_stm32f0xx.c
+++ /dev/null
@@ -1,402 +0,0 @@
-/**
- ******************************************************************************
- * @file system_stm32f0xx.c
- * @author MCD Application Team
- * @version V1.0.0
- * @date 17-January-2014
- * @brief CMSIS Cortex-M0 Device Peripheral Access Layer System Source File.
- * This file contains the system clock configuration for STM32F0xx devices,
- * and is customized for use with STM32F072B-DISCOVERY Kit.
- *
- *
- * The STM32F072x is configured to run at 48 MHz, following the five
- * configuration below:
- * - SOURCE_HSI48 (default) : HSI48 (48MHz) used as system clock source.
- * - PLL_SOURCE_HSI : HSI (~8MHz) used to clock the PLL, and
- * the PLL is used as system clock source.
- * - PLL_SOURCE_HSI48 : HSI48 (48MHz) used to clock the PLL, and
- * the PLL is used as system clock source.
- * - PLL_SOURCE_HSE : HSE (8MHz) used to clock the PLL, and
- * the PLL is used as system clock source.
- * - PLL_SOURCE_HSE_BYPASS : HSE bypassed with an external clock
- * (8MHz, coming from ST-Link) used to clock
- * the PLL, and the PLL is used as system
- * clock source.
- *
- *
- * 1. This file provides two functions and one global variable to be called from
- * user application:
- * - SystemInit(): Setups the system clock (System clock source, PLL Multiplier
- * and Divider factors, AHB/APBx prescalers and Flash settings),
- * depending on the configuration made in the clock xls tool.
- * This function is called at startup just after reset and
- * before branch to main program. This call is made inside
- * the "startup_stm32f0xx.s" file.
- *
- * - SystemCoreClock variable: Contains the core clock (HCLK), it can be used
- * by the user application to setup the SysTick
- * timer or configure other parameters.
- *
- * - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and must
- * be called whenever the core clock is changed
- * during program execution.
- *
- * 2. After each device reset the HSI (8 MHz Range) is used as system clock source.
- * Then SystemInit() function is called, in "startup_stm32f0xx.s" file, to
- * configure the system clock before to branch to main program.
- *
- * 3. If the system clock source selected by user fails to startup, the SystemInit()
- * function will do nothing and HSI still used as system clock source. User can
- * add some code to deal with this issue inside the SetSysClock() function.
- *
- * 4. The default value of HSE crystal is set to 8MHz, refer to "HSE_VALUE" define
- * in "stm32f0xx.h" file. When HSE is used as system clock source, directly or
- * through PLL, and you are using different crystal you have to adapt the HSE
- * value to your own configuration.
- *
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
- *
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.st.com/software_license_agreement_liberty_v2
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************
- */
-
-/** @addtogroup CMSIS
- * @{
- */
-
-/** @addtogroup stm32f0xx_system
- * @{
- */
-
-/** @addtogroup STM32F0xx_System_Private_Includes
- * @{
- */
-
-#include "stm32f0xx.h"
-
-/**
- * @}
- */
-
-/** @addtogroup STM32F0xx_System_Private_TypesDefinitions
- * @{
- */
-
-/**
- * @}
- */
-
-/** @addtogroup STM32F0xx_System_Private_Defines
- * @{
- */
-/**
- * @}
- */
-
-/*!< Uncomment the following line if you need to relocate your vector Table in
- Internal SRAM. */
-/* #define VECT_TAB_SRAM */
-#define VECT_TAB_OFFSET 0x0 /*!< Vector Table base offset field.
- This value must be a multiple of 0x200. */
-
-/* Select the PLL clock source */
-
-//#define SOURCE_HSI48
-//#define PLL_SOURCE_HSI48 /* HSI48 (48MHz) used to clock USB, system clock and the PLL*/
-//#define PLL_SOURCE_HSI /* HSI (~8MHz) used to clock the PLL, and the PLL is used as system clock source*/
-#define PLL_SOURCE_HSE /* HSE (8MHz) used to clock the PLL, and the PLL is used as system clock source */
-//#define PLL_SOURCE_HSE_BYPASS /* HSE bypassed with an external clock (8MHz, coming from ST-Link) used to clock
-// the PLL, and the PLL is used as system clock source */
-
-
-/** @addtogroup STM32F0xx_System_Private_Macros
- * @{
- */
-
-/**
- * @}
- */
-
-/** @addtogroup STM32F0xx_System_Private_Variables
- * @{
- */
-uint32_t SystemCoreClock = 48000000;
-__I uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
-
-/**
- * @}
- */
-
-/** @addtogroup STM32F0xx_System_Private_FunctionPrototypes
- * @{
- */
-
-static void SetSysClock(void);
-
-/**
- * @}
- */
-
-/** @addtogroup STM32F0xx_System_Private_Functions
- * @{
- */
-
-/**
- * @brief Setup the microcontroller system.
- * Initialize the Embedded Flash Interface, the PLL and update the
- * SystemCoreClock variable.
- * @param None
- * @retval None
- */
-void SystemInit (void)
-{
- /* Set HSION bit */
- RCC->CR |= (uint32_t)0x00000001;
-
- /* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE and MCOSEL[3:0] bits MCOPRE[2:0] */
- RCC->CFGR &= (uint32_t)0x80FFB80C;
-
- /* Reset HSEON, CSSON and PLLON bits */
- RCC->CR &= (uint32_t)0xFEF6FFFF;
-
- /* Reset HSEBYP bit */
- RCC->CR &= (uint32_t)0xFFFBFFFF;
-
- /* Reset PLLSRC, PLLXTPRE and PLLMUL[3:0] bits */
- RCC->CFGR &= (uint32_t)0xFFC07FFF;
-
- /* Reset PREDIV1[3:0] bits */
- RCC->CFGR2 &= (uint32_t)0xFFFFFFF0;
-
- /* Reset USARTSW[1:0], I2CSW, CECSW and ADCSW bits */
- RCC->CFGR3 &= (uint32_t)0xFFFFFEAC;
-
- /* Reset HSI14 & HSI48 bit */
- RCC->CR2 &= (uint32_t)0xFFFEFFFE;
-
- /* Disable all interrupts */
- RCC->CIR = 0x00000000;
-
- /* Configure the System clock frequency, AHB/APBx prescalers and Flash settings */
- SetSysClock();
-}
-
-/**
- * @brief Update SystemCoreClock according to Clock Register Values
- * The SystemCoreClock variable contains the core clock (HCLK), it can
- * be used by the user application to setup the SysTick timer or configure
- * other parameters.
- *
- * @note Each time the core clock (HCLK) changes, this function must be called
- * to update SystemCoreClock variable value. Otherwise, any configuration
- * based on this variable will be incorrect.
- *
- * @note - The system frequency computed by this function is not the real
- * frequency in the chip. It is calculated based on the predefined
- * constant and the selected clock source:
- *
- * - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(*)
- *
- * - If SYSCLK source is HSE, SystemCoreClock will contain the HSE_VALUE(**)
- *
- * - If SYSCLK source is PLL, SystemCoreClock will contain the HSE_VALUE(**)
- * or HSI_VALUE(*) multiplied/divided by the PLL factors.
- * @note - If SYSCLK source is HSI48, function returns constant HSI48_VALUE(***)
- *
- * (*) HSI_VALUE is a constant defined in stm32f0xx.h file (default value
- * 8 MHz) but the real value may vary depending on the variations
- * in voltage and temperature.
- *
- * (**) HSE_VALUE is a constant defined in stm32f0xx.h file (default value
- * 8 MHz), user has to ensure that HSE_VALUE is same as the real
- * frequency of the crystal used. Otherwise, this function may
- * have wrong result.
- * @note (***) HSI48_VALUE is a constant defined in stm32f0xx.h file (default value
- * 48 MHz) but the real value may vary depending on the variations
- * in voltage and temperature.
- *
- * - The result of this function could be not correct when using fractional
- * value for HSE crystal.
- * @param None
- * @retval None
- */
-void SystemCoreClockUpdate (void)
-{
- uint32_t tmp = 0, pllmull = 0, pllsource = 0, prediv1factor = 0;
-
- /* Get SYSCLK source -------------------------------------------------------*/
- tmp = RCC->CFGR & RCC_CFGR_SWS;
-
- switch (tmp)
- {
- case 0x00: /* HSI used as system clock */
- SystemCoreClock = HSI_VALUE;
- break;
- case 0x04: /* HSE used as system clock */
- SystemCoreClock = HSE_VALUE;
- break;
- case 0x08: /* PLL used as system clock */
- /* Get PLL clock source and multiplication factor ----------------------*/
- pllmull = RCC->CFGR & RCC_CFGR_PLLMULL;
- pllsource = RCC->CFGR & RCC_CFGR_PLLSRC;
- pllmull = ( pllmull >> 18) + 2;
-
- if (pllsource == 0x00)
- {
- /* HSI oscillator clock divided by 2 selected as PLL clock entry */
- SystemCoreClock = (HSI_VALUE >> 1) * pllmull;
- }
- else
- {
- prediv1factor = (RCC->CFGR2 & RCC_CFGR2_PREDIV1) + 1;
- /* HSE oscillator clock selected as PREDIV1 clock entry */
- SystemCoreClock = (HSE_VALUE / prediv1factor) * pllmull;
- }
- break;
- case 0x0C: /* HSI48 used as system clock */
- SystemCoreClock = HSI48_VALUE;
- break;
- default: /* HSI used as system clock */
- SystemCoreClock = HSI_VALUE;
- break;
-
- }
- /* Compute HCLK clock frequency ----------------*/
- /* Get HCLK prescaler */
- tmp = AHBPrescTable[((RCC->CFGR & RCC_CFGR_HPRE) >> 4)];
- /* HCLK clock frequency */
- SystemCoreClock >>= tmp;
-}
-
-/**
- * @brief Configures the System clock frequency, AHB/APBx prescalers and Flash
- * settings.
- * @note This function should be called only once the RCC clock configuration
- * is reset to the default reset state (done in SystemInit() function).
- * @param None
- * @retval None
- */
-static void SetSysClock(void)
-{
- __IO uint32_t StartUpCounter = 0, HSEStatus = 0;
-
- /* SYSCLK, HCLK, PCLK configuration ----------------------------------------*/
- /* At this stage the HSI is already enabled */
-
- /* Enable Prefetch Buffer and set Flash Latency */
- FLASH->ACR = FLASH_ACR_PRFTBE | FLASH_ACR_LATENCY;
-
- /* HCLK = SYSCLK */
- RCC->CFGR |= (uint32_t)RCC_CFGR_HPRE_DIV1;
-
- /* PCLK = HCLK */
- RCC->CFGR |= (uint32_t)RCC_CFGR_PPRE_DIV1;
-
-#ifndef SOURCE_HSI48
-
- #if defined (PLL_SOURCE_HSI)
- /* PLL configuration = HSI * 6 = 48 MHz */
- RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_PLLSRC | RCC_CFGR_PLLXTPRE | RCC_CFGR_PLLMULL));
- RCC->CFGR |= (uint32_t)(RCC_CFGR_PLLSRC_HSI_PREDIV | RCC_CFGR_PLLXTPRE_PREDIV1 | RCC_CFGR_PLLMULL6);
- #elif defined (PLL_SOURCE_HSI48)
- /* Enable HSI48 */
- RCC->CR2 |= RCC_CR2_HSI48ON;
- /* PLL configuration = HSI48 * 1 = 48 MHz */
- RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_PLLSRC | RCC_CFGR_PLLXTPRE | RCC_CFGR_PLLMULL));
- RCC->CFGR |= (uint32_t)(RCC_CFGR_PLLSRC_HSI48_PREDIV | RCC_CFGR_PLLXTPRE_PREDIV1_Div2);
-
- #else
- /* Enable HSE */
- RCC->CR |= ((uint32_t)RCC_CR_HSEON);
- #if defined (PLL_SOURCE_HSE_BYPASS)
- /* HSE oscillator bypassed with external clock */
- RCC->CR |= (uint32_t)(RCC_CR_HSEBYP);
- #endif
- /* Wait till HSE is ready and if Time out is reached exit */
- do
- {
- HSEStatus = RCC->CR & RCC_CR_HSERDY;
- StartUpCounter++;
- } while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
-
- if ((RCC->CR & RCC_CR_HSERDY) != RESET)
- {
- HSEStatus = (uint32_t)0x01;
- }
- else
- {
- HSEStatus = (uint32_t)0x00;
- }
-
- if (HSEStatus == (uint32_t)0x01)
- {
- /* PLL configuration = HSE * 6 = 48 MHz */
- RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_PLLSRC | RCC_CFGR_PLLXTPRE | RCC_CFGR_PLLMULL));
- RCC->CFGR |= (uint32_t)(RCC_CFGR_PLLSRC_PREDIV1 | RCC_CFGR_PLLXTPRE_PREDIV1 | RCC_CFGR_PLLMULL6);
-
- }
- else
- { /* If HSE fails to start-up, the application will have wrong clock
- configuration. User can add here some code to deal with this error */
- }
-
-
-
- #endif /* PLL_SOURCE_HSI */
- /* Enable PLL */
- RCC->CR |= RCC_CR_PLLON;
-
- /* Wait till PLL is ready */
- while((RCC->CR & RCC_CR_PLLRDY) == 0)
- {
- }
-
- /* Select PLL as system clock source */
- RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_SW));
- RCC->CFGR |= (uint32_t)RCC_CFGR_SW_PLL;
-
- /* Wait till PLL is used as system clock source */
- while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS) != (uint32_t)RCC_CFGR_SWS_PLL)
- {
- }
-#else
- /* Enable HSI48 */
- RCC->CR2 |= RCC_CR2_HSI48ON;
- /* Wait till HSI48RDY is set */
- while((RCC->CR2 & RCC_CR2_HSI48RDY) == 0)
- { }
- /* Select HSI48 as system clock source */
- RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_SW));
- RCC->CFGR |= (uint32_t)RCC_CFGR_SW_HSI48;
-
-#endif
-
-}
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/