CN108089886A - A kind of intelligent card chip downloads the implementation method of program - Google Patents
A kind of intelligent card chip downloads the implementation method of program Download PDFInfo
- Publication number
- CN108089886A CN108089886A CN201611017095.3A CN201611017095A CN108089886A CN 108089886 A CN108089886 A CN 108089886A CN 201611017095 A CN201611017095 A CN 201611017095A CN 108089886 A CN108089886 A CN 108089886A
- Authority
- CN
- China
- Prior art keywords
- cos
- program
- download
- interrupt
- order
- 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.)
- Pending
Links
Classifications
-
- 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/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44521—Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
- G06F9/44526—Plug-ins; Add-ons
Abstract
The invention discloses the implementation methods that a kind of intelligent card chip downloads program.The intelligent card chip downloads Program Realizing Method and passes through a fixed APDU order, realize that COS switches over operation with downloading program, the interrupt vector table of erasable homepage is not removed, but the method for using the backup of COS interrupt vector tables and mark, by downloading the interrupt service routine of program by reading mark to determine whether having downloaded COS, the mark writes the clear area of NVM after COS has been downloaded, also, provides any interface and order for recovering to download program without user.Program Realizing Method of this intelligent card chip downloading reduces the difficulty using chip during user procedure development, provides and adds particular interface without user to recover the method for BL, while avoids the phenomenon that homepage modification mistake causes " dead card ".
Description
Technical field
The present invention relates to IC design technical field more particularly to the program download technologies of intelligent card chip.
Background technology
The download program of intelligent card chip(Bootloader, hereinafter referred BL)It is initially reside in chip internal one section
Startup program, in User Exploitation program(Hereinafter referred COS)During, COS is downloaded in chip.BL passes through application
Protocol command(Hereinafter referred APDU)User program is written to corresponding non-volatile storage area(Hereinafter referred NVM).Work as chip
When running again, BL is no longer will be performed, but performs COS.In practice exploitation debugging process, COS can be changed constantly, often be had more
The demand of secondary download, this also requires possess the function of recovering BL operations, so as to repeated downloads.
Intelligent card chip program structure is made of interrupt vector table and interrupt service routine, implementation procedure be exactly by
Interrupt event drives, and corresponding interrupt service routine is run by interrupt vector table according to the type of interruption.Interrupt vector table is
Very crucial, positioned at the initial address of chip memory, i.e. homepage, when chip has interrupt event arrival, the program of CPU refers to
Pin can directly search interrupt vector table according to number is interrupted first, then branch to corresponding interrupt service routine and perform.Such as Fig. 1
It is shown, perform work flow diagram for existing intelligent card chip program.Wherein, the program of intelligent card chip performs(10)It is to pass through
RESET interruptions jump to principal function execution(11), other interrupt events are had in principal function implementation procedure and are generated, for example radio frequency leads to
Communication interface(RF), timer 0 interrupts(T0)Deng will be jumped to according to different interrupt routine pointers and corresponding interrupt service journey
Sequence(12、13)Middle operation.
User needs to download to COS in chip by BL, and COS rather than BL is performed after restarting.General operation
Mode is such, as shown in Fig. 2, the realization flow chart for existing intelligent card chip BL.It powers on initially, chip is transported in BL
Row performs the interrupt service routine of BL(21), when there is the downloading COS of the task, COS interrupt service routines are first downloaded into NVM
In(22), the then BL interrupt vector tables erasing of homepage(23), finally in the interrupt vector table of homepage write-in COS(24), replace
The interrupt vector table of BL.After smart card re-powers, pass through the interrupt vector table of COS(24)The interruption of COS can be performed
Service routine(25).
User is in the exploitation of intelligent card chip application program and debugging process, it is necessary to repeatedly download user program.Therefore
Most BL designs need user to reserve the interface for recovering BL operations, and this interface requirement at least needs to change interrupt vector table.
And the running environment of smart card is very complicated, is susceptible to power down behavior, and the erasable increase of interrupt vector table data page is repeated
The risk of failure, if interrupt vector table is destroyed will cause card that cannot continue to work normally, and " dead card " phenomenon occur.This
Outside, it is desirable that user, which reserves, to recover the interfaces of BL operations and also affect ease for use during User Exploitation.
The content of the invention
Insufficient present in for the above-mentioned prior art, the purpose of the present invention is pass through a fixed APDU order, reality
Existing COS and BL switches over operation, does not remove the interrupt vector table of erasable homepage, but use the backup of COS interrupt vector tables and
The method of mark, and provide any interface and order for recovering to download program without user.
In order to reach above-mentioned technical purpose, the technical solution adopted in the present invention is:
A kind of intelligent card chip downloads the implementation method of program, and concrete implementation method is as follows:
(1)Start first and download program, download program and performed since interrupt vector table, then jump to the interruption for downloading program
Service routine;
(2)The interrupt service routine of program is downloaded by reading mark to determine whether having downloaded COS, which is downloading
The clear area of NVM is write after complete COS;If the mark exists, illustrate to have downloaded COS, download the interruption service of program
Program then reads the interrupt vector table of COS, then branches to corresponding COS interrupt service routines and performs COS;If the mark is not
In the presence of then explanation continues to execute download program, wait for downloads order there is no COS;
(3)When the order that equipment is sent arrives, the interrupt service routine of program is downloaded by judging the type of order into traveling
Single stepping;If the order for recovering download program, then remove and have been marked as the existing marks of COS;If download COS
Order, then first download COS interrupt service routines, then download COS interrupt vector table;
(4)It downloads program to complete after performing, re-power, chip enters(1)Flow.
The present invention realizes that COS is switched over downloading program as a result of above by a fixed APDU order
Operation, it is to reduce user program to provide any interface for recovering to download program and order, the advantageous effect obtained without user
The difficulty using chip in development process provides and adds particular interface without user to recover the method for BL, avoids simultaneously
Homepage modification mistake causes the phenomenon that " dead card ".
The present invention will be further described with reference to the accompanying drawings and detailed description.
Description of the drawings
Fig. 1 is to download program work flow chart for existing intelligent card chip.
Fig. 2 is that existing intelligent card chip downloads program work flow chart.
The intelligent card chip that Fig. 3 is the present invention downloads program work flow chart.
Fig. 4 is that the intelligent card chip that the present invention is embodied downloads memory allocation schematic diagram after COS.
Fig. 5 is that the intelligent card chip that the present invention is embodied downloads program realization flow chart.
As shown in figure 3, download program work flow chart for the intelligent card chip of the present invention.In BL designs, serviced interrupting
Program increases to whether jumping to the judgements of COS interrupt service routines, this judges to realize by reading mark, marks
It is to download the clear area that COS writes NVM after finishing.If mark is not present, illustrate, there is no COS, to continue to execute download
Program, wait for downloads order;If mark exists, the interrupt vector table of COS is read, and according to the interrupt vector table of COS
Program pointer is jumped in the interrupt service routine of COS and performed by address;When the order that equipment is sent arrives, the interruption clothes of BL
Program of being engaged in is by judging that the type of order carries out further operating;If the order for recovering BL, then remove and have been marked as COS
Existing mark;If the order for downloading COS, then COS interrupt service routines are first downloaded, then download the interrupt vector of COS
Table;BL is completed after performing, and is re-powered, the flow that chip starts into the BL most started.
As shown in figure 4, memory allocation schematic diagram after the intelligent card chip download COS being embodied for the present invention.This
The BL carriers of invention specific implementation are NVM, and FLASH is inexpensive form common in NVM.Firstly, it is necessary to the storage by FLASH
It is planned, needs to build BL interrupt vector tables, COS interrupt vector tables, mark S, COS interrupt service routine, use in FLASH
Several function modules such as user data and BL interrupt service routines.Wherein COS interrupt vector tables, COS interrupt service routines, user
Data belong to user COS;And BL interrupt vector tables and BL interrupt service routines belong to BL;S is marked for selecting to perform BL still
COS;The startup address of chip program is 0, it is necessary to store BL interrupt vector tables in FLASH home address;It is opened from FLASH second pages
Begin to store COS interrupt vector tables, mark S, COS interrupt service routine and user data etc. successively, this partial content does not have in COS
It is not present before downloading, but needs to reserve corresponding space in the design of BL.BL interrupt service routines are stored in
The highest address of FLASH, does not allow users to visit generally and changes.
As shown in figure 5, downloading program for the intelligent card chip that the present invention is embodied realizes flow chart.BL needs ensure
Under power-down conditions 3 basic functions are completed on the premise of " not dead " card:It downloads COS, operation COS and recovers BL.BL downloads COS's
In implementation procedure, APDU is received first and generates interface interrupt, BL interrupt service routines are jumped to by access interrupt vector table, is read
The mark S there are COS is taken, if there is no COS, and the order that this APDU is download COS, execution backup COS interrupt vector tables,
Download COS interrupt service routines and write there are COS mark S.
It runs in COS implementation procedures, generates electrification reset first and interrupt, generated in operational process and interrupt and can be interrupted by BL
Vector table jumps to BL interrupt service routines, reads mark S and judges whether COS, if COS exists, whether judges order
To recover the order of BL, if it is not, reading the interrupt vector table of COS and jumping to the interrupt service routine of COS.
Recover in BL implementation procedures, receive APDU first and generate interface interrupt, jumping to BL by interrupt vector table interrupts
Service routine if there is COS, and receives order to recover the order of BL, then removes the mark S there are COS.
As shown in figure 5, according to download programming realization process analysis, do not wipe homepage BL interrupt vector table and
The interrupt service routine of BL is not changed, will ensure that and occurs in chip download COS in the BL that power down can continue to operation, it will not
" dead card ".And the process for being restored to BL of COS only needs a specific APDU, and this APDU is realized and determined without user program
Justice.
The present invention is not limited to embodiment discussed above, more than the description of specific embodiment is intended to retouch
It states and illustrates technical solution of the present invention.The obvious conversion or replacement enlightened based on the present invention should also be as being considered
Fall into protection scope of the present invention;Above specific embodiment is used for disclosing the optimal implementation of the present invention, so that this
The those of ordinary skill in field can apply numerous embodiments of the invention and a variety of alternatives to reach the present invention's
Purpose.
Claims (1)
1. a kind of intelligent card chip downloads the implementation method of program, which is characterized in that concrete methods of realizing is as follows:
(1)Start first and download program, download program and performed since interrupt vector table, then jump to the interruption for downloading program
Service routine;
(2)The interrupt service routine of program is downloaded by reading mark to determine whether having downloaded COS, which is downloading
The clear area of NVM is write after complete COS;If the mark exists, illustrate to have downloaded COS, download the interruption service of program
Program then reads the interrupt vector table of COS, then branches to corresponding COS interrupt service routines and performs COS;If the mark is not
In the presence of then explanation continues to execute download program, wait for downloads order there is no COS;
(3)When the order that equipment is sent arrives, download the interrupt service routine of program by judge the type of order carry out into
Single stepping;If the order for recovering download program, then remove and have been marked as the existing marks of COS;If download COS
Order, then first download COS interrupt service routines, then download COS interrupt vector table;
(4)It downloads program to complete after performing, re-power, chip enters(1)Flow.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611017095.3A CN108089886A (en) | 2016-11-19 | 2016-11-19 | A kind of intelligent card chip downloads the implementation method of program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611017095.3A CN108089886A (en) | 2016-11-19 | 2016-11-19 | A kind of intelligent card chip downloads the implementation method of program |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108089886A true CN108089886A (en) | 2018-05-29 |
Family
ID=62168740
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201611017095.3A Pending CN108089886A (en) | 2016-11-19 | 2016-11-19 | A kind of intelligent card chip downloads the implementation method of program |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108089886A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111176700A (en) * | 2019-12-04 | 2020-05-19 | 东信和平科技股份有限公司 | Method and system for downloading and updating smart card COS (chip operating System) |
Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040015952A1 (en) * | 2001-04-18 | 2004-01-22 | Domosys Corporation | Method of remotely upgrading firmware in field-deployed devices |
US6850973B1 (en) * | 1999-09-29 | 2005-02-01 | Fisher-Rosemount Systems, Inc. | Downloadable code in a distributed process control system |
US20050204226A1 (en) * | 2004-02-06 | 2005-09-15 | Whetsel Lee D. | Core circuit test architecture |
CN101782859A (en) * | 2010-03-18 | 2010-07-21 | 上海乐毅信息科技有限公司 | Upgrading method of embedded system in application |
CN101923500A (en) * | 2010-07-14 | 2010-12-22 | 康佳集团股份有限公司 | Backup and update method and device of bootstrap program in embedded equipment |
CN103077056A (en) * | 2012-12-31 | 2013-05-01 | 中国电子科技集团公司第十五研究所 | Method for implementing Bootloader by using small quantity of ROM (Read Only Memory) resources |
CN103996412A (en) * | 2013-02-19 | 2014-08-20 | 北京同方微电子有限公司 | Power-fail protection method applied to intelligent-card nonvolatile memories |
CN104090796A (en) * | 2014-07-08 | 2014-10-08 | 成都万维图新信息技术有限公司 | Embedded device program updating method and system |
CN104360877A (en) * | 2014-10-24 | 2015-02-18 | 同济大学 | ECU (electronic control unit) firmware updating method based on Bootloader self update |
CN104376283A (en) * | 2014-11-18 | 2015-02-25 | 北京工业大学 | Smart card COS high-speed downloading system |
-
2016
- 2016-11-19 CN CN201611017095.3A patent/CN108089886A/en active Pending
Patent Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6850973B1 (en) * | 1999-09-29 | 2005-02-01 | Fisher-Rosemount Systems, Inc. | Downloadable code in a distributed process control system |
US20040015952A1 (en) * | 2001-04-18 | 2004-01-22 | Domosys Corporation | Method of remotely upgrading firmware in field-deployed devices |
US20050204226A1 (en) * | 2004-02-06 | 2005-09-15 | Whetsel Lee D. | Core circuit test architecture |
CN101782859A (en) * | 2010-03-18 | 2010-07-21 | 上海乐毅信息科技有限公司 | Upgrading method of embedded system in application |
CN101923500A (en) * | 2010-07-14 | 2010-12-22 | 康佳集团股份有限公司 | Backup and update method and device of bootstrap program in embedded equipment |
CN103077056A (en) * | 2012-12-31 | 2013-05-01 | 中国电子科技集团公司第十五研究所 | Method for implementing Bootloader by using small quantity of ROM (Read Only Memory) resources |
CN103996412A (en) * | 2013-02-19 | 2014-08-20 | 北京同方微电子有限公司 | Power-fail protection method applied to intelligent-card nonvolatile memories |
CN104090796A (en) * | 2014-07-08 | 2014-10-08 | 成都万维图新信息技术有限公司 | Embedded device program updating method and system |
CN104360877A (en) * | 2014-10-24 | 2015-02-18 | 同济大学 | ECU (electronic control unit) firmware updating method based on Bootloader self update |
CN104376283A (en) * | 2014-11-18 | 2015-02-25 | 北京工业大学 | Smart card COS high-speed downloading system |
Non-Patent Citations (2)
Title |
---|
AO BIAO ET AL: "Key Management System of IC Card based on information security", 《2010 INTERNATIONAL CONFERENCE ON COMPUTER APPLICATION AND SYSTEM MODELING (ICCASM 2010)》 * |
薛明策等: "智能卡COS操作系统高速下载的研究与实现", 《单片机与嵌入式应用》 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111176700A (en) * | 2019-12-04 | 2020-05-19 | 东信和平科技股份有限公司 | Method and system for downloading and updating smart card COS (chip operating System) |
CN111176700B (en) * | 2019-12-04 | 2023-08-01 | 东信和平科技股份有限公司 | Method and system for downloading and updating smart card COS (class of service) after operation |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN1333358C (en) | In-circuit configuration architecture with configuration on initialization function | |
CN102565671B (en) | Dynamic allocation method for on-line programming of integrated circuit tester | |
CN102236621B (en) | Computer interface information configuration system and method | |
CN102169459B (en) | Method, device and intelligent card for accessing data | |
JPH03240127A (en) | Program control system | |
CN101446918B (en) | Method for realizing debugging of single function by user state debugger and system thereof | |
CN103488464B (en) | microprocessor and microprocessor operation method | |
CN104360877A (en) | ECU (electronic control unit) firmware updating method based on Bootloader self update | |
CN102023908A (en) | Method and device for backing up boot program | |
CN105930186B (en) | The method for loading software of multi -CPU and software loading apparatus based on multi -CPU | |
CN101154207A (en) | Operating method for configured interface of microcontroller | |
CN103745167A (en) | IAP method and device of single chip microcomputer | |
CN104461859B (en) | A kind of emulator and method for supporting the soft debugging breakpoints of NVM | |
CN109408122A (en) | A kind of equipment starting method, electronic equipment and computer storage medium | |
CN100421099C (en) | In-circuit configuration architecture for embedded configurable logic array | |
CN102467446A (en) | Processor chip emulator capable of setting program pointer value | |
CN1333357C (en) | In-circuit configuration architecture with non-volatile configuration store | |
CN102622257A (en) | On-line meter self-updating method and device | |
CN102520778A (en) | One-key reset method suitable for embedded Linux operating system | |
CN104035757A (en) | MIPS-based (microprocessor without interlocked piped stages-based) U-boot (universal boot loader) transplantation implementing method | |
KR970066888A (en) | Microcomputers Using Nonvolatile Memory | |
CN101697132A (en) | Method, device and network equipment for quickly restarting operating system | |
CN107544804A (en) | The startup method and device of embedded system terminal development mode | |
CN108089886A (en) | A kind of intelligent card chip downloads the implementation method of program | |
US9652259B2 (en) | Apparatus and method for managing register information in a processing system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
CB02 | Change of applicant information | ||
CB02 | Change of applicant information |
Address after: 100083 18 floor, West Tower, block D, Tongfang science and Technology Plaza, 1 Wang Zhuang Road, Wudaokou, Haidian District, Beijing. Applicant after: Purple light co core Microelectronics Co., Ltd. Address before: 100083 18 floor, West Tower, block D, Tongfang science and Technology Plaza, 1 Wang Zhuang Road, Wudaokou, Haidian District, Beijing. Applicant before: Beijing Tongfang Microelectronics Company |
|
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WD01 | Invention patent application deemed withdrawn after publication | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20180529 |