Skip to content

Commit 175b349

Browse files
committed
first commit source code
1 parent e6bae57 commit 175b349

1,270 files changed

Lines changed: 859559 additions & 3 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
/*
2+
* FreeRTOS V202011.00
3+
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4+
*
5+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
* this software and associated documentation files (the "Software"), to deal in
7+
* the Software without restriction, including without limitation the rights to
8+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
* the Software, and to permit persons to whom the Software is furnished to do so,
10+
* subject to the following conditions:
11+
*
12+
* The above copyright notice and this permission notice shall be included in all
13+
* copies or substantial portions of the Software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21+
*
22+
* http://www.FreeRTOS.org
23+
* http://aws.amazon.com/freertos
24+
*
25+
* 1 tab == 4 spaces!
26+
*/
27+
28+
29+
#ifndef FREERTOS_CONFIG_H
30+
#define FREERTOS_CONFIG_H
31+
32+
#ifdef __cplusplus
33+
extern "C" {
34+
#endif
35+
36+
/*-----------------------------------------------------------
37+
* Application specific definitions.
38+
*
39+
* These definitions should be adjusted for your particular hardware and
40+
* application requirements.
41+
*
42+
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
43+
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
44+
*
45+
* See http://www.freertos.org/a00110.html
46+
*----------------------------------------------------------*/
47+
48+
/* The MPU version of port.c includes and excludes functions depending on the
49+
settings within this file. Therefore, to ensure all the functions in port.c
50+
build, this configuration file has all options turned on. */
51+
52+
#define configUSE_PREEMPTION 1
53+
#define configTICK_RATE_HZ ( 1000 )
54+
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
55+
#define configUSE_QUEUE_SETS 1
56+
#define configUSE_IDLE_HOOK 0
57+
#define configUSE_TICK_HOOK 0
58+
#define configCPU_CLOCK_HZ 48000000
59+
#define configMAX_PRIORITIES ( 5 )
60+
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 256 )
61+
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 16 * 1024 ) )
62+
#define configMAX_TASK_NAME_LEN ( 10 )
63+
#define configUSE_TRACE_FACILITY 0
64+
#define configUSE_16_BIT_TICKS 0
65+
#define configIDLE_SHOULD_YIELD 1
66+
#define configUSE_MUTEXES 1
67+
#define configQUEUE_REGISTRY_SIZE 5
68+
#define configCHECK_FOR_STACK_OVERFLOW 2
69+
#define configUSE_RECURSIVE_MUTEXES 1
70+
#define configUSE_MALLOC_FAILED_HOOK 1
71+
#define configUSE_APPLICATION_TASK_TAG 1
72+
#define configUSE_COUNTING_SEMAPHORES 1
73+
#define configUSE_TICKLESS_IDLE 0
74+
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 2
75+
76+
#define configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H 0
77+
#define configPATCH_PRIVILEGE_ELEVATION 0
78+
#define configUSE_DMA_CONTAINER 0
79+
#define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 1
80+
81+
/* The following definitions are meant only for benchmark evaluation */
82+
#define USARTBENCHMARK 2 // 2 for IT , 1 for pooling
83+
#define SPIBENCHMARK 0
84+
#define I2CBENCHMARK 0
85+
#define ADCBENCHMARK 0
86+
87+
88+
89+
/* This demo shows the MPU being used without any dynamic memory allocation. */
90+
#define configSUPPORT_STATIC_ALLOCATION 1
91+
#define configSUPPORT_DYNAMIC_ALLOCATION 1
92+
93+
/* Run time stats gathering definitions. */
94+
#define configGENERATE_RUN_TIME_STATS 1
95+
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
96+
#define portGET_RUN_TIME_COUNTER_VALUE() 0
97+
98+
/* This demo makes use of one or more example stats formatting functions. These
99+
format the raw data provided by the uxTaskGetSystemState() function in to human
100+
readable ASCII form. See the notes in the implementation of vTaskList() within
101+
FreeRTOS/Source/tasks.c for limitations. */
102+
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
103+
104+
/* Co-routine definitions. */
105+
#define configUSE_CO_ROUTINES 0
106+
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
107+
108+
/* Software timer definitions. */
109+
#define configUSE_TIMERS 1
110+
#define configTIMER_TASK_PRIORITY ( 2 )
111+
#define configTIMER_QUEUE_LENGTH 5
112+
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE )
113+
114+
/* Set the following definitions to 1 to include the API function, or zero
115+
to exclude the API function. */
116+
#define INCLUDE_vTaskPrioritySet 1
117+
#define INCLUDE_uxTaskPriorityGet 1
118+
#define INCLUDE_vTaskDelete 1
119+
#define INCLUDE_vTaskCleanUpResources 1
120+
#define INCLUDE_vTaskSuspend 1
121+
#define INCLUDE_vTaskDelayUntil 1
122+
#define INCLUDE_vTaskDelay 1
123+
#define INCLUDE_eTaskGetState 1
124+
#define INCLUDE_xTimerPendFunctionCall 0
125+
#define INCLUDE_xSemaphoreGetMutexHolder 1
126+
#define INCLUDE_xTaskGetHandle 1
127+
#define INCLUDE_xTaskGetCurrentTaskHandle 1
128+
#define INCLUDE_xTaskGetIdleTaskHandle 1
129+
#define INCLUDE_xTaskAbortDelay 1
130+
#define INCLUDE_xTaskGetSchedulerState 1
131+
#define INCLUDE_xTaskGetIdleTaskHandle 1
132+
#define INCLUDE_uxTaskGetStackHighWaterMark 1
133+
134+
/* Cortex-M specific definitions. */
135+
#ifdef __NVIC_PRIO_BITS
136+
/* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
137+
#define configPRIO_BITS __NVIC_PRIO_BITS
138+
#else
139+
#define configPRIO_BITS 4 /* 15 priority levels */
140+
#endif
141+
142+
/* The lowest interrupt priority that can be used in a call to a "set priority"
143+
function. */
144+
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0xf
145+
146+
/* The highest interrupt priority that can be used by any interrupt service
147+
routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
148+
INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
149+
PRIORITY THAN THIS! (higher priorities are lower numeric values. */
150+
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5
151+
152+
/* Interrupt priorities used by the kernel port layer itself. These are generic
153+
to all Cortex-M ports, and do not rely on any particular library functions. */
154+
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
155+
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
156+
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
157+
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
158+
159+
160+
/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
161+
standard names. */
162+
#define xPortPendSVHandler PendSV_Handler
163+
#define vPortSVCHandler SVC_Handler
164+
#define xPortSysTickHandler SysTick_Handler
165+
166+
/* Normal assert() semantics without relying on the provision of an assert.h
167+
header file. */
168+
#define configASSERT( x ) if( ( x ) == 0 ) { portDISABLE_INTERRUPTS(); for( ;; ); }
169+
170+
/* Ensure that system calls can only be made from kernel code. */
171+
#define configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY 1
172+
173+
#if (configUSE_TRACE_FACILITY ==1)
174+
#include "trcRecorder.h"
175+
#else
176+
#include "stm32l1xx.h"
177+
#endif
178+
179+
180+
#ifdef __cplusplus
181+
}
182+
#endif
183+
184+
#endif /* FREERTOS_CONFIG_H */
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
/*
2+
* FreeRTOS V202011.00
3+
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4+
*
5+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
* this software and associated documentation files (the "Software"), to deal in
7+
* the Software without restriction, including without limitation the rights to
8+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
* the Software, and to permit persons to whom the Software is furnished to do so,
10+
* subject to the following conditions:
11+
*
12+
* The above copyright notice and this permission notice shall be included in all
13+
* copies or substantial portions of the Software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21+
*
22+
* http://www.FreeRTOS.org
23+
* http://aws.amazon.com/freertos
24+
*
25+
* 1 tab == 4 spaces!
26+
*/
27+
/* Scheduler includes. */
28+
#include "FreeRTOS.h"
29+
#include "task.h"
30+
31+
/* App includes. */
32+
#include "app_main.h"
33+
34+
/* Demo includes. */
35+
#include "mpu_demo.h"
36+
37+
void app_main( void )
38+
{
39+
/* Start the MPU demo. */
40+
vStartMPUDemo();
41+
42+
/* Start the scheduler. */
43+
vTaskStartScheduler();
44+
45+
/* Should not get here. */
46+
for( ;; );
47+
}
48+
/*-----------------------------------------------------------*/
49+
50+
void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )
51+
{
52+
/* If configCHECK_FOR_STACK_OVERFLOW is set to either 1 or 2 then this
53+
function will automatically get called if a task overflows its stack. */
54+
( void ) pxTask;
55+
( void ) pcTaskName;
56+
for( ;; );
57+
}
58+
/*-----------------------------------------------------------*/
59+
60+
void vApplicationMallocFailedHook( void )
61+
{
62+
/* If configUSE_MALLOC_FAILED_HOOK is set to 1 then this function will
63+
be called automatically if a call to pvPortMalloc() fails. pvPortMalloc()
64+
is called automatically when a task, queue or semaphore is created. */
65+
for( ;; );
66+
}
67+
/*-----------------------------------------------------------*/
68+
69+
/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an
70+
implementation of vApplicationGetIdleTaskMemory() to provide the memory that is
71+
used by the Idle task. */
72+
void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize )
73+
{
74+
/* If the buffers to be provided to the Idle task are declared inside this
75+
function then they must be declared static - otherwise they will be allocated on
76+
the stack and so not exists after this function exits. */
77+
static StaticTask_t xIdleTaskTCB;
78+
static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ];
79+
80+
/* Pass out a pointer to the StaticTask_t structure in which the Idle task's
81+
state will be stored. */
82+
*ppxIdleTaskTCBBuffer = &xIdleTaskTCB;
83+
84+
/* Pass out the array that will be used as the Idle task's stack. */
85+
*ppxIdleTaskStackBuffer = uxIdleTaskStack;
86+
87+
/* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer.
88+
Note that, as the array is necessarily of type StackType_t,
89+
configMINIMAL_STACK_SIZE is specified in words, not bytes. */
90+
*pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
91+
}
92+
/*-----------------------------------------------------------*/
93+
94+
/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the
95+
application must provide an implementation of vApplicationGetTimerTaskMemory()
96+
to provide the memory that is used by the Timer service task. */
97+
void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize )
98+
{
99+
/* If the buffers to be provided to the Timer task are declared inside this
100+
function then they must be declared static - otherwise they will be allocated on
101+
the stack and so not exists after this function exits. */
102+
static StaticTask_t xTimerTaskTCB;
103+
static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];
104+
105+
/* Pass out a pointer to the StaticTask_t structure in which the Timer
106+
task's state will be stored. */
107+
*ppxTimerTaskTCBBuffer = &xTimerTaskTCB;
108+
109+
/* Pass out the array that will be used as the Timer task's stack. */
110+
*ppxTimerTaskStackBuffer = uxTimerTaskStack;
111+
112+
/* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.
113+
Note that, as the array is necessarily of type StackType_t,
114+
configMINIMAL_STACK_SIZE is specified in words, not bytes. */
115+
*pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
116+
}
117+
/*-----------------------------------------------------------*/
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* FreeRTOS V202011.00
3+
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4+
*
5+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
* this software and associated documentation files (the "Software"), to deal in
7+
* the Software without restriction, including without limitation the rights to
8+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
* the Software, and to permit persons to whom the Software is furnished to do so,
10+
* subject to the following conditions:
11+
*
12+
* The above copyright notice and this permission notice shall be included in all
13+
* copies or substantial portions of the Software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21+
*
22+
* http://www.FreeRTOS.org
23+
* http://aws.amazon.com/freertos
24+
*
25+
* 1 tab == 4 spaces!
26+
*/
27+
28+
#ifndef __APP_MAIN_H__
29+
#define __APP_MAIN_H__
30+
31+
/**
32+
* @brief Main app entry point.
33+
*/
34+
void app_main( void );
35+
36+
#endif /* __APP_MAIN_H__ */

0 commit comments

Comments
 (0)