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

📄 heap_1.s43

📁 MSP430 IAR project with FreeRTOS port.
💻 S43
字号:
//////////////////////////////////////////////////////////////////////////////
//                                                                           /
// IAR MSP430 C/C++ Compiler V3.41A/W32                22/Apr/2006  00:25:14 /
// 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\Source\portable\ /
//                     MemMang\heap_1.c                                      /
//    Command line  =  C:\MSP430F169_Eval_Port\FreeRTOSv401\Source\portable\ /
//                     MemMang\heap_1.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\heap_ /
//                     1.s43                                                 /
//                                                                           /
//                                                                           /
//////////////////////////////////////////////////////////////////////////////

        NAME heap_1

        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 ?cstart_init_zero
        EXTERN ?longjmp_r4
        EXTERN ?longjmp_r5
        EXTERN ?setjmp_r4
        EXTERN ?setjmp_r5

        PUBWEAK ?setjmp_save_r4
        PUBWEAK ?setjmp_save_r5
        PUBLIC pvPortMalloc
        FUNCTION pvPortMalloc,021203H
        LOCFRAME CSTACK, 6, STACK
        PUBLIC vPortFree
        FUNCTION vPortFree,0203H
        LOCFRAME CSTACK, 2, STACK
        PUBLIC vPortInitialiseBlocks
        FUNCTION vPortInitialiseBlocks,0203H
        LOCFRAME CSTACK, 2, 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 vTaskSuspendAll
        FUNCTION vTaskSuspendAll,0202H
        EXTERN xTaskResumeAll
        FUNCTION xTaskResumeAll,0202H

// C:\MSP430F169_Eval_Port\FreeRTOSv401\Source\portable\MemMang\heap_1.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 
//   35 Changes between V2.5.1 and V2.5.1
//   36 
//   37 	+ The memory pool has been defined within a struct to ensure correct memory
//   38 	  alignment on 32bit systems.
//   39 
//   40 Changes between V2.6.1 and V3.0.0
//   41 
//   42 	+ An overflow check has been added to ensure the next free byte variable 
//   43 	  does not wrap around.
//   44 */
//   45 
//   46 
//   47 /*
//   48  * The simplest possible implementation of pvPortMalloc().  Note that this
//   49  * implementation does NOT allow allocated memory to be freed again.
//   50  *
//   51  * See heap_2.c and heap_3.c for alternative implementations, and the memory
//   52  * management pages of http://www.FreeRTOS.org for more information.
//   53  */
//   54 #include <stdlib.h>
//   55 #include "FreeRTOS.h"
//   56 #include "task.h"
//   57 
//   58 /* Setup the correct byte alignment mask for the defined byte alignment. */
//   59 #if portBYTE_ALIGNMENT == 4
//   60 	#define heapBYTE_ALIGNMENT_MASK	( ( size_t ) 0x0003 )
//   61 #endif
//   62 
//   63 #if portBYTE_ALIGNMENT == 2
//   64 	#define heapBYTE_ALIGNMENT_MASK	( ( size_t ) 0x0001 )
//   65 #endif
//   66 
//   67 #if portBYTE_ALIGNMENT == 1 
//   68 	#define heapBYTE_ALIGNMENT_MASK	( ( size_t ) 0x0000 )
//   69 #endif
//   70 
//   71 #ifndef heapBYTE_ALIGNMENT_MASK
//   72 	#error "Invalid portBYTE_ALIGNMENT definition"
//   73 #endif
//   74 
//   75 /* Allocate the memory for the heap.  The struct is used to force byte
//   76 alignment without using any non-portable code. */
//   77 static struct xRTOS_HEAP
//   78 {
//   79 	unsigned portLONG ulDummy;
//   80 	unsigned portCHAR ucHeap[ configTOTAL_HEAP_SIZE ];

        RSEG DATA16_Z:DATA:SORT:NOROOT(1)
        REQUIRE ?cstart_init_zero
//   81 } xHeap;
xHeap:
        DS8 9254
//   82 

        RSEG DATA16_Z:DATA:SORT:NOROOT(1)
        REQUIRE ?cstart_init_zero
//   83 static size_t xNextFreeByte = ( size_t ) 0;
xNextFreeByte:
        DS8 2
//   84 /*-----------------------------------------------------------*/
//   85 

        RSEG CODE:CODE:REORDER:NOROOT(1)
//   86 void *pvPortMalloc( size_t xWantedSize )
pvPortMalloc:
        CFI Block cfiBlock0 Using cfiCommon0
        CFI Function pvPortMalloc
