CN105630422B - It is a kind of to realize the method and apparatus more applied based on low capacity processor - Google Patents

It is a kind of to realize the method and apparatus more applied based on low capacity processor Download PDF

Info

Publication number
CN105630422B
CN105630422B CN201511000181.9A CN201511000181A CN105630422B CN 105630422 B CN105630422 B CN 105630422B CN 201511000181 A CN201511000181 A CN 201511000181A CN 105630422 B CN105630422 B CN 105630422B
Authority
CN
China
Prior art keywords
application
value
module
identity position
equipment
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
CN201511000181.9A
Other languages
Chinese (zh)
Other versions
CN105630422A (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.)
Feitian Technologies Co Ltd
Original Assignee
Feitian Technologies 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 Feitian Technologies Co Ltd filed Critical Feitian Technologies Co Ltd
Priority to CN201511000181.9A priority Critical patent/CN105630422B/en
Publication of CN105630422A publication Critical patent/CN105630422A/en
Application granted granted Critical
Publication of CN105630422B publication Critical patent/CN105630422B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/08Error detection or correction by redundancy in data representation, e.g. by using checking codes
    • G06F11/10Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's
    • G06F11/1008Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's in individual solid state devices
    • G06F11/1068Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's in individual solid state devices in sector programmable memories, e.g. flash disk
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0629Configuration or reconfiguration of storage systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Quality & Reliability (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a kind of method and apparatus realized and applied more based on low capacity processor, belong to field of computer technology.Equipment disclosed by the invention includes processor and external flash chip, and processor includes the inside flash chip for storing and executing an application, and the external flash chip being connect with processor is for storing multiple applications;Method disclosed by the invention includes, equipment judges whether to need loading application programs according to the application identity position stored in external memory area, it is to be loaded into internal storage region and run from the application program that will be loaded in external memory area according to the application identity position, the application program otherwise directly stored in operation internal storage region.Method and apparatus disclosed by the invention not only extends the supported application function of equipment, while can reduce the development cost of equipment more applied.

Description

It is a kind of to realize the method and apparatus more applied based on low capacity processor
Technical field
The present invention relates to field of computer technology more particularly to a kind of methods more applied based on the realization of low capacity processor And equipment.
Background technology
Flash is one kind of storage chip, and flash memory is also known as flash memory, with microcontroller or microprocessor In electronic equipment, microcontroller or microprocessor have inside using a processor chips inside processor chips Storage region storing and executing for code on flash, internal flash, usually internal flash is more expensive, therefore such as Fruit will develop and apply more, need to store multiple application codes using internal flash chip, must just give processor chips The inside flash for configuring large capacity, will necessarily increase development cost in this way.
Invention content
The present invention is proposed by using cheap external flash chip, and coordinating has flash chip inside low capacity Processor can effectively solve defect existing in the prior art to realize more application functions of equipment.
The technical solution adopted by the present invention is specific as follows:A method of it is applied more, is wrapped based on the realization of low capacity processor Include following steps:
Step S1:Device power, initialization;
Step S2:Equipment reads application identity position from external memory area, judges whether to need to add according to application identity position Application program is carried, is that determination to be loaded in the application program stored in external memory area according to the application identity position answers With program, will be determining described in the application program to be loaded be loaded into internal storage region, then execute step S3, otherwise directly hold Row step S3;
Step S3:Equipment self-inspection, and deposited in determining internal storage region according to application program initial address after self-test success The application program of storage runs the application program stored in internal storage region.
The method further includes, and when equipment, which receives user, switches the operation of application, switches the behaviour of application according to user Make the value of setting application identity position, then executes step S2;Equipment described in the step S2 judges according to application identity position It is no to need loading application programs specifically, judging the value of application identity position, loading application programs are not needed if being equal to default value, Loading application programs are needed if being not equal to default value;The application program that will be loaded is loaded into after internal storage region also Value including modification application identity position is default value.
Above-mentioned steps S2 is specifically, equipment reads the first application identity position and the second application identity from external memory area Position, judge whether to need loading application programs according to the first application identity position, be then according to second application identity position outside The determination application program to be loaded in the application program stored in portion memory block, will be determining described in the application program to be loaded add It is downloaded to internal storage region, then executes step S3, otherwise direct step S3.
It is above-mentioned will be determining described in the application program to be loaded be loaded into internal storage region, specifically include:To add to described The corresponding application file of application program of load is verified, and internal storage region is emptied if by verification, from external storage It presets the data that initial address starts to read in the application file in area to be written in internal storage region, if not passing through school It tests, loads failure.
Described pass through when verification further includes changing the value of application identity position as the first default value;When described not validated also Value including modification application identity position is the second default value;First default value be currently loaded into answering in internal storage region It is corresponded to program, second default value is corresponding with the application program in internal storage region before not loading;The equipment according to Application identity position judges whether to need loading application programs specifically, the value of application identity position is judged, if equal to the first acquiescence Value or the second default value do not need loading application programs then, otherwise need loading application programs.
It is described that the corresponding application file of the application program to be loaded is verified, specially:
Step a1:According to default initial address and application file size be applied from external memory area program text Part obtains firmware data and digest data from the application file;
Step a2:Sign test is carried out to the digest data according to default signature algorithm and obtains the first digest value, according to Default hash algorithm calculates abstract to the firmware data and obtains the second digest value;
Step a3:Compare first digest value and whether second digest value is equal, is to pass through verification;Otherwise not By verification, the application file in external memory area is removed.
It is a kind of to realize the equipment more applied, including processor and external flash chip, the place based on low capacity processor It includes internal flash chip to manage in device, and the capacity of the internal flash chip is less than the external flash chip;The place Also include in reason device:Initialization module, read module, judgment module, load-on module, selftest module and operation module;
The initialization module, for executing initialization operation after device power;
The read module, for reading application identity position from external memory area;The external memory area is to be located at institute State the storage region in external flash chip;
The judgment module, the application identity position for being read according to the read module judge whether to need to load Application program, in the application program stored in external memory area according to the application identity position if being judged as YES determination to add The application program of load simultaneously triggers load-on module work, if being judged as otherwise triggering selftest module work;
The load-on module, for the application program to be loaded to be loaded into storage inside from external memory area Area, and trigger selftest module work;The internal storage region is the storage region being located in the internal flash chip;
The selftest module, for executing self-test operations;
The operation module runs in internal storage region and stores after executing self-test operations success for the selftest module Application program.
Above-mentioned processor further includes the first setup module, for when equipment receive user select application operation when, root The value of the operation setting application identity position of application is selected according to user.Further include the second setup module, use is received for working as equipment When the operation of family switching application, switch the value of the operation setting application identity position of application according to user;
Above-mentioned judgment module is specifically used for, and the value for the application identity position that the read module is read is judged, if being equal to Default value does not need loading application programs then, needs loading application programs if being not equal to default value;
The load-on module, the value of modification application identity position is default value after being additionally operable to load successfully.
Above-mentioned read module is specifically used for reading the first application identity position and the second application mark from the external memory area Will position;The judgment module is specifically used for judging whether to need loading application programs according to first application identity position, is then It the determination application program to be loaded and is touched in the application program stored in external memory area according to second application identity position Load-on module work is sent out, selftest module work is otherwise triggered.
Above-mentioned load-on module is specifically used for, to the corresponding application file of the application program in external memory area into Row verification, internal storage region is emptied if by verification, and the application is read presetting initial address since external memory area Data in program file are written in internal storage region and trigger selftest module work, and failure is loaded if not validated.
The value that the load-on module is additionally operable to change application identity position when the application file passes through verification is the One default value;Value for changing application identity position when the application file is not validated is the second default value;Institute It is corresponding with the application program being currently loaded into internal storage region to state the first default value, second default value and the load mould Application program before block is not carried out load operation in internal storage region corresponds to;
Above-mentioned judgment module is specifically used for, and the value for the application identity position that the read module is read is judged, if being equal to First default value or the second default value do not need loading application programs then, are needed if not equal to the first default value or the second default value Want loading application programs.
Above-mentioned load-on module specifically includes verification unit, the verification unit be used for the application file to be loaded into Row verification;
The verification unit specifically includes acquiring unit, computing unit and comparing unit;
The acquiring unit, for being obtained from external memory area according to default initial address, application file size To application file, firmware data and digest data are obtained from the application file;
The computing unit is plucked for obtaining first to digest data progress sign test according to default signature algorithm It is worth, calculating abstract to the firmware data according to default hash algorithm obtains the second digest value;
The comparing unit, it is whether equal for first digest value and second digest value, it is to pass through Verification;Otherwise not validated, remove the application file in external memory area.
Beneficial effects of the present invention are as follows:It is provided by the invention that the method more applied is realized based on low capacity processor and is set It is standby, the supported application function of equipment is not only extended, while the development cost of equipment more applied can be reduced.
Description of the drawings
Fig. 1 is a kind of composed structure signal for realizing the equipment more applied based on low capacity processor provided by the invention Figure;
Fig. 2 is a kind of method flow diagram more applied based on the realization of low capacity processor that embodiment 1 provides;
Fig. 3 be embodiment 1 provide from external memory area load the first application program to internal storage region implementation process Figure;
Fig. 4 be embodiment 1 provide from external memory area load the second application program to internal storage region implementation process Figure;
Fig. 5 is a kind of method flow diagram more applied based on the realization of low capacity processor that embodiment 2 provides;
Fig. 6 is a kind of application method flow for realizing the equipment more applied based on low capacity processor that embodiment 3 provides Figure;
Fig. 7 is a kind of composition frame chart for realizing the equipment more applied based on low capacity processor that embodiment 4 provides.
Specific implementation mode
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation describes, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on Embodiment in the present invention, the every other implementation that those skilled in the art are obtained without making creative work Example, shall fall within the protection scope of the present invention.
The present invention provides a kind of device and method realized and applied more based on low capacity processor, wherein the equipment is such as Include external flash chip and processor shown in Fig. 1, wherein includes internal flash chip, external flash in processor Chip passes through serial interface communication with processor.In embodiment provided by the invention, external memory area is to be located at the outside Storage region in flash chip, internal storage region are the storage regions being located in the internal flash chip.In order to reduce To the capacity requirement of internal flash chip, the binary file of an application program can be only stored in internal storage region, outside The binary file of multiple application programs is stored in portion memory block, after processor starts, runs the areas boot of processor first Start code, read the application identity position stored in external memory area, and judge whether to need to switch application, if you do not need to cutting Application program need not be reloaded by changing, then carries out self-test to the application program in internal storage region, run after the completion of self-test Application program in internal storage region;It switches over if necessary, then processor reads user's selection from external memory area Then the binary file of the corresponding application program of the application to be switched first empties internal storage region by the binary system of reading text Part is written in the internal storage region of processor, and then processor is to the application journey in the binary file in write-in internal storage region Sequence is verified i.e. process of self-test, after verification is errorless, runs the application program in internal storage region, to realize that applies cuts more It changes.In embodiment provided by the invention, judge whether to need loading application programs with specific reference to application identity position to judge, if answering It is that default value does not need loading application programs then with the value of flag bit, needs to add if the value of application identity position is not equal to default value Carry application program.Before the wherein described default value executes the operation of selection application or switching application with user after device power-up, The corresponding application of currently stored application program corresponds in internal flash chip, such as currently stored application program is corresponding Using for the first application, then default value takes the first default value, the corresponding application of currently stored application program then to write from memory for the second application Recognize value and takes the second default value.
Embodiment 1
A kind of method realized and applied more based on low capacity processor is present embodiments provided, specifically, in the present embodiment It is stored with the first application program and the second application program in external memory area, judges whether to need to load to answer according to application identity position The application program to be loaded with program and determination is not required to when the value of application identity position is the first default value or the second default value Want loading application programs, wherein the value of equipment known applications flag bit is corresponding with the application program that is stored in external memory area Relationship.When the value of application identity position is the first preset value, the determination application program to be loaded is the first application program, works as application The determination application program to be loaded is the second application program when the value of flag bit is the second preset value, and the first preset value is 0x01, 0x00;It is specially 0x01 that second preset value, which is specially 0x00,0x00, the second default value for 0x00,0x01, the first default value, 0x01.As shown in Fig. 2, method provided in this embodiment includes:
Step 101:Device power, initialization;
Specifically, the initialization includes GPIO initialization, SPI initialization, display screen initializes etc., and when device power wraps Open system clock is included, clock source is provided to PIT (cycle interruption timer) modules and USB module.
Step 102:Equipment reads two byte datas from the specified address in external memory area, and is stored in the first number Group;
Specifically, specifying two byte datas of address storage for identifying the application that switch execution in external memory area Program is applied for example, the mostly application that the equipment may be implemented includes the first application and second, with two byte data 0x01, 0x00 marks will be switched to the first application, and the second application is switched to two byte data 0x00,0x01 marks.
Preferably, further include that equipment pops up application switching menu by display screen after step 101, when user key-press selects After selecting the application to be switched, equipment can be according to two words for specifying address storage in the application modification external memory area that user selects Joint number evidence, for example, user key-press selection is switched to the first application, then equipment is by two of specified address storage in external memory area Byte data is revised as 0x01,0x00.
Specifically, the first application is the application (such as MiniPay) of realization payment function in the present embodiment, the second application is real The application (such as USBKey) of existing signature function.
Step 103:Equipment judges whether the first character joint number evidence that low level rises in the first array is 0x00, is to execute step Rapid 106, it is no to then follow the steps 104;
Step 104:Equipment judges whether second byte data that low level rises in the first array is 0x01, is to execute step Rapid 108, it is no to then follow the steps 105;
Specifically, when two byte datas that step 102 is read are 0x01, when 0x00, this step judging result is to execute Step 105.
Step 105:Equipment loads the first application program to internal storage region from external memory area, then executes step 108;
The specific implementation of this step is as shown in figure 3, include:
Step 105-1:It is obtained in external memory area according to the first default initial address, the first application file size First application file obtains firmware data and digest data from first application file;
Specifically, the first default initial address is 0x340000, the first application file size is 162K bytes, In, the 18K bytes of front are firmware data, and remaining 144K bytes are digest data.
Step 105-2:The digest data are calculated according to default signature algorithm, and are plucked what is be calculated It is stored in the second array;
Specifically, default signature algorithm is RSA Algorithm, digest data are calculated according to RSA Algorithm, and will meter The data for calculating rear 20 bytes of result are stored in the second array.
Step 105-3:The firmware data is calculated according to default hash algorithm, and result of calculation is stored in third Array;
Specifically, default hash algorithm is SHA1 algorithms, cryptographic Hash is calculated to the firmware data according to SHA1 algorithms, and The cryptographic Hash of be calculated 20 bytes is stored in third value.
Step 105-4:It is whether identical as the data in third array to compare the second array, is to then follow the steps 105-5, it is no Then follow the steps 105-9;
Step 105-5:Internal storage region is emptied, and judges whether to empty success, is to then follow the steps 105-6, otherwise shows Show and empty failure, after re-powering, returns to step 105-1;
Step 105-6:It executes to read the data in the first application file from external memory area and be written to inside and deposit Read-write operation in storage area;
Specifically, the processor of equipment reads the data of 18K bytes from external memory area every time, processor is every time inside The data that 2K bytes are written in portion memory block, recycle read-write operation, until will be in the first application file in external memory area The data of 162K bytes be all written to internal storage region.
Step 105-7:Judge whether to run succeeded, be to then follow the steps 105-8, otherwise shows read-write failure, wait for again After the power is turned on, 105-1 is returned to step;
Step 105-8:Display loads successfully, two byte datas of address will be specified to be revised as in external memory area Then 0x00,0x00 execute step 108.
Specifically, it is 0x00 to specify two byte datas of address in external memory area, when 0x00, for identifying equipment The application once executed is the first application.
Step 105-9:Remove the first default initial address and the first application file size described in external memory area The first corresponding application file;
Step 105-10:Display load failure will specify two byte datas of address to be revised as in external memory area Then 0x01,0x01 execute step 108.
Specifically, it is 0x00 to specify two byte datas of address in external memory area, when 0x00, for identifying equipment The application once executed is the second application.
Step 106:Equipment judges whether second byte data that low level rises in the first array is 0x00, is to execute step Rapid 108, it is no to then follow the steps 107;
Specifically, when two bytes that step 102 is read are 0x00, when 0x01, the judging result of this step is to execute step Rapid 107.
Step 107:Equipment loads the second application program to internal storage region from external memory area, then executes step 108;
The specific implementation of this step is as shown in Figure 4:
Step 107-1:It is obtained in external memory area according to the second default initial address, the second application file size Second application file obtains firmware data and digest data from second application file;
Preferably, the second default initial address is 0x300000, and the second application file size is 162K bytes, In, preceding 18K bytes are firmware data, and rear 144K bytes are digest data.
Step 107-2:The digest data are calculated according to default signature algorithm, and are plucked what is be calculated It is stored in the second array;
Preferably, it is RSA Algorithm to preset signature algorithm, is calculated digest data according to RSA Algorithm, and will meter The data for calculating rear 20 bytes of result are stored in the second array.
Step 107-3:The firmware data is calculated according to default hash algorithm, and result of calculation is stored in third Array;
Preferably, it is SHA1 algorithms to preset hash algorithm, and cryptographic Hash is calculated to the firmware data according to SHA1 algorithms, and The cryptographic Hash of be calculated 20 bytes is stored in third value.
Step 107-4:It is whether identical as the data in third array to compare the second array, is to then follow the steps 107-5, it is no Then follow the steps 107-9;
Step 107-5:Internal storage region is emptied, and judges whether to empty success, is to then follow the steps 107-6, otherwise shows Show and empty failure, after re-powering, returns to step 107-1;
Step 107-6:It executes to read the data in the second application file from external memory area and be written to inside and deposit Read-write operation in storage area;
Specifically, the processor of equipment reads the data of 18K bytes from external memory area every time, processor is every time inside The data that 2K bytes are written in portion memory block, recycle read-write operation, until will be in the second application file in external memory area The data of 162K bytes be all written to internal storage region.
Step 107-7:Judge whether to run succeeded, be to then follow the steps 107-8, otherwise shows read-write failure, wait for again After the power is turned on, 107-1 is returned to step;
Step 107-8:Display loads successfully, two byte datas of address will be specified to be revised as in external memory area Then 0x01,0x01 execute step 108.
Specifically, it is 0x01 to specify two byte datas of address in external memory area, when 0x01, for identify load at It is the second application that application program currently stored in internal storage region is corresponding after work(.
Step 107-9:Remove the second default initial address and the second application file size described in external memory area The second corresponding application file;
Step 107-10:Display load failure will specify two byte datas of address to be revised as in external memory area Then 0x00,0x00 execute step 108.
Specifically, it is 0x00 to specify two byte datas of address in external memory area, when 0x00, held for identifying equipment The corresponding application program stored in internal storage region before row load is the first application.
Step 108:Equipment self-inspection;
Specifically, equipment self-inspection includes the integrality of the application program in device authentication internal storage region.
Step 109:Equipment judges whether self-test succeeds, and is to then follow the steps 110, otherwise shows fail self-test, returns to step Rapid 108;
Step 110:Equipment executes the application program stored in internal storage region according to application program initial address.
Specifically, the application program initial address is equipment known address, depositing for application program is determined according to the address Put position.
It further, can be by temporal cache space such as after equipment has executed the application program stored in internal storage region First array, the second array and third array empty.
The application identity position provided in the present embodiment is made of two bytes, can be true according to the two of application identity position bytes It is fixed whether to need loading application programs and which application program specifically loaded, can also be equipment from external storage similarly The first application identity position and the second application identity position are read in area respectively, judges whether to need to load according to the first application identity position Application program is, according to the address of second application identity position determination from external memory area application program to be loaded, And the application program that will be loaded is loaded into internal storage region, then executes self-test and runs the application journey in internal storage region Otherwise sequence directly executes self-test and runs the application program in internal storage region.
Embodiment 2
Present embodiments provide it is a kind of the method more applied is realized based on low capacity processor, it is internal in the present embodiment The referred to as internal flash of flash chip, the referred to as internal flash of external flash chip, as shown in figure 5, including:
Step 201:Processor sends to external flash and reads application identity bit instruction;
Preferably, further include that processor runs boot program before step 201, the pop-up application selection menu in equipment, After user key-press selects switching application, processor can be according to the application stored in the external flash of application modification that user selects Flag bit, for example, the first application of user key-press selection, then the application identity position stored in external flash is revised as by processor First preset value, if the application identity position stored in external flash is revised as by the second application of user key-press selection, processor Second preset value.In the present embodiment, the first preset value is 0x01,0x00;Second preset value is 0x00,0x01.
Step 202:External flash returns to application identity position to processor;
Step 203:Processor judges whether to need loading application programs according to the application identity position received, is to execute Step 204, no to then follow the steps 213;
Specifically, processor judges whether the application identity position received is the first preset value or the second preset value, is then Loading application programs are needed, step 204 is executed, otherwise need not load, execute step 213.
Step 204:Processor sends to external flash and reads according to the application identity position determination application program to be loaded Take the instruction of firmware data and digest data;
Specifically, if application identity position is the first preset value, it is determined that the application program to be switched is the first application program, If application identity position is the second preset value, it is determined that the application program to be switched is the second application program.
Step 205:External flash returns to firmware data and digest data to processor;
Above-mentioned steps 204 and step 205 specifically include:
According to the determining application program to be loaded, composition reads digest data command and is sent to 1-1. processors External flash, external flash return to digest data to processor;
1-2. processors are sent to outer according to the determining application program to be loaded, one reading firmware data instruction of composition Portion flash, external flash return to a firmware data to processor;
1-3. processors judge whether to finish receiving firmware according to the corresponding firmware data size of the application program to be loaded Data are to then follow the steps 206, otherwise return and execute 1-2.
Step 206:Processor carries out sign test to the digest data received according to default signature algorithm and obtains First digest value to the firmware data received carries out that the second digest value is calculated according to default hash algorithm;
Step 207:Processor compares the first digest value and whether the second digest value is equal, is to then follow the steps 208, otherwise Execute step 212;
Step 208:The internal flash of processor erasing;
Step 209:Processor is sent to external flash reads application file instruction;
Step 210:External flash returns to application file to processor;
Step 211:Data in the application file received are written in internal flash by processor, are then held Row step 212;
Step 212:Processor sends update application identity bit instruction to external flash, then executes step 213;
When the update application identity bit instruction that external flash is received, application identity position is updated.
Step 213:Processor runs self-check program, and the application program in internal flash is run after self-test success.
Specifically, the integrality of the application program in the internal flash of processor operation self-check program verification, if application program Complete then self-test is successful, otherwise fail self-test.
Embodiment 3
A kind of application method for realizing the equipment more applied based on low capacity processor is present embodiments provided, such as Fig. 6 institutes Show, including:
Step 301:Device power-up;
Step 302:Equipment prompts process of self-test by display screen;
Step 303:After the completion of equipment self-inspection, current application is determined according to application identity position, and by display screen show into Enter current application;
Specifically, the value that device power-up executes the application identity position obtained when boot program is default value, according to default value Determine current application.The default value defined in the present embodiment is stored in internal flash chip before shutting down with equipment last time The corresponding numerical value of application program, for example, user's last time using equipment be used as USBKey, then this step obtain default value be 0x00,0x00, and the current application determined remains as USBKey.
Step 304:When user presses function button, equipment is prompted the user with by display screen to be pressed programmable button and can cut Change to another application;
Step 305 is executed when user presses programmable button;
Preferably, when user presses programmable button, equipment receives the operation that user switches application, according to the behaviour of user Make setting application identity position.The setting application identity position is specially by the value of application identity position from the corresponding acquiescence of current application Value is revised as the corresponding numerical value of the another application to be switched into.For example, current application is USBKey, when user presses number key 1 application to be switched to is MiniPay, then the value of application identity position is revised as 0x01,0x00 from 0x00,0x00.
Step 305:Equipment judges whether to switch successfully, and is to then follow the steps 306, no to then follow the steps 307;
Specifically, equipment is added by running boot program, the application program for the application that will switch from external flash chip It is downloaded in the inside flash chip of processor, 306 is successfully thened follow the steps if loading, if load unsuccessfully thens follow the steps 307.
Further, if further including being revised as the value of application identity position currently before executing step 306 after loading successfully The corresponding default value of application program in internal flash chip.For example, the application journey being currently loaded into internal flash chip Sequence is MiniPay application programs, then the value of application identity position is revised as 0x01,0x01 from 0x01,0x00.
Step 306:Equipment prompts process of self-test by display screen, and another application is switched into after the completion of self-test;Terminate.
Specifically, this step further include equipment operation processor inside flash chip in application code.
Step 307:Equipment prompts to fail by display screen, terminates.
Further, above-mentioned steps 302 and step 303 may be replaced by:
Step 302':Equipment prompts user to select application by display screen;
Step 303':Equipment receives the operation that user selects application, determines current application depending on the user's operation, then holds Row self-test shows access into current application after the completion of self-test by display screen;
Specifically, the value that device power-up executes the application identity position obtained when boot program is default value, default value is judged It is whether corresponding with the application of user's selection, it is directly to run the application program stored in current internal flash chip, otherwise will The value of application identity position is revised as the corresponding numerical value of application that user selects from default value, and the application that user selects corresponding is answered It is loaded into internal flash chip from external flash chip with program, then self-test and runs the application program in internal flash.
Embodiment 4
A kind of equipment realized and applied more based on low capacity processor is present embodiments provided, as shown in fig. 7, the equipment packet It includes including processor 600 and external flash chip 500, the processor 600 is with the external flash chip 500 by serial Interface connects, and includes internal flash chip 400 in the processor 600;Also include in the processor 600:Initialization Module 401, read module 402, judgment module 403, load-on module 404, selftest module 405 and operation module 406;
The initialization module 401, for executing initialization operation after device power;
The read module 402, for reading application identity position from external memory area;The external memory area is to be located at Storage region in the external flash chip 500;Specifically, the read module 402 in processor 600 is specifically used for institute It states external flash chip 500 and sends reading application identity bit instruction, correspondingly, the external flash chip 500 is used to work as and connect When receiving the reading application identity bit instruction, application identity position is returned to the read module 402.
The judgment module 403, the application identity position for being read according to the read module 403 judge whether need Loading application programs are wanted, according to application identity position determination from external memory area application journey to be loaded if being judged as YES Load-on module work 404 is simultaneously triggered in the address of sequence, if being judged as otherwise triggering the work of selftest module 405;Wherein, application identity position Value and the application program stored in external memory area it is uniquely corresponding, correspondence known to equipment, for example, being protected in advance in equipment There is the list of the correspondence, equipment is determined according to the value of the application identity position of reading from external memory area by lookup table mode In the application program that will load.
The load-on module 404, the application program for that will be loaded from external memory area are loaded into internal storage region, And trigger the work of selftest module 405;The internal storage region is the storage region being located in the internal flash chip 600;Tool Body, which includes reading unit, and the reading unit is used to send to the external flash chip 500 and read The instruction of firmware data and digest data;The external flash chip 500, which is used to work as, receives the reading firmware data When with the instructions of digest data, the firmware data and the digest data are returned to the reading unit.Specifically , reading unit can send one to read instruction reading firmware data and digest data from external flash chip, Can also be to send to read firmware data instruction and read digest data command respectively to read from external flash chip admittedly Number of packages evidence and digest data.
The selftest module 405, for executing self-test operations;
The operation module 406 rises after executing self-test operations success for the selftest module 405 according to application program Beginning address determines the application program stored in internal storage region, runs the application program stored in internal storage region.
In the present embodiment, the equipment further includes display screen and button, if equipment has the function of selecting application for user When, the processor can also include setup module;Setup module, for receiving the operation that user selects application when equipment When, the value of application identity position is set depending on the user's operation.
If equipment has the function of being switched to other application from current application for user, the setup module, for working as When equipment receives the operation of user's switching application, the value of application identity position is set depending on the user's operation.Correspondingly, described sentence Disconnected module 403 is specifically used for the value for the application identity position for judging that the read module 402 is read, if being equal to default value not Loading application programs are needed, need loading application programs if being not equal to default value;
The load-on module 404, the value of modification application identity position is default value after being additionally operable to load successfully.
Further, the read module 402 can also be answers specifically for reading first from the external memory area With flag bit and the second application identity position;The judgment module 403 is specifically used for being judged according to first application identity position It is no to need loading application programs, be, according to second application identity position determination from external memory area application journey to be loaded The work of load-on module 404 is simultaneously triggered in the address of sequence, otherwise triggers selftest module 405 and works.
The load-on module 404 provided in this embodiment is specifically used for the application file in external memory area It is verified, internal storage region is emptied if by verification, answered described in reading presetting initial address since external memory area The work of selftest module 405 is written in internal storage region and triggered with the data in program file, is loaded if not validated Failure.The value that the load-on module 404 is additionally operable to change application identity position when the application file passes through verification is First default value;Value for changing application identity position when the application file is not validated is the second acquiescence Value;First default value is corresponding with the application program being currently loaded into internal storage region, second default value with it is described Application program before load-on module is not carried out load operation in internal storage region corresponds to;Correspondingly, the judgment module 403 has The value for the application identity position that body is used to judge that the read module 402 is read, if silent equal to the first default value or second Recognize value and do not need loading application programs then, otherwise needs loading application programs.
Preferably, the load-on module 404 includes verification unit, and the verification unit is used for answering in external memory area It is verified with program file;
The verification unit specifically includes acquiring unit, computing unit and comparing unit;
The acquiring unit, for being obtained from external memory area according to default initial address, application file size To application file, firmware data and digest data are obtained from the application file;
The computing unit is plucked for obtaining first to digest data progress sign test according to default signature algorithm It is worth, calculating abstract to the firmware data according to default hash algorithm obtains the second digest value;
The comparing unit, it is whether equal for first digest value and second digest value, it is to pass through Verification;Otherwise not validated, remove the application file in external memory area.
The present invention is described in Examples 1 and 2 by taking achievable mostly application is two applications as an example, should be noted It is, if realizing the switching of more than two applications, to be readily apparent that according to the description of embodiment 1 and embodiment 2, multiple words can be used Section indicates application identity position, and multiple storage address are opened up in external flash chip and store different application programs, processor is pre- The correspondence for first preserving the value and the storage address of multiple application programs in external flash chip of application identity position arranges Table.When user selects switching in application, equipment reads application program write-in from corresponding storage address in external flash chip It can also be derived from the specific descriptions in Example 1 and Example 2 of the present invention to the detailed process in internal flash chip Go out.
Although the embodiments of the present invention has been shown and described above, it is to be understood that above-described embodiment is example Property, it is not considered as limiting the invention, those skilled in the art are not departing from the principle of the present invention and objective In the case of can make changes, modifications, alterations, and variations to the above described embodiments within the scope of the invention.The scope of the present invention By appended claims and its equivalent limit.

Claims (17)

1. a method of it is applied based on the realization of low capacity processor more, characterized in that including:
Step S1:Device power, initialization;
Step S2:Equipment reads application identity position from external memory area, judges whether to need to load to answer according to application identity position With program, it is the determination application journey to be loaded in the application program stored in external memory area according to the application identity position Sequence, will be determining described in the application program to be loaded be loaded into internal storage region, then execute step S3, otherwise directly execute step Rapid S3;
It is described will be determining described in the application program to be loaded be loaded into internal storage region, specifically include:It to be loaded to described The corresponding application file of application program is verified, and internal storage region is emptied if by verification, from external memory area The data that default initial address starts to read in the application file are written in internal storage region, if not validated Load failure;
It is described that the corresponding application file of the application program to be loaded is verified, specially:
Step a1:It is applied from external memory area program file according to default initial address and application file size, Firmware data and digest data are obtained from the application file;
Step a2:Sign test is carried out to the digest data according to default signature algorithm and obtains the first digest value, according to default Hash algorithm calculates abstract to the firmware data and obtains the second digest value;
Step a3:Compare first digest value and whether second digest value is equal, is to pass through verification;Otherwise do not pass through The application file in external memory area is removed in verification;
Step S3:Equipment self-inspection, and the application program stored in operation internal storage region after self-test success.
2. the method as described in claim 1, it is characterized in that:Further include that equipment receives between the step S1 and step S2 User selects the operation of application, and the value of the operation setting application identity position of application is selected according to user, then executes step S2.
3. method as claimed in claim 1 or 2, it is characterized in that:The method further includes being answered when equipment receives user's switching When operation, switch the value of the operation setting application identity position of application according to user, then executes step S2;
Equipment described in the step S2 judges whether to need loading application programs specifically, judging application according to application identity position The value of flag bit does not need loading application programs, if needing loading application programs not equal to default value if being equal to default value; It is described will be determining described in the application program to be loaded to be loaded into after internal storage region further include the value for changing application identity position For default value.
4. the method as described in claim 1, it is characterized in that:The step S2 is specifically, equipment is read from external memory area First application identity position and the second application identity position, judge whether to need loading application programs, are according to the first application identity position The determination application program to be loaded in the application program then stored in external memory area according to second application identity position, will The determining application program to be loaded is loaded into internal storage region, then executes step S3, otherwise direct step S3.
5. the method as described in claim 1, it is characterized in that:Described pass through when verification further includes changing the value of application identity position to be First default value;Further include changing the value of application identity position as the second default value when described not validated;First acquiescence Value is corresponding with the application program being currently loaded into internal storage region, second default value and internal storage region before not loading In application program correspond to;
The equipment judges whether to need loading application programs specifically, judging taking for application identity position according to application identity position Value does not need loading application programs if equal to the first default value or the second default value, otherwise needs loading application programs.
6. the method as described in claim 1, it is characterized in that:It is specific that the equipment reads application identity position from external memory area For the processor of the equipment is sent to flash chip where the external memory area reads application identity bit instruction, described outer Flash chip returns to application identity position to the processor where portion memory block.
7. the method as described in claim 1, it is characterized in that:In the data read in the application file are written to Specifically, the processor of the equipment is sent to flash chip where the external memory area reads firmware number in portion memory block According to the instruction with digest data, flash chip returns to the firmware number to the processor where the external memory area According to the digest data.
8. it is the method for claim 7, it is characterized in that:The firmware data and the instruction of digest data of reading is extremely Few one is read instruction.
9. a kind of realizing the equipment more applied based on low capacity processor, it is characterized in that:The equipment includes processor and outside Flash chip includes internal flash chip in the processor, and the capacity of the internal flash chip is less than the outside Flash chip;Also include in the processor:Initialization module, read module, judgment module, load-on module, selftest module With operation module;
The initialization module, for executing initialization operation after device power;
The read module, for reading application identity position from external memory area;The external memory area is located at outside described Storage region in portion's flash chip;
The judgment module, the application identity position for being read according to the read module judge whether to need to load application Program, in the application program stored in external memory area according to the application identity position if being judged as YES determination to be loaded Application program simultaneously triggers load-on module work, if being judged as otherwise triggering selftest module work;
The load-on module, for the application program to be loaded to be loaded into internal storage region from external memory area, and Trigger selftest module work;The internal storage region is the storage region being located in the internal flash chip;
The selftest module, for executing self-test operations;
The operation module, after executing self-test operations success for the selftest module, what is stored in operation internal storage region answers Use program;
The load-on module is specifically used for, to the corresponding application program text of the application program to be loaded described in external memory area Part is verified, and internal storage region is emptied if by verification, since external memory area default initial address described in reading Data in application file are written in internal storage region and trigger selftest module work, and mistake is loaded if not validated It loses;
The load-on module includes verification unit, and the verification unit is used for the corresponding application of the application program to be loaded Program file is verified;
The verification unit specifically includes acquiring unit, computing unit and comparing unit;
The acquiring unit, for getting and answering from external memory area according to default initial address, application file size With program file, firmware data and digest data are obtained from the application file;
The computing unit obtains the first abstract for carrying out sign test to the digest data according to default signature algorithm Value calculates abstract to the firmware data according to default hash algorithm and obtains the second digest value;
The comparing unit, it is whether equal for first digest value and second digest value, it is to pass through verification; Otherwise not validated, remove the application file in external memory area.
10. equipment as claimed in claim 9, it is characterized in that:The processor further includes the first setup module, for working as equipment When receiving the operation of user's selection application, the value of the operation setting application identity position of application is selected according to user.
11. the equipment as described in claim 9 or 10, it is characterized in that:The processor further includes the second setup module, for working as When equipment receives the operation of user's switching application, switch the value of the operation setting application identity position of application according to user;
The judgment module is specifically used for, and judges the value for the application identity position that the read module is read, if equal to acquiescence Value does not need loading application programs then, needs loading application programs if being not equal to default value;
The load-on module, the value of modification application identity position is default value after being additionally operable to load successfully.
12. equipment as claimed in claim 9, it is characterized in that:The read module is specifically used for from the external memory area Read the first application identity position and the second application identity position;The judgment module is specifically used for according to first application identity position Judge whether to need loading application programs, is, the application journey stored from external memory area according to second application identity position In sequence the determination application program to be loaded and trigger load-on module work, otherwise trigger selftest module work.
13. equipment as claimed in claim 9, it is characterized in that:The load-on module is additionally operable to when the application file is logical The value of modification application identity position is the first default value when crossing verification;For being changed when the application file is not validated The value of application identity position is the second default value;First default value and the application program pair being currently loaded into internal storage region It answers, the application program before second default value is not carried out load operation with the load-on module in internal storage region is corresponding;
The judgment module is specifically used for, and judges the value for the application identity position that the read module is read, if equal to the One default value or the second default value do not need loading application programs then, are needed if not equal to the first default value or the second default value Loading application programs.
14. equipment as claimed in claim 9, it is characterized in that:The read module is specifically used for the external flash cores Piece, which is sent, reads application identity bit instruction;The external flash chip, which is used to work as, receives the reading application identity bit instruction When, return to application identity position to the read module.
15. equipment as claimed in claim 9, it is characterized in that:The load-on module includes reading unit, and the reading unit is used In the instruction for sending reading firmware data and digest data to the external flash chip;Portion's flash chip is used for When receiving the instruction of the reading firmware data and digest data, the firmware data is returned to the reading unit With the digest data.
16. equipment as claimed in claim 15, it is characterized in that:The reading unit is specifically used for the external flash cores Piece sends at least one and reads instruction to read the firmware data and the digest data.
17. equipment as claimed in claim 9, it is characterized in that:The processor passes through serial interface with the external flash chip Mouth connection.
CN201511000181.9A 2015-12-28 2015-12-28 It is a kind of to realize the method and apparatus more applied based on low capacity processor Active CN105630422B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201511000181.9A CN105630422B (en) 2015-12-28 2015-12-28 It is a kind of to realize the method and apparatus more applied based on low capacity processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201511000181.9A CN105630422B (en) 2015-12-28 2015-12-28 It is a kind of to realize the method and apparatus more applied based on low capacity processor

Publications (2)

Publication Number Publication Date
CN105630422A CN105630422A (en) 2016-06-01
CN105630422B true CN105630422B (en) 2018-07-24

Family

ID=56045420

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201511000181.9A Active CN105630422B (en) 2015-12-28 2015-12-28 It is a kind of to realize the method and apparatus more applied based on low capacity processor

Country Status (1)

Country Link
CN (1) CN105630422B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111930575A (en) * 2020-07-01 2020-11-13 联想(北京)有限公司 Firmware acquisition method and device and electronic equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101110037A (en) * 2007-08-28 2008-01-23 北京海尔集成电路设计有限公司 Method for calling application program in exterior storage medium in embedded type equipment
CN101673204A (en) * 2009-08-13 2010-03-17 上海酷吧信息技术有限公司 Dynamic loading method of application program of mobile phone based on arm
CN202759507U (en) * 2012-09-11 2013-02-27 李平 A smart phone

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9164887B2 (en) * 2011-12-05 2015-10-20 Industrial Technology Research Institute Power-failure recovery device and method for flash memory

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101110037A (en) * 2007-08-28 2008-01-23 北京海尔集成电路设计有限公司 Method for calling application program in exterior storage medium in embedded type equipment
CN101673204A (en) * 2009-08-13 2010-03-17 上海酷吧信息技术有限公司 Dynamic loading method of application program of mobile phone based on arm
CN202759507U (en) * 2012-09-11 2013-02-27 李平 A smart phone

Also Published As

Publication number Publication date
CN105630422A (en) 2016-06-01

Similar Documents

Publication Publication Date Title
US20050273588A1 (en) Bootstrap method and apparatus with plural interchangeable boot code images
US6571347B1 (en) Apparatus and method for intelligent computer initiation program recovery
CN103793256B (en) Manage the method and electronic equipment of storage card
US7644322B2 (en) Hardware flow control monitor
CN106528097A (en) Version synchronization method for two pieces of BIOS (Basic Input/ Output System) firmware, and electronic equipment
US8819330B1 (en) System and method for updating a locally stored recovery image
US20100037042A1 (en) System for switching bios set-values
CN102722394A (en) Start upgrading method of embedded equipment
CN107066343A (en) The restorative procedure of partition table, device and mobile terminal in mobile terminal
CN107704258A (en) Uboot upgrade methods, system and terminal device
CN104394145B (en) A kind of dynamic token and method of work thereof with journal function
CN110020528A (en) A kind of BMC starting method, apparatus and electronic equipment and storage medium
CN107450953B (en) Method and device for updating BIOS
CN108389600B (en) Data storage device and parameter rewriting method
US20140289455A1 (en) Memory Patching Circuit
CN106126206A (en) A kind of information processing method and electronic equipment
CN116266467A (en) Memory device with secure boot update and auto-restore
CN105630422B (en) It is a kind of to realize the method and apparatus more applied based on low capacity processor
CN103455750B (en) The high peace verification method of a kind of embedded device and device
US20170194054A1 (en) Eeprom backup method and device
CN108156310A (en) A kind of method and system of finger prints processing, terminal device and computer-readable medium
CN102184115B (en) Method for updating system software and terminal device
CN112084064A (en) Master-slave BIOS switching method, board card and equipment
CN108664280A (en) A kind of embedded system start method and device
CN114510751A (en) Hardware replacement prevention device and method based on processor security kernel

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant