📄 death.lst
字号:
##############################################################################
# #
# IAR MSP430 C/C++ Compiler V3.41A/W32 22/Apr/2006 00:25:13 #
# Copyright 1996-2006 IAR Systems. All rights reserved. #
# #
# __rt_version = 2 #
# __double_size = 32 #
# __reg_r4 = free #
# __reg_r5 = free #
# __pic = no #
# __core = 64kb #
# Source file = C:\MSP430F169_Eval_Port\FreeRTOSv401\Demo\Common\Minim #
# al\death.c #
# Command line = C:\MSP430F169_Eval_Port\FreeRTOSv401\Demo\Common\Minim #
# al\death.c -D ROWLEY_MSP430 -D IAR_MSP430 -lC #
# C:\MSP430F169_Eval_Port\FreeRTOSv401\Debug\List\ -lA #
# C:\MSP430F169_Eval_Port\FreeRTOSv401\Debug\List\ #
# --remarks -o C:\MSP430F169_Eval_Port\FreeRTOSv401\Debu #
# g\Obj\ -s2 --no_cse --no_unroll --no_inline #
# --no_code_motion --no_tbaa --debug -e #
# --migration_preprocessor_extensions --double=32 -I #
# C:\MSP430F169_Eval_Port\FreeRTOSv401\Demo\Common\Inclu #
# de\ -I C:\MSP430F169_Eval_Port\FreeRTOSv401\Source\Inc #
# lude\ -I C:\MSP430F169_Eval_Port\FreeRTOSv401\Demo\MSP #
# 430_IAR\ -I C:\MSP430F169_Eval_Port\FreeRTOSv401\Sourc #
# e\portable\msp430f1611\ -I "C:\Program Files\IAR #
# Systems\Embedded Workbench 4.0\430\INC\" -I #
# "C:\Program Files\IAR Systems\Embedded Workbench #
# 4.0\430\INC\CLIB\" #
# List file = C:\MSP430F169_Eval_Port\FreeRTOSv401\Debug\List\death. #
# lst #
# Object file = C:\MSP430F169_Eval_Port\FreeRTOSv401\Debug\Obj\death.r #
# 43 #
# #
# #
##############################################################################
C:\MSP430F169_Eval_Port\FreeRTOSv401\Demo\Common\Minimal\death.c
1 /*
2 FreeRTOS V4.0.1 - Copyright (C) 2003-2006 Richard Barry.
3
4 This file is part of the FreeRTOS distribution.
5
6 FreeRTOS is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 FreeRTOS is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with FreeRTOS; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
20 A special exception to the GPL can be applied should you wish to distribute
21 a combined work that includes FreeRTOS, without being obliged to provide
22 the source code for any proprietary components. See the licensing section
23 of http://www.FreeRTOS.org for full details of how and when the exception
24 can be applied.
25
26 ***************************************************************************
27 See http://www.FreeRTOS.org for documentation, latest information, license
28 and contact details. Please ensure to read the configuration and relevant
29 port sections of the online documentation.
30 ***************************************************************************
31 */
32
33 /**
34 * Create a single persistent task which periodically dynamically creates another
35 * four tasks. The original task is called the creator task, the four tasks it
36 * creates are called suicidal tasks.
37 *
38 * Two of the created suicidal tasks kill one other suicidal task before killing
39 * themselves - leaving just the original task remaining.
40 *
41 * The creator task must be spawned after all of the other demo application tasks
42 * as it keeps a check on the number of tasks under the scheduler control. The
43 * number of tasks it expects to see running should never be greater than the
44 * number of tasks that were in existence when the creator task was spawned, plus
45 * one set of four suicidal tasks. If this number is exceeded an error is flagged.
46 *
47 * \page DeathC death.c
48 * \ingroup DemoFiles
49 * <HR>
50 */
51
52 /*
53 Changes from V3.0.0
54 + CreationCount sizes changed from unsigned portBASE_TYPE to
55 unsigned portSHORT to minimize the risk of overflowing.
56
57 + Reset of usLastCreationCount added
58
59 Changes from V3.1.0
60 + Changed the dummy calculation to use variables of type long, rather than
61 float. This allows the file to be used with ports that do not support
62 floating point.
63
64 */
65
66 #include <stdlib.h>
67
68 /* Scheduler include files. */
69 #include "FreeRTOS.h"
70 #include "task.h"
71
72 /* Demo program include files. */
73 #include "death.h"
74
75 #define deathSTACK_SIZE ( configMINIMAL_STACK_SIZE + 24 )
76
77 /* The task originally created which is responsible for periodically dynamically
78 creating another four tasks. */
79 static portTASK_FUNCTION_PROTO( vCreateTasks, pvParameters );
80
81 /* The task function of the dynamically created tasks. */
82 static portTASK_FUNCTION_PROTO( vSuicidalTask, pvParameters );
83
84 /* A variable which is incremented every time the dynamic tasks are created. This
85 is used to check that the task is still running. */
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
86 static volatile unsigned portSHORT usCreationCount = 0;
\ usCreationCount:
\ 000000 DS8 2
87
88 /* Used to store the number of tasks that were originally running so the creator
89 task can tell if any of the suicidal tasks have failed to die.
90 */
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
91 static volatile unsigned portBASE_TYPE uxTasksRunningAtStart = 0;
\ uxTasksRunningAtStart:
\ 000000 DS8 2
92
93 /* Tasks are deleted by the idle task. Under heavy load the idle task might
94 not get much processing time, so it would be legitimate for several tasks to
95 remain undeleted for a short period. */
\ In segment DATA16_C, align 2, align-sorted
96 static const unsigned portBASE_TYPE uxMaxNumberOfExtraTasksRunning = 4;
\ uxMaxNumberOfExtraTasksRunning:
\ 000000 0400 DC16 4
97
98 /* Used to store a handle to the tasks that should be killed by a suicidal task,
99 before it kills itself. */
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
100 xTaskHandle xCreatedTask1, xCreatedTask2;
\ xCreatedTask1:
\ 000000 DS8 2
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
\ xCreatedTask2:
\ 000000 DS8 2
101
102 /*-----------------------------------------------------------*/
103
\ In segment CODE, align 2
104 void vCreateSuicidalTasks( unsigned portBASE_TYPE uxPriority )
\ vCreateSuicidalTasks:
105 {
\ 000000 0A12 PUSH.W R10
\ 000002 0B12 PUSH.W R11
\ 000004 0A4C MOV.W R12, R10
106 unsigned portBASE_TYPE *puxPriority;
107
108 /* Create the Creator tasks - passing in as a parameter the priority at which
109 the suicidal tasks should be created. */
110 puxPriority = ( unsigned portBASE_TYPE * ) pvPortMalloc( sizeof( unsigned portBASE_TYPE ) );
\ 000006 2C43 MOV.W #0x2, R12
\ 000008 B012.... CALL #pvPortMalloc
\ 00000C 0B4C MOV.W R12, R11
111 *puxPriority = uxPriority;
\ 00000E 8B4A0000 MOV.W R10, 0(R11)
112
113 xTaskCreate( vCreateTasks, "CREATOR", deathSTACK_SIZE, ( void * ) puxPriority, uxPriority, NULL );
\ 000012 0312 PUSH.W #0x0
\ 000014 0A12 PUSH.W R10
\ 000016 0B12 PUSH.W R11
\ 000018 30125800 PUSH.W #0x58
\ 00001C 3E40.... MOV.W #`?<Constant "CREATOR">`, R14
\ 000020 3C40.... MOV.W #vCreateTasks, R12
\ 000024 B012.... CALL #xTaskCreate
114
115 /* Record the number of tasks that are running now so we know if any of the
116 suicidal tasks have failed to be killed. */
117 uxTasksRunningAtStart = ( unsigned portBASE_TYPE ) uxTaskGetNumberOfTasks();
\ 000028 B012.... CALL #uxTaskGetNumberOfTasks
\ 00002C 824C.... MOV.W R12, &uxTasksRunningAtStart
118
119 /* FreeRTOS versions before V3.0 started the idle-task as the very
120 first task. The idle task was then already included in uxTasksRunningAtStart.
121 From FreeRTOS V3.0 on, the idle task is started when the scheduler is
122 started. Therefore the idle task is not yet accounted for. We correct
123 this by increasing uxTasksRunningAtStart by 1. */
124 uxTasksRunningAtStart++;
\ 000030 9253.... ADD.W #0x1, &uxTasksRunningAtStart
125 }
\ 000034 3152 ADD.W #0x8, SP
\ 000036 3B41 POP.W R11
\ 000038 3A41 POP.W R10
\ 00003A 3041 RET
126 /*-----------------------------------------------------------*/
127
\ In segment CODE, align 2
128 static portTASK_FUNCTION( vSuicidalTask, pvParameters )
\ vSuicidalTask:
129 {
\ 000000 0A12 PUSH.W R10
\ 000002 0B12 PUSH.W R11
\ 000004 0812 PUSH.W R8
\ 000006 3182 SUB.W #0x8, SP
\ 000008 0A4C MOV.W R12, R10
130 volatile portLONG l1, l2;
131 xTaskHandle xTaskToKill;
132 const portTickType xDelay = ( portTickType ) 200 / portTICK_RATE_MS;
\ 00000A 3840C800 MOV.W #0xc8, R8
133
134 if( pvParameters != NULL )
\ 00000E 0A93 CMP.W #0x0, R10
\ 000010 0224 JEQ ??vSuicidalTask_1
135 {
136 /* This task is periodically created four times. Two created tasks are
137 passed a handle to the other task so it can kill it before killing itself.
138 The other task is passed in null. */
139 xTaskToKill = *( xTaskHandle* )pvParameters;
\ 000012 2B4A MOV.W @R10, R11
\ 000014 013C JMP ??vSuicidalTask_0
140 }
141 else
142 {
143 xTaskToKill = NULL;
\ ??vSuicidalTask_1:
\ 000016 0B43 MOV.W #0x0, R11
144 }
145
146 for( ;; )
147 {
148 /* Do something random just to use some stack and registers. */
149 l1 = 2;
\ ??vSuicidalTask_0:
\ 000018 A1430400 MOV.W #0x2, 0x4(SP)
\ 00001C 81430600 MOV.W #0x0, 0x6(SP)
150 l2 = 89;
\ 000020 B14059000000 MOV.W #0x59, 0x0(SP)
\ 000026 81430200 MOV.W #0x0, 0x2(SP)
151 l2 *= l1;
^
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -