KR20080064065A - Apparatus and method for developing programs and a method of updating programs - Google Patents

Apparatus and method for developing programs and a method of updating programs Download PDF

Info

Publication number
KR20080064065A
KR20080064065A KR1020070000809A KR20070000809A KR20080064065A KR 20080064065 A KR20080064065 A KR 20080064065A KR 1020070000809 A KR1020070000809 A KR 1020070000809A KR 20070000809 A KR20070000809 A KR 20070000809A KR 20080064065 A KR20080064065 A KR 20080064065A
Authority
KR
South Korea
Prior art keywords
binary
code
existing
codes
present
Prior art date
Application number
KR1020070000809A
Other languages
Korean (ko)
Other versions
KR100866211B1 (en
Inventor
정영훈
Original Assignee
삼성전자주식회사
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 삼성전자주식회사 filed Critical 삼성전자주식회사
Priority to KR1020070000809A priority Critical patent/KR100866211B1/en
Publication of KR20080064065A publication Critical patent/KR20080064065A/en
Application granted granted Critical
Publication of KR100866211B1 publication Critical patent/KR100866211B1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input 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/12Digital output to print unit, e.g. line printer, chain printer
    • G06F3/1201Dedicated interfaces to print systems
    • G06F3/1223Dedicated interfaces to print systems specifically adapted to use a particular technique
    • G06F3/1229Printer resources management or printer maintenance, e.g. device status, power levels
    • G06F3/123Software or firmware update, e.g. device firmware management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/37Compiler construction; Parser generation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Human Computer Interaction (AREA)
  • Stored Programmes (AREA)

Abstract

A device and a method for developing programs, and a program updating method thereof are provided to reduce resource/time needed for downloading entire binary to an electronic device to test a corrected code, and reduce the time/cost needed for updating the binary by updating only the binary corresponding to a corrected part without updating whole binary in an OTA(Over-The-Air) mode. A code building unit(110) generates binary by compiling and linking corrected codes independently. A file binary loading unit(120) stores the generated binary to a predetermined memory address. A dynamic linking unit(140) overwrites the codes to be corrected with a branch code capable of branching off to the predetermined memory address. The dynamic linking unit performs an overwrite operation after backing up the present codes and setting an MMU(Memory Management Unit) to a state capable of reading/writing an area corresponding to the present codes. The code building unit removes a symbol defined for the present code among a symbol table file of present binary after generating the binary and links the generated binary with the symbol table file of the present binary.

Description

프로그램 개발 장치 및 방법과 이를 이용한 프로그램 업데이트 방법{Apparatus and method for developing programs and a method of updating programs}Apparatus and method for developing programs and a method of updating programs}

도 1은 프로그램의 일부 코드가 변경된 경우에 타겟 바이너리 파일의 생성을 모식적으로 나타낸 도면,1 is a diagram schematically illustrating generation of a target binary file when some code of a program is changed;

도 2는 본 발명의 개념을 설명하기 위한 도면,2 is a view for explaining the concept of the present invention,

도 3은 본 발명의 일 실시예에 따른 프로그램 개발 장치의 블록 구성도를 나타낸 도면,3 is a block diagram of a program development apparatus according to an embodiment of the present invention;

도 4는 본 발명의 일 실시예에 따른 코드 빌드 유닛의 동작을 나타낸 플로우챠드,4 is a flowchart illustrating an operation of a code build unit according to an embodiment of the present invention;

도 5는 본 발명의 일 실시예에 따른 동적 링크 유닛의 동작을 나타낸 플로우챠드,5 is a flowchart illustrating an operation of a dynamic link unit according to an embodiment of the present invention;

도 6는 프로그램의 일부 코드가 변경된 경우에 본 발명의 일 실시예에 따른 동적 링킹 방법을 모식적으로 나타낸 도면,6 is a view schematically showing a dynamic linking method according to an embodiment of the present invention when some code of a program is changed;

도 7은 본 발명의 일 실시예에 따른 OTA를 통한 업데이트 과정을 나타낸 플로우챠드.7 is a flowchart illustrating an update process through an OTA according to an embodiment of the present invention.

본 발명은 프로그램 개발 장치 및 방법 및 이를 이용한 프로그램 업데이트 방법에 관한 것이다.The present invention relates to a program development apparatus and method and a program update method using the same.

방대하고 또한 다양한 신호 처리가 요구되는 측정 장치나 통신 장치 등의 전자 기기는 일반적으로 고성능의 프로세서가 탑재되어 있다. 이와 같은 프로세서 상에서 실행되는 프로그램도 역시 복잡하고 크기가 커지는 경향이 있다. 이들 전자 기기에 기록되어 있는 프로그램은 버그를 포함하기도 하고, 기능의 추가나 개선을 요구받는 일이 많다. 이를 위해, 프로그램 개발자들은 자주 전자 기기에서 실행될 프로그램의 일부를 수정하고 수정된 프로그램에 대하여 테스트를 수행한다. BACKGROUND Electronic devices such as measurement devices and communication devices that require a large variety of signal processing are generally equipped with high performance processors. Programs running on such processors also tend to be complex and large. Programs recorded on these electronic devices often contain bugs and are often required to add or improve functions. To this end, program developers frequently modify a part of a program to be executed on an electronic device and test the modified program.

