KR20220017184A - Code insertion module and method for dividing storage of firmware segment - Google Patents

Code insertion module and method for dividing storage of firmware segment Download PDF

Info

Publication number
KR20220017184A
KR20220017184A KR1020200097377A KR20200097377A KR20220017184A KR 20220017184 A KR20220017184 A KR 20220017184A KR 1020200097377 A KR1020200097377 A KR 1020200097377A KR 20200097377 A KR20200097377 A KR 20200097377A KR 20220017184 A KR20220017184 A KR 20220017184A
Authority
KR
South Korea
Prior art keywords
segment
function
area
code
unit
Prior art date
Application number
KR1020200097377A
Other languages
Korean (ko)
Other versions
KR102391312B1 (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 KR1020200097377A priority Critical patent/KR102391312B1/en
Publication of KR20220017184A publication Critical patent/KR20220017184A/en
Application granted granted Critical
Publication of KR102391312B1 publication Critical patent/KR102391312B1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/654Updates using techniques specially adapted for alterable solid state memories, e.g. for EEPROM or flash memories
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/443Optimisation
    • G06F8/4434Reducing the memory space required by the program code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/45Exploiting coarse grain parallelism in compilation, i.e. parallelism between groups of instructions
    • G06F8/453Data distribution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/656Updates while running
    • 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/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30098Register arrangements
    • G06F9/3012Organisation of register space, e.g. banked or distributed register file
    • 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/4401Bootstrapping
    • G06F9/4406Loading of operating system
    • 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/44557Code layout in executable memory
    • 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/44568Immediately runnable code
    • G06F9/44578Preparing or optimising for 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)
  • Stored Programmes (AREA)

Abstract

The present invention relates to a code insertion module and method for separate storage of a segment. More specifically, the present invention relates to the code insertion module and method for separate storage of a segment, if a size of an update function exceeds a pre-allocated segment when updating firmware stored in a flash memory, to locate a portion of a code of the function exceeding the pre-allocated segment in a separate available area and jump and return to the area. The module comprises: a memory area monitoring unit (110); an analysis unit (120); a segment size comparison unit (130); a segment reallocation unit (140); a prologue insertion unit (150); and an epilogue insertion unit (160).

Description

세그먼트의 분리 저장을 위한 코드 삽입 모듈 및 방법{CODE INSERTION MODULE AND METHOD FOR DIVIDING STORAGE OF FIRMWARE SEGMENT}CODE INSERTION MODULE AND METHOD FOR DIVIDING STORAGE OF FIRMWARE SEGMENT

본 발명은 세그먼트의 분리 저장을 위한 코드 삽입 모듈 및 방법에 관한 것으로, 더욱 상세하게는 플래시 메모리에 저장된 펌웨어를 업데이트할 때, 업데이트 함수의 크기가 미리 할당된 세그먼트를 초과시, 그 초과하는 함수 코드 부분을 별도의 가용 영역에 배치하고 해당 영역으로 점프 및 리턴하는 세그먼트의 분리 저장을 위한 코드 삽입 모듈 및 방법에 관한 것이다.The present invention relates to a code insertion module and method for separate storage of segments, and more particularly, when updating firmware stored in a flash memory, when the size of the update function exceeds a pre-allocated segment, the function code portion that exceeds the size to a code injection module and method for segregated storage of segments that place .

일반적으로 세그먼트(segment)는 프로그램 실행시에 메모리상에 적재되는 프로그램의 분할 가능한 기본 단위를 의미하는 것으로, 프로그램을 한 번에 저장할 수 없거나 필요한 경우 이를 구성하는 몇 개의 세그먼트로 분할한다.In general, a segment means a divisible basic unit of a program that is loaded into memory when a program is executed, and if a program cannot be stored at once or is necessary, it is divided into several segments.

한편, 최근의 사물 인터넷 기반 디바이스와 같은 다양한 기술분야에서도 펌웨어(firmware) 개발에 드는 비용과 인력을 줄이기 위해 펌웨어의 일부만 업데이트하는 세그먼테이션(segmentation) 기술이 적용되고 있다.Meanwhile, a segmentation technology for updating only a part of the firmware is being applied to reduce the cost and manpower required for firmware development even in various technological fields such as devices based on the recent Internet of Things.

그런데, 업데이트로 인해 함수의 크기가 계속해서 증가한다면 펌웨어 내의 세그먼트 재배치 또는 각 세그머트에 할당되는 함수 코드의 사이즈를 줄이기 위해 추가적인 노력과 비용이 소모된다.However, if the size of the function continues to increase due to the update, additional effort and cost are consumed to relocate segments in the firmware or to reduce the size of the function code allocated to each segment.

또한, 종래의 펌웨어 작성 방식은 개발자가 함수를 직접 보고 각각의 세그먼트에 배치해야 하며, 펌웨어 중 필요한 일부분만을 효율적으로 업데이트하기 위해서는 그에 대응하여 세그머트의 크기 역시 작아져야 한다.In addition, in the conventional firmware writing method, a developer must directly view a function and place it in each segment, and in order to efficiently update only a necessary part of the firmware, the size of the segment must also be reduced correspondingly.

따라서, 업데이트에 의해 함수의 크기가 세그먼트의 크기를 초과하는 상황이 발생하면, 개발자는 펌웨어를 이루는 세그먼트들을 모두 재배치하거나 함수의 크기를 더욱 줄이기 위해 시간과 인력 비용을 투입해야 하는 문제가 발생한다.Therefore, when a situation occurs in which the size of a function exceeds the size of a segment due to an update, a problem arises in that the developer has to relocate all segments constituting the firmware or invest time and manpower cost to further reduce the size of the function.

대한민국 등록특허 제10-1350059호Republic of Korea Patent No. 10-1350059 대한민국 등록특허 제10-0927446호Republic of Korea Patent Registration No. 10-0927446

본 발명은 전술한 바와 같은 문제점을 해결하기 위한 것으로, 플래시 메모리에 저장된 펌웨어를 업데이트함에 따라 함수의 크기가 미리 할당된 세그먼트를 초과하는 경우, 그 초과하는 함수 코드 부분을 별도의 가용 영역에 배치하고 해당 영역으로 점프 및 리턴하는 세그먼트의 분리 저장을 위한 코드 삽입 모듈 및 방법을 제공하고자 한다.The present invention is to solve the above problems, and when the size of a function exceeds a pre-allocated segment as the firmware stored in the flash memory is updated, the excess function code portion is placed in a separate availability area, It is intended to provide a code insertion module and method for separate storage of segments that jump and return to the corresponding area.

이를 위해, 본 발명에 따른 세그먼트의 분리 저장을 위한 코드 삽입 모듈은 플래시 메모리 내의 펌웨어 세그먼트 영역 및 쓰기가 가능한 가용 영역을 감시하는 메모리 영역 감시부와; 상기 펌웨어를 구성하는 다수의 함수들 중 업데이트 대상이 되는 업데이트 함수의 크기를 분석하는 업데이트 함수 분석부와; 상기 업데이트 함수의 크기와 상기 업데이트 함수가 할당된 세그먼트의 크기를 비교하는 세그먼트 크기 비교부와; 상기 업데이트 함수의 크기가 상기 세그먼트보다 크면 상기 업데이트 함수 중 상기 세그먼트를 초과하는 함수 코드 부분을 상기 가용 영역에 지정하는 세그먼트 재할당부와; 상기 함수 코드 부분이 지정된 가용 영역으로 이동하는 프롤로그 어셈블리 코드를 상기 세그먼트에 삽입하는 프롤로그 삽입부; 및 상기 함수 코드 부분이 실행된 후 상기 세그먼트로 되돌아가는 에필로그 어셈블리 코드를 상기 가용 영역에 삽입하는 에필로그 삽입부;를 포함하는 것을 특징으로 한다.To this end, a code insertion module for segment storage according to the present invention includes: a memory area monitoring unit monitoring a firmware segment area and a writable available area in a flash memory; an update function analysis unit that analyzes the size of an update function to be updated among a plurality of functions constituting the firmware; a segment size comparison unit comparing the size of the update function with the size of the segment to which the update function is allocated; a segment reallocation unit for designating a function code portion exceeding the segment among the update functions to the availability region when the size of the update function is greater than the segment; a prolog inserting unit for inserting a prologue assembly code that moves to an availability region in which the function code part is designated into the segment; and an epilog inserting unit that inserts an epilogue assembly code returning to the segment after the function code part is executed into the available area.

이때, 상기 펌웨어 세그먼트 영역 및 쓰기가 가능한 가용 영역은 동일한 칩셋으로 구성된 플래시 메모리 내에서 제공되는 것이 바람직하다.In this case, it is preferable that the firmware segment area and the writeable available area are provided in a flash memory configured with the same chipset.

또한, 상기 메모리 영역 감시부는 상기 함수가 할당된 각각의 세그먼트마다 시작 영역과 끝 영역을 감시하는 것이 바람직하다.Preferably, the memory area monitoring unit monitors a start area and an end area for each segment to which the function is assigned.

또한, 상기 프롤로그 삽입부는 상기 프롤로그 어셈블리 코드를 상기 세그먼트의 끝 영역에 삽입하는 것이 바람직하다.In addition, it is preferable that the prologue insertion unit inserts the prologue assembly code into an end region of the segment.

또한, 상기 프롤로그 어셈블리 코드는 상기 세그먼트 영역에서 가용 영역으로 이동시키는 'PUSH' 어셈블리 코드를 포함하는 것이 바람직하다.In addition, the prologue assembly code preferably includes a 'PUSH' assembly code for moving from the segment area to the usable area.

또한, 상기 프롤로그 어셈블리 코드는 어드레스가 상기 세그먼트와 연속하지 않는 가용 영역으로 점프시키는 'JUMP' 어셈블리 코드를 더 포함하는 것이 바람직하다.Preferably, the prologue assembly code further includes a 'JUMP' assembly code that jumps to an available region whose address is not contiguous with the segment.

또한, 상기 에필로그 삽입부는 상기 에필로그 어셈블리 코드를 상기 가용 영역 중 초과 함수가 할당된 영역의 끝 영역에 삽입하는 것이 바람직하다.Preferably, the epilog inserting unit inserts the epilogue assembly code into an end region of a region to which an excess function is allocated among the available regions.

또한, 상기 에필로그 어셈블리 코드는 상기 가용 영역에서 상기 세그먼트의 끝 영역으로 이동시키는 'POP' 어셈블리 코드를 포함하는 것이 바람직하다.In addition, the epilogue assembly code preferably includes a 'POP' assembly code for moving from the availability region to the end region of the segment.

또한, 상기 에필로그 삽입부는 상기 가용 영역 중 초과 함수가 할당된 영역의 시작 영역에 삽입되며, 상기 초과 함수를 실행시키는 'RUN FUNCTION' 어셈블리 코드를 생성하는 것이 바람직하다.In addition, it is preferable that the epilog inserter is inserted into a start region of a region to which an excess function is allocated among the available regions, and generates a 'RUN FUNCTION' assembly code that executes the excess function.

한편, 본 발명에 따른 세그먼트의 분리 저장을 위한 코드 삽입 방법은 메모리 영역 감시부에서 플래시 메모리 내의 펌웨어 세그먼트 영역 및 쓰기가 가능한 가용 영역을 감시하는 메모리 감시단계와; 업데이트 함수 분석부에서 상기 펌웨어를 구성하는 다수의 함수들 중 업데이트 대상이 되는 업데이트 함수의 크기를 분석하는 함수 분석단계와; 세그먼트 크기 비교부에서 상기 업데이트 함수의 크기와 상기 업데이트 함수가 할당된 세그먼트의 크기를 비교하는 저장영역 비교단계와; 세그먼트 재할당부에서 상기 업데이트 함수의 크기가 상기 세그먼트보다 크면 상기 업데이트 함수 중 상기 세그먼트를 초과하는 함수 코드 부분을 상기 가용 영역에 지정하는 분리영역 지정단계와; 프롤로그 삽입부에서 상기 함수 코드 부분이 지정된 가용 영역으로 이동하는 프롤로그 어셈블리 코드를 상기 세그먼트에 삽입하는 프롤로그 코드 삽입단계; 및 에필로그 삽입부에서 상기 함수 코드 부분이 실행된 후 상기 세그먼트로 되돌아가는 에필로그 어셈블리 코드를 상기 가용 영역에 삽입하는 에필로그 코드 삽입단계;를 포함하는 것을 특징으로 한다.Meanwhile, according to the present invention, a code insertion method for segment storage includes: a memory monitoring step of monitoring a firmware segment area and a writable available area in a flash memory by a memory area monitoring unit; a function analysis step of analyzing the size of an update function to be updated among a plurality of functions constituting the firmware by an update function analysis unit; a storage area comparison step of comparing the size of the update function with the size of the segment to which the update function is allocated in a segment size comparison unit; a segmentation region designation step of assigning, in the segment reallocation unit, a function code portion exceeding the segment among the update functions to the available region when the size of the update function is greater than the segment; a prologue code insertion step of inserting a prologue assembly code that moves from a prologue insertion unit to an available area in which the function code portion is designated into the segment; and an epilogue code insertion step of inserting an epilogue assembly code returned to the segment after the function code portion is executed by the epilogue insertion unit into the available region.

이상과 같은 본 발명은 플래시 메모리에 저장된 펌웨어를 업데이트함에 따라 함수의 크기가 미리 할당된 세그먼트를 초과하는 경우, 그 초과하는 함수 코드 부분을 별도의 가용 영역에 배치하고 해당 영역으로 점프 및 리턴한다. According to the present invention as described above, when the size of a function exceeds a pre-allocated segment as the firmware stored in the flash memory is updated, the excess function code portion is placed in a separate available area, and jumps and returns to the corresponding area.

