CN102087608B - Compression method and decompression method of embedded programs and embedded system - Google Patents

Compression method and decompression method of embedded programs and embedded system Download PDF

Info

Publication number
CN102087608B
CN102087608B CN200910188727.6A CN200910188727A CN102087608B CN 102087608 B CN102087608 B CN 102087608B CN 200910188727 A CN200910188727 A CN 200910188727A CN 102087608 B CN102087608 B CN 102087608B
Authority
CN
China
Prior art keywords
code
program
control unit
program storage
bank31
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.)
Active
Application number
CN200910188727.6A
Other languages
Chinese (zh)
Other versions
CN102087608A (en
Inventor
周波
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Konka Holding Group Co Ltd
Original Assignee
Konka Group Co Ltd
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 Konka Group Co Ltd filed Critical Konka Group Co Ltd
Priority to CN200910188727.6A priority Critical patent/CN102087608B/en
Publication of CN102087608A publication Critical patent/CN102087608A/en
Application granted granted Critical
Publication of CN102087608B publication Critical patent/CN102087608B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses a compression method and a decompression method of embedded programs and an embedded system. The compression method comprises the following steps of: compiling program codes by a micro-control unit; intensively putting kernel program code data in relation to chip initialization and power supply management parts into a BANK0 code set area of a code set area; loading some other function codes into BANK1-BANK31 areas of the code set area; connecting a program storage; compressing the codes in the BANK1-BANK31 areas in the compiling and connecting processes; and outputting executable programs to the program storage. Through the compression method, the decompression method and the embedded system, the capacities of conventional program storages and data storages are fully used to adapt to more and more program storing.

Description

A kind of embedded program compression method, decompression method and embedded system
Technical field
The present invention relates to embedded program treatment technology, particularly relate to a kind of embedded program compression method, decompression method and embedded system.
Background technology
51 series monolithics are a kind of band 4K byte flicker programmable and erasable ROM (read-only memory) (FPEROM) FalshProgrammable and Erasable Read Only Memory) low-voltage, high-performance CMOS 8-bit microprocessor, is commonly called as single-chip microcomputer.
Storer is parts very important and indispensable in single-chip microcomputer, and the work of single-chip microcomputer be unable to do without program, and program is deposited in program memory just.Equally, the process to data is can't do without in the operation of program, and various constant, variable, intermediate data, running status, operation result, all leave in data-carrier store.
Although program storage and data-carrier store are both storer, because purposes is different, thus they are not identical for the requirement of memory performance yet.Program storage, for depositing program, form and fixing constant, only therefrom extracts instruction or constant during single-chip microcomputer work, usually can not modify to its content, therefore to its basic demand be.Must guarantee that storing content remains unchanged for a long period of time, power-off is not also lost, so that program storage is non-volatile ROM (read-only memory) (Non-Volatile Read OnlyMesmory, NVROM); And data-carrier store is used to storage constant, variable, intermediate data, running status, operation result etc., that is, the content that data-carrier store is deposited will often change in program is run, namely to the requirement of data-carrier store be want can read and write quickly and easily at any time, so that data-carrier store is random access memory (Random--AccessMemory, RAM).
Program storage conventional in single-chip microcomputer has mask-type ROM MROM, disposable programmable memory OTPROM, ultraviolet light erasable programmable read only memory EPROM and flash memory Flash Memory etc. four kinds.
Due to the restriction of 51 series monolithic 16 bit address registers, the addressing range of external program memory and external data memory is all 64KB.Grouping connecting positioner BL51 allows generating code length to be greater than 8051 target programs of 64KB, it can manage a public domain (COMMONAREA) and maximum 32 code-group regions (BANKAREA), each code-group is 64KB to the maximum, thus this just determine that executable code is maximum can not more than 2MB (32*64KB).
Along with the application and development in 8051 series constantly increases, and application scale is large than ever, the past up a few MB of executable code.For the single-chip microcomputer of 8, because it holds quantitative limitation, when the relatively large program of exploitation, because program storage and data storage capacity are all smaller, and application function must not be reduced.
Therefore, along with increasing stored program demand, how to make full use of existing program storage and data storage capacity, make product have more the market competitiveness, become problem anxious to be resolved.
Summary of the invention
The object of the invention is to provide a kind of embedded program compression method, decompression method and embedded system, makes full use of existing program storage and data storage capacity, stores to adapt to increasing program.
For solving technical matters of the present invention, the present invention discloses a kind of compression method of embedded program code, wherein, comprising:
Micro-control unit compiles program code, kernel program code data centralization about chip initiation and power management section is put into the BANK0 code-group district in code-group region, some other function code is loaded BANK1 ~ BANK31 region in code-group region;
Linker storer;
In compiling and connection procedure, the code in BANK1 ~ BANK31 region is compressed;
Export executable program to described program storage.
More preferably, described compiling adopts the algorithm of Run-Length Coding (RLE, Run Length Encoding).
For solving technical matters of the present invention, the present invention also discloses a kind of decompression method of embedded program code, wherein, comprising:
Micro-control unit loads BANKO executive routine from program storage;
System initial value;
Described micro-control unit loads BANK (1-31) from described program storage and decompresses;
In embedding normal program operation process, the packed data that described micro-control unit reads in BANK1 ~ BANK31 from described program storage unzips to the operational area connecting Double Data Rate synchronous DRAM;
Described micro-control unit carries out major cycle.
More preferably, after described micro-control unit carries out major cycle, described method also comprises:
Described micro-control unit also reads in BANK1 ~ BANK31 packed data from described program storage successively and decompresses successively in free segment.
For solving technical matters of the present invention, the present invention also discloses a kind of embedded system, wherein, comprising: micro-control unit and program storage, and wherein, described micro-control unit connects described program storage; Wherein
Described micro-control unit, for compiling program code, kernel program code data centralization about chip initiation and power management section is put into the BANK0 code-group district in code-group region, some other function code is loaded BANK1 ~ BANK31 region in code-group region; In compiling and connection procedure, the code in BANK1 ~ BANK31 region is compressed, export executable program to described program storage;
Described program storage, for receiving and store the code data after the compiling of described micro-control unit and compression.
More preferably, also comprise: the Double Data Rate synchronous DRAM be connected with described micro-control unit, wherein,
Described Double Data Rate synchronous DRAM, for receiving the code data after the decompression of described micro-control unit, and runs.
Compared with prior art, the present invention has following beneficial effect:
Embedded program compression method disclosed by the invention, decompression method and embedded system, use compression and decompression technology, make identical program storage load more run time version, realize more function.
Accompanying drawing explanation
Fig. 1 is the executive routine code structure schematic diagram of the embodiment of the present invention;
Fig. 2 is a kind of Embedded System Structure schematic diagram of the embodiment of the present invention;
Fig. 3 is the compression method schematic flow sheet of a kind of embedded program code of the embodiment of the present invention;
Fig. 4 is the schematic flow sheet of the decompression method of a kind of embedded program code of the embodiment of the present invention;
Fig. 5 is the schematic flow sheet of the decompression method of a kind of embedded program code of another embodiment of the present invention.
Embodiment
The present invention discloses a kind of embedded program compression method, decompression method and embedded system, uses compression and decompression technology, makes identical program storage load more run time version, realize more function.
In one embodiment of the present of invention, adopt Run-Length Coding (RLE, Run Length Encoding) algorithm, also known as run length encoding, RLE is a very simple algorithm for Lossless Compression, and it simply describes with the number of times of repetition byte and repetition the byte replacing repetition.
The compression method in code-group region (BANK AREA) can be as follows.
According to 51 serial public domains (COMMON AREA) and maximum 32 code-group regions (BANK AREA), each code-group is this cardinal principle of 64KB to the maximum, and its executive routine code structure can be as shown in Figure 1.
As shown in Figure 2, for a kind of Embedded System Structure schematic diagram of the embodiment of the present invention, this system can comprise: micro-control unit (MCU, Micro Control Unit) 21, Double Data Rate synchronous DRAM (DDR, Double DataRate SDRAM) 22 and program storage 23.Wherein, MCU is also known as one chip microcomputer (Single ChipMicrocomputer) or single-chip microcomputer.Wherein, micro-control unit 21 connects described DDR22 and program storage 23 respectively.
Embed run time version can be write MCU storer DDR22 by MCU21 operational area from program storage 23.
Described micro-control unit 21, for compiling program code, kernel program code data centralization about chip initiation and power management section is put into the BANK0 code-group district in code-group region, some other function code is loaded BANK1 ~ BANK31 region in code-group region; In compiling and connection procedure, the code in BANK1 ~ BANK31 region is compressed, export executable program to described program storage 23;
Described program storage 23, compiles and code data after compressing for receiving and store described micro-control unit 21.
Described Double Data Rate synchronous DRAM 22, for receiving the code data after the decompression of described micro-control unit 21, and runs.
Embedding MCU21 is cannot carry out maim body to compress for embedded executable program.But smaller about the kernel program code such as chip initiation and power management section amount in embedded program, general tens KB, add a few KB size of code that decompresses, enough for 64KB space, a code-group region.Therefore, this part can be put into BANK0 code-group district about the kernel program code such as chip initiation and power management section data centralization, guarantee that embedded system is normally run, some other function code is loaded BANK1 ~ BANK31 region.
As shown in Figure 3, be the compression method schematic flow sheet of a kind of embedded program code of one embodiment of the invention, in compiling connection procedure, BANK1 ~ BANK31 compressed, mainly can be as described below.
Step 31, MCU21 carries out the compiling of program code;
Step 32, MCU21 carries out the compression of BANK (1-31) data, adopt RLE compression method, BANK0 code-group district will be put into about the kernel program code such as chip initiation and power management section data centralization, guarantee that embedded system is normally run, some other function code is loaded BANK1 ~ BANK31 region, in compilation process, the code in BANK1 ~ BANK31 region in code-group region is compressed.
Step 33, MCU21 linker storer 23, and in connection procedure, the code in BANK1 ~ BANK31 region in code-group region is compressed;
Step 34, exports executable program.
Such as, executable program is exported to the described program storage 23 connected.
As shown in Figure 4, be the schematic flow sheet of the decompression method of a kind of embedded program code of the embodiment of the present invention, can be as described below.
Step 41, embeds MCU21 and loads BANKO executive routine from program storage 23;
Step 42, system initial value;
Step 43, embeds MCU21 and loads BANK (1-31) decompression from program storage;
In embedding normal program operation process, embed the operational area that packed data that MCU21 reads in BANK1 ~ BANK31 from program storage 23 unzips to storer DDR22, wherein, system needs to spend several seconds kind decompression times.
Step 44, embeds MCU21 and carries out major cycle.
As shown in Figure 5, be the schematic flow sheet of the decompression method of a kind of embedded program code of another embodiment of the present invention, can be as described below.
Step 51, embeds MCU21 and loads BANKO executive routine from program storage 23;
Step 52, system initial value;
Step 53, embeds MCU21 and loads BANK (1-31) decompression from program storage;
In embedding normal program operation process, embed the operational area that packed data that MCU21 reads in BANK1 ~ BANK31 from program storage 23 unzips to storer DDR22, wherein, system needs to spend several seconds kind decompression times.
Step 54, embeds MCU21 and carries out major cycle.
After step 54 executes, the described micro-control unit 21 of embedded system can also 23 read in BANK1 ~ BANK31 packed data and decompresses successively successively in free segment from program storage.
In sum, the invention belongs to the large-scale embedded program system of exploitation, run time version is carried out reasonable compression and decompression, load program storer, identical program storage is made to load more run time version, realize more function, also can greatly reduce program storage device space, lower system cost.