그런데, 기존에는 목적(Target) 프로그램의 코드를 수정하거나 새로운 코드를 작성하게 되면 테스트를 위하여 전체 타겟 바이너리를 빌드하고 해당 전자 기기에 다운로드한 후에 테스트가 실시되었다. 즉, 코드의 변경이 작더라도 변경된 코드에 대한 테스트 결과를 얻기 위해서는 타겟 바이너리를 빌드하고 해당 전자 기기에 다운로드해야 한다.However, in the past, when the code of the target program was modified or a new code was written, the test was performed after the entire target binary was built and downloaded to the electronic device for testing. In other words, even if the code changes are small, the target binary must be built and downloaded to the electronic device in order to obtain the test results for the changed code.

이러한 타겟 바이너리를 빌드하는 절차에는 수정되지 않은 많은 프로그램 코드들의 의존성을 검사하는 과정, 오브젝트 파일들을 링크하는 과정 등이 포함되므로 긴 시간이 소요된다. 컴파일 과정은 변경된 코드의 파일에 대해서만 수행되지만, 변경된 파일의 의존성 검사에도 시간이 소요되며, 특히 전체 오브젝트 파일들 을 링크하는 부분이 가장 많은 지연시간을 차지하고 있다.The process of building such target binaries takes a long time because it involves checking dependencies of many unmodified program codes and linking object files. The compilation process is performed only on the files of the changed code, but it also takes time to check the dependencies of the changed files, especially the linking of the entire object files takes the most delay time.

도 1은 프로그램의 일부 코드가 변경된 경우에 타겟 바이너리 파일의 생성을 모식적으로 나타낸 도면이다.1 is a diagram schematically showing generation of a target binary file when some code of a program is changed.

도 1을 참조하면, 어떤 프로그램의 일부 코드, 즉, 어떤 소스 프로그램(10)이 변경된 경우, 변경된 소스 프로그램(10)만이 컴파일된다. 그러나, 소스 프로그램(10)이 컴파일된 결과인 오브젝트 파일은 다른 많은 오브젝트 파일들과 링크되어 타겟 바이너리(20)가 생성된다.Referring to FIG. 1, when some code of a program, that is, a source program 10 is changed, only the changed source program 10 is compiled. However, the object file that is the result of the compilation of the source program 10 is linked with many other object files to generate the target binary 20.

기존의 방식은 코드를 수정한 경우 이미 만들어져 있는 Target Binary 파일을 삭제하고 변경된 코드의 파일을 컴파일하여 오브젝트 파일을 생성하고 이미 생성되어 있던 오브젝트 파일들과 링크하여 타겟 바이너리를 생성한다. 이 과정에서 수천개의 오브젝트 파일들이 심볼 링크 과정과 재배치 과정을 거치기 때문에 오랜 시간이 소요되게 된다. 즉, 하나의 소스 코드를 수정하여도 매번 수천개의 오브젝트 파일들을 링크하여 타겟 바이너리를 생성하고 해당 전자 기기에 다운로드하는 시간이 소요된다.When the code is modified, the existing method deletes the existing target binary file, compiles the changed code file, creates an object file, and creates a target binary by linking with the object files that have already been created. This can take a long time because thousands of object files go through symbol linking and relocation. That is, even if one source code is modified, it takes time to link thousands of object files each time to generate a target binary and download it to the corresponding electronic device.

한편, 양산된 전자 기기를 업데이트 하기 위하여 기존에는 변경된 바이너리 전체를 OTA를 통하여 업데이트 하는 방식을 사용하고 있다. 하지만 이 방법은 전체 바이너리를 전송하여야 하기 때문에 시간적 / 비용적 손실이 크다고 할 수 있다. Meanwhile, in order to update a mass-produced electronic device, a conventional method of updating all changed binaries through OTA is used. However, this method has a large time / cost loss because the entire binary must be transmitted.

본 발명은 이미 Target Binary가 수천개의 오브젝트 파일들의 링크 과정을 거쳐 생성되었으므로 소스코드가 수정될 때마다 매번 Target Binary를 생성하지 않도록 한다. Since the target binaries have already been generated through linking thousands of object files, the target binaries are not generated every time the source code is modified.

본 발명은 타겟 바이너리를 다운로드하는데 소요되는 시간을 절약할 수 있도록 한다.The present invention makes it possible to save time required to download the target binary.

또한, 본 발명은 양산이 완료된 전자 기기의 프로그램 업데이트를 용이하게 하도록 한다.In addition, the present invention facilitates the program update of the mass-produced electronic device.

이하 본 발명의 바람직한 실시 예들을 첨부한 도면을 참조하여 상세히 설명한다. 또한 본 발명의 요지를 불필요하게 흐릴 수 있는 공지 기능 및 구성에 대한 상세한 설명은 생략한다.Hereinafter, exemplary embodiments of the present invention will be described in detail with reference to the accompanying drawings. In addition, detailed descriptions of well-known functions and configurations that may unnecessarily obscure the subject matter of the present invention will be omitted.

이를 위해 본 발명에 따른 전자 기기에 인스톨되는 프로그램을 개발하는 장치는 수정된 코드들을 독립적으로 컴파일 및 링크하여 바이너리를 생성하는 코드 빌드 유닛과, 상기 생성된 바이너리를 미리 정해진 메모리 주소에 저장하는 파일 바이너리 로딩 유닛과, 상기 수정될 기존의 코드들을 상기 미리 정해진 메모리 주소로 브랜치할 수 있도록 하는 브랜치 코드로 오버라이트하는 동적 링킹 유닛을 포함한다.To this end, an apparatus for developing a program installed in an electronic device according to the present invention includes a code building unit for generating a binary by independently compiling and linking modified codes, and a file binary for storing the generated binary at a predetermined memory address. And a loading unit and a dynamic linking unit that overwrites the existing codes to be modified with branch codes to enable branching to the predetermined memory address.

이하 본 발명의 바람직한 실시 예들을 첨부한 도면을 참조하여 상세히 설명한다. 또한 본 발명의 요지를 불필요하게 흐릴 수 있는 공지 기능 및 구성에 대한 상세한 설명은 생략한다.Hereinafter, exemplary embodiments of the present invention will be described in detail with reference to the accompanying drawings. In addition, detailed descriptions of well-known functions and configurations that may unnecessarily obscure the subject matter of the present invention will be omitted.

먼저, 프로그램은 생성하는 과정은 프로그램 코드를 적절한 에디터를 이용하여 작성(type out)하는 과정, 소스 프로그램 코드를 컴파일하여 오브젝트 파일을 생성하는 과정, 오브젝트 파일들을 결합(combine)하여 실행가능한 (executable) 타겟 바이너리를 생성하는 과정을 포함한다. First, the process of generating a program includes writing out program code using an appropriate editor, compiling source program code to generate an object file, and combining object files to be executed. This includes creating a target binary.

본 발명은 타겟 바이너리가 생성된 이후에 소스 코드가 변경되더라도 타겟 바이너리 전체를 다시 생성하지 않아도 타켓 바이너리가 변경된 동작을 할 수 있도록 한다.According to the present invention, even if the source code is changed after the target binary is generated, the target binary can be changed even without generating the entire target binary again.

이를 위해 본 발명은 동적 링킹(dynamic linking) 방식으로 명명되는 알고리즘을 채용한다. 원래의 소스 프로그램 상에서 일부 코드가 변경되는 경우, 본 발명의 실시예에 따라, 변경된 코드의 파일을 컴파일하여 오브젝트 파일을 생성한다. 본 발명의 실시예는 이 새로운 오브젝트 파일을 타겟 바이너리에 포함시키지 않고, 별도의 바이너리로서 미리 정해진 주소의 메모리에 저장한다. 그리고, 기존의 타겟 바이너리에서 변경된 코드가 대응하는 기존 코드는 브랜치 코드로 오버라이트된다. 이 브랜치 코드는 새로운 오브젝트 파일의 바이너리를 호출한다. 즉, 브랜치 코드는 기존 타겟 바이너리의 레지스터들 및 스택들을 모두 보존하면서, 새로운 오브젝트 파일의 바이너리가 저장된 메모리 주소로 브랜치하는 역할을 한다.To this end, the present invention employs an algorithm named dynamic linking. When some code is changed on the original source program, an object file is generated by compiling a file of the changed code according to an embodiment of the present invention. An embodiment of the present invention does not include this new object file in the target binary, but stores it in a memory at a predetermined address as a separate binary. The existing code corresponding to the code changed in the existing target binary is overwritten by the branch code. This branch code calls the binary of the new object file. That is, the branch code serves to branch to the memory address where the binary of the new object file is stored, while preserving all the registers and stacks of the existing target binary.

이러한 본 발명의 개념을 도 2를 참조하여 설명한다. 참조부호 1~6은 프로그램의 실행 순서를 나타낸다.This concept of the present invention will be described with reference to FIG. Reference numerals 1 to 6 denote the execution order of the programs.

도 2를 참조하면, 본 발명의 실시예에 따라 타겟 바이너리를 변경하지 않고, 변경된 코드에 대응하는 기존 코드는 브랜치 코드로 오버라이트되어 있다.Referring to FIG. 2, the existing code corresponding to the changed code is overwritten with the branch code without changing the target binary according to the embodiment of the present invention.

소정 전자 기기의 프로세서는 참조부호 1에 의해 지시된 방향으로 프로그램을 실행하는 중에 참조부호 2에 의해 지시된 브랜치 코드를 만난다. 프로세서는 브랜치 코드에 의해 참조부호 3에 의해 지시된 메모리의 주소로 브랜치한 후 참조부호 4에 의해 지시된 방향으로 프로그램을 실행한다. 참조부호 3에 의해 지시된 메모리 주소에는 변경된 코드가 컴파일되어 생성된 오브젝트 파일의 바이너리가 저장되어 있다. 이 때, 변경된 코드는 기존의 코드와 동일하게 링크레지스터(LR) 또는 스택에 저장된 리턴어드레스를 사용하여 기존의 타겟 바이너리로 리턴하도록 프로그램되어 있다. 그러므로, 프로세서는 새로운 코드의 프로그램을 실행한 후 기존의 타겟 바이너리로 리턴한다. The processor of a given electronic device encounters the branch code indicated by reference 2 while executing the program in the direction indicated by reference 1. The processor executes the program in the direction indicated by reference number 4 after branching to the address of the memory indicated by reference number 3 by the branch code. The memory address indicated by reference 3 stores the binary of the object file generated by the compiled code. At this time, the changed code is programmed to return to the existing target binary using the link address (LR) or the return address stored in the stack as the existing code. Therefore, the processor executes the program of the new code and returns to the existing target binary.

이와 같이, 본 발명은 기존의 타겟 바이너리를 변경하지 않고 프로그램 코드를 변경할 수 있기 때문에 테스트에 소요되는 시간 및 자원을 줄일 수 있다. As described above, the present invention can change the program code without changing the existing target binary, thereby reducing the time and resources required for testing.

한편, 상기 설명한 본 발명의 실시예는 프로그램을 탑재한 전자 기기에도 적용할 수 있다. 예컨대, 전자 기기에 수정된 부분의 바이너리 및 동적 링크 바이너리에 대한 정보를 제공한다. 이후 전자 기기에서 부팅시, 전자 기기는 동작 링크 바이너리에 대한 정보에 기초하여 변경된 바이너리 코드들에 대해 동적 링킹을 수행하는 것이다.Meanwhile, the above-described embodiment of the present invention can be applied to an electronic device equipped with a program. For example, the electronic device provides information about the binary and dynamic link binary of the modified part. Then, when booting from the electronic device, the electronic device performs dynamic linking on the changed binary codes based on the information on the operation link binary.

그에 따라, 전자 기기가 양산된 후에도 수정된 부분의 바이너리만을 전자 기기에 제공함으로써 프로그램의 업데이트를 달성할 수 있게 된다.Accordingly, even after the electronic device is mass produced, updating of the program can be achieved by providing only the binary of the modified part to the electronic device.

도 3은 본 발명의 일 실시예에 따른 프로그램 개발 장치의 블록 구성도를 나타낸 도면이다.3 is a block diagram of a program development apparatus according to an embodiment of the present invention.

도 3을 참조하면, 프로그램 개발 장치는 코드 빌드 유닛(110), 바이너리 로딩 유닛(120), 파일 시스템(130), 동적 링크 유닛(140) 및 메모리(150)를 포함한다.Referring to FIG. 3, the program development apparatus includes a code build unit 110, a binary loading unit 120, a file system 130, a dynamic link unit 140, and a memory 150.

코드 빌드 유닛(110)은 수정된 소스 코드들을 독립적으로 컴파일 및 링크하여 바이너리를 생성한다. 코드 빌드 유닛(110)의 상세한 동작은 도 4를 참조하여 설명한다.The code build unit 110 independently compiles and links the modified source codes to generate a binary. Detailed operations of the code build unit 110 will be described with reference to FIG. 4.

도 4는 본 발명의 일 실시예에 따른 코드 빌드 유닛의 동작을 나타낸 플로우챠드이다.4 is a flowchart illustrating an operation of a code build unit according to an embodiment of the present invention.

도 4를 참조하면, 코드 빌드 유닛(110)은 단계 310에서 새로운 코드를 컴파일하여 오브젝트 코드들을 생성한다. 이어서 코드 빌드 유닛(110)은 단계 320에서 기존 바이너리의 심볼 테이블 파일 중에서 기존 코드에 대해 정의된 심볼을 제거한다. 그런 다음, 코드 빌드 유닛(110)은 단계 330에서 생성한 오브젝트 코드를 기존 바이너리의 심볼 테이블 파일과 링크한다. 이 때, 코드 빌드 유닛(110)은 수정된 코드의 바이너리가 메모리 상에 로드될 주소에 맞춰서 심볼 재배치를 수행한다.Referring to FIG. 4, in operation 310, the code building unit 110 compiles new code to generate object codes. In operation 320, the code building unit 110 removes the symbol defined for the existing code from the symbol table file of the existing binary. Then, the code building unit 110 links the object code generated in step 330 with the symbol table file of the existing binary. At this time, the code build unit 110 performs symbol relocation in accordance with the address at which the binary of the modified code is to be loaded onto the memory.

바이너리 로딩 유닛(120)은 생성된 바이너리를 파일 시스템(130)에 저장한다. 이와 같이, 본 발명은 수정된 코드들의 바이너리를 기존의 타겟 바이너리에 포함시키지 않고 파일 시스템(130)에 저장한 후, 이후 부팅시 특정 메모리 주소에 로드한다. The binary loading unit 120 stores the generated binary in the file system 130. As such, the present invention stores the modified binary in the file system 130 without including the binary in the existing target binary, and then loads it into a specific memory address at boot time.

동적 링크 유닛(140)은 파일 시스템(130)에 저장된 바이너리를 메모리(150)에 로드하여 브랜치 코드를 통해 기존의 코드들을 로드한 바이너리로 대체한다. 동 적 링크 유닛(140)의 상세한 동작은 도 5를 참조하여 설명한다.The dynamic link unit 140 loads the binary stored in the file system 130 into the memory 150 and replaces the existing codes with the loaded binary through the branch code. Detailed operation of the dynamic link unit 140 will be described with reference to FIG. 5.

도 5는 본 발명의 일 실시예에 따른 동적 링크 유닛의 동작을 나타낸 플로우챠드이다.5 is a flowchart illustrating the operation of a dynamic link unit according to an embodiment of the present invention.

도 5를 참조하면, 동적 링크 유닛(140)은 단계 210에서 수정되어야 하는 기존의 코드들을 백업한다. 이어서, 동적 링크 유닛(140)은 단계 220에서 해당 코드들에 대응한 영역이 리드/라이트 가능한 상태가 되도록 상기 영역에 대응한 MMU(Memory Management Unit)를 세팅한다. 동적 링크 유닛(140)은 단계 230에서 변경될 기존의 코드들을 브랜치 코드로 오버라이트한 후 단계 240에서 오버라이트된 영역이 판독만 되는(readonly) 상태가 되도록 MMU를 세팅한다. Referring to FIG. 5, the dynamic link unit 140 backs up existing codes that must be modified in step 210. Subsequently, the dynamic link unit 140 sets a memory management unit (MMU) corresponding to the region in step 220 such that the region corresponding to the codes becomes a read / write state. The dynamic link unit 140 overwrites the existing codes to be changed in step 230 with the branch code and sets the MMU such that the overwritten area is in a read only state in step 240.

이 경우, 기존 타겟 바이너리에서 수정되어야 할 부분에 새로운 코드를 직접 오버라이트하지 않는 몇 가지의 이유가 있다. 첫번째 이유는 새로운 코드들을 기존의 코드들의 위치에 각각 오버라이트되기 위해서는 오브젝트 파일별로 링크하거나 심볼들을 재배치해야 하기 때문이다. 두번째 이유는 기존의 코드들의 길이가 새로운 코드들과 다를 수 있기 때문이다. In this case, there are several reasons for not overwriting new code directly in the existing target binaries to be modified. The first reason is that in order for new codes to be overwritten in place of existing codes, they must be linked by object file or relocated symbols. The second reason is that the length of the existing codes can be different from the new codes.

본 발명에 따라 수정되어야 할 부분을 오버라이트하는 브랜치 코드는 다음과 같이 작성될 수 있다. According to the present invention, the branch code that overwrites the part to be modified can be written as follows.

 PUSH {r0,r1,r2}     MOV r1,sp     ADD r1,r1,#8     LDR r0,=nAddr     STR r0,[r1]     POP {r0,r1,pc} nAddr     DCD [Address of New Code]   PUSH {r0, r1, r2} MOV r1, sp ADD r1, r1, # 8 LDR r0, = nAddr STR r0, [r1] POP {r0, r1, pc} nAddr DCD [Address of New Code]

이 브랜치 코드는 기존의 코드가 호출 되는 경우 레지스터와 스택을 모두 변 경하지 않고 새로운 주소로 브랜치하는 역할을 한다. 브랜치 코드로부터 리턴할 주소는 레지스터에 저장된다. 프로세서가 기존의 코드를 리드할 때, 오버라이트된 브랜치 코드가 기존의 코드 대신에 실행된다. 브랜치 코드는 기존의 레지스터들과 스택들을 변형하지 않고 새로운 코드로의 분기를 가능하게 한다. 또한, 리턴할 주소가 레지스터에 저장되었기 때문에 프로세서는 기존 코드를 호출했던 지점으로 리턴할 수 있다. 인자(argument)와 리턴값이 적절하게 사용되기 위해서는 기존 코드와 새로운 코드는 같은 프로토타입(Prototype)을 가져야 한다.This branch code is responsible for branching to a new address without changing both the register and stack when the existing code is called. The address to return from the branch code is stored in a register. When the processor reads existing code, the overwritten branch code is executed instead of the existing code. Branch code allows branching to new code without modifying existing registers and stacks. Also, because the address to return is stored in a register, the processor can return to the point where the existing code was called. In order for arguments and return values to be used properly, existing and new code must have the same prototype.

이후, 동적 링크 유닛(140)은 기존의 코드를 복구할 수 있다. 구체적으로, 동적 링크 유닛(140)은 브랜치 코드로 오버라이트된 부분에 대응한 MMU를 리드/라이트 가능한 상태가 되도록 세팅한 후, 백업되었된 기존의 코드를 원래의 자리에 라이트함으로써 복원한다. 기존 코드의 복원 후, 동적 링크 유닛(140)은 상기 MMU를 대응 코드 영역이 독출만 가능한(Readonly) 상태가 되도록 세팅한다.The dynamic link unit 140 can then recover the existing code. Specifically, the dynamic link unit 140 sets the MMU corresponding to the part overwritten with the branch code to be in the read / write state, and then restores the existing code that has been backed up by writing to the original place. After restoring the existing code, the dynamic link unit 140 sets the MMU such that the corresponding code area is in a read-only state.

도 6는 프로그램의 일부 코드가 변경된 경우에 본 발명의 일 실시예에 따른 동적 링킹 방법을 모식적으로 나타낸 도면이다.6 is a diagram schematically illustrating a dynamic linking method according to an embodiment of the present invention when some code of a program is changed.

도 6을 참조하면, 새로운 코드의 바이너리는 타겟 바이너리에 포함되지 않고, 특정 메모리 주소에 로드된다. 이후, 프로그램의 실행 시, 새로운 코드는 브랜치 코드에 의해 링크되어 기존 타겟 바이너리에 연결되어 수행될 수 있다. Referring to FIG. 6, the binary of the new code is not included in the target binary, but is loaded into a specific memory address. Then, when the program is executed, the new code may be linked by the branch code and linked to the existing target binary to be executed.

한편, 본 발명의 다른 실시예에 따라, 동적 링킹 방법을 양산된 전자 기기에 적용하는 경우 전체 바이너리가 아닌 수정된 바이너리가 작성되어 OTA(Over The Air)를 통하여 전송하는 방법을 사용할 수 있다.Meanwhile, according to another embodiment of the present invention, when the dynamic linking method is applied to a mass-produced electronic device, a modified binary rather than an entire binary may be created and transmitted through over the air (OTA).

도 7은 본 발명의 일 실시예에 따른 OTA를 통한 업데이트 과정을 나타낸 플로우챠드이다.7 is a flowchart illustrating an update process through an OTA according to an embodiment of the present invention.

도 7을 참조하면, 어떤 프로그램의 일부 코드, 즉, 어떤 소스 프로그램이 변경된 경우, 서버(402)는 단계 410에서 변경된 소스 프로그램만이 컴파일되어 동적 링킹 바이너리를 생성하고 이 동적 링킹 바이너리는 OTA를 통해 단말(404)에 제공한다. 단말(404)은 단계 420에서 OTA를 통해 수신한 동적 링킹 바이너리를 비휘발성 메모리에 저장하고 단계 430에서 동적 링킹에 관련한 정보를 저장한다. 이 후, 단말(404)는 단계 440에서 부팅할 경우, 단계 450에서 동적 링킹에 관련한 정보를 참조하여 동적 링킹 알고리즘을 사용한다. Referring to FIG. 7, when some code of a program, that is, a source program is changed, the server 402 compiles only the changed source program in step 410 to generate a dynamic linking binary, which is generated through the OTA. Provided to the terminal 404. The terminal 404 stores the dynamic linking binary received through the OTA in the non-volatile memory in step 420 and the information related to the dynamic linking in the step 430. Thereafter, when booting in step 440, the terminal 404 uses the dynamic linking algorithm by referring to the information related to the dynamic linking in step 450.

이를 좀 더 구체적으로 설명하면, 본 발명의 실시예에 따라, OTA를 통해 동적 링킹 바이너리가 전자 기기에 수신되면, 이 동적 링킹 바이너리는 휘발성 메모리 예컨대, SDRAM에 먼저 저장되므로, 동적 링킹 바이너리가 비휘발성 메모리 예컨대, NAND에 추가적으로 저장되도록 한다. 이러한 저장은 동적 링킹 바이너리를 다운로드할 때 또는 전자 기기의 파워 오프 시 수행될 수 있다.More specifically, according to an embodiment of the present invention, when dynamic linking binaries are received by an electronic device through OTA, the dynamic linking binaries are first stored in volatile memory, for example, SDRAM, so that the dynamic linking binaries are nonvolatile. It may be additionally stored in a memory, for example, NAND. Such storage may be performed when downloading the dynamic linking binary or upon power off of the electronic device.

이어서, 전자 기기는 적용된 동적 링크에 대한 정보를 별도로 비휘발성 메모리에 저장한다. 이후, 전자 기기는 부팅시, 새로운 바이너리를 비휘발성 메모리로부터 휘발성 메모리로 로드할 수 있다. 또는 전자 기기는 업데이트될 기존의 바이너리 부분에 대응하는 MMU를 리드/라이트 가능하도록 세팅하고, 비휘발성 메모리에 저장된 새로운 바이너리를 페이지 폴트(page fault) 방식을 이용하여 페이지 단위로 휘발서 메모리에 로드할 수 있다. The electronic device then stores information about the applied dynamic link in a separate nonvolatile memory. Thereafter, the electronic device may load new binaries from the nonvolatile memory into the volatile memory upon booting. Alternatively, the electronic device may set the MMU corresponding to the existing binary part to be updated to be read / writeable, and may load the new binary stored in the nonvolatile memory into the memory by page fault using a page fault method. Can be.

이와 같이, 본 발명의 상기한 실시예에 따르면, 양산된 전자 기기가 OTA를 통해 전체 바이너리가 아닌 수정 바이너리만을 다운로드하여 업데이트를 수행할 수 있다. As described above, according to the above-described embodiment of the present invention, the mass-produced electronic device may download and update only the modified binary, not the entire binary, through the OTA.

한편 본 발명의 상세한 설명에서는 구체적인 실시 예에 관해 설명하였으나, 본 발명의 실시예는 어떠한 프로그램 개발에도 적용될 수 있음은 물론이다. 그러므로 본 발명의 범위는 설명된 실시 예에 국한되어 정해져서는 아니 되며 후술하는 특허청구 범위뿐만 아니라 이 특허청구의 범위와 균등한 것들에 의해 정해져야 한다.Meanwhile, in the detailed description of the present invention, specific embodiments have been described, but embodiments of the present invention may be applied to any program development. Therefore, the scope of the present invention should not be limited to the described embodiments, but should be determined not only by the claims below but also by the equivalents of the claims.

전술한 바와 같이, 본 발명은 기존의 방식에서 수정된 코드를 테스트할 때 해당 전자 기기에 전체 바이너리를 다운로드하는데 소요되는 자원 및 시간을 단축할 수 있다. 또한, 양산된 전자 기기에서 일부 수정된 바이너리를 업데이트 해야 할 필요가 있는 경우, OTA를 통하여 모든 바이너리를 업데이트 하는 기존의 방식을 개선하여, 수정된 부분의 바이너리만으로 업데이트가 가능하도록 하여 바이너리 업데이트에 소요되는 시간 및 비용을 절약할 수 있다.As described above, the present invention can reduce the resources and time required to download the entire binary to the corresponding electronic device when testing the code modified in the conventional manner. In addition, if there is a need to update some modified binaries in mass-produced electronic devices, the existing method of updating all binaries through OTA is improved, so that only binary of the modified part can be updated to update the binaries. Can save time and cost.

Claims (7)

전자 기기에 인스톨되는 프로그램을 개발하는 장치에 있어서,In the apparatus for developing a program installed in an electronic device, 수정된 코드들을 독립적으로 컴파일 및 링크하여 바이너리를 생성하는 코드 빌드 유닛과,A code build unit that independently compiles and links modified code to generate a binary, 상기 생성된 바이너리를 미리 정해진 메모리 주소에 저장하는 파일 바이너리 로딩 유닛과,A file binary loading unit for storing the generated binary at a predetermined memory address; 상기 수정될 기존의 코드들을 상기 미리 정해진 메모리 주소로 브랜치할 수 있도록 하는 브랜치 코드로 오버라이트하는 동적 링킹 유닛을 포함하는 것을 특징으로 하는 프로그램 개발 장치.And a dynamic linking unit that overwrites the existing codes to be modified with branch codes to enable branching to the predetermined memory address. 제1항에 있어서, 상기 동적 링크 유닛은 상기 기존의 코드들을 백업하고, 상기 기존 코드들에 대응한 영역이 리드/라이트 가능한 상태가 되도록 MMU(Memory Management Unit)를 세팅한 후 오버라이트 동작을 수행함을 특징으로 하는 프로그램 개발 장치. The method of claim 1, wherein the dynamic link unit backs up the existing codes, sets an MMU (Memory Management Unit) so that an area corresponding to the existing codes is read / writeable, and performs an overwrite operation. Program development apparatus characterized in that. 제1항에 있어서, 상기 코드 빌드 유닛은 상기 바이너리를 생성한 후 기존 바이너리의 심볼 테이블 파일 중에서 기존 코드에 대해 정의된 심볼을 제거하고, 상 기 생성한 바이너리를 기존 바이너리의 심볼 테이블 파일과 링크함을 특징으로 하는 프로그램 개발 장치.The method of claim 1, wherein the code build unit removes the symbol defined for the existing code from the symbol table file of the existing binary after generating the binary, and links the generated binary with the symbol table file of the existing binary. Program development apparatus characterized in that. 전자 기기에 인스톨되는 프로그램을 개발하는 방법에 있어서,In a method for developing a program installed in an electronic device, 수정된 코드들을 독립적으로 컴파일 및 링크하여 바이너리를 생성하는 단계와,Independently compiling and linking the modified code to generate a binary, 상기 생성된 바이너리를 미리 정해진 메모리 주소로 로드하는 단계와,Loading the generated binary to a predetermined memory address; 상기 수정될 기존의 코드들을 상기 미리 정해진 메모리 주소로 브랜치할 수 있도록 하는 브랜치 코드로 오버라이트하는 단계를 포함하는 것을 특징으로 하는 프로그램 개발 방법.Overwriting the existing code to be modified with branch code to enable branching to the predetermined memory address. 제4항에 있어서, 상기 오버라이트 단계는 상기 기존의 코드들을 백업하는 단계와, The method of claim 4, wherein the overwriting step comprises: backing up the existing codes; 상기 기존 코드들에 대응한 영역이 리드/라이트 및 리드온리 가능한 상태가 되도록 MMU(Memory Management Unit)를 세팅한 후 오버라이트 및 복원 동작을 수행하는 단계를 포함함을 특징으로 하는 프로그램 개발 방법. And setting the memory management unit (MMU) so that the regions corresponding to the existing codes are in a read / write and read-only state, and then performing overwrite and restore operations. 제4항에 있어서, 상기 코드 빌드 유닛은 상기 바이너리를 생성한 후 기존 바이너리의 심볼 테이블 파일 중에서 기존 코드에 대해 정의된 심볼을 제거하는 단계와, The method of claim 4, wherein the code build unit removes a symbol defined for the existing code from the symbol table file of the existing binary after generating the binary; 상기 생성한 바이너리를 기존 바이너리의 심볼 테이블 파일과 링크하는 단계를 포함함을 특징으로 하는 프로그램 개발 방법.Linking the generated binary with a symbol table file of an existing binary. 전자 기기에 인스톨된 프로그램을 업데이트하는 방법에 있어서,In the method of updating the program installed in the electronic device, 수정된 코드들을 독립적으로 컴파일 및 링크함으로써 생성된 바이너리를 수신하는 단계와,Receiving binaries generated by independently compiling and linking modified code, 상기 생성된 바이너리를 미리 정해진 메모리 주소에 저장하는 단계와,Storing the generated binary at a predetermined memory address; 부팅 시, 상기 수정될 기존의 코드들을 상기 미리 정해진 메모리 주소로 브랜치할 수 있도록 하는 브랜치 코드로 오버라이트하는 단계를 포함하는 것을 특징으로 하는 프로그램 업데이트 방법.And upon booting, overwriting existing code to be modified with branch code to enable branching to the predetermined memory address.
KR1020070000809A 2007-01-03 2007-01-03 Apparatus and method for developing programs and a method of updating programs KR100866211B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020070000809A KR100866211B1 (en) 2007-01-03 2007-01-03 Apparatus and method for developing programs and a method of updating programs

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020070000809A KR100866211B1 (en) 2007-01-03 2007-01-03 Apparatus and method for developing programs and a method of updating programs