따라서, 세그먼트의 재분배나 사이즈 감소를 위한 노력 없이도 가용 영역을 이용하여 자동으로 함수의 업데이트를 가능하게 함으로써 펌웨어의 작성에 따른 비용을 절감하고, 효율적으로 디바이스를 유지 관리할 수 있게 한다.Accordingly, it is possible to reduce the cost of writing firmware and efficiently maintain the device by enabling automatic function update using the availability area without any effort to redistribute segments or reduce the size.

도 1은 본 발명에 따른 세그먼트의 분리 저장을 위한 코드 삽입 모듈을 나타낸 구성도이다.
도 2는 본 발명에 따른 세그먼트의 분리 저장 상태를 나타낸 개념도이다.
도 3은 본 발명에 따른 세그먼트의 분리 저장 순서를 나타낸 개념도이다.
도 4는 본 발명에 따른 세그먼트의 분리 저장을 위한 코드 삽입 방법을 나타낸 흐름도이다.
1 is a block diagram showing a code insertion module for separate storage of segments according to the present invention.
2 is a conceptual diagram illustrating a separated storage state of a segment according to the present invention.
3 is a conceptual diagram illustrating a separate storage sequence of segments according to the present invention.
4 is a flowchart illustrating a code insertion method for separately storing segments according to the present invention.

이하, 첨부된 도면을 참조하여 본 발명의 바람직한 실시예에 따른 세그먼트의 분리 저장을 위한 코드 삽입 모듈 및 방법에 대해 상세히 설명한다.Hereinafter, a code insertion module and method for separately storing segments according to a preferred embodiment of the present invention will be described in detail with reference to the accompanying drawings.

도 1과 같이, 본 발명에 따른 세그먼트의 분리 저장을 위한 코드 삽입 모듈은 메모리 영역 감시부(110), 업데이트 함수 분석부(120), 세그먼트 크기 비교부(130), 세그먼트 재할당부(140), 프롤로그 삽입부(150) 및 에필로그 삽입부(160)를 포함한다.As shown in Fig. 1, the code insertion module for segment storage according to the present invention includes a memory area monitoring unit 110, an update function analysis unit 120, a segment size comparison unit 130, a segment reallocation unit 140, It includes a prologue insertion unit 150 and an epilogue insertion unit 160 .

이러한 본 발명은 실시예로 펌웨어(firmware)를 작성 또는 업데이트할 때 함수의 크기가 세그먼트 바운더리(segment boundary) 보다 커진다면 그 초과하는 부분을 디바이스 컨트롤러(MCU, 10)의 제어하에 플래시 메모리(11)내 별도의 가용 영역에 저장한다.As an embodiment of the present invention, if the size of the function becomes larger than the segment boundary when writing or updating firmware as an embodiment, the excess portion of the flash memory 11 under the control of the device controller (MCU, 10) I store it in my separate Availability Zone.

이때, 본 발명은 어셈블리 코드 레벨에서 세그먼트의 끝 영역에 그 초과하는 함수가 저장된 영역으로 이동 혹은 점프할 수 있는 프롤로그(prologue) 어셈블리 코드를 삽입한다. 또한, 가용 영역에 저장된 함수 수행이 모두 끝나면 다시 원래의 세그먼트 위치로 되돌아오도록 에필로그(epilogue) 어셈블리 코드를 삽입한다.At this time, according to the present invention, prologue assembly code capable of moving or jumping to a region in which the function exceeding the excess function is stored is inserted in the end region of the segment at the assembly code level. In addition, when all functions stored in the Availability Zone are executed, the epilogue assembly code is inserted to return to the original segment position.

따라서, 디바이스의 플래시 메모리(11)에 저장된 펌웨어를 업데이트함에 따라 함수의 크기가 미리 할당된 세그먼트를 초과하는 경우, 그 초과하는 함수 코드 부분을 메모리의 가용 영역(쓰기가 허용되는 메모리 영역)에 배치하고 해당 영역으로 점프 및 리턴할 수 있게 한다.Therefore, when the size of a function exceeds a pre-allocated segment by updating the firmware stored in the flash memory 11 of the device, the excess function code portion is placed in an available area of memory (a memory area where writing is allowed) and jump and return to that area.

이를 위해, 상기 메모리 영역 감시부(110)는 플래시 메모리(11) 내의 펌웨어 세그먼트 영역 및 쓰기가 가능한 가용 영역을 감시한다. 감시 대상은 각 영역의 메모리 크기(용량) 이외에 이들이 할당된 어드레스(adress)를 포함할 수 있다.To this end, the memory area monitoring unit 110 monitors a firmware segment area and a writable available area in the flash memory 11 . The monitoring target may include an address to which they are allocated in addition to the memory size (capacity) of each area.

플래시 메모리(11)는 대표적으로 사물 인터넷에 적용되는 IoT 디바이스에 탑재된 것을 포함하여 그 외 다양한 기기에 탑재된 것일 수 있으며, 세그먼트 영역 및 가용 영역은 단일 기능 칩셋의 플래시 메모리(11) 내에 할당된 것이 바람직하다.The flash memory 11 may be mounted on various other devices, including those mounted on IoT devices typically applied to the Internet of Things, and the segment area and availability area are allocated within the flash memory 11 of the single function chipset. it is preferable

다만, 메모리 영역 감시부(110)는 함수가 할당된 각각의 세그먼트마다 시작 영역과 끝 영역을 감시하는 것이 바람직하다. 이를 통해 시작 영역부터 세그먼트에 할당된 함수를 실행 후 끝 영역에서 나머지 함수 코드를 실행하는 가용 영역으로 이동할 수 있게 한다.However, it is preferable that the memory area monitoring unit 110 monitors the start area and the end area for each segment to which a function is assigned. This makes it possible to move the function assigned to the segment from the start region to the availability region where the rest of the function code is executed from the end region after execution.

업데이트 함수 분석부(120)는 펌웨어를 구성하는 다수의 함수들 중 업데이트 대상이 되는 업데이트 함수의 크기를 분석한다. 상기 함수 크기는 그 함수에 의해 호출되는 함수 코드에 따라 결정되며, 코드는 어셈블리 코드를 포함한다.The update function analysis unit 120 analyzes the size of an update function to be updated among a plurality of functions constituting the firmware. The size of the function is determined according to the function code called by the function, and the code includes assembly code.

펌웨어는 디바이스의 구동을 위한 프로그램으로서 다수의 세그먼트(segment)들로 구성된다. 또한, 함수는 세그먼트에 포함되어 플래시 메모리(11) 상에 적재되는 기본 단위나 기능별 단위를 나타낸다. 이러한 세그먼트는 보통 그 크기가 서로 다르며 그에 대응하여 할당된 메모리의 크기도 다르다.Firmware is a program for driving a device and is composed of a plurality of segments. In addition, the function indicates a basic unit or a unit for each function that is included in a segment and loaded on the flash memory 11 . These segments are usually of different sizes and correspondingly different sizes of allocated memory.

따라서, 펌웨어를 채택한 디바이스에서 유연한 설계 효율을 위해 펌웨어의 일부만 업데이트하는 세그먼테이션(segmentation) 기술을 적용시 업데이트되는 함수의 크기를 분석하여 세그먼트 바운더리 이내에 포함되는지 판단한다.Therefore, when a segmentation technology for updating only a part of firmware is applied in a device adopting firmware for flexible design efficiency, the size of an updated function is analyzed to determine whether it is included within a segment boundary.

세그먼트 크기 비교부(130)는 업데이트될 함수의 크기와 그 함수가 할당된 세그먼트의 크기를 비교한다. 비교를 통해 업데이트 함수의 크기가 작은 경우에는 종전과 동일하게 이미 할당된 세그먼트 내에서 업데이트를 한다.The segment size comparison unit 130 compares the size of the function to be updated with the size of the segment to which the function is allocated. If the size of the update function is small through comparison, the update is performed within the already allocated segment as before.

반면, 업데이트 함수의 크기가 큰 경우에는 아래에서 다시 상세히 설명하는 바와 같이 세그먼트 영역에서 가용 영역으로 이동하여 나머지 함수 코드를 삽입하고 거기서 함수를 실행한다.On the other hand, when the size of the update function is large, as described in detail again below, it moves from the segment area to the availability area, inserts the rest of the function code, and executes the function there.

도 2와 같이 세그먼트 재할당부(140)는 세그먼트 크기 비교부(130)를 통해 비교한 결과, 업데이트 함수의 크기가 세그먼트보다 크면 업데이트 함수 중 세그먼트를 초과하는 함수 코드 부분을 가용 영역에 지정한다.As shown in FIG. 2 , when the size of the update function is larger than the segment as a result of comparison through the segment size comparison unit 130 , the segment reassignment unit 140 assigns a function code portion exceeding the segment among the update functions to the available area.

세그먼트를 초과하는 함수 코드는 업데이트 함수의 일부분에 해당하는 것으로, 가용 영역의 지정은 함수 코드가 저장되는데 필요한 메모리 용량(가용 영역 용량)을 포함한다.The function code that exceeds the segment corresponds to a part of the update function, and the designation of the availability area includes a memory capacity (availability area capacity) required to store the function code.

나아가, 세그먼트 재할당부(140)에서 가용 영역을 지정시 그 가용 영역 내 시작과 끝 어드레스를 포함하여 범위를 지정할 수 있다. 또한 용량이 허용되는 한 하나의 가용 영역내에 여러 세그먼트의 함수 코드를 각각 삽입할 수 있다.Furthermore, when the segment reallocation unit 140 designates an available area, a range including start and end addresses within the available area may be designated. In addition, multiple segments of function code can be individually inserted within one Availability Zone as capacity permits.

프롤로그 삽입부(150)는 세그먼트를 초과하는 함수 코드 부분이 가용 영역으로 이동되게 하는 프롤로그 어셈블리 코드(prologue assembly code)를 세그먼트에 삽입한다. 따라서, 프롤로그 어셈블리 코드의 실행에 의해 세그먼트 영역에서 실행(업데이트)을 마친 프로그램이 가용 영역으로 이동된 후 추가로 실행(업데이트)된다.The prologue insertion unit 150 inserts a prologue assembly code that causes a function code portion that exceeds the segment to be moved to an available area into the segment. Therefore, the program that has been executed (updated) in the segment area by the execution of the prolog assembly code is moved to the availability area and then additionally executed (updated).

도 3과 같이 프롤로그 삽입부(150)는 프롤로그 어셈블리 코드를 세그먼트의 끝 영역에 삽입하는 것이 바람직하다. 해당 함수에 대해 할당된 세그먼트는 시작 영역부터 끝 영역에 해당하는 메모리 용량을 제공하므로, 그 중 끝 영역에 프롤로그 어셈블리 코드를 삽입한다. 이를 통해 세그먼트에 대해 먼저 수행을 모두 마친 후 가용 영역으로 이동할 수 있게 된다.As shown in FIG. 3 , it is preferable that the prologue insertion unit 150 inserts the prologue assembly code into the end region of the segment. The segment allocated for the function provides the memory capacity from the start area to the end area, so insert the prolog assembly code in the end area. This allows the segment to be done first before moving into the Availability Zone.

세그먼트 영역에서 가용 영역으로 이동시키는 어셈블리 코드로는 'PUSH'가 있다. 즉, 프롤로그 어셈블리 코드는 'PUSH'이며, 'PUSH'는 인자 전달을 위해 스택을 이용시 임시로 기억 장치인 가용 영역에 저장되게 한다.'PUSH' is the assembly code to move from segment area to availability area. That is, the prologue assembly code is 'PUSH', and 'PUSH' causes the stack to be temporarily stored in the available area, which is a memory device, for argument transfer.

또한, 프롤로그 어셈블리 코드는 어드레스가 세그먼트와 연속하지 않는 가용 영역으로 점프시키는 'JUMP' 어셈블리 코드를 더 포함한다. 이에 따라 프롤로그 어셈블리 코드는 'PUSH'와 'JUMP'를 포함하며, 세그먼트와 인접하지 않는 여러 가용 영역으로도 자유롭게 이동할 수 있게 된다.In addition, the prologue assembly code further includes 'JUMP' assembly code that jumps to an availability region whose address is not contiguous with the segment. As a result, the prologue assembly code contains 'PUSH' and 'JUMP', and can move freely to multiple Availability Zones that are not adjacent to the segment.

에필로그 삽입부(160)는 가용 영역에서의 잔여 업데이트 함수 코드 부분이 실행(수행)된 후 다시 해당 함수의 세그먼트로 되돌아가는 에필로그 어셈블리 코드를 해당 가용 영역에 삽입한다.The epilogue inserting unit 160 inserts the epilogue assembly code that returns to the segment of the corresponding function after the remaining update function code part in the availability area is executed (executed) into the corresponding availability area.

이때, 에필로그 삽입부(160)는 가용 영역에 기록(업데이트)하는 에필로그 어셈블리 코드를 해당 가용 영역 중 초과 함수가 할당된 영역의 끝 영역에 삽입하는 것이 바람직하다. 이를 통해 가용 영역에서 필요한 부분까지 사용하여 업데이트 수행을 마친 후 다시 세그먼트로 되돌아가게 된다.In this case, it is preferable that the epilog inserting unit 160 inserts the epilogue assembly code to be recorded (updated) in the available area into the end area of the area to which the excess function is allocated among the available areas. This allows us to use the required portion of the Availability Zone to complete the update and then return to the segment.

에필로그 어셈블리 코드는 상기한 'PUSH'에 대응하여 가용 영역에서 다시 세그먼트의 끝 영역으로 이동시키는 'POP' 어셈블리 코드를 포함한다. 또한, 가용 영역 중 초과 함수가 할당된 영역의 시작 영역에 삽입되며, 초과 함수를 실행시키는 'RUN FUNCTION' 어셈블리 코드를 생성하여 이 역시 기록한다.The epilogue assembly code includes a 'POP' assembly code that moves from the availability region back to the end region of the segment in response to the 'PUSH'. In addition, the excess function is inserted into the start area of the allocated area among the available areas, and the 'RUN FUNCTION' assembly code that executes the excess function is generated and recorded as well.

이에 따라 실시예로 도시한 바와 같이 에필로그 어셈블리 코드는 'RUN FUNCTION'과 'POP'을 순차로 수행하며, 이들에 의해 실행 후 복귀가 이루어지는 어셈블리가 구현된다.Accordingly, as shown in the embodiment, the epilogue assembly code sequentially performs 'RUN FUNCTION' and 'POP', thereby implementing an assembly that returns after execution.

이상과 같이 본 발명은 플래시 메모리(11)에 저장된 펌웨어를 업데이트함에 따라 함수의 크기가 미리 할당된 세그먼트를 초과하는 경우, 그 초과하는 함수 코드 부분을 별도의 가용 영역에 배치하고 해당 영역으로 점프 및 리턴한다. As described above, according to the present invention, when the size of a function exceeds a pre-allocated segment as the firmware stored in the flash memory 11 is updated, the excess function code portion is placed in a separate available area and jumped to the corresponding area and return

따라서, 세그먼트의 재분배나 사이즈 감소를 위한 노력 없이도 가용 영역을 이용하여 함수의 업데이트를 가능하게 함으로써 펌웨어의 작성에 따른 비용을 절감하고, 효율적으로 디바이스를 유지 관리할 수 있게 한다.Accordingly, it is possible to reduce the cost of writing firmware and efficiently maintain the device by enabling the update of the function using the availability area without any effort to redistribute segments or reduce the size.

이하, 첨부된 도면을 참조하여 본 발명의 바람직한 실시예에 따른 세그먼트의 분리 저장을 위한 코드 삽입 방법에 대해 설명한다. 다만, 본 발명의 코드 삽입 방법은 위에서 설명한 코드 삽입 장치에서 구현되는 것을 예를 들어 설명하므로 가급적 중복적인 설명은 생략한다.Hereinafter, a code insertion method for segmented storage according to a preferred embodiment of the present invention will be described with reference to the accompanying drawings. However, since the code insertion method of the present invention is described as an example implemented in the above-described code insertion apparatus, redundant descriptions are omitted as much as possible.

도 4와 같이, 본 발명에 따른 세그먼트의 분리 저장을 위한 코드 삽입 방법은 메모리 감시단계(S110), 함수 분석단계(S120), 저장영역 비교단계(S130), 분리영역 지정단계(S140), 프롤로그 코드 삽입단계(S150) 및 에필로그 코드 삽입단계(S160)를 포함한다.As shown in Fig. 4, the code insertion method for segmented storage according to the present invention includes a memory monitoring step (S110), a function analysis step (S120), a storage area comparison step (S130), a separation area designation step (S140), and a prologue. It includes a code insertion step (S150) and an epilogue code insertion step (S160).

여기서, 상기 메모리 감시단계(S110)는 메모리 영역 감시부(110)에서 플래시 메모리(11) 내의 펌웨어 세그먼트 영역 및 쓰기가 가능한 가용 영역을 감시한다. 감시 대상은 각 영역의 메모리 크기(용량) 이외에 이들이 할당된 어드레스를 포함한다.Here, in the memory monitoring step ( S110 ), the memory area monitoring unit 110 monitors the firmware segment area and the writable available area in the flash memory 11 . The monitoring target includes the address to which they are allocated in addition to the memory size (capacity) of each area.

플래시 메모리(11)는 대표적으로 사물 인터넷에 적용되는 IoT 디바이스에 탑재된 것을 포함하여 그 외 다양한 기기에 탑재된 것일 수 있으며, 바람직하게 세그먼트 영역 및 가용 영역은 단일 기능 칩셋의 플래시 메모리(11) 내에 할당된다.The flash memory 11 may be mounted on various other devices, including those mounted on IoT devices typically applied to the Internet of Things, and preferably, the segment area and the available area are within the flash memory 11 of a single function chipset. is assigned

다만, 메모리 영역 감시부(110)는 함수가 할당된 각각의 세그먼트마다 시작 영역과 끝 영역을 감시하는 것이 바람직하다. 이를 통해 시작 영역부터 세그먼트에 할당된 함수를 실행 후 끝 영역에서 나머지 함수 코드를 실행하는 가용 영역으로 이동할 수 있게 한다.However, it is preferable that the memory area monitoring unit 110 monitors the start area and the end area for each segment to which a function is assigned. This makes it possible to move the function assigned to the segment from the start region to the availability region where the rest of the function code is executed from the end region after execution.

다음, 함수 분석단계(S120)는 업데이트 함수 분석부(120)에서 펌웨어를 구성하는 다수의 함수들 중 업데이트 대상이 되는 업데이트 함수의 크기를 분석한다. 분석되는 함수의 크기는 그 함수에 의해 호출되는 함수 코드에 따라 결정되며, 코드는 어셈블리 코드를 포함한다.Next, in the function analysis step ( S120 ), the update function analysis unit 120 analyzes the size of an update function to be updated among a plurality of functions constituting the firmware. The size of the parsed function is determined according to the function code called by the function, and the code includes assembly code.

실시예로 펌웨어를 채택한 디바이스에서 유연한 설계 효율을 위해 펌웨어의 일부만 업데이트하는 세그먼테이션(segmentation) 기술을 적용시 업데이트되는 함수의 크기를 분석하여 세그먼트 바운더리 이내에 포함되는지 판단한다.In an embodiment, when a segmentation technology that updates only a part of the firmware is applied for flexible design efficiency in a device adopting firmware, the size of the updated function is analyzed to determine whether it is included within the segment boundary.

저장영역 비교단계(S130)는 세그먼트 크기 비교부(130)에서 상기 업데이트 함수의 크기와 상기 업데이트 함수가 할당된 세그먼트의 크기를 비교한다.In the storage area comparison step S130 , the segment size comparison unit 130 compares the size of the update function with the size of the segment to which the update function is allocated.

비교를 통해 업데이트 함수의 크기가 작은 경우에는 종전과 동일하게 이미 할당된 세그먼트 내에서 업데이트를 한다.If the size of the update function is small through comparison, the update is performed within the already allocated segment as before.

반면, 업데이트 함수의 크기가 큰 경우에는 아래에서 다시 상세히 설명하는 바와 같이 세그먼트 영역에서 가용 영역으로 이동하여 나머지 함수 코드를 삽입하고 거기서 함수를 실행한다.On the other hand, when the size of the update function is large, as described in detail again below, it moves from the segment area to the availability area, inserts the rest of the function code, and executes the function there.

다음, 분리영역 지정단계(S140)는 세그먼트 재할당부(140)에서 업데이트 함수의 크기가 세그먼트보다 크면 업데이트 함수 중 세그먼트를 초과하는 함수 코드 부분을 가용 영역에 지정한다.Next, in the segmentation region designation step S140 , if the size of the update function is larger than the segment in the segment reallocation unit 140 , a function code portion exceeding the segment among the update functions is assigned to the available region.

세그먼트 재할당부(140)는 세그먼트 크기 비교부(130)를 통해 비교한 결과, 업데이트 함수의 크기가 세그먼트보다 크면 업데이트 함수 중 세그먼트를 초과하는 함수 코드 부분을 가용 영역에 지정한다.As a result of comparison through the segment size comparison unit 130 , the segment reassignment unit 140 assigns a function code portion exceeding the segment among the update functions to the available area when the size of the update function is larger than the segment.

세그먼트를 초과하는 함수 코드는 업데이트 함수의 일부분에 해당하는 것으로, 가용 영역의 지정은 함수 코드가 저장되는데 필요한 메모리 용량(가용 영역 용량)을 포함한다.The function code that exceeds the segment corresponds to a part of the update function, and the designation of the availability area includes a memory capacity (availability area capacity) required to store the function code.

나아가, 세그먼트 재할당부(140)에서 가용 영역을 지정시 그 가용 영역 내 시작과 끝 어드레스를 포함하여 범위를 지정할 수 있다. 또한 용량이 허용되는 한 하나의 가용 영역내에 여러 세그먼트의 함수 코드를 각각 삽입할 수 있다.Furthermore, when the segment reallocation unit 140 designates an available area, a range including start and end addresses within the available area may be designated. In addition, multiple segments of function code can be individually inserted within one Availability Zone as capacity permits.

다음, 프롤로그 코드 삽입단계(S150)는 프롤로그 삽입부(150)에서 함수 코드 부분이 지정된 가용 영역으로 이동하는 프롤로그 어셈블리 코드를 세그먼트에 삽입한다. 따라서, 프롤로그 어셈블리 코드의 실행에 의해 세그먼트 영역에서 실행(업데이트)을 마친 프로그램이 가용 영역으로 이동된 후 추가로 실행(업데이트)된다.Next, in the prolog code insertion step ( S150 ), the prolog assembly code that moves to the available area in which the function code part is designated in the prolog inserter 150 is inserted into the segment. Therefore, the program that has been executed (updated) in the segment area by the execution of the prolog assembly code is moved to the availability area and then additionally executed (updated).

이러한 프롤로그 삽입부(150)는 프롤로그 어셈블리 코드를 세그먼트의 끝 영역에 삽입하는 것이 바람직하다. 해당 함수에 대해 할당된 세그먼트는 시작 영역부터 끝 영역에 해당하는 메모리 용량을 제공하므로, 그 중 끝 영역에 프롤로그 어셈블리 코드를 삽입한다. 이를 통해 세그먼트에 대해 먼저 수행을 모두 마친 후 가용 영역으로 이동할 수 있게 된다.It is preferable that the prologue insertion unit 150 inserts the prologue assembly code into the end region of the segment. The segment allocated for the function provides the memory capacity from the start area to the end area, so insert the prolog assembly code in the end area. This allows the segment to be done first before moving into the Availability Zone.

세그먼트 영역에서 가용 영역으로 이동시키는 어셈블리 코드로는 'PUSH'가 있다. 또한, 프롤로그 어셈블리 코드는 어드레스가 세그먼트와 연속하지 않는 가용 영역으로 점프시키는 'JUMP' 어셈블리 코드를 더 포함한다. 이에 따라 프롤로그 어셈블리 코드는 'PUSH'와 'JUMP'를 포함하며, 세그먼트와 인접하지 않는 여러 가용 영역으로도 자유롭게 이동할 수 있게 된다.'PUSH' is the assembly code to move from segment area to availability area. In addition, the prologue assembly code further includes 'JUMP' assembly code that jumps to an availability region whose address is not contiguous with the segment. As a result, the prologue assembly code contains 'PUSH' and 'JUMP', and can move freely to multiple Availability Zones that are not adjacent to the segment.

에필로그 코드 삽입단계(S160)는 에필로그 삽입부(160)에서 함수 코드 부분이 실행된 후 세그먼트로 되돌아가는 에필로그 어셈블리 코드를 가용 영역에 삽입한다.In the epilogue code insertion step ( S160 ), the epilogue assembly code returned to the segment after the function code part is executed by the epilogue insertion unit 160 is inserted into the usable area.

이때, 에필로그 삽입부(160)는 가용 영역에 기록(업데이트)하는 에필로그 어셈블리 코드를 해당 가용 영역 중 초과 함수가 할당된 영역의 끝 영역에 삽입한다. 이를 통해 가용 영역에서 필요한 부분까지 사용하여 업데이트 수행을 마친 후 다시 세그먼트로 되돌아가게 된다.At this time, the epilog inserting unit 160 inserts the epilogue assembly code to be recorded (updated) in the available area into the end area of the area to which the excess function is allocated among the available areas. This allows us to use the required portion of the Availability Zone to complete the update and then return to the segment.

에필로그 어셈블리 코드는 가용 영역에서 다시 세그먼트의 끝 영역으로 이동시키는 'POP' 어셈블리 코드를 포함한다. 또한, 가용 영역 중 초과 함수가 할당된 영역의 시작 영역에 삽입되며, 초과 함수를 실행시키는 'RUN FUNCTION' 어셈블리 코드를 생성하여 이 역시 기록한다.The epilogue assembly code contains the 'POP' assembly code that moves from the availability zone back to the end zone of the segment. In addition, the excess function is inserted into the start area of the allocated area among the available areas, and the 'RUN FUNCTION' assembly code that executes the excess function is generated and recorded as well.

이에 따라 에필로그 어셈블리 코드는 'RUN FUNCTION'과 'POP'을 순차로 수행하며, 이들에 의해 실행 후 복귀가 이루어지는 어셈블리가 구현된다.Accordingly, the epilogue assembly code sequentially performs 'RUN FUNCTION' and 'POP', thereby implementing an assembly that returns after execution.

이를 통해 본 발명은 플래시 메모리(11)에 저장된 펌웨어를 업데이트함에 따라 함수의 크기가 미리 할당된 세그먼트를 초과하는 경우, 그 초과하는 함수 코드 부분을 별도의 가용 영역에 배치하고 해당 영역으로 점프 및 리턴한다. Through this, in the present invention, when the size of a function exceeds a pre-allocated segment as the firmware stored in the flash memory 11 is updated, the excess function code portion is placed in a separate available area, and jumps and returns to the corresponding area do.

따라서, 세그먼트의 재분배나 사이즈 감소를 위한 노력 없이도 가용 영역을 이용하여 함수의 업데이트를 가능하게 함으로써 펌웨어의 작성에 따른 비용을 절감하고, 효율적으로 디바이스를 유지 관리할 수 있게 한다.Accordingly, it is possible to reduce the cost of writing firmware and efficiently maintain the device by enabling the update of the function using the availability area without any effort to redistribute segments or reduce the size.

이상, 본 발명의 특정 실시예에 대하여 상술하였다. 그러나, 본 발명의 사상 및 범위는 이러한 특정 실시예에 한정되는 것이 아니라, 본 발명의 요지를 변경하지 않는 범위 내에서 다양하게 수정 및 변형 가능하다는 것을 본 발명이 속하는 기술 분야에서 통상의 지식을 가진 자라면 이해할 것이다.In the above, specific embodiments of the present invention have been described above. However, the spirit and scope of the present invention is not limited to these specific embodiments, and various modifications and variations can be made within the scope that does not change the gist of the present invention. You will understand when you grow up.

따라서, 이상에서 기술한 실시예들은 본 발명이 속하는 기술 분야에서 통상의 지식을 가진 자에게 발명의 범주를 완전하게 알려주기 위해 제공되는 것이므로, 모든 면에서 예시적인 것이며 한정적이 아닌 것으로 이해해야만 하며, 본 발명은 청구항의 범주에 의해 정의될 뿐이다.Therefore, since the embodiments described above are provided to fully inform those of ordinary skill in the art to which the present invention belongs the scope of the invention, it should be understood that they are exemplary in all respects and not limiting, The invention is only defined by the scope of the claims.

110: 메모리 영역 감시부
120: 업데이트 함수 분석부
130: 세그먼트 크기 비교부
140: 세그먼트 재할당부
150: 프롤로그 삽입부
160: 에필로그 삽입부
110: memory area monitoring unit
120: update function analysis unit
130: segment size comparison unit
140: segment reallocation unit
150: prologue insert
160: epilogue insertion unit

Claims (10)

플래시 메모리(11) 내의 펌웨어 세그먼트 영역 및 쓰기가 가능한 가용 영역을 감시하는 메모리 영역 감시부(110)와;
상기 펌웨어를 구성하는 다수의 함수들 중 업데이트 대상이 되는 업데이트 함수의 크기를 분석하는 업데이트 함수 분석부(120)와;
상기 업데이트 함수의 크기와 상기 업데이트 함수가 할당된 세그먼트의 크기를 비교하는 세그먼트 크기 비교부(130)와;
상기 업데이트 함수의 크기가 상기 세그먼트보다 크면 상기 업데이트 함수 중 상기 세그먼트를 초과하는 함수 코드 부분을 상기 가용 영역에 지정하는 세그먼트 재할당부(140)와;
상기 함수 코드 부분이 지정된 가용 영역으로 이동하는 프롤로그 어셈블리 코드를 상기 세그먼트에 삽입하는 프롤로그 삽입부(150); 및
상기 함수 코드 부분이 실행된 후 상기 세그먼트로 되돌아가는 에필로그 어셈블리 코드를 상기 가용 영역에 삽입하는 에필로그 삽입부(160);를 포함하는 것을 특징으로 하는 세그먼트의 분리 저장을 위한 코드 삽입 모듈.
a memory area monitoring unit 110 for monitoring a firmware segment area and a writable available area in the flash memory 11;
an update function analysis unit 120 that analyzes the size of an update function to be updated among a plurality of functions constituting the firmware;
a segment size comparison unit 130 that compares the size of the update function with the size of the segment to which the update function is allocated;
a segment reallocation unit 140 for assigning a function code portion exceeding the segment among the update functions to the availability region when the size of the update function is larger than the segment;
a prologue insertion unit 150 for inserting a prologue assembly code that moves to an available region in which the function code portion is designated into the segment; and
and an epilog inserting unit (160) that inserts an epilogue assembly code returned to the segment after the function code part is executed into the available area.
제1항에 있어서,
상기 펌웨어 세그먼트 영역 및 쓰기가 가능한 가용 영역은 동일한 칩셋으로 구성된 플래시 메모리(11) 내에서 제공되는 것을 특징으로 하는 세그머트의 분리 저장을 위한 코드 삽입 모듈.
According to claim 1,
The code insertion module for separate storage of segments, characterized in that the firmware segment area and the writeable available area are provided in a flash memory (11) configured with the same chipset.
제1항에 있어서,
상기 메모리 영역 감시부(110)는,
상기 함수가 할당된 각각의 세그먼트마다 시작 영역과 끝 영역을 감시하는 것을 특징으로 하는 세그먼트의 분리 저장을 위한 코드 삽입 모듈.
According to claim 1,
The memory area monitoring unit 110,
A code insertion module for separate storage of segments, characterized in that monitoring a start area and an end area for each segment to which the function is assigned.
제3항에 있어서,
상기 프롤로그 삽입부(150)는,
상기 프롤로그 어셈블리 코드를 상기 세그먼트의 끝 영역에 삽입하는 것을 특징으로 하는 세그먼트의 분리 저장을 위한 코드 삽입 모듈.
4. The method of claim 3,
The prologue insertion unit 150,
A code insertion module for separate storage of segments, characterized in that inserting the prologue assembly code into an end region of the segment.
제4항에 있어서,
상기 프롤로그 어셈블리 코드는,
상기 세그먼트 영역에서 가용 영역으로 이동시키는 'PUSH' 어셈블리 코드를 포함하는 것을 특징으로 하는 세그먼트의 분리 저장을 위한 코드 삽입 모듈.
5. The method of claim 4,
The prologue assembly code is,
and a 'PUSH' assembly code for moving the segment area from the segment area to the availability area.
제5항에 있어서,
상기 프롤로그 어셈블리 코드는,
어드레스가 상기 세그먼트와 연속하지 않는 가용 영역으로 점프시키는 'JUMP' 어셈블리 코드를 더 포함하는 것을 특징으로 하는 세그먼트의 분리 저장을 위한 코드 삽입 모듈.
6. The method of claim 5,
The prologue assembly code is,
The code insertion module for separate storage of a segment, further comprising a 'JUMP' assembly code that jumps to an availability region whose address is not contiguous with the segment.
제3항에 있어서,
상기 에필로그 삽입부(160)는,
상기 에필로그 어셈블리 코드를 상기 가용 영역 중 초과 함수가 할당된 영역의 끝 영역에 삽입하는 것을 특징으로 하는 세그먼트의 분리 저장을 위한 코드 삽입 모듈.
4. The method of claim 3,
The epilogue insertion unit 160,
and inserting the epilogue assembly code into an end region of a region to which an excess function is allocated among the available regions.
제7항에 있어서,
상기 에필로그 어셈블리 코드는,
상기 가용 영역에서 상기 세그먼트의 끝 영역으로 이동시키는 'POP' 어셈블리 코드를 포함하는 것을 특징으로 하는 세그먼트의 분리 저장을 위한 코드 삽입 모듈.
8. The method of claim 7,
The epilogue assembly code is
and a 'POP' assembly code that moves from the availability region to the end region of the segment.
제3항에 있어서,
상기 에필로그 삽입부(160)는,
상기 가용 영역 중 초과 함수가 할당된 영역의 시작 영역에 삽입되며, 상기 초과 함수를 실행시키는 'RUN FUNCTION' 어셈블리 코드를 생성하는 것을 특징으로 하는 세그먼트의 분리 저장을 위한 코드 삽입 모듈.
4. The method of claim 3,
The epilogue insertion unit 160,
The code insertion module for separate storage of segments, wherein the 'RUN FUNCTION' assembly code for executing the excess function is generated by being inserted into the start area of the area to which the excess function is allocated among the available areas.
메모리 영역 감시부(110)에서 플래시 메모리(11) 내의 펌웨어 세그먼트 영역 및 쓰기가 가능한 가용 영역을 감시하는 메모리 감시단계(S110)와;
업데이트 함수 분석부(120)에서 상기 펌웨어를 구성하는 다수의 함수들 중 업데이트 대상이 되는 업데이트 함수의 크기를 분석하는 함수 분석단계(S120)와;
세그먼트 크기 비교부(130)에서 상기 업데이트 함수의 크기와 상기 업데이트 함수가 할당된 세그먼트의 크기를 비교하는 저장영역 비교단계(S130)와;
세그먼트 재할당부(140)에서 상기 업데이트 함수의 크기가 상기 세그먼트보다 크면 상기 업데이트 함수 중 상기 세그먼트를 초과하는 함수 코드 부분을 상기 가용 영역에 지정하는 분리영역 지정단계(S140)와;
프롤로그 삽입부(150)에서 상기 함수 코드 부분이 지정된 가용 영역으로 이동하는 프롤로그 어셈블리 코드를 상기 세그먼트에 삽입하는 프롤로그 코드 삽입단계(S150); 및
에필로그 삽입부(160)에서 상기 함수 코드 부분이 실행된 후 상기 세그먼트로 되돌아가는 에필로그 어셈블리 코드를 상기 가용 영역에 삽입하는 에필로그 코드 삽입단계(S160);를 포함하는 것을 특징으로 하는 세그먼트의 분리 저장을 위한 코드 삽입 방법.
a memory monitoring step (S110) in which the memory area monitoring unit 110 monitors the firmware segment area and the writable available area in the flash memory 11;
a function analysis step (S120) of analyzing, in the update function analysis unit 120, a size of an update function to be updated among a plurality of functions constituting the firmware;
a storage area comparison step (S130) of comparing the size of the update function with the size of the segment to which the update function is allocated in the segment size comparison unit 130;
a separation region designation step (S140) of assigning, in the segment reallocation unit 140, a function code portion exceeding the segment among the update functions to the available region when the size of the update function is greater than the segment;
a prologue code insertion step (S150) of inserting, in the prologue insertion unit 150, a prologue assembly code moving to an available area in which the function code part is designated, into the segment; and
After the function code part is executed by the epilogue inserting unit 160, an epilogue code inserting step (S160) of inserting an epilogue assembly code returning to the segment into the available area (S160); How to insert code for.
KR1020200097377A 2020-08-04 2020-08-04 Code insertion module and method for dividing storage of firmware segment KR102391312B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020200097377A KR102391312B1 (en) 2020-08-04 2020-08-04 Code insertion module and method for dividing storage of firmware segment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020200097377A KR102391312B1 (en) 2020-08-04 2020-08-04 Code insertion module and method for dividing storage of firmware segment

Publications (2)

Publication Number Publication Date
KR20220017184A true KR20220017184A (en) 2022-02-11
KR102391312B1 KR102391312B1 (en) 2022-04-28

Family

ID=80266400

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020200097377A KR102391312B1 (en) 2020-08-04 2020-08-04 Code insertion module and method for dividing storage of firmware segment

Country Status (1)

Country Link
KR (1) KR102391312B1 (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20090004715A (en) * 2007-07-05 2009-01-12 삼성전자주식회사 Method and system for partitioning compression-based firmware over the air
KR100927446B1 (en) 2007-11-28 2009-11-19 웹싱크 주식회사 Transaction unit firmware upgrade method of mobile communication terminal and firmware upgrade system using same
KR101350059B1 (en) 2011-11-25 2014-01-14 엘에스산전 주식회사 Apparatus and method for upgrading meter firmware
KR20150132431A (en) * 2013-03-15 2015-11-25 소프트 머신즈, 인크. Method and apparatus for guest return address stack emulation supporting speculation
KR20160144577A (en) * 2015-06-08 2016-12-19 삼성전자주식회사 Nonvolatile memory module and user device comprising the same
KR20170092912A (en) * 2016-02-04 2017-08-14 삼성전자주식회사 Mehtod for managing memory and electronic device thereof

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20090004715A (en) * 2007-07-05 2009-01-12 삼성전자주식회사 Method and system for partitioning compression-based firmware over the air
KR100927446B1 (en) 2007-11-28 2009-11-19 웹싱크 주식회사 Transaction unit firmware upgrade method of mobile communication terminal and firmware upgrade system using same
KR101350059B1 (en) 2011-11-25 2014-01-14 엘에스산전 주식회사 Apparatus and method for upgrading meter firmware
KR20150132431A (en) * 2013-03-15 2015-11-25 소프트 머신즈, 인크. Method and apparatus for guest return address stack emulation supporting speculation
KR20160144577A (en) * 2015-06-08 2016-12-19 삼성전자주식회사 Nonvolatile memory module and user device comprising the same
KR20170092912A (en) * 2016-02-04 2017-08-14 삼성전자주식회사 Mehtod for managing memory and electronic device thereof

Also Published As

Publication number Publication date
KR102391312B1 (en) 2022-04-28

Similar Documents

Publication Publication Date Title
US6223339B1 (en) System, method, and product for memory management in a dynamic translator
US5860082A (en) Method and apparatus for allocating storage in a flash memory
KR100512665B1 (en) Space-limited marking structure for tracing garbage collectors
US7363484B2 (en) Apparatus and method for selectively mapping proper boot image to processors of heterogeneous computer systems
US8266603B2 (en) Technique for allocating register to variable for compiling
Wimmer et al. Optimized interval splitting in a linear scan register allocator
CN107729240B (en) Embedded software stack overflow detection method and device
US20030233493A1 (en) Firmware installation methods and apparatus
CN110096300B (en) FPGA program file backup management system, operation method and upgrading method
US20080005722A1 (en) Compiling device, compiling method and recording medium
KR20010070416A (en) Computer
EP0962859A2 (en) Global register systems, methods, and computer program products
US20040044997A1 (en) Method and apparatus for downloading executable code in a non-disruptive manner
JP2016541047A (en) Code stack management
CN1811723A (en) Memory dump program boot method and mechanism, and computer-readable storage medium
US8954945B2 (en) Profile-based global live-range splitting
US20040015925A1 (en) Method, article of manufacture and apparatus for performing automatic intemodule call linkage optimization
US7003656B2 (en) Automatic selection of firmware for a computer that allows a plurality of process types
KR102391312B1 (en) Code insertion module and method for dividing storage of firmware segment
US20040015850A1 (en) Specialized heaps for creation of objects in object-oriented environments
US20080320212A1 (en) Control device and control method of nonvolatile memory and storage device
US20030079210A1 (en) Integrated register allocator in a compiler
US20120005460A1 (en) Instruction execution apparatus, instruction execution method, and instruction execution program
US7124271B2 (en) Method and system for allocating register locations in a memory during compilation
WO2021219211A1 (en) Memory allocation in a neural network

Legal Events

Date Code Title Description
E701 Decision to grant or registration of patent right