KR100748498B1 - How to read a file on an embedded system - Google Patents
How to read a file on an embedded system Download PDFInfo
- Publication number
- KR100748498B1 KR100748498B1 KR1020010028447A KR20010028447A KR100748498B1 KR 100748498 B1 KR100748498 B1 KR 100748498B1 KR 1020010028447 A KR1020010028447 A KR 1020010028447A KR 20010028447 A KR20010028447 A KR 20010028447A KR 100748498 B1 KR100748498 B1 KR 100748498B1
- Authority
- KR
- South Korea
- Prior art keywords
- file
- pointer
- size
- len
- ptr
- Prior art date
- Legal status (The legal status 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 status listed.)
- Expired - Fee Related
Links
Images
Classifications
-
- 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/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0638—Organizing or formatting or addressing of data
- G06F3/0643—Management of files
-
- 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/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/30003—Arrangements for executing specific machine instructions
- G06F9/3004—Arrangements for executing specific machine instructions to perform operations on memory
-
- 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/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/34—Addressing or accessing the instruction operand or the result ; Formation of operand address; Addressing modes
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
본 발명은 파일 시스템이 없는 임베디드 시스템상에서 구동되는 프로그램의 파일 읽기방법에 관한 것으로, 일반적으로 파일을 메모리에 로드(load)하고, 파일 입력 기능들을 메모리에서 읽도록 프로그램 소스 코드를 전반적으로 수정해 줘야 한다. 하지만, 파일 포인터(File pointer, fp)를 파라메터로 받아오거나 리턴(return)해야 하는 API(Application program interface)의 경우, 파일 포인터(fp)의 고려없이 수정하게 되면 프로그램의 정상적인 동작이 수행되지 않는 문제점이 있었다. 따라서, 본 발명은 파일의 시작 포인터를 가리키는 필드(_base)와, 그 파일의 전체 사이즈(size)를 나타내는 필드(_cnt)와, 그 파일의 다음 시작 포인터를 가리키는 필드(_ptr)를 메모리상의 주소로 설정하여 파일을 오픈(open)하고, 포인터(_ptr)가 가리키는 곳(data)에 소정 크기(len=size1*size2)의 블록을 읽어와서 저장하고, 그 크기(len) 만큼씩 포인터(_ptr)를 증가시키며 파일을 리드(fread)하도록 소스코드를 수정하고, 파일을 클로즈(Close) 시키도록 이루어짐으로써, 파일 읽기 코드가 많은 소프트웨어를 파일 시스템이 없는 임베디드 시스템에 포팅할 경우, 전반적인 소프트웨어의 동작에 지장을 주지 않으면서 파일을 읽는것과 같은 효과가 있다.BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a method of reading a file of a program running on an embedded system without a file system. In general, the program source code must be modified to load a file into a memory and read file input functions from the memory. do. However, in the case of an application program interface (API) that needs to receive or return a file pointer (fp) as a parameter, a normal operation of the program may not be performed when modified without considering the file pointer (fp). There was this. Therefore, in the present invention, the field (_base) indicating the start pointer of the file, the field (_cnt) indicating the total size of the file, and the field (_ptr) indicating the next start pointer of the file are designated as addresses in memory. Set to open the file, read and store a block of a certain size (len = size1 * size2) in the data pointed to by the pointer (_ptr), and store the pointer (_ptr) by the size (len). By modifying the source code to read the file in increments and closing the file, porting software with a lot of file reading code to embedded systems without a file system can interfere with the overall software behavior. It has the same effect as reading a file without giving it a chance.
Description
도 1은 파일 시스템이 구비되어 있는 임베디드 시스템의 개념적 구성을 보인 예시도.1 is an exemplary view showing a conceptual configuration of an embedded system provided with a file system.
도 2는 파일 입/출력 기능에 공통적으로 쓰이는 파일 구조를 보인 예시도.2 is an exemplary view showing a file structure commonly used for a file input / output function.
도 3은 본 발명을 적용하기 위해 변환된 파일의 포맷을 보인 예시도.3 is an exemplary view showing a format of a file converted for applying the present invention.
도 4는 파일 시스템이 구비되어 있지 않은 임베디드 시스템의 개념적 구성을 보인 예시도.4 is an exemplary view showing a conceptual configuration of an embedded system without a file system.
본 발명은 임베디드 시스템의 파일 읽기 방법에 관한 것으로, 특히 파일 시스템이 없는 임베디드 시스템(Embedded system)에서 파일 포인터를 조작하여 메모리에 로드된 파일을 읽을 수 있도록 하는 임베디드 시스템의 파일 읽기 방법에 관한 것이다.The present invention relates to a file reading method of an embedded system, and more particularly, to a file reading method of an embedded system that enables a file pointer to be read by manipulating a file pointer in an embedded system without a file system.
파일 시스템(File system)이란, 전체적인 기억장치 관리 시스템의 한 부분으로서, 주로 보조 기억 장치 상의 파일을 관리하는 시스템을 의미하며, 여기에는 MS-Dos 파일 시스템, 유닉스 파일 시스템, 네트워크 파일 시스템 등 컴퓨터 시스템에 따라 여러 가지가 있다.The file system is a part of the overall storage management system, and mainly refers to a system that manages files on the auxiliary storage device, and includes a computer system such as an MS-Dos file system, a UNIX file system, and a network file system. There are several ways.
보다 구체적으로 파일시스템(file system)이란, 운영체제가 파티션이나 디스크에 파일들이 연속되게 하기 위해 사용하는 방법 또는 자료 구조를 의미하는 것으로, 파일을 저장하는 데 사용되는 파티션이나 디스크를 가리킬 때나, 파일시스템의 형식을 가리킬 때 사용되기도 한다.More specifically, a file system is a method or data structure that the operating system uses to keep files on a partition or disk, and refers to a partition or disk used to store files. Also used to refer to the form of.
디스크나 파티션이 포함하고 있는 파일시스템의 차이는 중요한데, 약간의 프로그램들(합리적으로 충분히 파일시스템을 만드는 프로그램을 포함해서)은 디스크나 파티션의 원시 섹터를 직접 조정한다. The difference in the filesystem that a disk or partition contains is important, as some programs (including those that make a reasonably sufficient filesystem) directly manipulate the raw sectors of a disk or partition.
대부분의 프로그램들은 파일시스템 위에서 작동하며, 파일시스템이 없는(혹은 다른 형식의 파일시스템이 있는) 파티션에서는 작동하지 않는다. Most programs run on top of filesystems and do not work on partitions without filesystems (or other types of filesystems).
파티션이나 디스크가 파일시스템으로서 사용될 수 있게 하기 위해서는 초기화되어야 하며, 파일정보 기록을 위한 자료구조를 디스크에 만들어야 한다.In order for a partition or disk to be used as a filesystem, it must be initialized and a data structure must be created on disk to record file information.
한편, 어떤 소프트웨어를 임베디드 시스템에 포팅(porting) 하려는 경우, 소프트웨어 내용에는 파일을 리드(read)하는 부분이 포함될 경우가 있다.On the other hand, when porting certain software to an embedded system, the software content may include a part that reads a file.
그런데, 임베디드 시스템에는 파일 시스템(일종의 하드디스크와 같은 보조 기억장치)이 있는 경우도 있고 그렇지 않은 경우도 있다.By the way, an embedded system may or may not have a file system (a kind of auxiliary storage device such as a hard disk).
따라서, 만약 도1에 도시된 바와 같이, 파일 시스템이 있는 경우에는 소프트웨어 내용에 파일을 리드하는 부분이 있더라도 별다른 처리를 필요로 하지 않지만, 파일 시스템이 없는 경우에는 파일을 메모리에 로드(load)하고, 파일 입력 기능들을 메모리에서 읽도록 프로그램 소스코드를 전반적으로 수정해 줘야 한다.Therefore, as shown in Fig. 1, if there is a file system, even if there is a part that reads the file in the software content, no special processing is required, but if there is no file system, the file is loaded into memory. In general, the program source code must be modified to read file input functions from memory.
그러나, 프로그램 내에 파일 포인터(File pointer, fp)를 파라메터로 받아오거나 리턴(return)해야 하는 API가 있는 경우, 파일 포인터(fp)의 고려없이 수정하게 되면 프로그램의 정상적인 동작을 기대할 수 없게 된다.However, if there is an API that needs to get or return a file pointer (file pointer, fp) as a parameter in the program, if the modification without considering the file pointer (fp) can not expect the normal operation of the program.
왜냐하면, 해당 API가 프로그램 내에서 언제, 어떻게 호출될지 모르기 때문이다. 이런 연유로 파일을 리드하는 소스코드를 어떻게 바꾸는가 하는 문제는 매우 중요하다.This is because the API does not know when and how to call it in a program. For this reason, the question of how to change the source code that leads a file is very important.
따라서, 본 발명은 상기와 같은 종래의 문제점을 해결하기 위하여 창출한 것으로, 파일 시스템이 없는 임베디드 시스템(Embedded system)에서 파일 포인터를 사용해 메모리에 로드된 파일을 읽을 수 있도록 하는 임베디드 시스템의 파일 읽기 방법을 제공함에 그 목적이 있다.Therefore, the present invention has been created to solve the above-mentioned conventional problems, the file reading method of the embedded system to read the file loaded in the memory using a file pointer in the embedded system (Embedded system) without a file system The purpose is to provide.
이와 같은 목적을 달성하기 위한 본 발명은, 파일읽는 내용이 포함된 API를 호출하는 함수호출자(caller)에서는, 이 API를 호출함으로서 실제로 파일시스템상의 파일을 읽는것과 똑같은 효과를 얻을 수 있는 것을 특징으로 한다.In order to achieve the above object, the present invention provides a function caller that calls an API including a file reading content, and by calling this API, the same effect as that of actually reading a file on a file system can be obtained. do.
또한, 본 발명은 이 API에 파라메터 형식으로 넘어가는 파일 포인터 때문에 같은 파일 포인터를 쓰는 다른 API에게 오동작을 일으키지 않도록 하는 것을 특징으로 한다 In addition, the present invention is characterized in that it does not cause a malfunction to other APIs that use the same file pointer because of the file pointer passed to the API in parameter form.
이하, 본 발명에 따른 일실시예를 첨부한 도면을 참조하여 상세히 설명하면 다음과 같다.Hereinafter, an embodiment according to the present invention will be described in detail with reference to the accompanying drawings.
본 발명에서는 파일 시스템이 구비되지 않은 임베디드 시스템에서 파일이 16진수 형태로 메모리상에 로드되는 경우, 파일 포인터를 조작하여 마치 파일 시스템에서 파일을 읽는 것과 같은 효과를 나타낸다.According to the present invention, when a file is loaded on a memory in hexadecimal form in an embedded system without a file system, the file pointer is manipulated to read the file in the file system.
도2는 파일 입/출력 기능에 공통적으로 쓰이는 파일 구조를 보인 예시도로서, 로드(load)하려는 파일이 'Status_bar.gif'라고 할 경우를 예로 들어 살펴보기로 한다.FIG. 2 is an exemplary view showing a file structure commonly used for a file input / output function. A case in which a file to be loaded is 'Status_bar.gif' will be described as an example.
도3과 같이 메모리에는 부호없는 8비트 문자형(unsigned char type)으로 16진수(hexadecimal) 형태로 저장하며, 전체 길이는 32비트 정수형(long type)으로 저장한다.As shown in FIG. 3, the memory is stored in hexadecimal form as an unsigned char type, and the total length is stored as a 32-bit long type.
상기와 같이 메모리에 로드할 파일의 혈태는 동종 업계에 종사하는 엔지니어 의 경우, 간단한 변환 프로그램을 작성하여 쉽게 변환이 가능하므로 포맷 변환에 관한 구체적인 설명은 생략하기로 한다.As described above, the format of the file to be loaded into the memory can be easily converted by an engineer working in the same industry by creating a simple conversion program, and thus a detailed description of the format conversion will be omitted.
상기와 같이 파일(Status_bar.gif)이 파일 시스템이 아닌 메모리 상에 로드되면, 각 파일 입/출력 기능들은 다음 표1과 같이 파일에 관련된 소스 코드를 약간 수정하는 것에 의해, 메모리를 파일 시스템으로 인식하게 하여 프로그램 소스의 전반적인 수정없이도 동작이 가능하게 한다.When the file (Status_bar.gif) is loaded on the memory rather than the file system as described above, each file input / output function recognizes the memory as the file system by slightly modifying the source code related to the file as shown in Table 1 below. This allows operation without overall modification of the program source.
여기서, '_ptr'은 파일에서 다음 시작 포인터를 나타내고, '_cnt'는 전체 파일 크기를 나타내고, '_base'는 그 파일의 시작 포인터를 나타내는 것으로 '_ptr'과는 달리 시작 포인터가 변하지 않는다는 것이다.Here, '_ptr' represents the next starting pointer in the file, '_cnt' represents the total file size, and '_base' represents the starting pointer of the file. Unlike '_ptr', the starting pointer does not change.
가령, 다음과 같은 함수가 있다고 가정한다.For example, suppose you have the following function:
File_read(FILE*fp)File_read (FILE * fp)
{ {
fread(data,size1,size2,fp);fread (data, size1, size2, fp);
}}
상기 함수에서 파일을 읽는 'fread' 대신에 메모리에 로드된 파일을 읽는 일반적인 코드를 적용한다면, 파라메터 'fp'에 아무런 변화가 없으므로 소프트웨어 기능 전반에 영향을 미치게 된다.If you apply the general code to read the file loaded in memory instead of 'fread' in the function, the parameter 'fp' has no change, affecting the overall software function.
그러나, 본 발명에 의한 방식을 이용하여 파일 입/출력 함수의 소스 코드를 수정하면, 파일 포인터 'fp'에 조작이 가해지기 때문에 소프트웨어는 정상으로 동작하여 원하는 결과를 출력하게 되는 것이다.However, if the source code of the file input / output function is modified using the method according to the present invention, since the manipulation is applied to the file pointer 'fp', the software operates normally and outputs the desired result.
즉, 전체적인 임베디드 시스템은 파일 입/출력 API(Application Program Interface)를 이용하여 파일 시스템에서 파일을 읽어오지만, 도4에 도시된 바와 같이 API를 본 발명에 의한 코드로 수정해 줌으로써, 전반적인 시스템의 동작을 저해하지 않으면서 파일 시스템이 있는 것과 같은 동작을 수행하게 되는 것이다. That is, the entire embedded system reads a file from the file system using a file input / output application program interface (API), but as shown in FIG. 4, by modifying the API with the code according to the present invention, the overall system operation is performed. It does the same thing as having a file system without sacrificing this.
이상에서 설명한 바와 같이 본 발명 임베디드 시스템의 파일 읽기 방법은 상기와 같은 파일 읽기 코드가 많은 소프트웨어를 파일 시스템이 없는 임베디드 시스템에 포팅할 경우, 전반적인 소프트웨어의 동작에 지장을 주지 않으면서 파일을 읽는것과 같은 효과가 있다.As described above, in the file reading method of the embedded system of the present invention, when porting the software having a large number of file reading codes to an embedded system without a file system, the method of reading a file without interrupting the overall software operation is performed. It works.
Claims (2)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
KR1020010028447A KR100748498B1 (en) | 2001-05-23 | 2001-05-23 | How to read a file on an embedded system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
KR1020010028447A KR100748498B1 (en) | 2001-05-23 | 2001-05-23 | How to read a file on an embedded system |
Publications (2)
Publication Number | Publication Date |
---|---|
KR20020089642A KR20020089642A (en) | 2002-11-30 |
KR100748498B1 true KR100748498B1 (en) | 2007-08-13 |
Family
ID=27706160
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
KR1020010028447A Expired - Fee Related KR100748498B1 (en) | 2001-05-23 | 2001-05-23 | How to read a file on an embedded system |
Country Status (1)
Country | Link |
---|---|
KR (1) | KR100748498B1 (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR940006034A (en) * | 1992-07-06 | 1994-03-23 | 윌리암 에이취. 뉴콤 | Method and system for organizing file internal structure |
KR960025212A (en) * | 1994-12-26 | 1996-07-20 | 가시오 가즈오 | Data file update processing device |
JPH101994A (en) * | 1996-06-17 | 1998-01-06 | Naoya Suzuki | Urination helper for man in sitting stool |
JPH101996A (en) * | 1996-06-18 | 1998-01-06 | Hitachi Home Tec Ltd | Sanitary washer burn prevention device |
-
2001
- 2001-05-23 KR KR1020010028447A patent/KR100748498B1/en not_active Expired - Fee Related
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR940006034A (en) * | 1992-07-06 | 1994-03-23 | 윌리암 에이취. 뉴콤 | Method and system for organizing file internal structure |
KR960025212A (en) * | 1994-12-26 | 1996-07-20 | 가시오 가즈오 | Data file update processing device |
JPH101994A (en) * | 1996-06-17 | 1998-01-06 | Naoya Suzuki | Urination helper for man in sitting stool |
JPH101996A (en) * | 1996-06-18 | 1998-01-06 | Hitachi Home Tec Ltd | Sanitary washer burn prevention device |
Non-Patent Citations (2)
Title |
---|
10-1994-0006034 |
10-1996-0025212 |
Also Published As
Publication number | Publication date |
---|---|
KR20020089642A (en) | 2002-11-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JPH01154267A (en) | Address resolution method for input/output device control program | |
JP2009501369A (en) | Changing the code execution path using kernel mode redirection | |
CN115408099A (en) | Virtual machine data access method, storage medium and device | |
KR100748498B1 (en) | How to read a file on an embedded system | |
US6694393B1 (en) | Method and apparatus for compressing information for use in embedded systems | |
JP2555920B2 (en) | Online real-time processor | |
Feder | The UNIX system: The evolution of UNIX system performance | |
JP2685532B2 (en) | Memory dump method | |
WO2004017200A1 (en) | Information processing method and program and recording medium for implementing the method | |
KR100319755B1 (en) | Bytecode compression method for embedded java virtual machine | |
Wichmann | A modular operating system. | |
KR100388612B1 (en) | Method of Compressing Packing In Switching System | |
CN109460640A (en) | A kind of java applet guard method, device, equipment and readable storage medium storing program for executing | |
JP2990609B2 (en) | Computer system | |
JPS63174145A (en) | data processing equipment | |
US20040064462A1 (en) | File system for storing multiple files as a single compressed file | |
KR920014051A (en) | Database Backup and Recovery Method in DBMS of Electronic Switching System | |
US7584480B1 (en) | Method of monitoring multiple computer system calls using one routine and non-executable configuration file | |
KR20010003246A (en) | Feature code management method using shared memory in HLR | |
JPS6417128A (en) | Dynamic arrangement system for domain area of virtual computer | |
JPH0322152A (en) | File restoring system | |
JPH04279933A (en) | Information processor | |
KR101058059B1 (en) | Mounting device of embedded file system and its method | |
Gilmore | Deimos user manual | |
CN118296592A (en) | Linux process system call safety protection method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PA0109 | Patent application |
Patent event code: PA01091R01D Comment text: Patent Application Patent event date: 20010523 |
|
N231 | Notification of change of applicant | ||
PN2301 | Change of applicant |
Patent event date: 20020603 Comment text: Notification of Change of Applicant Patent event code: PN23011R01D |
|
PG1501 | Laying open of application | ||
A201 | Request for examination | ||
PA0201 | Request for examination |
Patent event code: PA02012R01D Patent event date: 20060404 Comment text: Request for Examination of Application Patent event code: PA02011R01I Patent event date: 20010523 Comment text: Patent Application |
|
E701 | Decision to grant or registration of patent right | ||
PE0701 | Decision of registration |
Patent event code: PE07011S01D Comment text: Decision to Grant Registration Patent event date: 20070531 |
|
GRNT | Written decision to grant | ||
PR0701 | Registration of establishment |
Comment text: Registration of Establishment Patent event date: 20070806 Patent event code: PR07011E01D |
|
PR1002 | Payment of registration fee |
Payment date: 20070807 End annual number: 3 Start annual number: 1 |
|
PG1601 | Publication of registration | ||
PR1001 | Payment of annual fee |
Payment date: 20100630 Start annual number: 4 End annual number: 4 |
|
FPAY | Annual fee payment |
Payment date: 20110620 Year of fee payment: 5 |
|
PR1001 | Payment of annual fee |
Payment date: 20110620 Start annual number: 5 End annual number: 5 |
|
FPAY | Annual fee payment |
Payment date: 20120727 Year of fee payment: 6 |
|
PR1001 | Payment of annual fee |
Payment date: 20120727 Start annual number: 6 End annual number: 6 |
|
LAPS | Lapse due to unpaid annual fee | ||
PC1903 | Unpaid annual fee |
Termination category: Default of registration fee Termination date: 20140709 |