//   87 {
        FUNCALL pvPortMalloc, vTaskSuspendAll
        LOCFRAME CSTACK, 6, STACK
        FUNCALL pvPortMalloc, xTaskResumeAll
        LOCFRAME CSTACK, 6, 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
//   88 void *pvReturn = NULL; 
        MOV.W   #0x0, R11
//   89 
//   90 	/* Ensure that blocks are always aligned to the required number of bytes. */
//   91 	#if portBYTE_ALIGNMENT != 1
//   92 		if( xWantedSize & heapBYTE_ALIGNMENT_MASK )
        BIT.W   #0x1, R10
        JNC     ??pvPortMalloc_0
//   93 		{
//   94 			/* Byte alignment required. */
//   95 			xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & heapBYTE_ALIGNMENT_MASK ) );
        MOV.W   R10, R14
        ADD.W   #0x2, R14
        MOV.W   R10, R15
        AND.W   #0x1, R15
        MOV.W   R14, R10
        SUB.W   R15, R10
//   96 		}
//   97 	#endif
//   98 
//   99 	vTaskSuspendAll();
??pvPortMalloc_0:
        CALL    #vTaskSuspendAll
//  100 	{
//  101 		/* Check there is enough room left for the allocation. */
//  102 		if( ( ( xNextFreeByte + xWantedSize ) < configTOTAL_HEAP_SIZE ) &&
//  103 			( ( xNextFreeByte + xWantedSize ) > xNextFreeByte )	)/* Check for overflow. */
        MOV.W   R10, R15
        ADD.W   &xNextFreeByte, R15
        CMP.W   #0x2422, R15
        JC      ??pvPortMalloc_1
        MOV.W   R10, R15
        ADD.W   &xNextFreeByte, R15
        CMP.W   R15, &xNextFreeByte
        JC      ??pvPortMalloc_1
//  104 		{
//  105 			/* Return the next free byte then increment the index past this
//  106 			block. */
//  107 			pvReturn = &( xHeap.ucHeap[ xNextFreeByte ] );
        MOV.W   #xHeap + 4, R15
        ADD.W   &xNextFreeByte, R15
        MOV.W   R15, R11
//  108 			xNextFreeByte += xWantedSize;			
        ADD.W   R10, &xNextFreeByte
//  109 		}	
//  110 	}
//  111 	xTaskResumeAll();
??pvPortMalloc_1:
        CALL    #xTaskResumeAll
//  112 
//  113 	return pvReturn;
        MOV.W   R11, R12
        POP.W   R11
        CFI R11 SameValue
        CFI CFA SP+4
        POP.W   R10
        CFI R10 SameValue
        CFI CFA SP+2
        RET
        CFI EndBlock cfiBlock0
//  114 }
//  115 /*-----------------------------------------------------------*/
//  116 

        RSEG CODE:CODE:REORDER:NOROOT(1)
//  117 void vPortFree( void *pv )
vPortFree:
        CFI Block cfiBlock1 Using cfiCommon0
        CFI Function vPortFree
//  118 {
//  119 	/* Memory cannot be freed using this scheme.  See heap_2.c and heap_3.c 
//  120 	for alternative implementations, and the memory management pages of 
//  121 	http://www.FreeRTOS.org for more information. */
//  122 	( void ) pv;
//  123 }
        RET
        CFI EndBlock cfiBlock1
//  124 /*-----------------------------------------------------------*/
//  125 

        RSEG CODE:CODE:REORDER:NOROOT(1)
//  126 void vPortInitialiseBlocks( void )
vPortInitialiseBlocks:
        CFI Block cfiBlock2 Using cfiCommon0
        CFI Function vPortInitialiseBlocks
//  127 {
//  128 	/* Only required when static memory is not cleared. */
//  129 	xNextFreeByte = ( size_t ) 0;
        MOV.W   #0x0, &xNextFreeByte
//  130 }
        RET
        CFI EndBlock cfiBlock2

        RSEG CODE:CODE:REORDER:NOROOT(1)
?setjmp_save_r4:
        REQUIRE ?setjmp_r4
        REQUIRE ?longjmp_r4

        RSEG CODE:CODE:REORDER:NOROOT(1)
?setjmp_save_r5:
        REQUIRE ?setjmp_r5
        REQUIRE ?longjmp_r5

        END
//  131 
//  132 
// 
//    86 bytes in segment CODE
// 9 256 bytes in segment DATA16_Z
// 
//    86 bytes of CODE memory
// 9 256 bytes of DATA memory
//
//Errors: none
//Warnings: none

⌨️ 快捷键说明

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