diff options
author | Oxore <oxore@protonmail.com> | 2023-03-05 20:20:45 +0300 |
---|---|---|
committer | Oxore <oxore@protonmail.com> | 2023-03-05 20:20:45 +0300 |
commit | ea807de65b0485ac58b6eae576209c64d4d5c4e9 (patch) | |
tree | b4264d20e1d700cfd9e0ece9d847a825dd1dfc03 /Project/src/platform/stm32f0-gcc | |
parent | dd01e7ed22cea652061f0d12cecf929e04b285e9 (diff) |
Split app code and third party libraries
Diffstat (limited to 'Project/src/platform/stm32f0-gcc')
-rw-r--r-- | Project/src/platform/stm32f0-gcc/freertos/FreeRTOSConfig.h | 157 | ||||
-rw-r--r-- | Project/src/platform/stm32f0-gcc/freertos/port.c | 368 | ||||
-rw-r--r-- | Project/src/platform/stm32f0-gcc/freertos/portmacro.h | 157 | ||||
-rw-r--r-- | Project/src/platform/stm32f0-gcc/startup/handlers_cm.c | 113 | ||||
-rw-r--r-- | Project/src/platform/stm32f0-gcc/startup/stack.cpp | 7 | ||||
-rw-r--r-- | Project/src/platform/stm32f0-gcc/startup/startup.cpp | 96 |
6 files changed, 0 insertions, 898 deletions
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); -} |