⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 death.s43

📁 MSP430 IAR project with FreeRTOS port.
💻 S43
📖 第 1 页 / 共 2 页
字号:
//////////////////////////////////////////////////////////////////////////////
//                                                                           /
// 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\Mini /
//                     mal\death.c                                           /
//    Command line  =  C:\MSP430F169_Eval_Port\FreeRTOSv401\Demo\Common\Mini /
//                     mal\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\Deb /
//                     ug\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\Incl /
//                     ude\ -I C:\MSP430F169_Eval_Port\FreeRTOSv401\Source\I /
//                     nclude\ -I C:\MSP430F169_Eval_Port\FreeRTOSv401\Demo\ /
//                     MSP430_IAR\ -I C:\MSP430F169_Eval_Port\FreeRTOSv401\S /
//                     ource\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 /
//                     .s43                                                  /
//                                                                           /
//                                                                           /
//////////////////////////////////////////////////////////////////////////////

        NAME death

        RTMODEL "__core", "64kb"
        RTMODEL "__double_size", "32"
        RTMODEL "__pic", "no"
        RTMODEL "__reg_r4", "free"
        RTMODEL "__reg_r5", "free"
        RTMODEL "__rt_version", "2"

        RSEG CSTACK:DATA:SORT:NOROOT(1)

        EXTERN ?Epilogue3
        EXTERN ?Mul32
        EXTERN ?cstart_init_copy
        EXTERN ?cstart_init_zero
        EXTERN ?longjmp_r4
        EXTERN ?longjmp_r5
        EXTERN ?setjmp_r4
        EXTERN ?setjmp_r5

        PUBWEAK ?setjmp_save_r4
        PUBWEAK ?setjmp_save_r5
        PUBLIC vCreateSuicidalTasks
        FUNCTION vCreateSuicidalTasks,021203H
        LOCFRAME CSTACK, 14, STACK
        FUNCTION vCreateTasks,021603H
        LOCFRAME CSTACK, 40, STACK
        FUNCTION vSuicidalTask,021603H
        LOCFRAME CSTACK, 16, STACK
        PUBLIC xCreatedTask1
        PUBLIC xCreatedTask2
        PUBLIC xIsCreateTaskStillRunning
        FUNCTION xIsCreateTaskStillRunning,021203H
        LOCFRAME CSTACK, 4, STACK
        
        CFI Names cfiNames0
        CFI StackFrame CFA SP DATA
        CFI Resource PC:16, SP:16, SR:16, R4:16, R5:16, R6:16, R7:16, R8:16
        CFI Resource R9:16, R10:16, R11:16, R12:16, R13:16, R14:16, R15:16
        CFI EndNames cfiNames0
        
        CFI Common cfiCommon0 Using cfiNames0
        CFI CodeAlign 2
        CFI DataAlign 2
        CFI ReturnAddress PC CODE
        CFI CFA SP+2
        CFI PC Frame(CFA, -2)
        CFI SR Undefined
        CFI R4 SameValue
        CFI R5 SameValue
        CFI R6 SameValue
        CFI R7 SameValue
        CFI R8 SameValue
        CFI R9 SameValue
        CFI R10 SameValue
        CFI R11 SameValue
        CFI R12 Undefined
        CFI R13 Undefined
        CFI R14 Undefined
        CFI R15 Undefined
        CFI EndCommon cfiCommon0
        
        EXTERN uxTaskGetNumberOfTasks
        FUNCTION uxTaskGetNumberOfTasks,0202H
        EXTERN vPortFree
        FUNCTION vPortFree,0202H
        EXTERN vTaskDelay
        FUNCTION vTaskDelay,0202H
        EXTERN xTaskCreate
        FUNCTION xTaskCreate,0202H
        EXTERN vTaskDelete
        FUNCTION vTaskDelete,0202H
        EXTERN pvPortMalloc
        FUNCTION pvPortMalloc,0202H

// 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. */

        RSEG DATA16_Z:DATA:SORT:NOROOT(1)
        REQUIRE ?cstart_init_zero
//   86 static volatile unsigned portSHORT usCreationCount = 0;
usCreationCount:
        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 */

        RSEG DATA16_Z:DATA:SORT:NOROOT(1)
        REQUIRE ?cstart_init_zero
//   91 static volatile unsigned portBASE_TYPE uxTasksRunningAtStart = 0;
uxTasksRunningAtStart:
        DS8 2

        RSEG DATA16_C:CONST:SORT:NOROOT(0)
`?<Constant "CREATOR">`:
        DC8 "CREATOR"

        RSEG DATA16_C:CONST:SORT:NOROOT(0)
`?<Constant "SUICID1">`:
        DC8 "SUICID1"

        RSEG DATA16_C:CONST:SORT:NOROOT(0)
`?<Constant "SUICID2">`:
        DC8 "SUICID2"
//   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. */

        RSEG DATA16_C:CONST:SORT:NOROOT(1)
//   96 static const unsigned portBASE_TYPE uxMaxNumberOfExtraTasksRunning = 4;
uxMaxNumberOfExtraTasksRunning:
        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. */

        RSEG DATA16_Z:DATA:SORT:NOROOT(1)
        REQUIRE ?cstart_init_zero
//  100 xTaskHandle xCreatedTask1, xCreatedTask2;
xCreatedTask1:
        DS8 2

        RSEG DATA16_Z:DATA:SORT:NOROOT(1)
        REQUIRE ?cstart_init_zero
xCreatedTask2:
        DS8 2
//  101 
//  102 /*-----------------------------------------------------------*/
//  103 

        RSEG CODE:CODE:REORDER:NOROOT(1)
//  104 void vCreateSuicidalTasks( unsigned portBASE_TYPE uxPriority )
vCreateSuicidalTasks:
        CFI Block cfiBlock0 Using cfiCommon0
        CFI Function vCreateSuicidalTasks
//  105 {
        FUNCALL vCreateSuicidalTasks, pvPortMalloc
        LOCFRAME CSTACK, 6, STACK
        FUNCALL vCreateSuicidalTasks, xTaskCreate
        LOCFRAME CSTACK, 14, STACK
        FUNCALL vCreateSuicidalTasks, uxTaskGetNumberOfTasks
        LOCFRAME CSTACK, 14, STACK
        PUSH.W  R10
        CFI R10 Frame(CFA, -4)
        CFI CFA SP+4
        PUSH.W  R11
        CFI R11 Frame(CFA, -6)
        CFI CFA SP+6
        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 ) );
        MOV.W   #0x2, R12
        CALL    #pvPortMalloc
        MOV.W   R12, R11
//  111 	*puxPriority = uxPriority;
        MOV.W   R10, 0(R11)
//  112 
//  113 	xTaskCreate( vCreateTasks, "CREATOR", deathSTACK_SIZE, ( void * ) puxPriority, uxPriority, NULL );
        PUSH.W  #0x0
        CFI CFA SP+8
        PUSH.W  R10
        CFI CFA SP+10
        PUSH.W  R11
        CFI CFA SP+12
        PUSH.W  #0x58
        CFI CFA SP+14
        MOV.W   #`?<Constant "CREATOR">`, R14
        MOV.W   #vCreateTasks, R12
        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();
        CALL    #uxTaskGetNumberOfTasks
        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++;
        ADD.W   #0x1, &uxTasksRunningAtStart
//  125 }
        ADD.W   #0x8, SP
        CFI CFA SP+6
        POP.W   R11
        CFI R11 SameValue
        CFI CFA SP+4
        POP.W   R10
        CFI R10 SameValue
        CFI CFA SP+2
        RET
        CFI EndBlock cfiBlock0

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -