임베디드/[ RTOS ]

[ RTOS ] 00. ThreadX의 Memory Usage

kim.svadoz 2021. 3. 25. 10:07
728x90
반응형

참조글 : THREADX.PDF

여기도 도움이 된다. https://ppua.tistory.com/entry/%EC%8B%A4%EC%8B%9C%EA%B0%84-%EC%9A%B4%EC%98%81%EC%B2%B4%EC%A0%9C-RTOS%EC%9D%98-%EC%9D%B4%ED%95%B4

Memory Usage

ThreadX resides along with the application program. As a result, the static memory (or fixed memory) usage of ThreadX is determined by the development tools; e.g., the compiler, linker, and locator. Dynamic memory (or run-time memory) usage is under direct control of the application.

ThreadX는 응용 프로그램과 함께 상주합니다. 결과적으로 ThreadX의 정적 메모리 (또는 고정 메모리) 사용량은 개발 도구에 의해 결정됩니다. 예 : 컴파일러, 링커 및 로케이터. 동적 메모리 (또는 런타임 메모리) 사용량은 애플리케이션에서 직접 제어합니다.

  • Static Memory Usage

Most of the development tools divide the application program image into five basic areas: instruction, constant, initialized data, uninitialized data, and system stack. Figure 3 on page 47 shows an example of these memory areas.

It is important to realize that this is only an example. The actual static memory layout is specific to the processor, development tools, and the underlying hardware.

The instruction area contains all of the program’s processor instructions. This area is typically the largest and is often located in ROM.

대부분의 개발 도구는 응용 프로그램 이미지를 명령어, 상수, 초기화 된 데이터, 초기화되지 않은 데이터 및 시스템 스택의 다섯 가지 기본 영역으로 나눕니다. 47 페이지의 그림 3은 이러한 메모리 영역의 예를 보여줍니다.

이것은 단지 예일 뿐이라는 것을 인식하는 것이 중요합니다. 실제 정적 메모리 레이아웃은 프로세서, 개발 도구 및 기본 하드웨어에 따라 다릅니다.

명령 영역에는 프로그램의 모든 프로세서 명령이 포함되어 있습니다. 이 영역은 일반적으로 가장 크고 ROM에있는 경우가 많습니다.

image-20210210141640749

The constant area contains various compiled constants, including strings defined or referenced within the program. In addition, this area contains the “initial copy” of the initialized data area. During the compiler’s initialization process, this portion of the constant area is used to setup the initialized data area in RAM. The constant area usually follows the instruction area and is often located in ROM.

The initialized data and uninitialized data areas contain all of the global and static variables. These areas are always located in RAM. The system stack is generally setup immediately following the initialized and uninitialized data areas.

The system stack is used by the compiler during initialization and then by ThreadX during initialization and subsequently in ISR processing.

상수 영역에는 프로그램 내에서 정의되거나 참조되는 문자열을 포함하여 다양한 컴파일 된 상수가 포함됩니다. 또한이 영역에는 초기화 된 데이터 영역의 "초기 복사"가 포함됩니다. 컴파일러의 초기화 프로세스 동안 상수 영역의이 부분은 RAM에서 초기화 된 데이터 영역을 설정하는 데 사용됩니다. 상수 영역은 일반적으로 명령 영역을 따르며 종종 ROM에 있습니다.

초기화 된 데이터 및 초기화되지 않은 데이터 영역에는 모든 전역 및 정적 변수가 포함됩니다. 이러한 영역은 항상 RAM에 있습니다. 시스템 스택은 일반적으로 초기화 및 초기화되지 않은 데이터 영역 직후에 설정됩니다.

시스템 스택은 초기화 중에 컴파일러에서 사용하고 초기화 중에 ThreadX에서 사용하고 이후에 ISR 처리에서 사용합니다.

  • Dynamic Memory Usage

As mentioned before, dynamic memory usage is under direct control of the application. Control blocks and memory areas associated with stacks, queues, and memory pools can be placed anywhere in the target’s memory space. This is an important feature because it facilitates easy utilization of different types of physical memory.

For example, suppose a target hardware environment has both fast memory and slow memory. If the application needs extra performance for a high-priority thread, its control block (TX_THREAD) and stack can be placed in the fast memory area, which might greatly enhance its performance.

앞서 언급했듯이 동적 메모리 사용량은 애플리케이션에서 직접 제어합니다. 스택, 대기열 및 메모리 풀과 관련된 제어 블록 및 메모리 영역은 대상의 메모리 공간 어디에나 배치 할 수 있습니다. 이것은 다양한 유형의 물리적 메모리를 쉽게 활용할 수 있도록 해주기 때문에 중요한 기능입니다.

예를 들어 대상 하드웨어 환경에 빠른 메모리와 느린 메모리가 모두 있다고 가정합니다. 응용 프로그램에 우선 순위가 높은 스레드에 대한 추가 성능이 필요한 경우 제어 블록 (TX_THREAD) 및 스택을 빠른 메모리 영역에 배치 할 수 있으므로 성능이 크게 향상 될 수 있습니다.

728x90
반응형