Publications (2)

Publication Number Publication Date
KR20080064065A true KR20080064065A (en) 2008-07-08
KR100866211B1 KR100866211B1 (en) 2008-10-30

Family

ID=39815521

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020070000809A KR100866211B1 (en) 2007-01-03 2007-01-03 Apparatus and method for developing programs and a method of updating programs

Country Status (1)

Country Link
KR (1) KR100866211B1 (en)

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6658656B1 (en) 2000-10-31 2003-12-02 Hewlett-Packard Development Company, L.P. Method and apparatus for creating alternative versions of code segments and dynamically substituting execution of the alternative code versions
US20020184615A1 (en) 2001-04-25 2002-12-05 Sumner William Earl System and method for selectively and automatically modifying the source code of a computer program
KR100478463B1 (en) * 2003-07-22 2005-03-23 재단법인서울대학교산학협력재단 Dynamic Linking Method for Application Program
JP2005182102A (en) 2003-12-16 2005-07-07 Nec Corp Build system and method, building program, and build server
JP4311327B2 (en) 2004-10-04 2009-08-12 日本電気株式会社 Source code automatic generation device, source code automatic generation method, program, and recording medium
US20060080682A1 (en) 2004-10-12 2006-04-13 Picsel Research Ltd. Run time dynamic linking

Also Published As

Publication number Publication date
KR100866211B1 (en) 2008-10-30

Similar Documents

Publication Publication Date Title
CN109491695B (en) Incremental updating method for integrated android application
US6442660B1 (en) Dynamic system relocation based on availability of system memory
US6795963B1 (en) Method and system for optimizing systems with enhanced debugging information
US5581697A (en) Method and apparatus for run-time error checking using dynamic patching
JP4006337B2 (en) How to fix executable execution using shared libraries
US8381198B2 (en) Systems, methods and computer program products for safety checking executable application programs in a module
JP2000181725A (en) Method and system for altering executable code and giving addition function
US20060190933A1 (en) Method and apparatus for quickly developing an embedded operating system through utilizing an automated building framework
CN110088736B (en) Self-tuning method and system
CN112214219A (en) Component processing method and device, server and storage medium
JP2008502968A (en) Method for loading software comprising an intermediate object-oriented language onto a portable device
US20110126179A1 (en) Method and System for Dynamic Patching Software Using Source Code
CN112882718B (en) Compiling processing method, device, equipment and storage medium
CN102364433B (en) Method for realizing Wine construction tool transplanting on ARM (Advanced RISC Machines) processor
US20040083467A1 (en) System and method for executing intermediate code
CN115617687B (en) Program instrumentation method, device, equipment and storage medium
KR100866211B1 (en) Apparatus and method for developing programs and a method of updating programs
CN111400256A (en) Method and device for calling resource file by application program
KR100478463B1 (en) Dynamic Linking Method for Application Program
CN110275710B (en) Java local interface consistency checking method and system, storage medium and terminal
CN114490103A (en) Operating system interface calling method and device and electronic equipment
CN113641389A (en) Software upgrading method, device and equipment based on OpenCPU
KR100321999B1 (en) Method for program patch using script
Hallinan Reducing boot time in embedded linux systems
CN111367512B (en) Method and device for creating Android library module dependency relationship in application development

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
LAPS Lapse due to unpaid annual fee