📄 sysmem.c
字号:
/*****************************************************************************/
/* sysmem v2.24 - System memory allocation */
/* Copyright (c) 1996-2002 Texas Instruments Incorporated */
/*****************************************************************************/
/* */
/* This module declares the memory area used by the memory */
/* allocation functions malloc(), etc. The size and placement */
/* of this memory area is done in the linker (using section */
/* directives and the -heap flag). The default size is 64 bytes.*/
/* */
/* NOTE 1:This mechanism works in cooperation with "memory.c" */
/* and the linker. If an alternate (custom) memory */
/* allocation scheme is used this file may need to be */
/* modified or discarded. */
/* */
/* NOTE 2:This file will only be linked in if any of the memory */
/* allocation functions are used in the program! (or if */
/* you reference __sys_memory for some reason) */
/* */
/****************************************************************/
__asm(" .global __SYSMEM_SIZE ");
__asm(" .global __sys_memory ");
__asm(" .global __memory_size ");
/****************************************************************/
/* Define the heap memory area. Note that 64 is a default size */
/* which is overridden in the linker. Note also that the heap */
/* area must be word aligned so that accesses to __sys_memory */
/* work properly. */
/****************************************************************/
__asm("__sys_memory .usect \".sysmem\", 64, 4");
/****************************************************************/
/* GENERATE AN AUTOINITIALIZATION RECORD TO INITIALIZE HEAP. */
/* This code assumes that "__sys_memory" contains a structure */
/* of type PACKET (as defined in "memory.c"). */
/* The purpose of this is to initialize the heap into one (big) */
/* free packet of size "__SYSMEM_SIZE-8". This is equivalent */
/* to calling minit() at boot time. */
/****************************************************************/
__asm(" .sect \".cinit\" ");
__asm(" .align 4 ");
__asm(" .long 8 ");
__asm(" .long __sys_memory ");
__asm(" .long __SYSMEM_SIZE-8 ");
__asm(" .long 0 ");
/****************************************************************/
/* INITIALIZE THE VARIABLE INDICATING HEAP SIZE */
/****************************************************************/
__asm(" .long 4 ");
__asm(" .long __memory_size ");
__asm(" .long __SYSMEM_SIZE ");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -