Add Full build configuration to the Kinetis demo. Still a work in progress.

This commit is contained in:
Richard Barry 2011-07-08 21:02:03 +00:00
parent 862f99832d
commit 9d181af847
10 changed files with 2803 additions and 221 deletions

View File

@ -73,11 +73,10 @@
* See http://www.freertos.org/a00110.html. * See http://www.freertos.org/a00110.html.
*----------------------------------------------------------*/ *----------------------------------------------------------*/
#define configUSE_PREEMPTION 1 #define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 1 #define configUSE_IDLE_HOOK 1
#define configUSE_TICK_HOOK 1 #define configUSE_TICK_HOOK 1
#define configCPU_CLOCK_HZ ( 75000000UL ) #define configCPU_CLOCK_HZ ( 96000000UL )
#define configTICK_RATE_HZ ( ( portTickType ) 1000 ) #define configTICK_RATE_HZ ( ( portTickType ) 1000 )
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 ) #define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 )
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 90 ) #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 90 )

View File

@ -38,19 +38,6 @@ common_startup(void)
uint8 * bss_start, * bss_end; uint8 * bss_start, * bss_end;
/* Addresses for VECTOR_TABLE and VECTOR_RAM come from the linker file */
extern uint32 __VECTOR_TABLE[];
extern uint32 __VECTOR_RAM[];
/* Copy the vector table to RAM */
if (__VECTOR_RAM != __VECTOR_TABLE)
{
for (n = 0; n < 0x410; n++)
__VECTOR_RAM[n] = __VECTOR_TABLE[n];
}
/* Point the VTOR to the new copy of the vector table */
write_vtor((uint32)__VECTOR_RAM);
/* Get the addresses for the .data section (initialized data section) */ /* Get the addresses for the .data section (initialized data section) */
#if (defined(CW)) #if (defined(CW))
data_ram = (uint8 *)__DATA_RAM; data_ram = (uint8 *)__DATA_RAM;

View File

@ -27,7 +27,6 @@ __startup
MOV r10,#0 MOV r10,#0
MOV r11,#0 MOV r11,#0
MOV r12,#0 MOV r12,#0
CPSIE i ; Unmask interrupts
import start import start
BL start ; call the C code BL start ; call the C code
__done __done

View File

@ -7,14 +7,6 @@
#include "vectors.h" #include "vectors.h"
#include "common.h" #include "common.h"
/* The kernel interrupts - in their CMSIS form. */
extern void SVC_Handler( void );
extern void PendSV_Handler( void );
extern void SysTick_Handler( void );
/* The button interrupt. */
extern void vPort_E_ISRHandler( void );
/****************************************************************************** /******************************************************************************
* Vector Table * Vector Table
******************************************************************************/ ******************************************************************************/
@ -41,11 +33,11 @@ typedef void (*vector_entry)(void);
VECTOR_008, VECTOR_008,
VECTOR_009, VECTOR_009,
VECTOR_010, VECTOR_010,
SVC_Handler, VECTOR_011,
VECTOR_012, VECTOR_012,
VECTOR_013, VECTOR_013,
PendSV_Handler, VECTOR_014,
SysTick_Handler, VECTOR_015,
VECTOR_016, VECTOR_016,
VECTOR_017, VECTOR_017,
@ -134,11 +126,11 @@ typedef void (*vector_entry)(void);
VECTOR_100, VECTOR_100,
VECTOR_101, VECTOR_101,
VECTOR_102, VECTOR_102,
VECTOR_103, /* Port A */ VECTOR_103,
VECTOR_104, VECTOR_104,
VECTOR_105, /* Port C */ VECTOR_105,
VECTOR_106, VECTOR_106,
vPort_E_ISRHandler, /* Port E */ VECTOR_107,
VECTOR_108, VECTOR_108,
VECTOR_109, VECTOR_109,
VECTOR_110, VECTOR_110,

View File

@ -1,16 +1,25 @@
/****************************************************************************** /******************************************************************************
* File: vectors.h * File: vectors.h
* *
* Purpose: Provide custom interrupt service routines for Kinetis. * Purpose: Provide custom interrupt service routines for Kinetis.
* *
* NOTE: This vector table is a superset table, so interrupt sources might be * NOTE: This vector table is a superset table, so interrupt sources might be
* listed that are not available on the specific Kinetis device you are * listed that are not available on the specific Kinetis device you are
* using. * using.
******************************************************************************/ ******************************************************************************/
#ifndef __VECTORS_H #ifndef __VECTORS_H
#define __VECTORS_H 1 #define __VECTORS_H 1
/* The kernel interrupts - in their CMSIS form. */
extern void SVC_Handler( void );
extern void PendSV_Handler( void );
extern void SysTick_Handler( void );
/* The button interrupt. */
extern void vPort_E_ISRHandler( void );
// function prototype for default_isr in vectors.c // function prototype for default_isr in vectors.c
void default_isr(void); void default_isr(void);
void abort_isr(void); void abort_isr(void);
@ -32,15 +41,15 @@ extern void __iar_program_start(void);
#define VECTOR_004 default_isr // 0x0000_0010 4 - #define VECTOR_004 default_isr // 0x0000_0010 4 -
#define VECTOR_005 default_isr // 0x0000_0014 5 - ARM core Bus Fault #define VECTOR_005 default_isr // 0x0000_0014 5 - ARM core Bus Fault
#define VECTOR_006 default_isr // 0x0000_0018 6 - ARM core Usage Fault #define VECTOR_006 default_isr // 0x0000_0018 6 - ARM core Usage Fault
#define VECTOR_007 default_isr // 0x0000_001C 7 - #define VECTOR_007 default_isr // 0x0000_001C 7 -
#define VECTOR_008 default_isr // 0x0000_0020 8 - #define VECTOR_008 default_isr // 0x0000_0020 8 -
#define VECTOR_009 default_isr // 0x0000_0024 9 - #define VECTOR_009 default_isr // 0x0000_0024 9 -
#define VECTOR_010 default_isr // 0x0000_0028 10 - #define VECTOR_010 default_isr // 0x0000_0028 10 -
#define VECTOR_011 default_isr // 0x0000_002C 11 - ARM core Supervisor call (SVCall) #define VECTOR_011 SVC_Handler // 0x0000_002C 11 - ARM core Supervisor call (SVCall)
#define VECTOR_012 default_isr // 0x0000_0030 12 - ARM core Debug Monitor #define VECTOR_012 default_isr // 0x0000_0030 12 - ARM core Debug Monitor
#define VECTOR_013 default_isr // 0x0000_0034 13 - #define VECTOR_013 default_isr // 0x0000_0034 13 -
#define VECTOR_014 default_isr // 0x0000_0038 14 - ARM core Pendable request for system service (PendableSrvReq) #define VECTOR_014 PendSV_Handler // 0x0000_0038 14 - ARM core Pendable request for system service (PendableSrvReq)
#define VECTOR_015 default_isr // 0x0000_003C 15 - ARM core System tick timer (SysTick) #define VECTOR_015 SysTick_Handler // 0x0000_003C 15 - ARM core System tick timer (SysTick)
#define VECTOR_016 default_isr // 0x0000_0040 16 0 DMA DMA Channel 0 transfer complete #define VECTOR_016 default_isr // 0x0000_0040 16 0 DMA DMA Channel 0 transfer complete
#define VECTOR_017 default_isr // 0x0000_0044 17 1 DMA DMA Channel 1 transfer complete #define VECTOR_017 default_isr // 0x0000_0044 17 1 DMA DMA Channel 1 transfer complete
#define VECTOR_018 default_isr // 0x0000_0048 18 2 DMA DMA Channel 2 transfer complete #define VECTOR_018 default_isr // 0x0000_0048 18 2 DMA DMA Channel 2 transfer complete
@ -85,7 +94,7 @@ extern void __iar_program_start(void);
#define VECTOR_057 default_isr // 0x0000_00E4 57 41 CAN1 Receive Warning #define VECTOR_057 default_isr // 0x0000_00E4 57 41 CAN1 Receive Warning
#define VECTOR_058 default_isr // 0x0000_00E8 58 42 CAN1 Wake Up #define VECTOR_058 default_isr // 0x0000_00E8 58 42 CAN1 Wake Up
#define VECTOR_059 default_isr // 0x0000_00EC 59 43 CAN1 Individual Matching Elements Update (IMEU) #define VECTOR_059 default_isr // 0x0000_00EC 59 43 CAN1 Individual Matching Elements Update (IMEU)
#define VECTOR_060 default_isr // 0x0000_00F0 60 44 CAN1 Lost receive #define VECTOR_060 default_isr // 0x0000_00F0 60 44 CAN1 Lost receive
#define VECTOR_061 default_isr // 0x0000_00F4 61 45 UART0 Single interrupt vector for UART status sources #define VECTOR_061 default_isr // 0x0000_00F4 61 45 UART0 Single interrupt vector for UART status sources
#define VECTOR_062 default_isr // 0x0000_00F8 62 46 UART0 Single interrupt vector for UART error sources #define VECTOR_062 default_isr // 0x0000_00F8 62 46 UART0 Single interrupt vector for UART error sources
#define VECTOR_063 default_isr // 0x0000_00FC 63 47 UART1 Single interrupt vector for UART status sources #define VECTOR_063 default_isr // 0x0000_00FC 63 47 UART1 Single interrupt vector for UART status sources
@ -100,7 +109,7 @@ extern void __iar_program_start(void);
#define VECTOR_072 default_isr // 0x0000_0120 72 56 UART5 Single interrupt vector for UART error sources #define VECTOR_072 default_isr // 0x0000_0120 72 56 UART5 Single interrupt vector for UART error sources
#define VECTOR_073 default_isr // 0x0000_0124 73 57 ADC0 #define VECTOR_073 default_isr // 0x0000_0124 73 57 ADC0
#define VECTOR_074 default_isr // 0x0000_0128 74 58 ADC1 #define VECTOR_074 default_isr // 0x0000_0128 74 58 ADC1
#define VECTOR_075 default_isr // 0x0000_012C 75 59 CMP0 High-speed comparator #define VECTOR_075 default_isr // 0x0000_012C 75 59 CMP0 High-speed comparator
#define VECTOR_076 default_isr // 0x0000_0130 76 60 CMP1 #define VECTOR_076 default_isr // 0x0000_0130 76 60 CMP1
#define VECTOR_077 default_isr // 0x0000_0134 77 61 CMP2 #define VECTOR_077 default_isr // 0x0000_0134 77 61 CMP2
#define VECTOR_078 default_isr // 0x0000_0138 78 62 FTM0 Single interrupt vector for all sources #define VECTOR_078 default_isr // 0x0000_0138 78 62 FTM0 Single interrupt vector for all sources
@ -116,7 +125,7 @@ extern void __iar_program_start(void);
#define VECTOR_088 default_isr // 0x0000_0160 88 72 PDB #define VECTOR_088 default_isr // 0x0000_0160 88 72 PDB
#define VECTOR_089 default_isr // 0x0000_0164 89 73 USB OTG #define VECTOR_089 default_isr // 0x0000_0164 89 73 USB OTG
#define VECTOR_090 default_isr // 0x0000_0168 90 74 USB Charger Detect #define VECTOR_090 default_isr // 0x0000_0168 90 74 USB Charger Detect
#define VECTOR_091 default_isr // 0x0000_016C 91 75 ENET IEEE 1588 Timer interrupt #define VECTOR_091 default_isr // 0x0000_016C 91 75 ENET IEEE 1588 Timer interrupt
#define VECTOR_092 default_isr // 0x0000_0170 92 76 ENET Transmit interrupt #define VECTOR_092 default_isr // 0x0000_0170 92 76 ENET Transmit interrupt
#define VECTOR_093 default_isr // 0x0000_0174 93 77 ENET Receive interrupt #define VECTOR_093 default_isr // 0x0000_0174 93 77 ENET Receive interrupt
#define VECTOR_094 default_isr // 0x0000_0178 94 78 ENET Error and miscellaneous interrupt #define VECTOR_094 default_isr // 0x0000_0178 94 78 ENET Error and miscellaneous interrupt
@ -132,157 +141,157 @@ extern void __iar_program_start(void);
#define VECTOR_104 default_isr // 0x0000_01A0 104 88 Port control module Pin Detect (Port B) #define VECTOR_104 default_isr // 0x0000_01A0 104 88 Port control module Pin Detect (Port B)
#define VECTOR_105 default_isr // 0x0000_01A4 105 89 Port control module Pin Detect (Port C) #define VECTOR_105 default_isr // 0x0000_01A4 105 89 Port control module Pin Detect (Port C)
#define VECTOR_106 default_isr // 0x0000_01A8 106 90 Port control module Pin Detect (Port D) #define VECTOR_106 default_isr // 0x0000_01A8 106 90 Port control module Pin Detect (Port D)
#define VECTOR_107 default_isr // 0x0000_01AC 107 91 Port control module Pin Detect (Port E) #define VECTOR_107 vPort_E_ISRHandler // 0x0000_01AC 107 91 Port control module Pin Detect (Port E)
#define VECTOR_108 default_isr // 0x0000_01B0 108 92 #define VECTOR_108 default_isr // 0x0000_01B0 108 92
#define VECTOR_109 default_isr // 0x0000_01B4 109 93 #define VECTOR_109 default_isr // 0x0000_01B4 109 93
#define VECTOR_110 default_isr // 0x0000_01B8 110 94 #define VECTOR_110 default_isr // 0x0000_01B8 110 94
#define VECTOR_111 default_isr // 0x0000_01BC 111 95 #define VECTOR_111 default_isr // 0x0000_01BC 111 95
#define VECTOR_112 default_isr // 0x0000_01C0 112 96 #define VECTOR_112 default_isr // 0x0000_01C0 112 96
#define VECTOR_113 default_isr // 0x0000_01C4 113 97 #define VECTOR_113 default_isr // 0x0000_01C4 113 97
#define VECTOR_114 default_isr // 0x0000_01C8 114 98 #define VECTOR_114 default_isr // 0x0000_01C8 114 98
#define VECTOR_115 default_isr // 0x0000_01CC 115 99 #define VECTOR_115 default_isr // 0x0000_01CC 115 99
#define VECTOR_116 default_isr // 0x0000_01D0 116 100 #define VECTOR_116 default_isr // 0x0000_01D0 116 100
#define VECTOR_117 default_isr // 0x0000_01D4 117 101 #define VECTOR_117 default_isr // 0x0000_01D4 117 101
#define VECTOR_118 default_isr // 0x0000_01D8 118 102 #define VECTOR_118 default_isr // 0x0000_01D8 118 102
#define VECTOR_119 default_isr // 0x0000_01DC 119 103 #define VECTOR_119 default_isr // 0x0000_01DC 119 103
#define VECTOR_120 default_isr // #define VECTOR_120 default_isr //
#define VECTOR_121 default_isr // #define VECTOR_121 default_isr //
#define VECTOR_122 default_isr // #define VECTOR_122 default_isr //
#define VECTOR_123 default_isr // #define VECTOR_123 default_isr //
#define VECTOR_124 default_isr // #define VECTOR_124 default_isr //
#define VECTOR_125 default_isr // #define VECTOR_125 default_isr //
#define VECTOR_126 default_isr // #define VECTOR_126 default_isr //
#define VECTOR_127 default_isr // #define VECTOR_127 default_isr //
#define VECTOR_128 default_isr // #define VECTOR_128 default_isr //
#define VECTOR_129 default_isr // #define VECTOR_129 default_isr //
#define VECTOR_130 default_isr // #define VECTOR_130 default_isr //
#define VECTOR_131 default_isr // #define VECTOR_131 default_isr //
#define VECTOR_132 default_isr // #define VECTOR_132 default_isr //
#define VECTOR_133 default_isr // #define VECTOR_133 default_isr //
#define VECTOR_134 default_isr // #define VECTOR_134 default_isr //
#define VECTOR_135 default_isr // #define VECTOR_135 default_isr //
#define VECTOR_136 default_isr // #define VECTOR_136 default_isr //
#define VECTOR_137 default_isr // #define VECTOR_137 default_isr //
#define VECTOR_138 default_isr // #define VECTOR_138 default_isr //
#define VECTOR_139 default_isr // #define VECTOR_139 default_isr //
#define VECTOR_140 default_isr // #define VECTOR_140 default_isr //
#define VECTOR_141 default_isr // #define VECTOR_141 default_isr //
#define VECTOR_142 default_isr // #define VECTOR_142 default_isr //
#define VECTOR_143 default_isr // #define VECTOR_143 default_isr //
#define VECTOR_144 default_isr // #define VECTOR_144 default_isr //
#define VECTOR_145 default_isr // #define VECTOR_145 default_isr //
#define VECTOR_146 default_isr // #define VECTOR_146 default_isr //
#define VECTOR_147 default_isr // #define VECTOR_147 default_isr //
#define VECTOR_148 default_isr // #define VECTOR_148 default_isr //
#define VECTOR_149 default_isr // #define VECTOR_149 default_isr //
#define VECTOR_150 default_isr // #define VECTOR_150 default_isr //
#define VECTOR_151 default_isr // #define VECTOR_151 default_isr //
#define VECTOR_152 default_isr // #define VECTOR_152 default_isr //
#define VECTOR_153 default_isr // #define VECTOR_153 default_isr //
#define VECTOR_154 default_isr // #define VECTOR_154 default_isr //
#define VECTOR_155 default_isr // #define VECTOR_155 default_isr //
#define VECTOR_156 default_isr // #define VECTOR_156 default_isr //
#define VECTOR_157 default_isr // #define VECTOR_157 default_isr //
#define VECTOR_158 default_isr // #define VECTOR_158 default_isr //
#define VECTOR_159 default_isr // #define VECTOR_159 default_isr //
#define VECTOR_160 default_isr // #define VECTOR_160 default_isr //
#define VECTOR_161 default_isr // #define VECTOR_161 default_isr //
#define VECTOR_162 default_isr // #define VECTOR_162 default_isr //
#define VECTOR_163 default_isr // #define VECTOR_163 default_isr //
#define VECTOR_164 default_isr // #define VECTOR_164 default_isr //
#define VECTOR_165 default_isr // #define VECTOR_165 default_isr //
#define VECTOR_166 default_isr // #define VECTOR_166 default_isr //
#define VECTOR_167 default_isr // #define VECTOR_167 default_isr //
#define VECTOR_168 default_isr // #define VECTOR_168 default_isr //
#define VECTOR_169 default_isr // #define VECTOR_169 default_isr //
#define VECTOR_170 default_isr // #define VECTOR_170 default_isr //
#define VECTOR_171 default_isr // #define VECTOR_171 default_isr //
#define VECTOR_172 default_isr // #define VECTOR_172 default_isr //
#define VECTOR_173 default_isr // #define VECTOR_173 default_isr //
#define VECTOR_174 default_isr // #define VECTOR_174 default_isr //
#define VECTOR_175 default_isr // #define VECTOR_175 default_isr //
#define VECTOR_176 default_isr // #define VECTOR_176 default_isr //
#define VECTOR_177 default_isr // #define VECTOR_177 default_isr //
#define VECTOR_178 default_isr // #define VECTOR_178 default_isr //
#define VECTOR_179 default_isr // #define VECTOR_179 default_isr //
#define VECTOR_180 default_isr // #define VECTOR_180 default_isr //
#define VECTOR_181 default_isr // #define VECTOR_181 default_isr //
#define VECTOR_182 default_isr // #define VECTOR_182 default_isr //
#define VECTOR_183 default_isr // #define VECTOR_183 default_isr //
#define VECTOR_184 default_isr // #define VECTOR_184 default_isr //
#define VECTOR_185 default_isr // #define VECTOR_185 default_isr //
#define VECTOR_186 default_isr // #define VECTOR_186 default_isr //
#define VECTOR_187 default_isr // #define VECTOR_187 default_isr //
#define VECTOR_188 default_isr // #define VECTOR_188 default_isr //
#define VECTOR_189 default_isr // #define VECTOR_189 default_isr //
#define VECTOR_190 default_isr // #define VECTOR_190 default_isr //
#define VECTOR_191 default_isr // #define VECTOR_191 default_isr //
#define VECTOR_192 default_isr // #define VECTOR_192 default_isr //
#define VECTOR_193 default_isr // #define VECTOR_193 default_isr //
#define VECTOR_194 default_isr // #define VECTOR_194 default_isr //
#define VECTOR_195 default_isr // #define VECTOR_195 default_isr //
#define VECTOR_196 default_isr // #define VECTOR_196 default_isr //
#define VECTOR_197 default_isr // #define VECTOR_197 default_isr //
#define VECTOR_198 default_isr // #define VECTOR_198 default_isr //
#define VECTOR_199 default_isr // #define VECTOR_199 default_isr //
#define VECTOR_200 default_isr // #define VECTOR_200 default_isr //
#define VECTOR_201 default_isr // #define VECTOR_201 default_isr //
#define VECTOR_202 default_isr // #define VECTOR_202 default_isr //
#define VECTOR_203 default_isr // #define VECTOR_203 default_isr //
#define VECTOR_204 default_isr // #define VECTOR_204 default_isr //
#define VECTOR_205 default_isr // #define VECTOR_205 default_isr //
#define VECTOR_206 default_isr // #define VECTOR_206 default_isr //
#define VECTOR_207 default_isr // #define VECTOR_207 default_isr //
#define VECTOR_208 default_isr // #define VECTOR_208 default_isr //
#define VECTOR_209 default_isr // #define VECTOR_209 default_isr //
#define VECTOR_210 default_isr // #define VECTOR_210 default_isr //
#define VECTOR_211 default_isr // #define VECTOR_211 default_isr //
#define VECTOR_212 default_isr // #define VECTOR_212 default_isr //
#define VECTOR_213 default_isr // #define VECTOR_213 default_isr //
#define VECTOR_214 default_isr // #define VECTOR_214 default_isr //
#define VECTOR_215 default_isr // #define VECTOR_215 default_isr //
#define VECTOR_216 default_isr // #define VECTOR_216 default_isr //
#define VECTOR_217 default_isr // #define VECTOR_217 default_isr //
#define VECTOR_218 default_isr // #define VECTOR_218 default_isr //
#define VECTOR_219 default_isr // #define VECTOR_219 default_isr //
#define VECTOR_220 default_isr // #define VECTOR_220 default_isr //
#define VECTOR_221 default_isr // #define VECTOR_221 default_isr //
#define VECTOR_222 default_isr // #define VECTOR_222 default_isr //
#define VECTOR_223 default_isr // #define VECTOR_223 default_isr //
#define VECTOR_224 default_isr // #define VECTOR_224 default_isr //
#define VECTOR_225 default_isr // #define VECTOR_225 default_isr //
#define VECTOR_226 default_isr // #define VECTOR_226 default_isr //
#define VECTOR_227 default_isr // #define VECTOR_227 default_isr //
#define VECTOR_228 default_isr // #define VECTOR_228 default_isr //
#define VECTOR_229 default_isr // #define VECTOR_229 default_isr //
#define VECTOR_230 default_isr // #define VECTOR_230 default_isr //
#define VECTOR_231 default_isr // #define VECTOR_231 default_isr //
#define VECTOR_232 default_isr // #define VECTOR_232 default_isr //
#define VECTOR_233 default_isr // #define VECTOR_233 default_isr //
#define VECTOR_234 default_isr // #define VECTOR_234 default_isr //
#define VECTOR_235 default_isr // #define VECTOR_235 default_isr //
#define VECTOR_236 default_isr // #define VECTOR_236 default_isr //
#define VECTOR_237 default_isr // #define VECTOR_237 default_isr //
#define VECTOR_238 default_isr // #define VECTOR_238 default_isr //
#define VECTOR_239 default_isr // #define VECTOR_239 default_isr //
#define VECTOR_240 default_isr // #define VECTOR_240 default_isr //
#define VECTOR_241 default_isr // #define VECTOR_241 default_isr //
#define VECTOR_242 default_isr // #define VECTOR_242 default_isr //
#define VECTOR_243 default_isr // #define VECTOR_243 default_isr //
#define VECTOR_244 default_isr // #define VECTOR_244 default_isr //
#define VECTOR_245 default_isr // #define VECTOR_245 default_isr //
#define VECTOR_246 default_isr // #define VECTOR_246 default_isr //
#define VECTOR_247 default_isr // #define VECTOR_247 default_isr //
#define VECTOR_248 default_isr // #define VECTOR_248 default_isr //
#define VECTOR_249 default_isr // #define VECTOR_249 default_isr //
#define VECTOR_250 default_isr // #define VECTOR_250 default_isr //
#define VECTOR_251 default_isr // #define VECTOR_251 default_isr //
#define VECTOR_252 default_isr // #define VECTOR_252 default_isr //
#define VECTOR_253 default_isr // #define VECTOR_253 default_isr //
#define VECTOR_254 default_isr // #define VECTOR_254 default_isr //
#define VECTOR_255 default_isr // #define VECTOR_255 default_isr //
#define CONFIG_1 (pointer*)0xffffffff #define CONFIG_1 (pointer*)0xffffffff
#define CONFIG_2 (pointer*)0xffffffff #define CONFIG_2 (pointer*)0xffffffff
#define CONFIG_3 (pointer*)0xffffffff #define CONFIG_3 (pointer*)0xffffffff
#define CONFIG_4 (pointer*)0xfffffffe #define CONFIG_4 (pointer*)0xfffffffe

