KR20070040007A - Code overlay method in the embedded system - Google Patents
Code overlay method in the embedded system Download PDFInfo
- Publication number
- KR20070040007A KR20070040007A KR1020050095217A KR20050095217A KR20070040007A KR 20070040007 A KR20070040007 A KR 20070040007A KR 1020050095217 A KR1020050095217 A KR 1020050095217A KR 20050095217 A KR20050095217 A KR 20050095217A KR 20070040007 A KR20070040007 A KR 20070040007A
- Authority
- KR
- South Korea
- Prior art keywords
- code
- ram
- embedded system
- flash memory
- application
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/44—Encoding
- G06F8/443—Optimisation
- G06F8/4441—Reducing the execution time required by the program code
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0668—Interfaces specially adapted for storage systems adopting a particular infrastructure
- G06F3/0671—In-line storage system
- G06F3/0673—Single storage device
- G06F3/0679—Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44505—Configuring for program initiating, e.g. using registry, configuration files
Abstract
본 발명은 임베디드 시스템에 있어서, 특히 프로그램 실행시 필요한 코드블록을 플레쉬 메모리에서 램 영역으로 복사한 후 실행시키는 코드 오버레이 방법에 관한 것이다. BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a method of overlaying code in an embedded system, in which a code block necessary for executing a program is copied from a flash memory to a RAM area and executed.
본 발명에 따른 임베디드 시스템에서의 코드 오버레이 방법은, 어플리케이션 프로그램의 정형화된 순서에 의해 실행 스케쥴이 생성되는 단계; 상기 어플리케이션 프로그램의 원본 소스를 컴파일하여 목적 파일을 생성하는 단계; 상기 생성된 스케쥴 정보, 각 목적 파일의 크기, 임베디드 시스템의 메모리 정보를 입력받아 임베디드 시스템의 플레쉬 메모리에 저장될 어플리케이션의 이미지 레이아웃을 결정하고, 메인 함수 및 링커 스트립트를 생성하는 단계; 상기 생성된 링커 스트립트를 이용하여 링킹 과정을 수행한 후 실행 가능한 이미지를 생성하고 임베디드 시스템의 플레쉬 메모리에 전달하는 단계를 포함하는 것을 특징으로 한다. Code overlay method in the embedded system according to the present invention comprises the steps of generating an execution schedule in a formal order of the application program; Compiling an original source of the application program to generate an object file; Determining the image layout of an application to be stored in the flash memory of the embedded system by receiving the generated schedule information, the size of each object file, and the memory information of the embedded system, and generating a main function and a linker script; After performing the linking process using the generated linker script, characterized in that it comprises the step of generating an executable image and transferred to the flash memory of the embedded system.
호스트, 임베디드 시스템, 코드 오버레이 Host, Embedded System, Code Overlay
Description
도 1은 본 발명에 따른 호스트 및 임베디드 시스템의 구성을 나타낸 도면.1 is a diagram showing the configuration of a host and an embedded system according to the present invention.
도 2는 본 발명에 따른 플레쉬 메모리의 구조를 나타낸 구성도.2 is a block diagram showing the structure of a flash memory according to the present invention.
도 3은 본 발명에 따른 임베디드 시스템에서의 코드 오버레이 방법을 나타낸 흐름도.3 is a flowchart illustrating a code overlay method in an embedded system according to the present invention.
도 4는 본 발명에 따른 메모리 레이 아웃을 나타낸 도면.4 illustrates a memory layout in accordance with the present invention.
도 5는 본 발명에 따른 메인 함수 구조의 예를 나타낸 도면.5 illustrates an example of a main function structure in accordance with the present invention.
도 6은 본 발명에 따른 플레쉬 메모리의 레이아웃으로서, 클러스터를 수행한 경우와 수행하지 않는 경우를 나타낸 도면.6 is a layout of a flash memory according to the present invention, illustrating a case where a cluster is performed and a case where a cluster is not performed.
도 7은 본 발명에 따른 위치 결정의 예를 나타낸 도면.7 shows an example of positioning according to the present invention;
<도면의 주요 부분에 대한 부호의 설명><Explanation of symbols for the main parts of the drawings>
10...플레쉬 메모리 20...램10
30...메인 제어부 40...호스트30
41...스케쥴 생성부 42...클러스터링 및 위치결정부41
43....링커부43 ... Linker part
본 발명은 임베디드 시스템에 있어서, 특히 어플리케이션 프로그램 실행시 스케쥴에 따라 필요한 코드블록만을 램 영역으로 복사한 후 실행시키는 코드 오버레이 방법에 관한 것이다. The present invention relates to a method of overlaying a code in an embedded system, which executes after copying only the necessary code blocks to a RAM area according to a schedule when executing an application program.
저 사양의 모바일 폰이나 메모리 카드 컨트롤러 같은 대부분의 임베디드 시스템의 경우, 내부에 낸드(NAND)형 플레쉬 메모리와 에스 램(SRAM)을 구비하고 있다. 상기 플레쉬 메모리에는 부트 스트랩(bootstrap) 코드와 같은 펌 웨어가 저장되어 있고, 시스템이 부팅되면 상기 펌 웨어를 에스 램으로 복사한 후 시작 코드 번지로 점프하여 구동하게 된다.Most embedded systems, such as low-end mobile phones and memory card controllers, have internal NAND flash memory and SRAM. Firmware such as bootstrap code is stored in the flash memory. When the system is booted, the firmware is copied to the SRAM and then jumped to a start code address to be driven.
이때, 에스 램의 크기는 복사되는 전체 프로그램의 크기 보다 커야 되는데, 다양한 기능의 추가로 인해 프로그램의 크기는 점차 늘어나는 반면, 에스 램의 크기는 이미 고정되어 있고, 그 크기를 늘리기 위해서는 추가의 비용이 들어가게 된다.In this case, the size of the SRAM should be larger than the size of the entire program to be copied. The size of the program is gradually increased due to the addition of various functions, while the size of the SRAM is already fixed. Will enter.
즉, 대부분의 임베디드 시스템에서 기능 추가 및 개선으로 인해 어플리케이션의 코드 크기는 계속하여 증가하게 된다. 그러나, 램의 크기는 이미 고정되어 있어, 실행될 수 있는 프로그램의 크기는 한계가 있다. 이를 해결하기 위해서는 하드웨어적으로 더 큰 용량의 램으로 교체해야 하는 등 비용문제가 발생된다. In other words, the code size of an application continues to increase as features are added and improved in most embedded systems. However, the size of the RAM is already fixed, so the size of the program that can be executed is limited. To solve this problem, there is a cost problem, such as replacing a larger amount of RAM in hardware.
또한 제품이 이미 출시되어 고객이 사용 중이라면 램 교체 등이 거의 불가능 하므로, 제품에 대한 신뢰도가 떨어지는 문제가 있다.In addition, if the product is already released and the customer is in use, it is almost impossible to replace the ram, there is a problem that the reliability of the product falls.
본 발명의 제 1목적은 임베디드 시스템에서 램의 용량에 따른 실행 가능한 프로그램의 크기 제약을 없앨 수 있도록 한 임베디드 시스템에서의 코드 오버레이 방법을 제공함에 있다.It is a first object of the present invention to provide a method of overlaying code in an embedded system to remove a size limitation of an executable program according to RAM capacity in an embedded system.
본 발명의 제 2목적은 런 타임이 필요한 코드 블록만을 램 영역에 복사하고, 상기 복사할 때 복사 오버헤드를 줄일 수 있도록 한 임베디드 시스템에서의 코드 오버레이 방법을 제공함에 있다.A second object of the present invention is to provide a method of overlaying code in an embedded system to copy only a block of code requiring run time to a RAM area and to reduce copy overhead when copying.
상기한 목적 달성을 위한 본 발명에 따른 임베디드 시스템에서의 코드 오버레이 방법은,Code overlay method in the embedded system according to the present invention for achieving the above object,
어플리케이션 프로그램의 정형화된 순서에 의해 실행 스케쥴이 생성되는 단계;Generating an execution schedule in a formal order of the application program;
상기 어플리케이션 프로그램의 원본 소스를 컴파일하여 목적 파일을 생성하는 단계;Compiling an original source of the application program to generate an object file;
상기 생성된 스케쥴 정보, 각 목적 파일의 크기, 임베디드 시스템의 메모리 정보를 입력받아 임베디드 시스템의 플레쉬 메모리에 저장될 어플리케이션의 이미지 레이아웃을 결정하고, 메인 함수 및 링커 스트립트를 생성하는 단계;Determining the image layout of an application to be stored in the flash memory of the embedded system by receiving the generated schedule information, the size of each object file, and the memory information of the embedded system, and generating a main function and a linker script;
상기 생성된 링커 스트립트를 이용하여 링킹 과정을 수행한 후 실행 가능한 이미지를 생성하고 임베디드 시스템의 플레쉬 메모리에 전달하는 단계를 포함하는 것을 특징으로 한다. After performing the linking process using the generated linker script, characterized in that it comprises the step of generating an executable image and transferred to the flash memory of the embedded system.
바람직하게, 상기 임베디드 시스템에서는 초기에 동작되면 플레쉬 메모리에 다운로드받은 이미지 중 부트스트랩코드가 실행이 되는 단계; 상기 부트스트랩코드가 실행되면, 어플리케이션 프로그램의 루트함수에 해당되는 메인 함수가 램으로 복사된 후, 상기 복사된 메인 함수가 시스템에 상주하여 상기 실행 스케쥴에 따라 전체 어플리케이션의 코드블록 실행과 로딩을 담당하는 단계를 포함하는 것을 특징으로 한다. Preferably, when the embedded system is initially operated, the bootstrap code of the image downloaded to the flash memory is executed; When the bootstrap code is executed, the main function corresponding to the root function of the application program is copied to RAM, and the copied main function resides in the system and is responsible for executing and loading code blocks of the entire application according to the execution schedule. Characterized in that it comprises a step.
바람직하게, 상기 코드 블록 실행은 런 타임시 필요한 코드블록만을 램 영역에 복사하여 사용하는 오버레이 기법을 이용하는 것을 특징으로 한다. Preferably, the code block execution uses an overlay technique in which only a code block necessary at run time is copied to the RAM area.
바람직하게, 상기 클러스터링 및 위치 결정은 실행 스케쥴에 따라 각 코드블록의 위치 및 클러스터에 따른 복사 오버헤드를 줄이기 위해 유전 알고리즘을 적용한 것을 특징으로 한다. Preferably, the clustering and location determination is characterized by applying a genetic algorithm to reduce the copy overhead according to the location and cluster of each code block according to the execution schedule.
바람직하게, 상기 램의 크기는 어플리케이션의 크기 보다 크지 않는 것을 특징으로 한다. Preferably, the size of the RAM is not larger than the size of the application.
한편, 본 발명의 다른 실시 예에 따른 임베디드 시스템에서의 코드 오버레이 방법은,On the other hand, the code overlay method in an embedded system according to another embodiment of the present invention,
부트 스트랩 코드 및 어플리케이션 프로그램이 저장된 플레쉬 메모리와; 작업공간인 램과; 상기 플레쉬 메모리 및 램을 제어하는 메인 제어부를 포함하는 임베디드 시스템에 있어서, A flash memory in which bootstrap code and an application program are stored; RAM which is a workspace; In the embedded system comprising a main control unit for controlling the flash memory and RAM,
시스템이 부팅되면 부트스트랩 코드가 실행되어 하드웨어 초기화를 수행하는 단계; 상기 어플리케이션의 메인 함수를 램에 복사하는 단계; 상기 램에 복사된 메인 함수에서 미리 정해진 실행 스케쥴에 따라 전체 어플리케이션에서 필요한 코드블록만을 램 영역에 복사시키고 실행시키는 단계를 포함하는 것을 특징으로 한다. When the system is booted, bootstrap code is executed to perform hardware initialization; Copying the main function of the application to RAM; And copying and executing only the code blocks necessary for the entire application to the RAM area according to a predetermined execution schedule in the main function copied to the RAM.
바람직하게, 상기 메인 함수에는 상기 실행 스케쥴에 따라 서로 호출관계에 있는 코드블록들의 로딩을 위해 클러스터링한 정보를 포함하는 것을 특징으로 한다. Preferably, the main function includes clustered information for loading code blocks that are in a call relationship with each other according to the execution schedule.
바람직하게, 상기 메인 함수에는 각 코드블록의 실행 스케쥴과 각각의 코드블록 램 주소를 고려하여 인접한 코드블록의 램 주소가 서로 같은 메모리 영역을 사용 여부에 대한 위치 결정 정보를 포함하는 것을 특징으로 한다.Preferably, the main function includes location information on whether a RAM address of an adjacent code block uses the same memory area in consideration of an execution schedule of each code block and each code block RAM address.
상기와 같이 구성되는 본 발명 실시 예에 따른 임베디드 시스템에서의 코드 오버레이 방법에 대하여 첨부된 도면을 참조하여 설명하면 다음과 같다.Referring to the accompanying drawings, a code overlay method in an embedded system according to an exemplary embodiment of the present invention configured as described above is as follows.
도 1은 본 발명에 따른 임베디드 시스템의 구성도이다.1 is a block diagram of an embedded system according to the present invention.
도 1을 참조하면, 페이지 단위로 이동되는 다운로드받은 이미지를 저장하고 있는 비휘발성 메모리인 플레쉬 메모리(10)와, 작업 공간으로서의 역할을 하는 램(예: SRAM)(20)과, 상기 플레쉬 메모리(10) 및 램(20)에 버스 연결되어 제어하는 메인 제어부(30)와, 상기 메인 제어부(30)를 통해 코드 오버레이로 실행 가능한 이미지를 다운로드시켜 주는 호스트(40)를 포함하는 구성이다.Referring to FIG. 1, a
여기서, 상기 플레쉬 메모리(10)는 예컨대 낸드(NAND) 플레쉬 메모리로 구성되며, 다운로드받은 어플리케이션 프로그램(즉, 이미지)이 저장된다. 또한 상기 플 레쉬 메모리(20)에는 부트스트랩 코드(bootstrap code)와 어플리케이션 다운로드를 관리하는 코드 부분(미도시)이 저장되어 있다. Here, the
상기와 같이 구성되는 본 발명 실시 예에 따른 임베디드 시스템에서의 코드 오버레이 장치 및 방법에 대하여 첨부된 도면을 참조하여 설명하면 다음과 같다.Referring to the accompanying drawings, a code overlay apparatus and method in an embedded system according to an exemplary embodiment of the present invention configured as described above are described below.
먼저, 도 1을 참조하면, 시스템이 부팅을 시작되면 메인 제어부(30)는 상기 플레쉬 메모리(10)에 저장되어 있는 상기 부트 스트랩 코드를 램(20)에 복사시킨 후 부트 스트랩 코드를 실행시키고 보드 초기화와 같은 하드웨어 초기화 작업을 실행하게 된다.First, referring to FIG. 1, when the system starts to boot, the
또한 상기 플레쉬 메모리(20)에 있는 어플리케이션 프로그램 전체(데이터까지 포함)를 램(20)의 저장 영역으로 복사하게 된다. 복사를 마친 후 해당 어플리케이션의 시작 부분으로 점프를 하여 어플리케이션 프로그램을 실행시키게 된다. In addition, the entire application program (including data) in the
이때, 어플리케이션을 전체 복사함에 있어서, 램(20)의 메모리 크기가 제한적이기 때문에, 본 발명에서는 현재 필요한 코드들 또는 앞으로 실행될 코드들만을 복사하여 램 용량이 초과되는 것을 방지하게 된다. 이런 방식으로 코드가 실행이 되면 서로 다른 코드 블록들이 같은 메모리 번지를 사용하게 된다(이하 코드 오버레이 라 함).At this time, since the memory size of the
이러한 코드 오버레이를 위해 호스트(40)에서는 코드 오버레이로 실행 가능한 이미지를 생성하여 메인 제어부(30)를 통해 플레쉬 메모리(10)에 다운로드시켜 준다.For this code overlay, the
이를 위해서, 호스트(40)에는 스케쥴 생성부(41), 클러스터링 및 위치 결정 부(42), 링커부(43)를 포함한다. 상기 스케쥴 생성부(41)는 정형화된 순서를 가지는 응용 프로그램을 그 대상으로 하고 있으며, 실제 임베디드 시스템의 응용 프로그램들의 경우 각 이벤트가 시간에 따라 수행하는 루틴들이 순차(Sequential)적으로 정해져 있으므로, 그러한 순차적인 이벤트에 의해 시간 기준으로 스케쥴을 생성하게 된다. 여기서, 상기 루틴은 하나의 펑션(function)이 아니라 펑션들의 모임으로 어떤 특정 목적을 가지고 실행된다. 즉, 이러한 실행 스케쥴은 스케쥴 생성부(41)에 의해 생성된다.To this end, the
클러스터링 및 위치 결정부(42)는 상기 생성된 스케쥴 정보와 각 코드블록의 크기를 입력으로 받아서, 클러스터링 및 위치 결정을 수행하여, 메인 함수와 파일생성, 링커 스트립트를 생성하여 출력하게 된다. The clustering and
그리고, 링커부(43)는 상기 생성된 링커 스트립트를 읽어들여 이를 분석한 후 링커 스트립트에 지시한 위치에 따라 링킹 작업을 수행하여, 실행 가능한 최종 이미지를 생성하게 된다. 그리고, 호스트(40)는 상기 링킹 작업을 통해 최종 생성된 이미지를 통신 수단(미도시)으로 연결된 메인 제어부(30)를 통해 플레쉬 메모리(10)에 다운로드시켜 준다.The
구체적으로 설명하면, 코드 오버레이를 하기 위해서는 플레쉬 메모리(10)의 물리적 특성에 따라 코드들을 몇 개의 영역으로 나누어 저장하게 된다. 또한 메인 제어부(30)는 램 영역으로 코드를 복사하기 위해 플레쉬 메모리에서 코드를 읽을 때 플레쉬 메모리 내부에서 페이지 단위로 이동을 하게 된다. 여기서, 도 2는 플레쉬 메모리의 구조를 나타낸 도면이다.Specifically, in order to code overlay, codes are divided into several areas according to the physical characteristics of the
상기 플레쉬 메모리의 페이지 크기는 일정한 크기 예컨대, 4K 정도의 크기를 갖는다. 예를 들면, 1K 정도의 코드 영역을 플레쉬 메모리에서 램으로 복사하려고 할 때 플레쉬 메모리 내부에서는 해당되는 1K가 걸쳐져 있는 페이지들을 모두 내부의 버퍼 영역으로 이동시키게 된다. 이는 페이지의 복사 회수가 증가되는 문제가 발생된다.The page size of the flash memory has a certain size, for example, about 4K. For example, if you try to copy an area of 1K code from flash memory to RAM, all the pages that span 1K are moved into the buffer area inside the flash memory. This causes a problem that the number of copies of the page is increased.
이를 해결하기 위해, 본 발명은 관련된 코드블록(함수)들을 클러스터링(Clustering)하고, 상기 클러스터링된 코드블록을 상기 페이지 크기 단위의 바운더리(boundary)의 정수배 안에 들어가도록 플레쉬 메모리에 저장시킨다. 즉, 어플리케이션 이미지를 플레쉬 메모리에 저장할 때 이미지의 레이아웃을 플레쉬 메모리의 페이지 단위의 특성을 이용하여 저장함으로써, 복사 오버헤드를 줄일 수 있다.To solve this problem, the present invention clusters related code blocks (functions) and stores the clustered code blocks in a flash memory so as to fall within an integer multiple of a boundary of the page size unit. That is, when the application image is stored in the flash memory, the copy overhead may be reduced by storing the layout of the image using the characteristics of the page unit of the flash memory.
도 3은 본 발명에 따른 호스트에서 임베디드 시스템을 위한 코드 오버레이 방법을 나타낸 플로우 챠트이다.3 is a flowchart illustrating a code overlay method for an embedded system in a host according to the present invention.
도 3을 참조하면, 원본 소스 파일을 프로파일(Profile)하여 함수들이 어떤 순서로 실행되는 지에 따라 스케쥴을 정하게 된다(41). 그리고, 원본 소스 파일(42)을 컴파일(compile)하여(43) 목적 파일(object file)을 만들게 된다(44). 이때 목적 파일을 알 수 있다. Referring to FIG. 3, the original source file is profiled to schedule the functions according to the order in which the functions are executed. The
여기서, 원본 소스 파일은 블록별로 나누어져 있으며, 스케쥴이 A->B->C라면 A,B,C라는 코드 블록으로 이루어진다. 상기 A->B->C 스케쥴에 의해 세 개의 원본 소스 파일 A.c, B.c, C.c 필요하게 된다.Here, the original source file is divided into blocks, and if the schedule is A-> B-> C, it consists of code blocks A, B, and C. The A-> B-> C schedule requires three original source files A.c, B.c, and C.c.
그리고, 클러스터링 및 위치 결정 과정을 수행하게 된다(45). 이때 클러스터 링 및 위치 결정을 위해 각 목적 파일의 크기, 실행 스케줄, 그리고 시스템의 메모리 상황(NAND 플레쉬의 페이지 크기, 램의 크기)에 해당되는 파라미터들이 입력된다.Then, the clustering and positioning process is performed (45). At this time, the parameters corresponding to the size of each object file, execution schedule, and memory condition (page size of NAND flash, RAM size) of the system are inputted for clustering and positioning.
이후, 상기 시스템 메모리 상황 등에 의해 플레쉬 메모리에 저장될 어플리케이션 이미지 레이아웃이 결정되고, 상기 스케쥴과 로딩을 담당하게 될 메인 함수(main())(46) 및 링커 스트립트(47)가 만들어져, 링커부의 입력으로 들어간다. 상기 메인 함수는 스케쥴에 따라 로딩 제어를 수행하며, 링커 스트립트는 로딩을 수행하게 된다.Subsequently, an application image layout to be stored in the flash memory is determined by the system memory situation, and a main function (main ()) 46 and a
여기서, 상기 클러스터링과 위치 결정 과정은 다양한 가능성에 대하여 유전 알고리즘을 적용하여 플레쉬 메모리에서 램으로의 복사 오버헤드가 최소가 되는 최적의 레이아웃을 찾게 된다. 마지막 링킹(48) 과정을 마치면서 실행 가능한 이미지가 생성됨으로써(49), 임베디드 시스템의 플레쉬 메모리에 어플리케이션 이미지가 다운로드 된다. Here, the clustering and positioning process applies a genetic algorithm to various possibilities to find an optimal layout that minimizes the copy overhead from the flash memory to the RAM. At the end of the
상기 링킹 과정을 수행하는 링커는 응용 프로그램을 실행하기 위한 것으로, 어떠한 과정을 통하여 실행되는지를 링크 스트립트를 참조하게 된다. 예를 들면, 링커는 C언어로 짜여진 원본 소스는 컴파일러에 의해 어셈블리로 바뀌고, 이것은 어셈블러를 거쳐 목적 파일 형태로 변화게 된다. 즉, 이렇게 만들어진 목적파일을 메모리에 넣어 실행파일을 만드는 것이다. 이러한 링킹 과정에서 링커 명령 파일(Linker command file)이 목적 파일을 어떻게 결합하고 프로그램 데이터를 임베디드 시스템 메모리의 어느 곳에 배치할지를 링커에게 명령한다. 그 명령 안에 프로 그래머가 의도한 메모리에 대한 정의와 섹션의 배치가 들어가 DSP 칩을 구동하게 되는 것이다. 즉, 링커는 응용 프로그램을 실행시켜 만든 목적 파일을 실제적으로 DSP 칩 안에서 실행 가능하도록 수행하고 있다. The linker that performs the linking process is for executing an application program, and the link script refers to how the process is executed. For example, the linker converts the original source code written in C into an assembly by the compiler, which is then converted into an object file by the assembler. In other words, the object file created in this way is put into memory to create an executable file. In this linking process, the linker command file instructs the linker how to combine the object files and place the program data in the embedded system memory. Within that command is the programmer's intended definition of memory and the placement of sections to drive the DSP chip. In other words, the linker actually executes the object file created by executing the application program in the DSP chip.
도 4를 참조하여, 본 발명에서 어플리케이션이 실행될 때의 시스템의 메모리 레이 아웃을 설명하면 다음과 같다. Referring to Figure 4, the memory layout of the system when the application is executed in the present invention will be described as follows.
초기 램(20)에는 데이터가 없는 상태에서 플레쉬 메모리(10)에 어플리케이션 이미지(A,B,C)(11,12,13)가 저장되어 있게 된다. 시스템이 동작 즉, 런 타임시 부트 스트립 코드(미도시)가 먼저 실행된 후 어플리케이션의 루트 함수에 해당되는 메인 함수 부분이 램(20)으로 복사된다. In the
상기 램(20)에 복사된 메인 함수(21)는 시스템이 꺼지기 전까지 항상 램에 상주하면서 스케쥴 정보에 따라 전체 어플리케이션의 실행과 로딩을 담당한다. 상기 로딩은 실제적으로 링커 스트립트에서 담당하게 된다. 즉, 스케쥴에 따라 플레쉬 메모리(10)에 저장된 필요한 코드블록 A,B,C(11,12,13)이 로딩되어 오버레이 버퍼(Overlay buffer)(22)에 복사되면서 어플리케이션이 실행된다The
도 5는 본 발명에 따른 메인 함수의 구조의 예로서, 실행 스케쥴과 로딩에 대해 설명한다. 도 4 및 도 5를 참조하면, 상기 메인 함수(main())는 스케쥴에 의해 "ABABCCC"라는 순서로 코드블록(함수)을 실행시키게 된다. 만약 코드블록 A(11)를 실행해야 하는데, 코드블록 A(11)가 램(20)의 오버레이 버퍼(22)에 없을 경우 플레쉬 메모리(10)에서 램(20)으로 코드블록 A(11)를 복사해 가지고 와서 실행을 시키게 된다. 이때, 플레쉬 메모리(20)에서 램(10)으로 복사할 때 복사에 따른 시 간 지연이 있게 된다. 이는 상기에서 실행되는 메인함수는 임베디드 시스템에 복사된 후 클러스터링 및 위치 결정 과정에 의해 복사 시간 지연을 최소화시킬 수 있다. 즉, 메인 함수에 실행스케쥴뿐만 아니라, 클러스터링 정보 및 위치 결정 정보를 포함시켜 줄 수 있다.5 illustrates an execution schedule and loading as an example of the structure of a main function according to the present invention. 4 and 5, the main function main () executes a code block (function) in the order of "ABABCCC" according to a schedule. If
도 6은 본 발명에 따른 클러스터링의 기능에 대해 설명하고 있다. 가)는 클러스터링을 하지 않는 경우로서, 코드블록 A 데이터가 필요한 경우 코드블록 A 데이터가 두 개의 페이지에 걸쳐 있기 때문에 두 개의 페이지(Page 1,2)를 읽어야 하며, 이와는 별도로 코드블록 B 데이터가 필요한 경우 한 번의 페이지(page 3)를 또 읽어야 한다. 그러나 나)는 클러스터링을 수행한 경우로서, 코드블록 A 데이터와 코드블록 B 데이터가 합쳐져서 두 개의 페이지에 들어가기 때문에 코드블록 A 데이터를 읽을 때 코드블록 B 데이터도 자동으로 읽게 된다. 만약 코드블록 A 데이터와 코드블록 B 데이터가 스케쥴상 서로 호출한다면 이는 아주 효율적인 클러스터링이 된다.6 illustrates the function of clustering according to the present invention. A) is a case where no clustering is required, and when code block A data is required, two pages (
이와 같이, 서로 연관이 있는 데이터들을 클러스터링함으로써, 상기 클러스터링되는 데이터의 호출시 복사 시간 및 램 메모리 공간의 활용을 크게 할 수 있다. As such, by clustering data that is related to each other, it is possible to increase the use of copy time and RAM memory space when calling the clustered data.
도면 7은 본 발명에 따른 위치 결정 예를 설명한 것이다.7 illustrates an example of positioning according to the present invention.
도 7을 참조하면, 모든 조건이 다 같고 단지 위치 결정만 다른 두 가지 예를 보여주고 있다. 여기서, 입력조건은 스케쥴이 ABABCCC이며, 램의 크기는 4K, 낸드플레쉬 메모리의 페이지 크기는 2K이고, 코드블록 A,B,C의 크기는 2K이다. 즉, 전 체 어플리케이션의 사이즈는 6K이고 램의 용량은 4K이다. Referring to FIG. 7, two examples are shown in which all conditions are the same and only positioning is different. Here, the input condition is ABABCCC, the RAM size is 4K, the NAND flash memory page size is 2K, and the code blocks A, B, and C are 2K. The overall application size is 6K and the RAM capacity is 4K.
가)의 경우는 코드블록 A와 코드블록 C에 같은 램 주소가 할당되어 있고, 나)의 경우에는 코드블록 A와 코드블록 B에 같은 램 주소가 할당되어 있다. 같은 주소가 할당되어 있다는 것은 두 개가 서로 같은 메모리 영역을 차지하기 때문에 배타적인 관계가 있다. 코드블록 A가 램에 먼저 상주하고 있었는데 같은 영역을 할당받은 코드블록 C가 램으로 복사된다면 전에 있던 코드블록 A는 무효화(삭제)가 된다. 그러므로 실행 스케쥴에 따라 각 코드블록들의 위치를 잘 결정해 주면 상당한 복사 오버헤드를 줄이는 효과가 있다. In the case of a), the same RAM address is assigned to Code Block A and Code Block C, and in the case of b), the same RAM address is assigned to Code Block A and Code Block B. Assigning the same address is exclusive because the two occupy the same memory area. If code block A resides in RAM first and code block C assigned the same area is copied to RAM, the previous code block A is invalidated (deleted). Therefore, if each code block is well positioned according to the execution schedule, it can reduce the considerable copy overhead.
가)의 경우는 복사(로드)가 3번만 일어나는 반면, 나)의 경우는 5번이나 일어나게 된다. 이는 코드블록 A와 B가 서로 호출하는 긴밀한 관계인데 같은 주소를 할당하여 서로 지우기 때문이다. In case of a), copying occurs only 3 times, while in case of b), it occurs 5 times. This is because Code Blocks A and B call each other because they assign the same address and erase each other.
즉, 가)의 경우는 본 발명의 위치 결정 예로서, 실행 스케쥴 ABABCCC에 의해 load A, load B, hit, hit, hit, load C(A 삭제), hit, hit 순서로 동작하면서, 복사가 3번 발생하게 된다.That is, in the case of a), in the positioning example of the present invention, copying is performed while executing in the order of load A, load B, hit, hit, hit, load C (deleting A), hit, and hit according to execution schedule ABABCCC. Will occur once.
그러나, 나)의 경우는 종래 문제점으로서, 실행 스케쥴 ABABCCC에 의해 load A, load B(A 삭제), load A(B 삭제), load B(A 삭제), load C, hit, hit로 동작하면서, 복사가 5번 이루어진다.However, in the case of b), it is a conventional problem, while the operation schedule ABABCCC operates under load A, load B (delete A), load A (delete B), load B (delete A), load C, hit, hit, The copy is made five times.
이와 같이 최소의 복사 오버헤드가 발생하도록 클러스터링과 위치결정을 수행하게 되는데, 이를 위해 유전 알고리즘을 이용하여 최적의 레이아웃을 찾게 된다. 일반적인 유전 알고리즘은 세대(generation)를 거듭해 가면서 좋은 유전자를 계속 남기고 이것을 계속 교배하여 더 좋은 형질을 얻는 것으로, 최종에는 최적의 해(solution)가 남게 된다. 이에 따라 서로 교차되어 동작하는 코드블록들은 서로 다른 램 위치로 결정하고, 서로 연관된 코드블록들은 같은 램 주소를 할당하지 않게 된다. 또 마지막에 실행될 코드블록은 앞으로 실행되지 않을 램 위치로 결정함으로써, 서로 중복되어 호출되는 문제를 해결하여 최적의 레이아웃을 구현할 수 있다.As such, clustering and positioning are performed to generate a minimum copy overhead. For this, a genetic layout is used to find an optimal layout. In general, genetic algorithms continue to leave good genes over generations and continue to cross them to obtain better traits, leaving an optimal solution at the end. Accordingly, code blocks intersecting with each other are determined to be different RAM locations, and code blocks associated with each other do not allocate the same RAM address. In addition, the final code block to be executed is determined as a RAM position that will not be executed in the future, thereby solving the problem of overlapping each other and implementing an optimal layout.
여기서, 코드블록 A와 코드블록 B가 같은 램 주소로 할당되면, 두 코드블록은 서로 스케쥴 상에서 연관성이 떨어지는 경우이다. 또한 코드블록 A가 호출된 후 코드블록 B가 호출되는 경우 혹은 반대의 경우가 없으므로, 두 개의 코드블록을 같은 메모리에 할당을 하여도, 서로 교체하는 경우가 발생하지 않으므로 플레쉬 메모리에서 다시 호출할 경우가 발생하지 않게 된다.Here, if code block A and code block B are allocated to the same RAM address, the two code blocks are inferior in relation to each other on a schedule. Also, since code block B is not called after code block A is called or vice versa, even if two code blocks are allocated to the same memory, swapping does not occur. Will not occur.
예를 들면, 코드블록 ABA의 순서로 스케쥴이 된다면 먼저 코드블록 A를 플레쉬 메모리에서 호출하여 복사하게 되며, 그 다음에 코드블록 B를 복사하게 된다. 만약 같은 주소를 할당받았다면 코드블록 A의 위치에 다시 코드블록 B가 로드되므로 코드블록 A가 없어졌으므로 코드블록 A가 플레쉬 메모리에서 삭제되었으므로 상기 코드블록 A를 다시 호출하게 된다. 이럴 경우 시간이 많이 걸리게 되므로, 코드블록 ABA와 같이 코드블록 A와 B가 서로 연관이 있다면 같은 램 주소를 할당하면 안 된다. For example, if scheduled in the order of code block ABA, code block A is first called from flash memory and copied. Then code block B is copied. If the same address is allocated, the code block B is loaded again at the location of the code block A, and thus the code block A is deleted. Therefore, the code block A is deleted from the flash memory. This can take a long time, so if the code blocks A and B are related to each other, such as code block ABA, they should not be assigned the same RAM address.
이와 같이, 어플리케이션이 실행됨에 따라 램의 크기 보다 큰 어플리케이션의 실행이 가능하게 된다. 이는 메모리의 크기에 의한 한계 없이 어플리케이션에 기능을 추가할 수 잇다.As such, as the application is executed, the application larger than the size of the RAM can be executed. This can add functionality to the application without limiting the size of the memory.
한편, 본 발명은 임베디드 시스템에서는 시스템이 부팅되면 부트스트랩 코드가 실행되어 하드웨어 초기화를 수행하고, 상기 어플리케이션의 메인 함수를 램에 복사함으로써, 상기 램에 복사된 메인 함수에서 미리 정해진 실행 스케쥴에 따라 전체 어플리케이션에서 필요한 코드블록만을 램 영역에 복사시키고 실행시켜 주게 된다. 이때, 상기 메인 함수는 함수에 포함된 클러스터링한 정보에 의해 상기 실행 스케쥴에 따라 서로 호출관계에 있는 코드블록들의 로딩하게 되며, 위치 결정 정보에 의해 각 코드블록의 실행 스케쥴과 각각의 코드블록 램 주소를 고려하여 인접한 코드블록의 램 주소가 서로 같은 메모리 영역의 사용 여부에 따라 호출하게 된다.Meanwhile, in the embedded system, when the system is booted, the bootstrap code is executed to perform hardware initialization, and by copying the main function of the application to RAM, the entire function according to a predetermined execution schedule is copied from the main function copied to the RAM. Only the code blocks needed by the application are copied to the RAM area and executed. At this time, the main function is to load the code blocks in the call relationship according to the execution schedule by the clustered information included in the function, the execution schedule of each code block and each code block RAM address by the positioning information In consideration of this, the RAM addresses of adjacent code blocks are called according to whether they use the same memory area.
이제까지 본 발명에 대하여 그 바람직한 실시 예를 중심으로 살펴보았으며, 본 발명이 속하는 기술분야에서 통상의 지식을 가진 자는 본 발명의 본질적 기술 범위 내에서 상기 본 발명의 상세한 설명과 다른 형태의 실시 예들을 구현할 수 있을 것이다. 여기서 본 발명의 본질적 기술범위는 특허청구범위에 나타나 있으며, 그와 동등한 범위 내에 있는 모든 차이점은 본 발명에 포함된 것으로 해석되어야 할 것이다.So far, the present invention has been described with reference to the preferred embodiments, and those skilled in the art to which the present invention pertains to the detailed description of the present invention and other forms of embodiments within the essential technical scope of the present invention. Could be implemented. Here, the essential technical scope of the present invention is shown in the claims, and all differences within the equivalent range will be construed as being included in the present invention.
본 발명에 따른 임베디드 시스템에서의 코드 오버레이 방법은, 임베디드 시스템에서 램의 크기가 프로그램보다 작을 경우, 램을 추가로 달거나 교체하는 일 없이 램의 크기 보다 크기가 큰 어플리케이션을 실행시킬 수 있는 효과가 있다. Code overlay method in the embedded system according to the present invention, when the size of the RAM is smaller than the program in the embedded system, there is an effect that can run an application larger than the size of the RAM without additionally adding or replacing the RAM. .
또한 메모리 크기에 의한 한계 없이 어플리케이션에 기능을 추가할 수 있는 효과가 있다.It also has the effect of adding functionality to the application without limiting memory size.
또한 시장에 출시된 기존 제품에도 적용이 가능한 효과가 있다.In addition, it can be applied to existing products on the market.
또한 오버레이로 인해 복사 시간이 줄어들어, 늘어나는 실행시간을 최소화시킬 수 있다.Overlays also reduce copy time, minimizing increased run time.
Claims (8)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
KR1020050095217A KR100745256B1 (en) | 2005-10-11 | 2005-10-11 | Code overlay method in the embedded system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
KR1020050095217A KR100745256B1 (en) | 2005-10-11 | 2005-10-11 | Code overlay method in the embedded system |
Publications (2)
Publication Number | Publication Date |
---|---|
KR20070040007A true KR20070040007A (en) | 2007-04-16 |
KR100745256B1 KR100745256B1 (en) | 2007-08-01 |
Family
ID=38175859
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
KR1020050095217A KR100745256B1 (en) | 2005-10-11 | 2005-10-11 | Code overlay method in the embedded system |
Country Status (1)
Country | Link |
---|---|
KR (1) | KR100745256B1 (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8984475B2 (en) | 2010-03-26 | 2015-03-17 | Samsung Electronics Co., Ltd. | Apparatus and method for generating code overlay |
CN103927187B (en) * | 2014-05-09 | 2017-03-22 | 金祺创(北京)技术有限公司 | Program execution method of embedded system |
US11960888B2 (en) | 2019-07-24 | 2024-04-16 | SK Hynix Inc. | Memory system, memory controller, and method for operating memory system |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR100322573B1 (en) * | 1998-06-19 | 2002-03-08 | 윤종용 | Swapping device and method between main memory and auxiliary memory, web video phone employing the device |
JP2001101071A (en) | 1999-09-29 | 2001-04-13 | Victor Co Of Japan Ltd | Data storage device using flash type memory and data managing method for the same memory |
KR100439507B1 (en) * | 2002-03-18 | 2004-07-09 | 삼성전기주식회사 | Data operating method in flash memory card system of high-capacity |
KR20050059562A (en) * | 2003-12-15 | 2005-06-21 | 엘지전자 주식회사 | Memory structure in embedded system and operating mehtod of the same |
KR100654611B1 (en) * | 2004-09-30 | 2006-12-08 | 주식회사 팬택 | Method for storing and reading data in mobile phone |
-
2005
- 2005-10-11 KR KR1020050095217A patent/KR100745256B1/en not_active IP Right Cessation
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8984475B2 (en) | 2010-03-26 | 2015-03-17 | Samsung Electronics Co., Ltd. | Apparatus and method for generating code overlay |
CN103927187B (en) * | 2014-05-09 | 2017-03-22 | 金祺创(北京)技术有限公司 | Program execution method of embedded system |
US11960888B2 (en) | 2019-07-24 | 2024-04-16 | SK Hynix Inc. | Memory system, memory controller, and method for operating memory system |
Also Published As
Publication number | Publication date |
---|---|
KR100745256B1 (en) | 2007-08-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP4903686B2 (en) | Flash memory programming | |
JP4006337B2 (en) | How to fix executable execution using shared libraries | |
KR101213275B1 (en) | System and method for providing monolithic image for use in a wireless device | |
EP3267308B1 (en) | Application loading method and device | |
EP1728155A2 (en) | Method and system for performing link-time code optimization without additional code analysis | |
CN102722387B (en) | Dynamic patching method and device | |
CN103927187A (en) | Program execution method of embedded system | |
CN102486733A (en) | Method and device for upgrading boot program | |
US6185578B1 (en) | Program creation apparatus, program creation method, and recording medium containing a software program for implementing the method | |
CN101334737A (en) | Embedded equipment start-up or reset method | |
US8510529B2 (en) | Method for generating program and method for operating system | |
KR100745256B1 (en) | Code overlay method in the embedded system | |
CN111133419B (en) | Stack security for independently defined operations | |
US8893127B2 (en) | Method and system for loading application to a local memory of a co-processor system by using position independent loader | |
CN115495158A (en) | Dynamic construction method of system service in microkernel operating system | |
CN115934213A (en) | Controller stack calling method, device, equipment and storage medium | |
KR100478463B1 (en) | Dynamic Linking Method for Application Program | |
JP2000010791A (en) | Method for initializing global register, computer program product, and device | |
CN112860287A (en) | System program upgrading method and device, computer equipment and storage medium | |
US8108645B2 (en) | Optimized memory allocation via feature extraction | |
JP5402595B2 (en) | Native IC card, IC card OS, and method | |
CN111190658A (en) | System for supporting dynamic loading of application program on SoC (system on chip) without MMU (memory management unit) based on-chip execution | |
JP6295914B2 (en) | Programmable controller system, its support device, programmable controller | |
US20220108003A1 (en) | Apparatus and method for kernel runtime randomization | |
KR20070081868A (en) | Method for updating software efficiently in mobile communication system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A201 | Request for examination | ||
E902 | Notification of reason for refusal | ||
E701 | Decision to grant or registration of patent right | ||
GRNT | Written decision to grant | ||
FPAY | Annual fee payment |
Payment date: 20130624 Year of fee payment: 7 |
|
FPAY | Annual fee payment |
Payment date: 20140624 Year of fee payment: 8 |
|
FPAY | Annual fee payment |
Payment date: 20150624 Year of fee payment: 9 |
|
FPAY | Annual fee payment |
Payment date: 20160624 Year of fee payment: 10 |
|
LAPS | Lapse due to unpaid annual fee |