보통 c 에서는 malloc()을 사용하면 Heap영역에 메모리가 할당된다.
FreeRTOS의 경우 Heap 할당하는 방법으로 세가지 방법 중 하나를 선택하여 사용 할 수 있으며 malloc, free 함수를 사용하는 대신 pvPortMalloc과 vPortFree를 사용한다.
Heap_1.c
배열을 사용하여 heap를 생성하므로 heap이 .bss 영역에 할당 된다.
아주 간단하게 구현된 반면 한번 할당된 메모리는 반환이 되지 않는 단점이 있다.
Heap_2.c
역시 배열을 사용하여 heap를 생성한다.
리스트 구조를 사용하여 할당 한 메모리의 반환이 가능하다.
Heap_3.c
컴파일러에 링크되는 malloc과 free함수를 호출 한다.
이 방법을 사용하려면 컴파일러에 맞게 heap영역을 설정해 주거나 시스템 콜을 구현해 주어야 한다.
E Project에서는 Heap_2.c를 사용 하여 구현 했으며 배열을 사용하는 대신 링크 스크립트 파일에서 .bss section이 끝나는 주소를 받아 사용하였다.
참고로 c로 컴파일된 프로그램의 일반적인 메모리 맵 구조는 다음과 같다.
STACK : local 변수 ( 사용할 수록 주소 감소 )
HEAP : malloc 를 사용하여 할당한 메모리 (사용할 수록 주소 증가 )
.BSS : 정적으로 할당된 변수 ( fill zero )
DATA : read only data
.TEXT : program code
참고로 FreeRTOS의 각 Task들은 별도의 Stack point를 갔는데 heap영역에 할당된다.
I’m a newbie and your accomplishment is quite a lot an inspiration for me. http://www.hostinginfinite.com
Just after read a number of the content on your website these couple of days, i definitely like your personal style of running a blog. I saved it to my favorite features web site collection and will also be checking again soon.
I truly like subsequent your website because the articles or blog posts are so easy to go through and adhere to. Exceptional. Please keep up the nice perform
I am new to web designing and it made me more confused when I stumble into this content-management-system thing. I’m planning to update a site that is not designed using JOOMLA and was wondering if I can use Joomla to update it..
You made several good points there. I did a search on the theme and found a good number of folks will go along with with your blog.
One thing I’d like to say is the fact before obtaining more laptop or computer memory, take a look at the machine within which it can be installed. If the machine is running Windows XP, for instance, the actual memory threshold is 3.25GB. Installing above this would purely constitute a waste. Be sure that one’s motherboard can handle the upgrade volume, as well. Good blog post.