View File

@ -0,0 +1,150 @@
/*
FreeRTOS V7.0.1 - Copyright (C) 2011 Real Time Engineers Ltd.
***************************************************************************
* *
* FreeRTOS tutorial books are available in pdf and paperback. *
* Complete, revised, and edited pdf reference manuals are also *
* available. *
* *
* Purchasing FreeRTOS documentation will not only help you, by *
* ensuring you get running as quickly as possible and with an *
* in-depth knowledge of how to use FreeRTOS, it will also help *
* the FreeRTOS project to continue with its mission of providing *
* professional grade, cross platform, de facto standard solutions *
* for microcontrollers - completely free of charge! *
* *
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
* *
* Thank you for using FreeRTOS, and thank you for your support! *
* *
***************************************************************************
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. See the GNU General Public License for
more details. You should have received a copy of the GNU General Public
License and the FreeRTOS license exception along with FreeRTOS; if not it
can be viewed here: http://www.freertos.org/a00114.html and also obtained
by writing to Richard Barry, contact details for whom are available on the
FreeRTOS WEB site.
1 tab == 4 spaces!
http://www.FreeRTOS.org - Documentation, latest information, license and
contact details.
http://www.SafeRTOS.com - A version that is certified for use in safety
critical systems.
http://www.OpenRTOS.com - Commercial support, development, porting,
licensing and training services.
*/
/*-----------------------------------------------------------
* Simple parallel port IO routines.
*-----------------------------------------------------------*/
/* Kernel includes. */
#include "FreeRTOS.h"
#include "task.h"
/* Standard demo include. */
#include "partest.h"
/* Freescale includes. */
#include "common.h"
/* Only the LEDs on one of the two seven segment displays are used. */
#define partstMAX_LEDS 4
const unsigned long ulLEDs[ partstMAX_LEDS ] = { ( 1UL << 10UL ), ( 1UL << 29UL ), ( 1UL << 28UL ), ( 1UL << 11UL ) };
/*-----------------------------------------------------------*/
void vParTestInitialise( void )
{
/* Set PTA10, PTA11, PTA28, and PTA29 (connected to LED's) for GPIO
functionality. */
PORTA_PCR10 = ( 0 | PORT_PCR_MUX( 1 ) );
PORTA_PCR11 = ( 0 | PORT_PCR_MUX( 1 ) );
PORTA_PCR28 = ( 0 | PORT_PCR_MUX( 1 ) );
PORTA_PCR29 = ( 0 | PORT_PCR_MUX( 1 ) );
/* Change PTA10, PTA11, PTA28, PTA29 to outputs. */
GPIOA_PDDR=GPIO_PDDR_PDD( ulLEDs[ 0 ] | ulLEDs[ 1 ] | ulLEDs[ 2 ] | ulLEDs[ 3 ] );
/* Start with LEDs off. */
GPIOA_PTOR = ~0U;
}
/*-----------------------------------------------------------*/
void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
{
if( uxLED < partstMAX_LEDS )
{
/* A critical section is used as the LEDs are also accessed from an
interrupt. */
taskENTER_CRITICAL();
{
if( xValue == pdTRUE )
{
GPIOA_PDOR &= ~GPIO_PDOR_PDO( ulLEDs[ uxLED ] );
}
else
{
GPIOA_PDOR |= GPIO_PDOR_PDO( ulLEDs[ uxLED ] );
}
}
taskEXIT_CRITICAL();
}
}
/*-----------------------------------------------------------*/
void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
{
if( uxLED < partstMAX_LEDS )
{
/* A critical section is used as the LEDs are also accessed from an
interrupt. */
taskENTER_CRITICAL();
{
GPIOA_PTOR |= GPIO_PDOR_PDO( ulLEDs[ uxLED ] );
}
taskEXIT_CRITICAL();
}
}
/*-----------------------------------------------------------*/
void vParTestSetLEDFromISR( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
{
unsigned portBASE_TYPE uxInterruptFlags;
if( uxLED < partstMAX_LEDS )
{
uxInterruptFlags = portSET_INTERRUPT_MASK_FROM_ISR();
{
if( xValue == pdTRUE )
{
GPIOA_PDOR &= ~GPIO_PDOR_PDO( ulLEDs[ uxLED ] );
}
else
{
GPIOA_PDOR |= GPIO_PDOR_PDO( ulLEDs[ uxLED ] );
}
}
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxInterruptFlags );
}
}
/*-----------------------------------------------------------*/

View File

@ -3,7 +3,7 @@
<project> <project>
<fileVersion>2</fileVersion> <fileVersion>2</fileVersion>
<configuration> <configuration>
<name>RTOSDemo</name> <name>Full</name>
<toolchain> <toolchain>
<name>ARM</name> <name>ARM</name>
</toolchain> </toolchain>
@ -891,6 +891,895 @@
</plugin> </plugin>
</debuggerPlugins> </debuggerPlugins>
</configuration> </configuration>
<configuration>
<name>Blinky</name>
<toolchain>
<name>ARM</name>
</toolchain>
<debug>1</debug>
<settings>
<name>C-SPY</name>
<archiveVersion>2</archiveVersion>
<data>
<version>22</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>CInput</name>
<state>1</state>
</option>
<option>
<name>CEndian</name>
<state>1</state>
</option>
<option>
<name>CProcessor</name>
<state>1</state>
</option>
<option>
<name>OCVariant</name>
<state>0</state>
</option>
<option>
<name>MacOverride</name>
<state>0</state>
</option>
<option>
<name>MacFile</name>
<state></state>
</option>
<option>
<name>MemOverride</name>
<state>0</state>
</option>
<option>
<name>MemFile</name>
<state>$TOOLKIT_DIR$\CONFIG\debugger\Freescale\iok60xxxx.ddf</state>
</option>
<option>
<name>RunToEnable</name>
<state>1</state>
</option>
<option>
<name>RunToName</name>
<state>main</state>
</option>
<option>
<name>CExtraOptionsCheck</name>
<state>0</state>
</option>
<option>
<name>CExtraOptions</name>
<state></state>
</option>
<option>
<name>CFpuProcessor</name>
<state>1</state>
</option>
<option>
<name>OCDDFArgumentProducer</name>
<state></state>
</option>
<option>
<name>OCDownloadSuppressDownload</name>
<state>0</state>
</option>
<option>
<name>OCDownloadVerifyAll</name>
<state>1</state>
</option>
<option>
<name>OCProductVersion</name>
<state>5.50.0.51907</state>
</option>
<option>
<name>OCDynDriverList</name>
<state>JLINK_ID</state>
</option>
<option>
<name>OCLastSavedByProductVersion</name>
<state>6.21.1.52845</state>
</option>
<option>
<name>OCDownloadAttachToProgram</name>
<state>0</state>
</option>
<option>
<name>UseFlashLoader</name>
<state>1</state>
</option>
<option>
<name>CLowLevel</name>
<state>1</state>
</option>
<option>
<name>OCBE8Slave</name>
<state>1</state>
</option>
<option>
<name>MacFile2</name>
<state></state>
</option>
<option>
<name>CDevice</name>
<state>1</state>
</option>
<option>
<name>FlashLoadersV3</name>
<state>$TOOLKIT_DIR$\config\flashloader\Freescale\FlashK60Xxxx.board</state>
</option>
<option>
<name>OCImagesSuppressCheck1</name>
<state>0</state>
</option>
<option>
<name>OCImagesPath1</name>
<state></state>
</option>
<option>
<name>OCImagesSuppressCheck2</name>
<state>0</state>
</option>
<option>
<name>OCImagesPath2</name>
<state></state>
</option>
<option>
<name>OCImagesSuppressCheck3</name>
<state>0</state>
</option>
<option>
<name>OCImagesPath3</name>
<state></state>
</option>
<option>
<name>OverrideDefFlashBoard</name>
<state>0</state>
</option>
<option>
<name>OCImagesOffset1</name>
<state></state>
</option>
<option>
<name>OCImagesOffset2</name>
<state></state>
</option>
<option>
<name>OCImagesOffset3</name>
<state></state>
</option>
<option>
<name>OCImagesUse1</name>
<state>0</state>
</option>
<option>
<name>OCImagesUse2</name>
<state>0</state>
</option>
<option>
<name>OCImagesUse3</name>
<state>0</state>
</option>
</data>
</settings>
<settings>
<name>ARMSIM_ID</name>
<archiveVersion>2</archiveVersion>
<data>
<version>1</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>OCSimDriverInfo</name>
<state>1</state>
</option>
<option>
<name>OCSimEnablePSP</name>
<state>0</state>
</option>
<option>
<name>OCSimPspOverrideConfig</name>
<state>0</state>
</option>
<option>
<name>OCSimPspConfigFile</name>
<state></state>
</option>
</data>
</settings>
<settings>
<name>ANGEL_ID</name>
<archiveVersion>2</archiveVersion>
<data>
<version>0</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>CCAngelHeartbeat</name>
<state>1</state>
</option>
<option>
<name>CAngelCommunication</name>
<state>1</state>
</option>
<option>
<name>CAngelCommBaud</name>
<version>0</version>
<state>3</state>
</option>
<option>
<name>CAngelCommPort</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>ANGELTCPIP</name>
<state>aaa.bbb.ccc.ddd</state>
</option>
<option>
<name>DoAngelLogfile</name>
<state>0</state>
</option>
<option>
<name>AngelLogFile</name>
<state>$PROJ_DIR$\cspycomm.log</state>
</option>
<option>
<name>OCDriverInfo</name>
<state>1</state>
</option>
</data>
</settings>
<settings>
<name>GDBSERVER_ID</name>
<archiveVersion>2</archiveVersion>
<data>
<version>0</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>OCDriverInfo</name>
<state>1</state>
</option>
<option>
<name>TCPIP</name>
<state>aaa.bbb.ccc.ddd</state>
</option>
<option>
<name>DoLogfile</name>
<state>0</state>
</option>
<option>
<name>LogFile</name>
<state>$PROJ_DIR$\cspycomm.log</state>
</option>
<option>
<name>CCJTagBreakpointRadio</name>
<state>0</state>
</option>
<option>
<name>CCJTagDoUpdateBreakpoints</name>
<state>0</state>
</option>
<option>
<name>CCJTagUpdateBreakpoints</name>
<state>_call_main</state>
</option>
</data>
</settings>
<settings>
<name>IARROM_ID</name>
<archiveVersion>2</archiveVersion>
<data>
<version>1</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>CRomLogFileCheck</name>
<state>0</state>
</option>
<option>
<name>CRomLogFileEditB</name>
<state>$PROJ_DIR$\cspycomm.log</state>
</option>
<option>
<name>CRomCommPort</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>CRomCommBaud</name>
<version>0</version>
<state>7</state>
</option>
<option>
<name>OCDriverInfo</name>
<state>1</state>
</option>
</data>
</settings>
<settings>
<name>JLINK_ID</name>
<archiveVersion>2</archiveVersion>
<data>
<version>13</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>JLinkSpeed</name>
<state>32</state>
</option>
<option>
<name>CCJLinkDoLogfile</name>
<state>0</state>
</option>
<option>
<name>CCJLinkLogFile</name>
<state>$PROJ_DIR$\cspycomm.log</state>
</option>
<option>
<name>CCJLinkHWResetDelay</name>
<state>0</state>
</option>
<option>
<name>OCDriverInfo</name>
<state>1</state>
</option>
<option>
<name>JLinkInitialSpeed</name>
<state>32</state>
</option>
<option>
<name>CCDoJlinkMultiTarget</name>
<state>0</state>
</option>
<option>
<name>CCScanChainNonARMDevices</name>
<state>0</state>
</option>
<option>
<name>CCJLinkMultiTarget</name>
<state>0</state>
</option>
<option>
<name>CCJLinkIRLength</name>
<state>0</state>
</option>
<option>
<name>CCJLinkCommRadio</name>
<state>0</state>
</option>
<option>
<name>CCJLinkTCPIP</name>
<state>aaa.bbb.ccc.ddd</state>
</option>
<option>
<name>CCJLinkSpeedRadioV2</name>
<state>0</state>
</option>
<option>
<name>CCUSBDevice</name>
<version>1</version>
<state>1</state>
</option>
<option>
<name>CCRDICatchReset</name>
<state>0</state>
</option>
<option>
<name>CCRDICatchUndef</name>
<state>0</state>
</option>
<option>
<name>CCRDICatchSWI</name>
<state>0</state>
</option>
<option>
<name>CCRDICatchData</name>
<state>0</state>
</option>
<option>
<name>CCRDICatchPrefetch</name>
<state>0</state>
</option>
<option>
<name>CCRDICatchIRQ</name>
<state>0</state>
</option>
<option>
<name>CCRDICatchFIQ</name>
<state>0</state>
</option>
<option>
<name>CCJLinkBreakpointRadio</name>
<state>0</state>
</option>
<option>
<name>CCJLinkDoUpdateBreakpoints</name>
<state>0</state>
</option>
<option>
<name>CCJLinkUpdateBreakpoints</name>
<state>_call_main</state>
</option>
<option>
<name>CCJLinkInterfaceRadio</name>
<state>1</state>
</option>
<option>
<name>OCJLinkAttachSlave</name>
<state>1</state>
</option>
<option>
<name>CCJLinkResetList</name>
<version>5</version>
<state>7</state>
</option>
<option>
<name>CCJLinkInterfaceCmdLine</name>
<state>0</state>
</option>
<option>
<name>CCCatchCORERESET</name>
<state>0</state>
</option>
<option>
<name>CCCatchMMERR</name>
<state>0</state>
</option>
<option>
<name>CCCatchNOCPERR</name>
<state>0</state>
</option>
<option>
<name>CCCatchCHRERR</name>
<state>0</state>
</option>
<option>
<name>CCCatchSTATERR</name>
<state>0</state>
</option>
<option>
<name>CCCatchBUSERR</name>
<state>0</state>
</option>
<option>
<name>CCCatchINTERR</name>
<state>0</state>
</option>
<option>
<name>CCCatchHARDERR</name>
<state>0</state>
</option>
<option>
<name>CCCatchDummy</name>
<state>0</state>
</option>
<option>
<name>OCJLinkScriptFile</name>
<state>1</state>
</option>
<option>
<name>CCJLinkUsbSerialNo</name>
<state></state>
</option>
<option>
<name>CCTcpIpAlt</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>CCJLinkTcpIpSerialNo</name>
<state></state>
</option>
<option>
<name>CCCpuClockEdit</name>
<state>72.0</state>
</option>
<option>
<name>CCSwoClockAuto</name>
<state>0</state>
</option>
<option>
<name>CCSwoClockEdit</name>
<state>2000</state>
</option>
</data>
</settings>
<settings>
<name>LMIFTDI_ID</name>
<archiveVersion>2</archiveVersion>
<data>
<version>2</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>OCDriverInfo</name>
<state>1</state>
</option>
<option>
<name>LmiftdiSpeed</name>
<state>500</state>
</option>
<option>
<name>CCLmiftdiDoLogfile</name>
<state>0</state>
</option>
<option>
<name>CCLmiftdiLogFile</name>
<state>$PROJ_DIR$\cspycomm.log</state>
</option>
<option>
<name>CCLmiFtdiInterfaceRadio</name>
<state>0</state>
</option>
<option>
<name>CCLmiFtdiInterfaceCmdLine</name>
<state>0</state>
</option>
</data>
</settings>
<settings>
<name>MACRAIGOR_ID</name>
<archiveVersion>2</archiveVersion>
<data>
<version>3</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>jtag</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>EmuSpeed</name>
<state>1</state>
</option>
<option>
<name>TCPIP</name>
<state>aaa.bbb.ccc.ddd</state>
</option>
<option>
<name>DoLogfile</name>
<state>0</state>
</option>
<option>
<name>LogFile</name>
<state>$PROJ_DIR$\cspycomm.log</state>
</option>
<option>
<name>DoEmuMultiTarget</name>
<state>0</state>
</option>
<option>
<name>EmuMultiTarget</name>
<state>0@ARM7TDMI</state>
</option>
<option>
<name>EmuHWReset</name>
<state>0</state>
</option>
<option>
<name>CEmuCommBaud</name>
<version>0</version>
<state>4</state>
</option>
<option>
<name>CEmuCommPort</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>jtago</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>OCDriverInfo</name>
<state>1</state>
</option>
<option>
<name>UnusedAddr</name>
<state>0x00800000</state>
</option>
<option>
<name>CCMacraigorHWResetDelay</name>
<state></state>
</option>
<option>
<name>CCJTagBreakpointRadio</name>
<state>0</state>
</option>
<option>
<name>CCJTagDoUpdateBreakpoints</name>
<state>0</state>
</option>
<option>
<name>CCJTagUpdateBreakpoints</name>
<state>_call_main</state>
</option>
<option>
<name>CCMacraigorInterfaceRadio</name>
<state>0</state>
</option>
<option>
<name>CCMacraigorInterfaceCmdLine</name>
<state>0</state>
</option>
</data>
</settings>
<settings>
<name>PEMICRO_ID</name>
<archiveVersion>2</archiveVersion>
<data>
<version>0</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>OCDriverInfo</name>
<state>1</state>
</option>
<option>
<name>OCPEMicroAttachSlave</name>
<state>1</state>
</option>
<option>
<name>CCPEMicroInterfaceList</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>CCPEMicroResetDelay</name>
<state></state>
</option>
<option>
<name>CCPEMicroJtagSpeed</name>
<state>1000</state>
</option>
<option>
<name>CCJPEMicroShowSettings</name>
<state>0</state>
</option>
<option>
<name>DoLogfile</name>
<state>0</state>
</option>
<option>
<name>LogFile</name>
<state>$PROJ_DIR$\cspycomm.log</state>
</option>
<option>
<name>CCPEMicroUSBDevice</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>CCPEMicroSerialPort</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>CCJPEMicroTCPIPAutoScanNetwork</name>
<state>1</state>
</option>
<option>
<name>CCPEMicroTCPIP</name>
<state>10.0.0.1</state>
</option>
<option>
<name>CCPEMicroCommCmdLineProducer</name>
<state>0</state>
</option>
</data>
</settings>
<settings>
<name>RDI_ID</name>
<archiveVersion>2</archiveVersion>
<data>
<version>2</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>CRDIDriverDll</name>
<state>###Uninitialized###</state>
</option>
<option>
<name>CRDILogFileCheck</name>
<state>0</state>
</option>
<option>
<name>CRDILogFileEdit</name>
<state>$PROJ_DIR$\cspycomm.log</state>
</option>
<option>
<name>CCRDIHWReset</name>
<state>0</state>
</option>
<option>
<name>CCRDICatchReset</name>
<state>0</state>
</option>
<option>
<name>CCRDICatchUndef</name>
<state>0</state>
</option>
<option>
<name>CCRDICatchSWI</name>
<state>0</state>
</option>
<option>
<name>CCRDICatchData</name>
<state>0</state>
</option>
<option>
<name>CCRDICatchPrefetch</name>
<state>0</state>
</option>
<option>
<name>CCRDICatchIRQ</name>
<state>0</state>
</option>
<option>
<name>CCRDICatchFIQ</name>
<state>0</state>
</option>
<option>
<name>OCDriverInfo</name>
<state>1</state>
</option>
</data>
</settings>
<settings>
<name>STLINK_ID</name>
<archiveVersion>2</archiveVersion>
<data>
<version>2</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>OCDriverInfo</name>
<state>1</state>
</option>
<option>
<name>CCSTLinkInterfaceRadio</name>
<state>0</state>
</option>
<option>
<name>CCSTLinkInterfaceCmdLine</name>
<state>0</state>
</option>
<option>
<name>CCSTLinkResetList</name>
<version>1</version>
<state>0</state>
</option>
<option>
<name>CCCpuClockEdit</name>
<state>72.0</state>
</option>
<option>
<name>CCSwoClockAuto</name>
<state>0</state>
</option>
<option>
<name>CCSwoClockEdit</name>
<state>2000</state>
</option>
</data>
</settings>
<settings>
<name>THIRDPARTY_ID</name>
<archiveVersion>2</archiveVersion>
<data>
<version>0</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>CThirdPartyDriverDll</name>
<state>###Uninitialized###</state>
</option>
<option>
<name>CThirdPartyLogFileCheck</name>
<state>0</state>
</option>
<option>
<name>CThirdPartyLogFileEditB</name>
<state>$PROJ_DIR$\cspycomm.log</state>
</option>
<option>
<name>OCDriverInfo</name>
<state>1</state>
</option>
</data>
</settings>
<settings>
<name>XDS100_ID</name>
<archiveVersion>2</archiveVersion>
<data>
<version>0</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
<name>OCDriverInfo</name>
<state>1</state>
</option>
<option>
<name>OCXDS100AttachSlave</name>
<state>1</state>
</option>
</data>
</settings>
<debuggerPlugins>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\MQX\MQXRtosPlugin.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\Quadros\Quadros_EWB6_Plugin.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin</file>
<loadFlag>1</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\FreeRTOS\FreeRTOSPlugin.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\OpenRTOS\OpenRTOSPlugin.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin</file>
<loadFlag>0</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin</file>
<loadFlag>1</loadFlag>
</plugin>
<plugin>
<file>$EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin</file>
<loadFlag>1</loadFlag>
</plugin>
</debuggerPlugins>
</configuration>
</project> </project>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,584 @@
/*
FreeRTOS V7.0.1 - Copyright (C) 2011 Real Time Engineers Ltd.
FreeRTOS supports many tools and architectures. V7.0.0 is sponsored by:
Atollic AB - Atollic provides professional embedded systems development
tools for C/C++ development, code analysis and test automation.
See http://www.atollic.com
***************************************************************************
* *
* FreeRTOS tutorial books are available in pdf and paperback. *
* Complete, revised, and edited pdf reference manuals are also *
* available. *
* *
* Purchasing FreeRTOS documentation will not only help you, by *
* ensuring you get running as quickly as possible and with an *
* in-depth knowledge of how to use FreeRTOS, it will also help *
* the FreeRTOS project to continue with its mission of providing *
* professional grade, cross platform, de facto standard solutions *
* for microcontrollers - completely free of charge! *
* *
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
* *
* Thank you for using FreeRTOS, and thank you for your support! *
* *
***************************************************************************
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. See the GNU General Public License for
more details. You should have received a copy of the GNU General Public
License and the FreeRTOS license exception along with FreeRTOS; if not it
can be viewed here: http://www.freertos.org/a00114.html and also obtained
by writing to Richard Barry, contact details for whom are available on the
FreeRTOS WEB site.
1 tab == 4 spaces!
http://www.FreeRTOS.org - Documentation, latest information, license and
contact details.
http://www.SafeRTOS.com - A version that is certified for use in safety
critical systems.
http://www.OpenRTOS.com - Commercial support, development, porting,
licensing and training services.
*/
/*
* main-blinky.c is included when the "Blinky" build configuration is used.
* main-full.c is included when the "Full" build configuration is used.
*
* main-full.c (this file) defines a comprehensive demo that creates many
* tasks, queues, semaphores and timers. It also demonstrates how Cortex-M3
* interrupts can interact with FreeRTOS tasks/timers.
*
* This project runs on the SK-FM3-100PMC evaluation board, which is populated
* with an MB9BF5006N Cortex-M3 based microcontroller.
*
* The main() Function:
* main() creates three demo specific software timers, one demo specific queue,
* and two demo specific tasks. It then creates a whole host of 'standard
* demo' tasks/queues/semaphores, before starting the scheduler. The demo
* specific tasks and timers are described in the comments here. The standard
* demo tasks are described on the FreeRTOS.org web site.
*
* The standard demo tasks provide no specific functionality. They are
* included to both test the FreeRTOS port, and provide examples of how the
* various FreeRTOS API functions can be used.
*
* This demo creates 43 tasks in total. If you want a simpler demo, use the
* Blinky build configuration.
*
* The Demo Specific LED Software Timer and the Button Interrupt:
* The user button SW2 is configured to generate an interrupt each time it is
* pressed. The interrupt service routine switches an LED on, and resets the
* LED software timer. The LED timer has a 5000 millisecond (5 second) period,
* and uses a callback function that is defined to just turn the LED off again.
* Therefore, pressing the user button will turn the LED on, and the LED will
* remain on until a full five seconds pass without the button being pressed.
* See the documentation page for this demo on the FreeRTOS.org web site to see
* which LED is used.
*
* The Demo Specific "Check" Callback Function:
* This is called each time the 'check' timer expires. The check timer
* callback function inspects all the standard demo tasks to see if they are
* all executing as expected. The check timer is initially configured to
* expire every three seconds, but will shorted this to every 500ms if an error
* is ever discovered. The check timer callback toggles the LED defined by
* the mainCHECK_LED definition each time it executes. Therefore, if LED
* mainCHECK_LED is toggling every three seconds, then no error have been found.
* If LED mainCHECK_LED is toggling every 500ms, then at least one errors has
* been found. The variable pcStatusMessage is set to a string that indicates
* which task reported an error. See the documentation page for this demo on
* the FreeRTOS.org web site to see which LED in the 7 segment display is used.
*
* The Demo Specific Idle Hook Function:
* The idle hook function demonstrates how to query the amount of FreeRTOS heap
* space that is remaining (see vApplicationIdleHook() defined in this file).
*
* The Demo Specific Tick Hook Function:
* The tick hook function is used to test the interrupt safe software timer
* functionality.
*/
/* Kernel includes. */
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "timers.h"
/* Freescale includes. */
#include "common.h"
/* Common demo includes. */
#include "partest.h"
#include "flash.h"
#include "BlockQ.h"
#include "death.h"
#include "blocktim.h"
#include "semtest.h"
#include "GenQTest.h"
#include "QPeek.h"
#include "recmutex.h"
#include "TimerDemo.h"
#include "comtest2.h"
#include "PollQ.h"
#include "countsem.h"
#include "dynamic.h"
/* The rate at which data is sent to the queue, specified in milliseconds, and
converted to ticks using the portTICK_RATE_MS constant. */
#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_RATE_MS )
/* The number of items the queue can hold. This is 1 as the receive task
will remove items as they are added, meaning the send task should always find
the queue empty. */
#define mainQUEUE_LENGTH ( 1 )
/* The LED toggled by the check timer callback function. */
#define mainCHECK_LED 3UL
/* The LED turned on by the button interrupt, and turned off by the LED timer. */
#define mainTIMER_CONTROLLED_LED 2UL
/* The LEDs toggled by the two simple flash LED timers. */
#define mainLED0 0UL
#define mainLED1 1UL
/* The LED used by the comtest tasks. See the comtest.c file for more
information. In this case, the LED is deliberatly out of the valid range as
all the available LEDs are already used by other tasks and timers. */
#define mainCOM_TEST_LED ( 4 )
/* Constant used by the standard timer test functions. */
#define mainTIMER_TEST_PERIOD ( 50 )
/* Priorities used by the various different standard demo tasks. */
#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 )
#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 )
#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 )
#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 )
#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY )
#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY )
#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 )
/* Priorities defined in this main-full.c file. */
#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
/* The period at which the check timer will expire, in ms, provided no errors
have been reported by any of the standard demo tasks. ms are converted to the
equivalent in ticks using the portTICK_RATE_MS constant. */
#define mainCHECK_TIMER_PERIOD_MS ( 3000UL / portTICK_RATE_MS )
/* The period at which the check timer will expire, in ms, if an error has been
reported in one of the standard demo tasks. ms are converted to the equivalent
in ticks using the portTICK_RATE_MS constant. */
#define mainERROR_CHECK_TIMER_PERIOD_MS ( 500UL / portTICK_RATE_MS )
/* The LED will remain on until the button has not been pushed for a full
5000ms. */
#define mainBUTTON_LED_TIMER_PERIOD_MS ( 5000UL / portTICK_RATE_MS )
/* The period at which the two simple LED flash timers will execute their
callback functions. */
#define mainLED1_TIMER_PERIOD_MS ( 200 / portTICK_RATE_MS )
#define mainLED2_TIMER_PERIOD_MS ( 600 / portTICK_RATE_MS )
/* A block time of zero simply means "don't block". */
#define mainDONT_BLOCK ( 0UL )
/* Baud rate used by the comtest tasks. */
#define mainCOM_TEST_BAUD_RATE ( 115200UL )
/* The vector used by the GPIO port E. Button SW2 is configured to generate
an interrput on this port. */
#define mainGPIO_E_VECTOR ( 107 - 16 )
/*-----------------------------------------------------------*/
/*
* Setup the NVIC, LED outputs, and button inputs.
*/
static void prvSetupHardware( void );
/*
* Creates the timers that are specific to this demo - namely, the check timer
* the button LED timer, and the two simple LED flash timers.
*/
static void prvCreateDemoSpecificTimers( void );
/*
* The LED timer callback function. This does nothing but switch an LED off.
*/
static void prvButtonLEDTimerCallback( xTimerHandle xTimer );
/*
* The callback function used by both simple LED flash timers. Both timers use
* the same callback, so the function parameter is used to determine which LED
* should be flashed (effectively to determine which timer has expired.
*/
static void prvLEDTimerCallback( xTimerHandle xTimer );
/*
* The check timer callback function, as described at the top of this file.
*/
static void prvCheckTimerCallback( xTimerHandle xTimer );
/*
* This is not a 'standard' partest function, so the prototype is not in
* partest.h, and is instead included here.
*/
void vParTestSetLEDFromISR( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue );
/*-----------------------------------------------------------*/
/* The queue used by both application specific demo tasks defined in this file. */
static xQueueHandle xQueue = NULL;
/* The LED software timer. This uses prvButtonLEDTimerCallback() as it's callback
function. */
static xTimerHandle xLEDTimer = NULL;
/* The check timer. This uses prvCheckTimerCallback() as its callback
function. */
static xTimerHandle xCheckTimer = NULL;
/* LED timers - these simply flash LEDs, each using a different frequency. */
static xTimerHandle xLED1Timer = NULL, xLED2Timer = NULL;
/* If an error is detected in a standard demo task, then pcStatusMessage will
be set to point to a string that identifies the offending task. This is just
to make debugging easier. */
static const char *pcStatusMessage = NULL;
/*-----------------------------------------------------------*/
void main( void )
{
/* Configure the NVIC, LED outputs and button inputs. */
prvSetupHardware();
/* Create the queue. */
xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) );
if( xQueue != NULL )
{
/* Create the timers that are specific to this demo - other timers are
created as part of the standard demo within vStartTimerDemoTask. */
prvCreateDemoSpecificTimers();
/* Create a lot of 'standard demo' tasks. Over 40 tasks are created in
this demo. For a much simpler demo, select the 'blinky' build
configuration. */
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
vCreateBlockTimeTasks();
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );
vStartQueuePeekTasks();
vStartRecursiveMutexTasks();
vStartTimerDemoTask( mainTIMER_TEST_PERIOD );
//_RB_ vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
vStartCountingSemaphoreTasks();
vStartDynamicPriorityTasks();
/* The suicide tasks must be created last, as they need to know how many
tasks were running prior to their creation in order to ascertain whether
or not the correct/expected number of tasks are running at any given
time. */
vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );
/* Start the tasks and timer running. */
vTaskStartScheduler();
}
/* If all is well, the scheduler will now be running, and the following line
will never be reached. If the following line does execute, then there was
insufficient FreeRTOS heap memory available for the idle and/or timer tasks
to be created. See the memory management section on the FreeRTOS web site
for more details. */
for( ;; );
}
/*-----------------------------------------------------------*/
static void prvCheckTimerCallback( xTimerHandle xTimer )
{
static long lChangedTimerPeriodAlready = pdFALSE;
/* Check the standard demo tasks are running without error. Latch the
latest reported error in the pcStatusMessage character pointer. */
if( xAreGenericQueueTasksStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: GenQueue";
}
if( xAreQueuePeekTasksStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: QueuePeek\n";
}
if( xAreBlockingQueuesStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: BlockQueue\n";
}
if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: BlockTime\n";
}
if( xAreSemaphoreTasksStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: SemTest\n";
}
if( xIsCreateTaskStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: Death\n";
}
if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: RecMutex\n";
}
if( 0 )//_RB_ if( xAreComTestTasksStillRunning() != pdPASS )
{
pcStatusMessage = "Error: ComTest\n";
}
if( xAreTimerDemoTasksStillRunning( ( mainCHECK_TIMER_PERIOD_MS ) ) != pdTRUE )
{
pcStatusMessage = "Error: TimerDemo\n";
}
if( xArePollingQueuesStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: PollQueue\n";
}
if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: CountSem\n";
}
if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: DynamicPriority\n";
}
/* Toggle the check LED to give an indication of the system status. If
the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then
everything is ok. A faster toggle indicates an error. */
vParTestToggleLED( mainCHECK_LED );
/* Have any errors been latch in pcStatusMessage? If so, shorten the
period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds.
This will result in an increase in the rate at which mainCHECK_LED
toggles. */
if( pcStatusMessage != NULL )
{
if( lChangedTimerPeriodAlready == pdFALSE )
{
lChangedTimerPeriodAlready = pdTRUE;
printf( "%s", pcStatusMessage );
/* This call to xTimerChangePeriod() uses a zero block time. Functions
called from inside of a timer callback function must *never* attempt
to block. */
xTimerChangePeriod( xCheckTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK );
}
}
}
/*-----------------------------------------------------------*/
static void prvButtonLEDTimerCallback( xTimerHandle xTimer )
{
/* The timer has expired - so no button pushes have occurred in the last
five seconds - turn the LED off. */
vParTestSetLED( mainTIMER_CONTROLLED_LED, pdFALSE );
}
/*-----------------------------------------------------------*/
static void prvLEDTimerCallback( xTimerHandle xTimer )
{
unsigned long ulLED;
/* This callback is shared by two timers, so the parameter is used to
determine which LED to toggle. The LED number is stored in the ID of the
timer. */
ulLED = ( unsigned long ) pvTimerGetTimerID( xTimer );
vParTestToggleLED( ulLED );
}
/*-----------------------------------------------------------*/
/* The ISR executed when the user button is pushed. */
void vPort_E_ISRHandler( void )
{
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
/* The button was pushed, so ensure the LED is on before resetting the
LED timer. The LED timer will turn the LED off if the button is not
pushed within 5000ms. */
vParTestToggleLED( mainTIMER_CONTROLLED_LED );
/* This interrupt safe FreeRTOS function can be called from this interrupt
because the interrupt priority is below the
configMAX_SYSCALL_INTERRUPT_PRIORITY setting in FreeRTOSConfig.h. */
xTimerResetFromISR( xLEDTimer, &xHigherPriorityTaskWoken );
/* Clear the interrupt before leaving. This just clears all the interrupts
for simplicity, as only one is actually used in this simple demo anyway. */
PORTE_ISFR = 0xFFFFFFFFUL;
/* If calling xTimerResetFromISR() caused a task (in this case the timer
service/daemon task) to unblock, and the unblocked task has a priority
higher than or equal to the task that was interrupted, then
xHigherPriorityTaskWoken will now be set to pdTRUE, and calling
portEND_SWITCHING_ISR() will ensure the unblocked task runs next. */
portEND_SWITCHING_ISR( xHigherPriorityTaskWoken );
}
/*-----------------------------------------------------------*/
static void prvSetupHardware( void )
{
/* Enable the interrupt on SW1. */
taskDISABLE_INTERRUPTS();
PORTE_PCR26 = PORT_PCR_MUX( 1 ) | PORT_PCR_IRQC( 0xA ) | PORT_PCR_PE_MASK | PORT_PCR_PS_MASK;
enable_irq( mainGPIO_E_VECTOR );
/* Configure the LED outputs. */
vParTestInitialise();
}
/*-----------------------------------------------------------*/
static void prvCreateDemoSpecificTimers( void )
{
/* This function creates the timers, but does not start them. This is
because the standard demo timer test is started after this function is
called. The standard demo timer test will deliberatly fill the timer
command queue - and will fail the test if the command queue already holds
start commands for the timers created here. Instead, the timers created in
this function are started from the idle task, at which time, the timer
service/daemon task will be running, and will have drained the timer command
queue. */
/* Create the software timer that is responsible for turning off the LED
if the button is not pushed within 5000ms, as described at the top of
this file. */
xLEDTimer = xTimerCreate( ( const signed char * ) "ButtonLEDTimer", /* A text name, purely to help debugging. */
( mainBUTTON_LED_TIMER_PERIOD_MS ), /* The timer period, in this case 5000ms (5s). */
pdFALSE, /* This is a one shot timer, so xAutoReload is set to pdFALSE. */
( void * ) 0, /* The ID is not used, so can be set to anything. */
prvButtonLEDTimerCallback /* The callback function that switches the LED off. */
);
/* Create the software timer that performs the 'check' functionality,
as described at the top of this file. */
xCheckTimer = xTimerCreate( ( const signed char * ) "CheckTimer",/* A text name, purely to help debugging. */
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
( void * ) 0, /* The ID is not used, so can be set to anything. */
prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */
);
/* Create the software timers used to simply flash LEDs. These two timers
share a callback function, so the callback parameter is used to pass in the
LED that should be toggled. */
xLED1Timer = xTimerCreate( ( const signed char * ) "LED1Timer",/* A text name, purely to help debugging. */
( mainLED1_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
( void * ) mainLED0, /* The ID is used to pass in the number of the LED to be toggled. */
prvLEDTimerCallback /* The callback function simply toggles the LED specified by its parameter. */
);
xLED2Timer = xTimerCreate( ( const signed char * ) "LED2Timer",/* A text name, purely to help debugging. */
( mainLED2_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
( void * ) mainLED1, /* The ID is used to pass in the number of the LED to be toggled. */
prvLEDTimerCallback /* The callback function simply toggles the LED specified by its parameter. */
);
}
/*-----------------------------------------------------------*/
void vApplicationMallocFailedHook( void )
{
/* Called if a call to pvPortMalloc() fails because there is insufficient
free memory available in the FreeRTOS heap. pvPortMalloc() is called
internally by FreeRTOS API functions that create tasks, queues, software
timers, and semaphores. The size of the FreeRTOS heap is set by the
configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
taskDISABLE_INTERRUPTS();
for( ;; );
}
/*-----------------------------------------------------------*/
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName )
{
( void ) pcTaskName;
( void ) pxTask;
/* Run time stack overflow checking is performed if
configconfigCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook
function is called if a stack overflow is detected. */
taskDISABLE_INTERRUPTS();
for( ;; );
}
/*-----------------------------------------------------------*/
void vApplicationIdleHook( void )
{
static long lPrintedOut = pdFALSE;
volatile size_t xFreeHeapSpace;
if( lPrintedOut == pdFALSE )
{
lPrintedOut = pdTRUE;
/* The timer command queue will have been filled when the timer test
tasks were created in main() (this is part of the test they perform).
Therefore, while the check and LED timers can be created in main(), they
cannot be started from main(). Once the scheduler has started, the timer
service task will drain the command queue, and now the check and digit
counter timers can be started successfully. */
xTimerStart( xCheckTimer, portMAX_DELAY );
xTimerStart( xLED1Timer, portMAX_DELAY );
xTimerStart( xLED2Timer, portMAX_DELAY );
xFreeHeapSpace = xPortGetFreeHeapSize();
printf( "%d bytes of FreeRTOS heap remain unused - configTOTAL_HEAP_SIZE can be reduced\n", xFreeHeapSpace );
if( xFreeHeapSpace > 100 )
{
/* By now, the kernel has allocated everything it is going to, so
if there is a lot of heap remaining unallocated then
the value of configTOTAL_HEAP_SIZE in FreeRTOSConfig.h can be
reduced accordingly. */
}
}
}
/*-----------------------------------------------------------*/
void vApplicationTickHook( void )
{
/* Call the periodic timer test, which tests the timer API functions that
can be called from an ISR. */
vTimerPeriodicISRTests();
}
/*-----------------------------------------------------------*/

View File

@ -124,21 +124,27 @@
converted to ticks using the portTICK_RATE_MS constant. */ converted to ticks using the portTICK_RATE_MS constant. */
#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_RATE_MS ) #define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_RATE_MS )
/* The LED will remain on until the button has not been pushed for a full
5000ms. */
#define mainBUTTON_LED_TIMER_PERIOD_MS ( 5000UL / portTICK_RATE_MS )
/* The number of items the queue can hold. This is 1 as the receive task /* The number of items the queue can hold. This is 1 as the receive task
will remove items as they are added, meaning the send task should always find will remove items as they are added, meaning the send task should always find
the queue empty. */ the queue empty. */
#define mainQUEUE_LENGTH ( 1 ) #define mainQUEUE_LENGTH ( 1 )
/* The LED toggle by the queue receive task (blue). */ /* The LED toggle by the queue receive task (blue). */
#define mainTASK_CONTROLLED_LED 10 #define mainTASK_CONTROLLED_LED ( 1UL << 10UL )
/* The LED turned on by the button interrupt, and turned off by the LED timer. */ /* The LED turned on by the button interrupt, and turned off by the LED timer. */
#define mainTIMER_CONTROLLED_LED 29 #define mainTIMER_CONTROLLED_LED ( 1UL << 29UL )
/* The vector used by the GPIO port E. Button SW2 is configured to generate
an interrput on this port. */
#define mainGPIO_E_VECTOR ( 107 - 16 ) #define mainGPIO_E_VECTOR ( 107 - 16 )
#define GPIO_PIN_MASK 0x1Fu /* A block time of zero simply means "don't block". */
#define GPIO_PIN( x ) ( ( ( 1 ) << ( x & GPIO_PIN_MASK ) ) ) #define mainDONT_BLOCK ( 0UL )
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -157,16 +163,16 @@ static void prvQueueSendTask( void *pvParameters );
* The LED timer callback function. This does nothing but switch off the * The LED timer callback function. This does nothing but switch off the
* LED defined by the mainTIMER_CONTROLLED_LED constant. * LED defined by the mainTIMER_CONTROLLED_LED constant.
*/ */
static void vLEDTimerCallback( xTimerHandle xTimer ); static void prvButtonLEDTimerCallback( xTimerHandle xTimer );
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/* The queue used by both tasks. */ /* The queue used by both tasks. */
static xQueueHandle xQueue = NULL; static xQueueHandle xQueue = NULL;
/* The LED software timer. This uses vLEDTimerCallback() as its callback /* The LED software timer. This uses prvButtonLEDTimerCallback() as its callback
function. */ function. */
static xTimerHandle xLEDTimer = NULL; static xTimerHandle xButtonLEDTimer = NULL;
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -188,11 +194,11 @@ void main( void )
/* Create the software timer that is responsible for turning off the LED /* Create the software timer that is responsible for turning off the LED
if the button is not pushed within 5000ms, as described at the top of if the button is not pushed within 5000ms, as described at the top of
this file. */ this file. */
xLEDTimer = xTimerCreate( ( const signed char * ) "LEDTimer", /* A text name, purely to help debugging. */ xButtonLEDTimer = xTimerCreate( ( const signed char * ) "ButtonLEDTimer", /* A text name, purely to help debugging. */
( 5000 / portTICK_RATE_MS ), /* The timer period, in this case 5000ms (5s). */ mainBUTTON_LED_TIMER_PERIOD_MS, /* The timer period, in this case 5000ms (5s). */
pdFALSE, /* This is a one shot timer, so xAutoReload is set to pdFALSE. */ pdFALSE, /* This is a one shot timer, so xAutoReload is set to pdFALSE. */
( void * ) 0, /* The ID is not used, so can be set to anything. */ ( void * ) 0, /* The ID is not used, so can be set to anything. */
vLEDTimerCallback /* The callback function that switches the LED off. */ prvButtonLEDTimerCallback /* The callback function that switches the LED off. */
); );
/* Start the tasks and timer running. */ /* Start the tasks and timer running. */
@ -208,14 +214,14 @@ void main( void )
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void vLEDTimerCallback( xTimerHandle xTimer ) static void prvButtonLEDTimerCallback( xTimerHandle xTimer )
{ {
/* The timer has expired - so no button pushes have occurred in the last /* The timer has expired - so no button pushes have occurred in the last
five seconds - turn the LED off. NOTE - accessing the LED port should use five seconds - turn the LED off. NOTE - accessing the LED port should use
a critical section because it is accessed from multiple tasks, and the a critical section because it is accessed from multiple tasks, and the
button interrupt - in this trivial case, for simplicity, the critical button interrupt - in this trivial case, for simplicity, the critical
section is omitted. */ section is omitted. */
GPIOA_PDOR |= GPIO_PDOR_PDO( GPIO_PIN( mainTIMER_CONTROLLED_LED ) ); GPIOA_PDOR |= GPIO_PDOR_PDO( mainTIMER_CONTROLLED_LED );
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -227,12 +233,12 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
/* The button was pushed, so ensure the LED is on before resetting the /* The button was pushed, so ensure the LED is on before resetting the
LED timer. The LED timer will turn the LED off if the button is not LED timer. The LED timer will turn the LED off if the button is not
pushed within 5000ms. */ pushed within 5000ms. */
GPIOA_PDOR &= ~GPIO_PDOR_PDO( GPIO_PIN( mainTIMER_CONTROLLED_LED ) ); GPIOA_PDOR &= ~GPIO_PDOR_PDO( mainTIMER_CONTROLLED_LED );
/* This interrupt safe FreeRTOS function can be called from this interrupt /* This interrupt safe FreeRTOS function can be called from this interrupt
because the interrupt priority is below the because the interrupt priority is below the
configMAX_SYSCALL_INTERRUPT_PRIORITY setting in FreeRTOSConfig.h. */ configMAX_SYSCALL_INTERRUPT_PRIORITY setting in FreeRTOSConfig.h. */
xTimerResetFromISR( xLEDTimer, &xHigherPriorityTaskWoken ); xTimerResetFromISR( xButtonLEDTimer, &xHigherPriorityTaskWoken );
/* Clear the interrupt before leaving. This just clears all the interrupts /* Clear the interrupt before leaving. This just clears all the interrupts
for simplicity, as only one is actually used in this simple demo anyway. */ for simplicity, as only one is actually used in this simple demo anyway. */
@ -267,7 +273,7 @@ const unsigned long ulValueToSend = 100UL;
toggle an LED. 0 is used as the block time so the sending operation toggle an LED. 0 is used as the block time so the sending operation
will not block - it shouldn't need to block as the queue should always will not block - it shouldn't need to block as the queue should always
be empty at this point in the code. */ be empty at this point in the code. */
xQueueSend( xQueue, &ulValueToSend, 0 ); xQueueSend( xQueue, &ulValueToSend, mainDONT_BLOCK );
} }
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -291,7 +297,7 @@ unsigned long ulReceivedValue;
because it is accessed from multiple tasks, and the button interrupt because it is accessed from multiple tasks, and the button interrupt
- in this trivial case, for simplicity, the critical section is - in this trivial case, for simplicity, the critical section is
omitted. */ omitted. */
GPIOA_PTOR |= GPIO_PDOR_PDO( GPIO_PIN( mainTASK_CONTROLLED_LED ) ); GPIOA_PTOR |= GPIO_PDOR_PDO( mainTASK_CONTROLLED_LED );
} }
} }
} }
@ -299,13 +305,11 @@ unsigned long ulReceivedValue;
static void prvSetupHardware( void ) static void prvSetupHardware( void )
{ {
/* Turn on all port clocks */
SIM_SCGC5 = SIM_SCGC5_PORTA_MASK | SIM_SCGC5_PORTB_MASK | SIM_SCGC5_PORTC_MASK | SIM_SCGC5_PORTD_MASK | SIM_SCGC5_PORTE_MASK;
/* Enable the interrupt on SW1. */ /* Enable the interrupt on SW1. */
PORTE_PCR26 = PORT_PCR_MUX( 1 ) | PORT_PCR_IRQC( 0xA ) | PORT_PCR_PE_MASK | PORT_PCR_PS_MASK; PORTE_PCR26 = PORT_PCR_MUX( 1 ) | PORT_PCR_IRQC( 0xA ) | PORT_PCR_PE_MASK | PORT_PCR_PS_MASK;
enable_irq( mainGPIO_E_VECTOR ); enable_irq( mainGPIO_E_VECTOR );
set_irq_priority( mainGPIO_E_VECTOR, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
/* Set PTA10, PTA11, PTA28, and PTA29 (connected to LED's) for GPIO /* Set PTA10, PTA11, PTA28, and PTA29 (connected to LED's) for GPIO
functionality. */ functionality. */
@ -314,8 +318,8 @@ static void prvSetupHardware( void )
PORTA_PCR28 = ( 0 | PORT_PCR_MUX( 1 ) ); PORTA_PCR28 = ( 0 | PORT_PCR_MUX( 1 ) );
PORTA_PCR29 = ( 0 | PORT_PCR_MUX( 1 ) ); PORTA_PCR29 = ( 0 | PORT_PCR_MUX( 1 ) );
/* Change PTA10, PTA11, PTA28, PTA29 to outputs. */ /* Change PTA10, PTA29 to outputs. */
GPIOA_PDDR=GPIO_PDDR_PDD( GPIO_PIN( mainTASK_CONTROLLED_LED ) | GPIO_PIN( mainTIMER_CONTROLLED_LED ) ); GPIOA_PDDR=GPIO_PDDR_PDD( mainTASK_CONTROLLED_LED | mainTIMER_CONTROLLED_LED );
/* Start with LEDs off. */ /* Start with LEDs off. */
GPIOA_PTOR = ~0U; GPIOA_PTOR = ~0U;
@ -329,6 +333,7 @@ void vApplicationMallocFailedHook( void )
internally by FreeRTOS API functions that create tasks, queues, software internally by FreeRTOS API functions that create tasks, queues, software
timers, and semaphores. The size of the FreeRTOS heap is set by the timers, and semaphores. The size of the FreeRTOS heap is set by the
configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
taskDISABLE_INTERRUPTS();
for( ;; ); for( ;; );
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -341,6 +346,7 @@ void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName
/* Run time stack overflow checking is performed if /* Run time stack overflow checking is performed if
configconfigCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook configconfigCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook
function is called if a stack overflow is detected. */ function is called if a stack overflow is detected. */
taskDISABLE_INTERRUPTS();
for( ;; ); for( ;; );
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/