Claims (3)

1. a compression method for embedded program code, is characterized in that, comprising:
Micro-control unit compiles program code, kernel program code data centralization about chip initiation and power management section is put into the BANK0 code-group district in code-group region, some other function code is loaded the BANK1-BANK31 in code-group region, described compiling adopts the algorithm of Run-Length Coding;
Linker storer;
In compiling and connection procedure, the code of BANK1-BANK31 is compressed;
Export executable program to described program storage.
2. a decompression method for embedded program code, is characterized in that, comprising:
Micro-control unit loads BANK0 executive routine from program storage;
System initial value;
Described micro-control unit loads BANK1-BANK31 from described program storage and decompresses;
In embedding normal program operation process, the packed data that described micro-control unit reads in BANK1-BANK31 from described program storage unzips to the operational area connecting Double Data Rate synchronous DRAM;
Described micro-control unit carries out major cycle;
Described micro-control unit also reads in BANK1-BANK31 packed data from described program storage successively and decompresses successively in free segment.
3. an embedded system, is characterized in that, comprising: micro-control unit and program storage, and wherein, described micro-control unit connects described program storage; Wherein
Described micro-control unit, for compiling program code, kernel program code data centralization about chip initiation and power management section is put into the BANK0 code-group district in code-group region, some other function code is loaded the BANK1-BANK31 region in code-group region; In compiling and connection procedure, the code of BANK1-BANK31 is compressed, export executable program to described program storage;
Described program storage, for receiving and store the code data after the compiling of described micro-control unit and compression;
Also comprise: the Double Data Rate synchronous DRAM be connected with described micro-control unit, wherein,
Described Double Data Rate synchronous DRAM, for receiving the code data after the decompression of described micro-control unit, and runs.
CN200910188727.6A 2009-12-04 2009-12-04 Compression method and decompression method of embedded programs and embedded system Active CN102087608B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN200910188727.6A CN102087608B (en) 2009-12-04 2009-12-04 Compression method and decompression method of embedded programs and embedded system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN200910188727.6A CN102087608B (en) 2009-12-04 2009-12-04 Compression method and decompression method of embedded programs and embedded system

Publications (2)

Publication Number Publication Date
CN102087608A CN102087608A (en) 2011-06-08
CN102087608B true CN102087608B (en) 2015-06-17

Family

ID=44099427

Family Applications (1)

Application Number Title Priority Date Filing Date
CN200910188727.6A Active CN102087608B (en) 2009-12-04 2009-12-04 Compression method and decompression method of embedded programs and embedded system

Country Status (1)

Country Link
CN (1) CN102087608B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102360381B (en) * 2011-09-29 2014-03-12 深圳众为兴技术股份有限公司 Device and method for performing lossless compression on embedded program
CN109709837A (en) * 2018-11-23 2019-05-03 上海琪埔维半导体有限公司 A kind of data processing method suitable for singlechip chip

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101334736A (en) * 2007-06-28 2008-12-31 索尼爱立信移动通信日本株式会社 Oftware updating method and portable terminal devic

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101334736A (en) * 2007-06-28 2008-12-31 索尼爱立信移动通信日本株式会社 Oftware updating method and portable terminal devic

Also Published As

Publication number Publication date
CN102087608A (en) 2011-06-08

Similar Documents

Publication Publication Date Title
CN106537327B (en) Flash memory compression
TWI643200B (en) Controller-based memory scrub for drams with internal error-correcting code (ecc) bits contemporaneously during auto refresh or by using masked write commands
CN104471547B (en) Data compression and management
CN103620564A (en) Data compression and compacting for memory devices
US7865679B2 (en) Power interrupt recovery in a hybrid memory subsystem
US10141039B2 (en) Burst length defined page size
CN111324299B (en) Mapping for multi-state programming of memory devices
CN102981959B (en) The control method of solid-state storage device and collecting garbage action thereof
CN102087608B (en) Compression method and decompression method of embedded programs and embedded system
WO2014055445A1 (en) Methods, devices and systems for physical-to-logical mapping in solid state drives
CN104662520B (en) For managing the method and apparatus of the cross-page instruction with different cache ability
CN102866865B (en) Multi-version code stream storage circuit architecture for configuration memory dedicated for FPGA (Field Programmable Gate Array)
CN103886916B (en) Encoding/decoding storage system with scalable input bit width
CN102339641A (en) Error checking and correcting verification module and data reading-writing method thereof
US9529726B2 (en) Memory device with page emulation mode
CN107741913A (en) method for managing a memory device, memory device and controller
CN100377086C (en) Method for realizing operating procedure directly from file system in embedded system
CN103544076A (en) Data backup method and device
CN112486577B (en) Novel CPU loading method
CN109799949A (en) Carry out refreshing method, memory storage and its controller of management in memory storage
CN106155914A (en) Method for maintaining entity storage comparison table and device using same
US20170293568A1 (en) Wear leveling in non-volatile memories
CN117075810A (en) ZNS solid state disk-based data management method
CN107133066A (en) A kind of storage multiplexed control system in MCU chip
CN105224503A (en) A kind of circuit increasing FPGA dynamic-configuration optional procedure quantity

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20200708

Address after: 23 / F, Guangdong hi tech District

Patentee after: Shenzhen Konka Holding Group Co., Ltd

Address before: 518055 No. 9008 Shennan Avenue, Shenzhen, Guangdong, Nanshan District

Patentee before: KONKA GROUP Co.,Ltd.