JP6390840B2 - Semiconductor device and electronic equipment - Google Patents

Semiconductor device and electronic equipment Download PDF

Info

Publication number
JP6390840B2
JP6390840B2 JP2014206361A JP2014206361A JP6390840B2 JP 6390840 B2 JP6390840 B2 JP 6390840B2 JP 2014206361 A JP2014206361 A JP 2014206361A JP 2014206361 A JP2014206361 A JP 2014206361A JP 6390840 B2 JP6390840 B2 JP 6390840B2
Authority
JP
Japan
Prior art keywords
circuit
external terminal
debug
semiconductor device
predetermined period
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
JP2014206361A
Other languages
Japanese (ja)
Other versions
JP2016076106A (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.)
Seiko Epson Corp
Original Assignee
Seiko Epson Corp
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 Seiko Epson Corp filed Critical Seiko Epson Corp
Priority to JP2014206361A priority Critical patent/JP6390840B2/en
Publication of JP2016076106A publication Critical patent/JP2016076106A/en
Application granted granted Critical
Publication of JP6390840B2 publication Critical patent/JP6390840B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Microcomputers (AREA)

Description

本発明は、半導体装置及び電子機器に関する。   The present invention relates to a semiconductor device and an electronic apparatus.

MCU(Micro Controller Unit)等の半導体装置(例えば、IC(Integrated Circuit))では、プロセッサーがメモリーに記憶されているプログラムを実行することで、所望の機能を実現している。このような半導体装置では、プログラムを不正利用されることから保護することが課題となる。特許文献1では、パワー・オン・リセット時にデバッグ回路を使用不可にしてセキュリティ・リソース(レジスタ、ファームウェア、I/Oデバイス)へのアクセスを防止し、ブート・メモリからのシステム初期化中に選択されたセキュリティ手順を読み出すセキュリティ・コードを実行し、呼び出されたセキュリティ手順が有効であるときは、呼び出されたセキュリティ手順に応じてセキュアな環境でシステムを作動させ、呼び出されたセキュリティ手順が有効でないときは、デバッグ機能を使用可能にし、すべてのセキュリティ機能を隠す手法が提案されている。   In a semiconductor device such as an MCU (Micro Controller Unit) (for example, an IC (Integrated Circuit)), a processor executes a program stored in a memory to realize a desired function. In such a semiconductor device, it is a problem to protect the program from unauthorized use. In Patent Document 1, the debug circuit is disabled during power-on reset to prevent access to security resources (registers, firmware, I / O devices), and is selected during system initialization from the boot memory. When the security code that reads the security procedure is executed and the called security procedure is valid, the system is operated in a secure environment according to the called security procedure, and the called security procedure is not valid. Has proposed a method to enable debugging functions and hide all security functions.

特表2003−521776号公報Japanese translation of PCT publication No. 2003-521776

特許文献1の手法を適用すれば、パワー・オン・リセット時に、プログラム(ファームウェア)へのアクセスが可能なデバッグ回路を使用不可にするため、プログラムを不正利用されることから保護することが可能かもしれない。しかしながら、特許文献1の手法では、デバッグ回路そのものを使用不可にしており、これを実現するための回路が複雑になり、半導体装置のサイズが増大しやすいという問題がある。また、特許文献1の手法では、呼び出されたセキュリティ手順が有効であるときは、セキュアな環境でシステムを作動させる(デバッグ機能を使用できない)ため、セキュリティ手順が無効の状態にしてプログラムのデバッグを行う必要があり、セキュリティ手順が有効の場合のデバッグを十分に行うことが難しいという問題もある。なお、プログラムの不正利用の保護に限らず、半導体装置に内蔵される検査回路の不正利用(意図しない使用も含む)に対する保護についても同様の問題がある。   If the method of Patent Document 1 is applied, the debug circuit that can access the program (firmware) is disabled at the time of power-on reset, so that the program may be protected from unauthorized use. unknown. However, the technique disclosed in Patent Document 1 disables the debug circuit itself, which complicates the circuit for realizing this and increases the size of the semiconductor device. Further, in the technique of Patent Document 1, when the called security procedure is valid, the system is operated in a secure environment (the debug function cannot be used), so that the security procedure is disabled and the program is debugged. There is also a problem that it is difficult to perform sufficient debugging when the security procedure is effective. Note that there is a similar problem not only with protection against unauthorized use of programs, but also with respect to protection against unauthorized use (including unintended use) of an inspection circuit built in a semiconductor device.

本発明は、以上のような問題点に鑑みてなされたものであり、本発明のいくつかの態様によれば、コストの増加を低減しながらプログラムの不正利用のおそれを低減させることが可能な半導体装置及び電子機器を提供することができる。また、本発明のいくつかの態様によれば、プログラムの不正利用のおそれを低減させながら、デバッグを容易に行うことが可能な半導体装置及び電子機器を提供することができる。また、本発明のいくつかの態様によれば、コストの増加を低減しながら検査回路の不正利用のおそれを低減させることが可能な半導体装置及び電子機器を提供することができる。また、本発明のいくつかの態様によれば、検査回路の不正利用のおそれを低減させながら、検査を容易に行うことが可能な半導体装置及び電子機器を提供することができる。   The present invention has been made in view of the above problems, and according to some aspects of the present invention, it is possible to reduce the risk of unauthorized use of a program while reducing an increase in cost. A semiconductor device and an electronic device can be provided. In addition, according to some aspects of the present invention, it is possible to provide a semiconductor device and an electronic device that can be easily debugged while reducing the possibility of unauthorized use of a program. In addition, according to some aspects of the present invention, it is possible to provide a semiconductor device and an electronic device that can reduce the risk of unauthorized use of the inspection circuit while reducing an increase in cost. In addition, according to some aspects of the present invention, it is possible to provide a semiconductor device and an electronic device that can be easily inspected while reducing the possibility of unauthorized use of the inspection circuit.

本発明は前述の課題の少なくとも一部を解決するためになされたものであり、以下の態様または適用例として実現することが可能である。   SUMMARY An advantage of some aspects of the invention is to solve at least a part of the problems described above, and the invention can be implemented as the following aspects or application examples.

[適用例1]
本適用例に係る半導体装置は、不揮発性メモリーと、前記不揮発性メモリーに記憶されているプログラムを実行するプロセッサーと、前記プログラムのデバッグ機能を備えたデバッグ回路と、前記プログラムのデバッグに使用される第1の外部端子と、リセット解除から所定期間、前記第1の外部端子と前記デバッグ回路との電気的な接続を切断するマスク回路と、前記所定期間において、前記所定期間の経過後も前記第1の外部端子と前記デバッグ回路との電気的な接続を切断するか否かを制御する制御回路と、を含む。
[Application Example 1]
A semiconductor device according to this application example is used for non-volatile memory, a processor that executes a program stored in the non-volatile memory, a debug circuit having a debug function of the program, and debugging of the program A first external terminal, a mask circuit for disconnecting electrical connection between the first external terminal and the debug circuit for a predetermined period after reset release, and the predetermined period, and the first circuit after the predetermined period has elapsed. And a control circuit for controlling whether or not to disconnect the electrical connection between the external terminal and the debug circuit.

本適用例に係る半導体装置によれば、リセット解除からの所定期間は、マスク回路によって第1の外部端子とデバッグ回路との電気的な接続が切断され、第1の外部端子とデバッグ回路との電気的な接続が切断されている当該所定期間において、制御回路によって所定期間の経過後も切断するように制御可能であるので、第1の外部端子からデバッグ回路を介してプログラムが不正に利用されるおそれを低減させることができる。また、本適用例に係る半導体装置は、マスク回路と制御回路により第1の外部端子とデバッグ回路との電気的な接続を切断するという簡易な構成で実現することができる。従って、本適用例に係る半導体装置によれば、コストの増加を低減しながらプログラムの不正利用のおそれを低減させることができる。   According to the semiconductor device of this application example, the electrical connection between the first external terminal and the debug circuit is disconnected by the mask circuit for a predetermined period after the reset is released, and the first external terminal and the debug circuit are disconnected. In the predetermined period in which the electrical connection is disconnected, the control circuit can control the disconnection even after the elapse of the predetermined period, so that the program is illegally used from the first external terminal via the debug circuit. Can reduce the risk. Further, the semiconductor device according to this application example can be realized with a simple configuration in which the electrical connection between the first external terminal and the debug circuit is disconnected by the mask circuit and the control circuit. Therefore, according to the semiconductor device of this application example, it is possible to reduce the risk of unauthorized use of the program while reducing the increase in cost.

また、本適用例に係る半導体装置によれば、第1の外部端子とデバッグ回路との電気的な接続が切断されている所定期間において、制御回路によって、所定期間の経過後は、第1の外部端子とデバッグ回路とが電気的に接続されるように制御可能であるので、第1の外部端子からデバッグ回路を介してプログラムのデバッグを容易に行うことができる。   Further, according to the semiconductor device according to this application example, the first circuit after the predetermined period elapses by the control circuit in the predetermined period in which the electrical connection between the first external terminal and the debug circuit is disconnected. Since control is possible so that the external terminal and the debug circuit are electrically connected, the program can be easily debugged from the first external terminal via the debug circuit.

[適用例2]
上記適用例に係る半導体装置において、前記制御回路は、前記所定期間において、前記プロセッサーが前記プログラムに含まれる第1の命令を実行した場合に、前記所定期間の経過後も前記第1の外部端子と前記デバッグ回路との電気的な接続を切断してもよい。
[Application Example 2]
In the semiconductor device according to the application example, when the processor executes a first instruction included in the program in the predetermined period, the control circuit includes the first external terminal even after the predetermined period elapses. And the debug circuit may be disconnected from the electrical connection.

本適用例に係る半導体装置によれば、プログラムにおいて、リセット解除からの所定期間にプロセッサーによって実行される位置に第1の命令が組み込まれている場合には、当該所定期間の経過後も第1の外部端子とデバッグ回路との電気的な接続が切断される。従って、例えば、プログラムの所望の位置に第1の命令を組み込んでおくことで、当該プログラムの不正利用のおそれを低減させることができる。   According to the semiconductor device of this application example, in the program, when the first instruction is incorporated at a position to be executed by the processor in a predetermined period from the reset release, the first instruction is passed even after the predetermined period has elapsed. The electrical connection between the external terminal and the debug circuit is disconnected. Therefore, for example, by incorporating the first instruction at a desired position in the program, the possibility of unauthorized use of the program can be reduced.

[適用例3]
上記適用例に係る半導体装置は、前記第1の外部端子と前記プロセッサーとの間における信号の入出力インターフェース回路をさらに含み、前記制御回路は、前記所定期間において、前記プロセッサーが前記第1の命令を実行した場合に、前記第1の外部端子と前記入出力インターフェース回路とを電気的に接続してもよい。
[Application Example 3]
The semiconductor device according to the application example further includes an input / output interface circuit for a signal between the first external terminal and the processor, and the control circuit is configured so that the processor executes the first command in the predetermined period. When the above is executed, the first external terminal and the input / output interface circuit may be electrically connected.

本適用例に係る半導体装置によれば、プログラムにおいて、リセット解除からの所定期間にプロセッサーによって実行される位置に第1の命令が組み込まれている場合には、当該所定期間の経過後は、第1の外部端子とデバッグ回路との電気的な接続が切断されたまま、第1の外部端子と入出力インターフェース回路とが電気的に接続される。従って、第1の外部端子をデバッグ用の外部端子と入出力インターフェース用の外部端子として兼用することができる。   According to the semiconductor device of this application example, in the program, when the first instruction is incorporated at a position to be executed by the processor during a predetermined period after reset release, after the elapse of the predetermined period, The first external terminal and the input / output interface circuit are electrically connected while the electrical connection between the first external terminal and the debug circuit is disconnected. Therefore, the first external terminal can be used both as an external terminal for debugging and an external terminal for input / output interface.

[適用例4]
上記適用例に係る半導体装置は、第2の外部端子をさらに含み、前記不揮発性メモリーは、前記第2の外部端子に所定の信号が入力された場合に、記憶している情報を消去して
もよい。
[Application Example 4]
The semiconductor device according to the application example further includes a second external terminal, and the nonvolatile memory erases stored information when a predetermined signal is input to the second external terminal. Also good.

本適用例に係る半導体装置において、前記第2の外部端子に所定の信号が入力された場合に、前記プロセッサーが、前記不揮発性メモリーが記憶している情報を消去する制御を行ってもよい。   In the semiconductor device according to this application example, when a predetermined signal is input to the second external terminal, the processor may perform control to erase information stored in the nonvolatile memory.

本適用例に係る半導体装置によれば、第2の外部端子に所定の信号を入力することにより、不揮発性メモリーが記憶している情報を消去することができる。従って、プログラムの所望の位置に第1の命令が組み込まれていた場合、当該第1の命令が消去されることにより、以降は、リセット解除後の所定期間経過後に、第1の外部端子とデバッグ回路とが電気的に接続されるため、第1の外部端子から不揮発性メモリーの情報にアクセス可能となり得るが、プログラムが消去されているため不正利用されるおそれがない。   According to the semiconductor device of this application example, information stored in the nonvolatile memory can be erased by inputting a predetermined signal to the second external terminal. Therefore, when the first instruction is incorporated at a desired position in the program, the first instruction is erased. Thereafter, after the predetermined period after the reset is released, the first external terminal and the debug are deleted. Since the circuit is electrically connected, it is possible to access information in the nonvolatile memory from the first external terminal. However, since the program is erased, there is no possibility of unauthorized use.

また、本適用例に係る半導体装置によれば、所望の位置に第1の命令が組み込まれたプログラムが消去された後は、リセット解除後の所定期間経過後に、第1の外部端子とデバッグ回路とが電気的に接続されるため、第1の外部端子から不揮発性メモリーに情報を書き込むことが可能となる。従って、例えば、不揮発性メモリーに、消去されたプログラムを再度書き込みことや新たなプログラムに書き換えることが可能となる。   Further, according to the semiconductor device according to this application example, after the program in which the first instruction is incorporated at a desired position is erased, the first external terminal and the debug circuit are passed after a predetermined period after the reset is released. Are electrically connected to each other, so that information can be written to the nonvolatile memory from the first external terminal. Therefore, for example, the erased program can be rewritten to a non-volatile memory or rewritten with a new program.

[適用例5]
上記適用例に係る半導体装置において、前記不揮発性メモリーは、複数の記憶領域を有し、前記第2の外部端子に所定の信号が入力された場合に、前記情報を前記記憶領域ごとに消去し、前記第1の命令が記憶されている前記記憶領域の情報を最後に消去してもよい。
[Application Example 5]
In the semiconductor device according to the application example described above, the nonvolatile memory has a plurality of storage areas, and when a predetermined signal is input to the second external terminal, the information is erased for each storage area. The information in the storage area in which the first instruction is stored may be erased last.

本適用例に係る半導体装置によれば、仮に、不揮発性メモリーに記憶されている情報の消去が最後まで完了しなかった場合に、第1の命令が消去されずに残る確率が高まるので、消去されなかった情報が不正に利用されるおそれを低減させることができる。   According to the semiconductor device of this application example, if the information stored in the nonvolatile memory is not completely erased, the probability that the first instruction remains without being erased increases. The risk of unauthorized use of information that has not been made can be reduced.

[適用例6]
上記適用例に係る半導体装置において、前記所定期間は、前記プロセッサーが前記第1の命令を実行するのに要する時間よりも長くてもよい。
[Application Example 6]
In the semiconductor device according to the application example, the predetermined period may be longer than a time required for the processor to execute the first instruction.

本適用例に係る半導体装置によれば、プロセッサーは、第1の外部端子とデバッグ回路との電気的な接続が切断されている所定期間中に、第1の命令を実行することができるので、当該所定期間の経過後も第1の外部端子とデバッグ回路とが切断されたままになる。従って、プログラムの不正利用のおそれを低減させることができる。   According to the semiconductor device according to this application example, the processor can execute the first instruction during a predetermined period in which the electrical connection between the first external terminal and the debug circuit is disconnected. Even after the predetermined period has elapsed, the first external terminal and the debug circuit remain disconnected. Therefore, the risk of unauthorized use of the program can be reduced.

[適用例7]
上記適用例に係る半導体装置において、前記制御回路は、前記プロセッサーが第2の命令を実行した場合に、前記第1の外部端子と前記デバッグ回路とを電気的に接続してもよい。
[Application Example 7]
In the semiconductor device according to the application example described above, the control circuit may electrically connect the first external terminal and the debug circuit when the processor executes a second instruction.

本適用例に係る半導体装置によれば、例えば、リセット解除から所定期間が経過後も第1の外部端子とデバッグ回路との電気的な接続が切断される場合でも、プロセッサーが第2の命令を実行することで、第1の外部端子とデバッグ回路とを電気的に接続させることができる。これにより、第1の外部端子からプログラムのデバッグ等が可能となる。   According to the semiconductor device of this application example, for example, even when the electrical connection between the first external terminal and the debug circuit is disconnected even after a predetermined period has elapsed since the reset release, the processor outputs the second instruction. By executing, the first external terminal and the debug circuit can be electrically connected. This makes it possible to debug the program from the first external terminal.

なお、プログラムが不正に利用されるおそれを低減させるために、例えば、所定の外部端子に所定の信号が入力された場合に、プロセッサーが第2の命令を実行するようにし、
第2の命令、所定の外部端子及び所定の信号についての情報は、プログラムを使用する権限を有する正規のユーザーに対してのみ公開されるようにしてもよい。
In order to reduce the possibility of unauthorized use of the program, for example, when a predetermined signal is input to a predetermined external terminal, the processor executes the second instruction,
Information about the second command, the predetermined external terminal, and the predetermined signal may be disclosed only to authorized users who have the authority to use the program.

[適用例8]
本適用例に係る半導体装置は、検査回路と、検査に使用される第1の外部端子と、リセット解除から所定期間、前記第1の外部端子と前記検査回路との電気的な接続を切断するマスク回路と、前記所定期間において、前記所定期間の経過後も前記第1の外部端子と前記検査回路との電気的な接続を切断するか否かを制御する制御回路と、を含む。
[Application Example 8]
The semiconductor device according to this application example disconnects an electrical connection between the inspection circuit, the first external terminal used for the inspection, and the first external terminal and the inspection circuit for a predetermined period after the reset is released. A mask circuit; and a control circuit that controls whether or not to disconnect the electrical connection between the first external terminal and the inspection circuit even after the predetermined period has elapsed in the predetermined period.

本適用例に係る半導体装置によれば、リセット解除からの所定期間は、マスク回路によって第1の外部端子と検査回路との電気的な接続が切断され、第1の外部端子と検査回路との電気的な接続が切断されている当該所定期間において、制御回路によって所定期間の経過後も切断するように制御可能であるので、第1の外部端子から検査回路が不正に利用されるおそれを低減させることができる。また、本適用例に係る半導体装置は、マスク回路と制御回路により第1の外部端子と検査回路との電気的な接続を切断するという簡易な構成で実現することができる。従って、本適用例に係る半導体装置によれば、コストの増加を低減しながら検査回路の不正利用のおそれを低減させることができる。   According to the semiconductor device of this application example, the electrical connection between the first external terminal and the inspection circuit is disconnected by the mask circuit for a predetermined period after the reset is released, and the first external terminal and the inspection circuit are disconnected. Since the control circuit can be controlled to disconnect after the lapse of the predetermined period in the predetermined period in which the electrical connection is disconnected, the possibility that the inspection circuit is illegally used from the first external terminal is reduced. Can be made. In addition, the semiconductor device according to this application example can be realized with a simple configuration in which the electrical connection between the first external terminal and the inspection circuit is disconnected by the mask circuit and the control circuit. Therefore, according to the semiconductor device of this application example, it is possible to reduce the risk of unauthorized use of the inspection circuit while reducing the increase in cost.

また、本適用例に係る半導体装置によれば、第1の外部端子と検査回路との電気的な接続が切断されている所定期間において、制御回路によって、所定期間の経過後は、第1の外部端子と検査回路とが電気的に接続されるように制御可能であるので、第1の外部端子から検査回路を介して半導体装置の検査を容易に行うことができる。   Further, according to the semiconductor device according to this application example, the first circuit is disconnected from the first external terminal by the control circuit in the predetermined period after the predetermined period has elapsed. Since the external terminal and the inspection circuit can be controlled to be electrically connected, the semiconductor device can be easily inspected from the first external terminal via the inspection circuit.

[適用例9]
上記適用例に係る半導体装置は、不揮発性メモリーと、前記不揮発性メモリーに記憶されているプログラムを実行するプロセッサーと、をさらに含み、前記制御回路は、前記所定期間において、前記プロセッサーが前記プログラムに含まれる第1の命令を実行した場合に、前記所定期間の経過後も前記第1の外部端子と前記検査回路との電気的な接続を切断してもよい。
[Application Example 9]
The semiconductor device according to the application example further includes a non-volatile memory and a processor that executes a program stored in the non-volatile memory, and the control circuit is configured so that the processor stores the program in the predetermined period. When the included first instruction is executed, the electrical connection between the first external terminal and the inspection circuit may be disconnected even after the predetermined period has elapsed.

本適用例に係る半導体装置によれば、プログラムにおいて、リセット解除からの所定期間にプロセッサーによって実行される位置に第1の命令が組み込まれている場合には、当該所定期間の経過後も第1の外部端子と検査回路との電気的な接続が切断される。従って、例えば、プログラムの所望の位置に第1の命令を組み込んでおくことで、検査回路の不正利用のおそれを低減させることができる。   According to the semiconductor device of this application example, in the program, when the first instruction is incorporated at a position to be executed by the processor in a predetermined period from the reset release, the first instruction is passed even after the predetermined period has elapsed. The electrical connection between the external terminal and the inspection circuit is cut off. Therefore, for example, by incorporating the first instruction at a desired position in the program, the possibility of unauthorized use of the inspection circuit can be reduced.

また、上記適用例に係る半導体装置は、前記第1の外部端子と前記プロセッサーとの間における信号の入出力インターフェース回路をさらに含み、前記制御回路は、前記所定期間において、前記プロセッサーが前記第1の命令を実行した場合に、前記第1の外部端子と前記入出力インターフェース回路とを電気的に接続してもよい。   The semiconductor device according to the application example further includes an input / output interface circuit for a signal between the first external terminal and the processor, and the control circuit is configured such that the processor has the first circuit in the predetermined period. When the above command is executed, the first external terminal and the input / output interface circuit may be electrically connected.

この半導体装置によれば、プログラムにおいて、リセット解除からの所定期間にプロセッサーによって実行される位置に第1の命令が組み込まれている場合には、当該所定期間の経過後は、第1の外部端子と検査回路との電気的な接続が切断されたまま、第1の外部端子と入出力インターフェース回路とが電気的に接続される。従って、第1の外部端子を検査用の外部端子と入出力インターフェース用の外部端子として兼用することができる。   According to this semiconductor device, in the program, when the first instruction is incorporated at a position to be executed by the processor during a predetermined period from the reset cancellation, the first external terminal after the predetermined period elapses The first external terminal and the input / output interface circuit are electrically connected while disconnecting the electrical connection between the first external terminal and the inspection circuit. Therefore, the first external terminal can be used as an external terminal for inspection and an external terminal for input / output interface.

また、上記適用例に係る半導体装置において、前記所定期間は、前記プロセッサーが前記第1の命令を実行するのに要する時間よりも長くてもよい。   In the semiconductor device according to the application example, the predetermined period may be longer than a time required for the processor to execute the first instruction.

本適用例に係る半導体装置によれば、プロセッサーは、第1の外部端子と検査回路との電気的な接続が切断されている所定期間中に、第1の命令を実行することができるので、当該所定期間の経過後も第1の外部端子と検査回路とが切断されたままになる。従って、検査回路の不正利用のおそれを低減させることができる。   According to the semiconductor device according to this application example, the processor can execute the first instruction during a predetermined period in which the electrical connection between the first external terminal and the inspection circuit is disconnected. Even after the predetermined period has elapsed, the first external terminal and the inspection circuit remain disconnected. Therefore, the risk of unauthorized use of the inspection circuit can be reduced.

また、上記適用例に係る半導体装置において、前記制御回路は、前記プロセッサーが第2の命令を実行した場合に、前記第1の外部端子と前記検査回路とを電気的に接続してもよい。   In the semiconductor device according to the application example described above, the control circuit may electrically connect the first external terminal and the inspection circuit when the processor executes a second instruction.

この半導体装置によれば、例えば、リセット解除から所定期間が経過後も第1の外部端子と検査回路との電気的な接続が切断される場合でも、プロセッサーが第2の命令を実行することで、第1の外部端子と検査回路とを電気的に接続させることができる。これにより、第1の外部端子から半導体装置の検査が可能となる。   According to this semiconductor device, for example, even when the electrical connection between the first external terminal and the inspection circuit is disconnected even after a predetermined period has elapsed since reset release, the processor executes the second instruction. The first external terminal and the inspection circuit can be electrically connected. As a result, the semiconductor device can be inspected from the first external terminal.

なお、検査回路が不正に利用されるおそれを低減させるために、例えば、所定の外部端子に所定の信号が入力された場合に、プロセッサーが第2の命令を実行するようにし、第2の命令、所定の外部端子及び所定の信号についての情報は、プログラムを使用する権限を有する正規のユーザーに対してのみ公開されるようにしてもよい。   In order to reduce the possibility that the inspection circuit is illegally used, for example, when a predetermined signal is input to a predetermined external terminal, the processor executes the second instruction, and the second instruction The information about the predetermined external terminal and the predetermined signal may be disclosed only to an authorized user who has the authority to use the program.

[適用例10]
本適用例に係る電子機器は、上記のいずれかの半導体装置を備えている。
[Application Example 10]
An electronic apparatus according to this application example includes any one of the semiconductor devices described above.

本適用例によれば、半導体装置により、コストの増加を低減しながらプログラム又は検査回路の不正利用のおそれを低減させることができるので、低コストで信頼性の高い電子機器を実現することができる。   According to this application example, the semiconductor device can reduce the risk of unauthorized use of the program or the inspection circuit while reducing the increase in cost, so that a highly reliable electronic device can be realized at low cost. .

第1実施形態の半導体装置の構成例を示す図。1 is a diagram illustrating a configuration example of a semiconductor device according to a first embodiment. 不揮発性メモリーに記憶されるプログラムの一例を示す図。The figure which shows an example of the program memorize | stored in a non-volatile memory. プロセッサーが図2のプログラムを実行する場合のタイミングチャートの一例を示す図。The figure which shows an example of the timing chart in case a processor runs the program of FIG. 不揮発性メモリーに記憶されるプログラムの一例を示す図。The figure which shows an example of the program memorize | stored in a non-volatile memory. プロセッサーが図4のプログラムを実行する場合のタイミングチャートの一例を示す図。The figure which shows an example of the timing chart in case a processor runs the program of FIG. 不揮発性メモリーの情報が全消去される場合のタイミングチャートの一例を示す図。The figure which shows an example of the timing chart in case the information of a non-volatile memory is erased entirely. 不揮発性メモリーの構成例を示す図。The figure which shows the structural example of a non-volatile memory. デバッグ端子有効命令が実行される場合のタイミングチャートの一例を示す図。The figure which shows an example of the timing chart in case a debug terminal effective instruction is performed. 第2実施形態の半導体装置の構成例を示す図。The figure which shows the structural example of the semiconductor device of 2nd Embodiment. 第3実施形態の半導体装置の構成例を示す図。The figure which shows the structural example of the semiconductor device of 3rd Embodiment. 本実施形態の電子機器の機能ブロック図。1 is a functional block diagram of an electronic apparatus according to an embodiment. 本実施形態の電子機器の外観の一例を示す図。1 is a diagram illustrating an example of an appearance of an electronic apparatus according to an embodiment.

以下、本発明の好適な実施形態について図面を用いて詳細に説明する。なお、以下に説明する実施の形態は、特許請求の範囲に記載された本発明の内容を不当に限定するものではない。また以下で説明される構成の全てが本発明の必須構成要件であるとは限らない。   DESCRIPTION OF EMBODIMENTS Hereinafter, preferred embodiments of the present invention will be described in detail with reference to the drawings. The embodiments described below do not unduly limit the contents of the present invention described in the claims. Also, not all of the configurations described below are essential constituent requirements of the present invention.

1.半導体装置
1−1.第1実施形態
[半導体装置の構成]
図1は、第1実施形態の半導体装置の構成例を示す図である。図1に示すように、第1実施形態の半導体装置1は、プロセッサー10、不揮発性メモリー20、RAM(Random
Access Memory)30、リセット回路40、発振回路50、GPIO(General Purpose Input Output)回路60、デバッグ回路70、マスク回路80、制御回路90及びこれらの要素が接続されるバス100を含んで構成されている。なお、本実施形態の半導体装置1は、これらの要素の一部を省略又は変更し、あるいは他の要素を追加した構成としてもよい。
1. 1. Semiconductor device 1-1. First Embodiment [Configuration of Semiconductor Device]
FIG. 1 is a diagram illustrating a configuration example of the semiconductor device according to the first embodiment. As shown in FIG. 1, the semiconductor device 1 according to the first embodiment includes a processor 10, a nonvolatile memory 20, a RAM (Random
(Access Memory) 30, reset circuit 40, oscillation circuit 50, GPIO (General Purpose Input Output) circuit 60, debug circuit 70, mask circuit 80, control circuit 90, and bus 100 to which these elements are connected. Yes. Note that the semiconductor device 1 of the present embodiment may have a configuration in which some of these elements are omitted or changed, or other elements are added.

半導体装置1は、例えば、1チップのICで構成されていてもよいし、複数チップのICで構成されていてもよい。半導体装置1は、例えば、MCUやSOC(System On a Chip)であってもよい。   The semiconductor device 1 may be composed of, for example, a one-chip IC or may be composed of a plurality of chips. The semiconductor device 1 may be, for example, an MCU or an SOC (System On a Chip).

半導体装置1は、外部端子P01や不図示の通信インターフェース用の外部端子(クロック端子やデータ端子等)を介してホストCPU3と通信可能に構成されている。また、半導体装置1は、外部端子DBGを介してデバッグ装置2(デバッガーを実行する装置)と通信可能に構成されている。   The semiconductor device 1 is configured to be able to communicate with the host CPU 3 via an external terminal P01 and an external terminal (not shown) for a communication interface (such as a clock terminal and a data terminal). The semiconductor device 1 is configured to be able to communicate with the debug device 2 (device that executes a debugger) via the external terminal DBG.

プロセッサー10は、不揮発性メモリー20に記憶されているプログラムを実行し、当該プログラムに応じた処理を行う。例えば、半導体装置1が電子時計に使用される場合は、プロセッサー10は、プログラムを実行することにより、時刻の計算機能、ストップウォッチ機能、アラーム機能などを実現するための各種の処理を行ってもよい。   The processor 10 executes a program stored in the nonvolatile memory 20 and performs processing according to the program. For example, when the semiconductor device 1 is used for an electronic timepiece, the processor 10 may perform various processes for realizing a time calculation function, a stopwatch function, an alarm function, and the like by executing a program. Good.

不揮発性メモリー20は、プロセッサー10が実行するプログラムや当該プログラムによって使用されるデータ等が記憶されている。不揮発性メモリー20は、例えば、フラッシュメモリーやEEPROM等で実現することができる。   The nonvolatile memory 20 stores a program executed by the processor 10, data used by the program, and the like. The nonvolatile memory 20 can be realized by, for example, a flash memory or an EEPROM.

RAM30は、一時的に必要な情報を記憶するための揮発性のメモリーであり、プロセッサー10が不揮発性メモリー20に記憶されているプログラムに応じた演算を行った結果のデータ等を一時的に記憶するなど、プロセッサー10の作業領域等として使用される。   The RAM 30 is a volatile memory for temporarily storing necessary information, and temporarily stores data obtained as a result of the processor 10 performing an operation according to a program stored in the nonvolatile memory 20. For example, it is used as a work area of the processor 10.

リセット回路40は、半導体装置1に電源が投入された時に、あるいは、プロセッサー10がリセット命令を実行した場合に、ローレベルのリセット信号rst_nを発生させ、不揮発性メモリー20及び発振回路50を除く各回路を初期化する。   The reset circuit 40 generates a low-level reset signal rst_n when the semiconductor device 1 is powered on or when the processor 10 executes a reset command, and removes the nonvolatile memory 20 and the oscillation circuit 50. Initialize the circuit.

発振回路50は、半導体装置1に電源が投入されると発振動作を開始し、発振信号に基づくクロック信号clkを出力する。本実施形態では、半導体装置1に電源が投入された時、発振回路50の発振が安定した後にリセットが解除され(リセット信号rst_nがハイレベルになり)、プロセッサー10、デバッグ回路70、マスク回路80及び制御回路90は、クロック信号clkに同期して動作する。   When the semiconductor device 1 is powered on, the oscillation circuit 50 starts an oscillation operation and outputs a clock signal clk based on the oscillation signal. In the present embodiment, when power is supplied to the semiconductor device 1, the reset is released after the oscillation of the oscillation circuit 50 is stabilized (the reset signal rst_n becomes high level), and the processor 10, the debug circuit 70, and the mask circuit 80. The control circuit 90 operates in synchronization with the clock signal clk.

例えば、リセット回路40は、抵抗と容量を用いた時定数回路やクロック信号clkなどのクロックパルスを所定数カウントした場合にリセット信号rst_nをハイレベルにする回路によって実現してもよい。   For example, the reset circuit 40 may be realized by a time constant circuit using resistors and capacitors, or a circuit that sets the reset signal rst_n to a high level when a predetermined number of clock pulses such as the clock signal clk are counted.

GPIO回路60は、外部端子P01とプロセッサー10との間における信号の入出力インターフェース回路であり、外部端子P01から入力される信号をプロセッサー10に伝搬させ、あるいは、プロセッサー10が出力する所望の信号を外部端子P01に伝搬さ
せる。例えば、外部端子P01がハイレベにプルアップされている場合に、ホストCPU3が、外部端子P01にローレベルの信号を供給すると、プロセッサー10は、GPIO回路60を介して、外部端子P01がハイレベルからローレベルに変化したことを認識し、所定の割り込み処理を実行するようにしてもよい。
The GPIO circuit 60 is a signal input / output interface circuit between the external terminal P01 and the processor 10, and propagates a signal input from the external terminal P01 to the processor 10 or outputs a desired signal output from the processor 10. Propagate to the external terminal P01. For example, when the external terminal P01 is pulled up to a high level and the host CPU 3 supplies a low level signal to the external terminal P01, the processor 10 causes the external terminal P01 to change from the high level via the GPIO circuit 60. A predetermined interrupt process may be executed by recognizing the change to the low level.

デバッグ回路70は、不揮発性メモリー20に記憶されているプログラムやデータのデバッグ機能(ブレークポイントの設定やステップ実行などの機能)を備えた回路である。外部端子DBG(第1の外部端子の一例)は、当該プログラムやデータのデバッグに使用される外部端子であり、デバッグ装置2は、外部端子DBGを介してデバッグ回路70にアクセスすることでプログラムやデータのデバッグを実行することができる。具体的には、デバッグ装置2は、外部端子DBGを介してデバッグ回路70にデバッグ要求信号dbgreqを送信し、デバッグ回路70は、デバッグ要求信号dbgreqを受信すると、外部端子DBGを介してデバッグ装置2にデバッグ応答信号dbgackを送信する。デバッグ装置2は、デバッグ応答信号dbgackを受信した後、外部端子DBGを介してデバッグ回路70にデバッグ指令(ブレークポイントの設定やステップ実行などの指令)を送信し、デバッグ回路70はデバッグ指令に応じた処理を行う。   The debug circuit 70 is a circuit having a debugging function for programs and data stored in the nonvolatile memory 20 (functions such as setting breakpoints and step execution). The external terminal DBG (an example of a first external terminal) is an external terminal used for debugging the program and data. The debug device 2 accesses the debug circuit 70 via the external terminal DBG to Data debugging can be performed. Specifically, the debug device 2 transmits the debug request signal dbgreq to the debug circuit 70 via the external terminal DBG. When the debug circuit 70 receives the debug request signal dbgreq, the debug device 2 transmits the debug request signal dbgreq via the external terminal DBG. A debug response signal dbback is transmitted to After receiving the debug response signal dbback, the debug device 2 transmits a debug command (a command for setting a breakpoint or executing a step) to the debug circuit 70 via the external terminal DBG, and the debug circuit 70 responds to the debug command. Process.

マスク回路80は、リセット解除から所定期間、外部端子DBGとデバッグ回路70との電気的な接続を切断する回路である。本実施形態では、マスク回路80は、この所定期間のみ、内部信号である不図示のマスク期間信号maskをハイレベルにする。そして、マスク回路80は、マスク期間信号maskがハイレベルの期間は、外部端子DBGから入力されるデバッグ要求信号dbgreqやデバッグ指令を伝搬させず、リセット解除から所定期間経過後(マスク期間信号maskがローレベルになった後)は、デバッグ要求信号dbgreqやデバッグ指令を伝搬させる。これにより、本実施形態では、少なくともリセット解除から所定期間は、外部端子DBGに入力される信号がすべて無効となり、外部端子DBGからデバッグ回路70に対するアクセスができない。   The mask circuit 80 is a circuit that disconnects the electrical connection between the external terminal DBG and the debug circuit 70 for a predetermined period from the reset release. In the present embodiment, the mask circuit 80 sets an unillustrated mask period signal mask, which is an internal signal, to a high level only during this predetermined period. The mask circuit 80 does not propagate the debug request signal dbgreq or the debug command input from the external terminal DBG while the mask period signal mask is at the high level, and after a predetermined period has elapsed since the reset release (the mask period signal mask is After the low level, the debug request signal dbgreq and the debug command are propagated. As a result, in this embodiment, at least during a predetermined period from reset cancellation, all signals input to the external terminal DBG are invalid, and the debug circuit 70 cannot be accessed from the external terminal DBG.

制御回路90は、リセット解除から所定期間(マスク期間信号maskがハイレベルの期間)において、当該所定期間の経過後も外部端子DBGとデバッグ回路70との電気的な接続を切断するか否かを制御する回路である。例えば、制御回路90は、所定期間(マスク期間信号maskがハイレベルの期間)において、プロセッサー10がプログラムに含まれるデバッグ端子無効命令(第1の命令の一例)を実行した場合に、当該所定期間の経過後も外部端子DBGとデバッグ回路70との電気的な接続を切断してもよい。また、制御回路90は、当該所定期間において、プロセッサー10がデバッグ端子無効命令を実行しなかった場合には、当該所定期間の経過後、外部端子DBGとデバッグ回路70とを電気的に接続するようにしてもよい。リセット解除からの所定期間(マスク期間信号maskがハイレベルの期間)は、プロセッサー10がデバッグ端子無効命令を実行するのに要する時間よりも長く設定される。   The control circuit 90 determines whether or not to disconnect the electrical connection between the external terminal DBG and the debug circuit 70 even after the lapse of the predetermined period in a predetermined period (period in which the mask period signal mask is at a high level) after reset is released. It is a circuit to control. For example, when the processor 10 executes a debug terminal invalid instruction (an example of a first instruction) included in a program in a predetermined period (a period in which the mask period signal mask is high), the predetermined period After the elapse of time, the electrical connection between the external terminal DBG and the debug circuit 70 may be disconnected. In addition, when the processor 10 does not execute the debug terminal invalid instruction in the predetermined period, the control circuit 90 electrically connects the external terminal DBG and the debug circuit 70 after the predetermined period has elapsed. It may be. A predetermined period after the reset is released (a period in which the mask period signal mask is at a high level) is set to be longer than the time required for the processor 10 to execute the debug terminal invalid instruction.

本実施形態では、制御回路90は、スイッチ回路92及び端子制御回路94を含んで構成されている。   In the present embodiment, the control circuit 90 includes a switch circuit 92 and a terminal control circuit 94.

スイッチ回路92は、端子制御回路94からのデバッグイネーブル信号dbgenがハイレベルの時は、マスク回路80の出力信号(例えば、デバッグ要求信号dbgreqやデバッグ指令)をデバッグ回路70に伝搬させ、あるいは、デバッグ回路70の出力信号(例えば、デバッグ応答信号dbgack)をマスク回路80に伝搬させる。また、スイッチ回路92は、デバッグイネーブル信号dbgenがローレベルの時は、マスク回路80の出力信号をデバッグ回路70に伝搬させず、かつ、デバッグ回路70の出力信号をマスク回路80に伝搬させない。   When the debug enable signal dbgen from the terminal control circuit 94 is at a high level, the switch circuit 92 propagates the output signal of the mask circuit 80 (for example, the debug request signal dbgreq or the debug command) to the debug circuit 70, or debugs The output signal of the circuit 70 (for example, the debug response signal dbback) is propagated to the mask circuit 80. Further, the switch circuit 92 does not propagate the output signal of the mask circuit 80 to the debug circuit 70 and does not propagate the output signal of the debug circuit 70 to the mask circuit 80 when the debug enable signal dbgen is at a low level.

端子制御回路94は、リセット解除後にデバッグイネーブル信号dbgenをハイレベルに設定し、プロセッサー10がリセット解除後の所定期間(マスク期間信号maskがハイレベルの期間)においてデバッグ端子無効命令を実行した場合に、これ以降、デバッグイネーブル信号dbgenをローレベルに固定する。例えば、端子制御回路94は、デバッグイネーブル信号dbgenに対応するデバッグイネーブルビット(初期値は1)を含むレジスタ(不図示)を備え、デバッグ端子無効命令は、このデバッグイネーブルビットを0に設定するロード命令であってもよい。   The terminal control circuit 94 sets the debug enable signal dbgen to a high level after reset release, and the processor 10 executes a debug terminal invalid instruction in a predetermined period after the reset is released (a period in which the mask period signal mask is high level). Thereafter, the debug enable signal dbgen is fixed at a low level. For example, the terminal control circuit 94 includes a register (not shown) including a debug enable bit (initial value is 1) corresponding to the debug enable signal dbgen. The debug terminal invalid instruction is a load that sets this debug enable bit to 0. It may be an instruction.

このように構成された第1実施形態の半導体装置1によれば、プロセッサー10がリセット解除後の所定期間にデバッグ端子無効命令を実行しなければ、当該所定期間の経過後は外部端子DBGからデバッグ回路70に対するアクセスが可能になる。従って、不揮発性メモリー20に記憶されるプログラムやデータのデバッグが可能となる。   According to the semiconductor device 1 of the first embodiment configured as described above, if the processor 10 does not execute the debug terminal invalid instruction in a predetermined period after the reset is released, the debugging is started from the external terminal DBG after the predetermined period has elapsed. Access to the circuit 70 becomes possible. Therefore, it is possible to debug programs and data stored in the nonvolatile memory 20.

一方、プロセッサー10がリセット解除後の所定期間にデバッグ端子無効命令を実行した場合は、当該所定期間の経過後も外部端子DBGからデバッグ回路70に対するアクセスができなくなる。従って、不揮発性メモリー20に記憶されるプログラムやデータのデバッグが完了した後は、例えば、当該プログラムの先頭付近においてデバッグ端子無効命令を追加し、又は置き換えることにより、外部端子DBGからデバッグ回路70に対するアクセスができなくなり、デバッグ回路70を介したプログラムやデータの不正利用のおそれを低減させることができる。   On the other hand, when the processor 10 executes the debug terminal invalid instruction during a predetermined period after the reset is released, the debug circuit 70 cannot be accessed from the external terminal DBG even after the predetermined period has elapsed. Therefore, after the debugging of the program and data stored in the nonvolatile memory 20 is completed, for example, by adding or replacing the debug terminal invalid instruction near the head of the program, the external terminal DBG can be used for the debug circuit 70. Access becomes impossible, and the possibility of unauthorized use of programs and data via the debug circuit 70 can be reduced.

[半導体装置の動作例1]
図2は、不揮発性メモリー20に記憶されるデバッグ対象のプログラムの一例を示す図である。本実施形態では、プロセッサー10は、リセット解除後、最初に、不揮発性メモリー20の0x0000アドレスに配置された命令を実行する。図2の例では、0x0000アドレスにはベクターフェッチ命令が配置されており、プロセッサー10は、リセット解除後、最初にこのベクターフェッチ命令を実行する。ベクターフェッチ命令は、あらかじめ決められたリセットベクター(図2の例ではx0100アドレス)へのジャンプ命令であり、プロセッサー10は、次に、0x0100アドレス以降に記憶された各命令を順番に実行する。図2の例では、0x0100アドレス以降には、NOP命令(nop)、NOP命令(nop)、ロード命令(ld)、ロード命令(ld)、加算命令(add)、ロード命令(ld)、減算命令(sub)、ロード命令(ld)、ジャンプ命令(jp)、論理左シフト命令(sll)、ロード命令(ld)、ロード命令(ld)、・・・の命令列が順に配置されている。この0x0100アドレス以降に記憶されている命令列がデバッグ対象のプログラムである。
[Operation Example 1 of Semiconductor Device]
FIG. 2 is a diagram illustrating an example of a debug target program stored in the nonvolatile memory 20. In the present embodiment, the processor 10 first executes the instruction arranged at the 0x0000 address of the nonvolatile memory 20 after the reset is released. In the example of FIG. 2, a vector fetch instruction is arranged at the address 0x0000, and the processor 10 first executes this vector fetch instruction after reset release. The vector fetch instruction is a jump instruction to a predetermined reset vector (x0100 address in the example of FIG. 2). Next, the processor 10 sequentially executes each instruction stored after the 0x0100 address. In the example of FIG. 2, after the address 0x0100, a NOP instruction (nop), a NOP instruction (nop), a load instruction (ld), a load instruction (ld), an addition instruction (add), a load instruction (ld), and a subtraction instruction (Sub), load instruction (ld), jump instruction (jp), logical left shift instruction (sll), load instruction (ld), load instruction (ld),... Are arranged in this order. The instruction sequence stored after the 0x0100 address is a program to be debugged.

図3は、プロセッサー10が図2の例のプログラムを実行する場合のタイミングチャートの一例を示す図である。図3の例では、時刻tにおいて、デバッグ装置2が外部端子DBGを介してデバッグ要求信号dbgreqを入力している。 FIG. 3 is a diagram showing an example of a timing chart when the processor 10 executes the program of the example of FIG. In the example of FIG. 3, at time t 0, debug unit 2 is entering a debug request signal dbgreq through the external terminals DBG.

次に、時刻tにおいてリセットが解除されると(リセット信号rst_nがローレベルからハイレベルに変化すると)、マスク期間信号maskとデバッグイネーブル信号dbgenはともにはハイレベルになっている。また、時刻tにおいてリセットが解除された後、プロセッサー10は、クロック信号clkの立ち上がりエッジに同期して、不揮発性メモリー20の0x0000アドレスに配置されているベクターフェッチ命令(図2参照)を読み出して実行する。 Next, when the reset is released at time t 1 (when the reset signal rst_n changes from the low level to the high level), both the mask period signal mask and the debug enable signal dbgen are at the high level. Also, after the reset is released at time t 1, processor 10 reads in synchronism with the rising edge of the clock signal clk, the vector fetch is disposed 0x0000 address of the nonvolatile memory 20 instructions (see Figure 2) And execute.

そして、プロセッサー10は、時刻t以降において、不揮発性メモリー20の0x0100アドレス以降に配置されている命令列(デバッグ対象のプログラム)(図2参照)を読み出して実行する。 Then, the processor 10 at time t 2 later, reads and executes the instruction sequence is arranged after 0x0100 address of the nonvolatile memory 20 (debug target program) (see Figure 2).

その後、時刻tにおいて、マスク期間信号maskがローレベルに変化し、デバッグイネーブル信号dbgenがハイレベルであるため、デバッグ回路70がデバッグ要求信号dbgreqを受け取り、外部端子DBGを介してデバッグ応答信号dbgackを出力する。 After that, at time t 3 , the mask period signal mask changes to low level, and the debug enable signal dbgen is high level. Therefore, the debug circuit 70 receives the debug request signal dbgreq, and receives the debug response signal dbback through the external terminal DBG. Is output.

デバッグ装置2は、デバッグ応答信号dbgackを受け取り、時刻tにおいて、デバッグ要求信号dbgreqを停止し、以降は、外部端子DBGを介して、デバッグ回路70にデバッグ指令を入力可能になる。 Debugger 2 receives the debug response signal DBGACK, at time t 4, to stop the debug request signal Dbgreq, since, through the external terminals DBG, allows the input debug command to the debug circuitry 70.

この図3の例では、リセット解除後、クロック信号clkのクロックパルスが8個分の期間はマスク期間信号maskがハイレベルであり、デバッグ装置2は、この期間は外部端子DBGからデバッグ回路70へのアクセスができないが、当該期間の経過後はアクセス可能となる。   In the example of FIG. 3, the mask period signal mask is at a high level during a period of eight clock pulses of the clock signal clk after the reset is released, and the debug device 2 from the external terminal DBG to the debug circuit 70 during this period. Cannot be accessed, but will be accessible after the period.

[半導体装置の動作例2]
図4は、図2のプログラムのデバッグが完了した後に不揮発性メモリー20に記憶されるプログラムの一例を示す図であり、図5は、プロセッサー10が図4の例のプログラムを実行する場合のタイミングチャートの一例を示す図である。図4の例では、図2の例において、デバッグ対象のプログラムの先頭の0x0100アドレスと0x0102アドレスに配置されていた2つのNOP命令(nop)がデバッグ端子無効命令に置き換わっており、その他は図2の例と同じである。
[Operation Example 2 of Semiconductor Device]
FIG. 4 is a diagram showing an example of a program stored in the nonvolatile memory 20 after debugging of the program of FIG. 2 is completed. FIG. 5 is a timing when the processor 10 executes the program of the example of FIG. It is a figure which shows an example of a chart. In the example of FIG. 4, in the example of FIG. 2, the two NOP instructions (nop) arranged at the top 0x0100 address and 0x0102 address of the program to be debugged are replaced with the debug terminal invalid instruction, and the others are shown in FIG. This is the same as the example.

図5の例でも、図3の例と同様に、時刻tにおいて、外部端子DBGを介してデバッグ要求信号dbgreqが入力されている。また、時刻tにおいてリセットが解除されると、マスク期間信号maskとデバッグイネーブル信号dbgenはともにハイレベルになっており、プロセッサー10は、クロック信号clkの立ち上がりエッジに同期してベクターフェッチ命令(図4参照)を読み出して実行する。 Also in the example of FIG. 5, the debug request signal dbgreq is input via the external terminal DBG at time t 0 as in the example of FIG. 3. When the reset at time t 1 is released, the mask period signal mask and debug enable signal dbgen has become both a high level, the processor 10, the vector fetch instruction in synchronization with the rising edge of the clock signal clk (Fig. 4) is read and executed.

そして、プロセッサー10は、時刻t以降において、不揮発性メモリー20の0x0100アドレス以降に配置されている命令列(デバッグが完了したプログラム)(図4参照)を読み出して実行する。ここで、プロセッサー10は、時刻t〜時刻tにおいてデバッグ端子無効命令を読み出して実行することで、デバッグイネーブル信号dbgenがハイレベルからローレベルに変化する。 Then, the processor 10 at time t 2 later, reads and executes the instruction sequence is arranged after 0x0100 address of the nonvolatile memory 20 (program debugging is completed) (see Fig. 4). Here, the processor 10 reads and executes the debug terminal invalid instruction from time t 2 to time t 3 , whereby the debug enable signal dbgen changes from high level to low level.

その後、時刻tにおいて、マスク期間信号maskがローレベルに変化するが、デバッグイネーブル信号dbgenがローレベルであるため、デバッグ回路70がデバッグ要求信号dbgreqを受け取ることができず、外部端子DBGからデバッグ応答信号dbgackが出力されない。 Then, at time t 4, but the mask period signal mask is changed to the low level, since the debug enable signal dbgen is at a low level, it is not possible to debug circuitry 70 receives a debug request signal Dbgreq, debug from the external terminal DBG The response signal dbback is not output.

この図5の例では、リセット解除後、クロック信号clkのクロックパルスが8個分の期間はマスク期間信号maskがハイレベルであり、この期間は外部端子DBGからデバッグ回路70へのアクセスができず、当該期間の経過後もデバッグイネーブル信号dbgenがローレベルのため、外部端子DBGからデバッグ回路70へのアクセスができない。従って、外部端子DBGからデバッグ回路70を介して不揮発性メモリーに記憶されているプログラムが不正利用されるおそれを低減させることができる。   In the example of FIG. 5, after the reset is released, the mask period signal mask is at a high level during a period of 8 clock pulses of the clock signal clk, and the debug circuit 70 cannot be accessed from the external terminal DBG during this period. Even after the lapse of the period, the debug enable signal dbgen is at a low level, so that the debug circuit 70 cannot be accessed from the external terminal DBG. Therefore, it is possible to reduce the possibility that the program stored in the nonvolatile memory from the external terminal DBG via the debug circuit 70 is illegally used.

[半導体装置の動作例3]
本実施形態において、不揮発性メモリー20は、外部端子P01(第2の外部端子の一例)に所定の信号(例えば、ローレベルの信号)が入力された場合に、記憶している情報
を消去する。不揮発性メモリー20は、記憶している情報のうち、不正利用されたくないプログラムやデータのみを消去してもよいし、記憶しているすべての情報を消去してもよい。例えば、外部端子P01に所定の信号が入力された場合に、プロセッサー10が、割り込み処理によって、不揮発性メモリー20が記憶している情報を消去する制御を行ってもよい。
[Operation Example 3 of Semiconductor Device]
In the present embodiment, the nonvolatile memory 20 erases stored information when a predetermined signal (for example, a low level signal) is input to the external terminal P01 (an example of a second external terminal). . The non-volatile memory 20 may erase only the programs and data that are not desired to be used illegally from the stored information, or may erase all the stored information. For example, when a predetermined signal is input to the external terminal P01, the processor 10 may perform control to erase information stored in the nonvolatile memory 20 by interrupt processing.

例えば、ユーザーが、不揮発性メモリー20に記憶されているプログラムを書き換える目的などで、外部端子P01からの入力信号gpio_nをハイレベルからローレベルに変化させると、これによって不揮発性メモリー20に記憶されている情報が消去されるようにしてもよい。   For example, when the user changes the input signal gpio_n from the external terminal P01 from a high level to a low level for the purpose of rewriting a program stored in the nonvolatile memory 20, it is stored in the nonvolatile memory 20 accordingly. The existing information may be deleted.

また、半導体装置1のハイレベル又はローレベルに固定されるべき1又は複数の所定の外部端子(第2の外部端子の一例)のいずれかがハイレベルからローレベルに変化し、又はローレベルからハイレベルに変化した場合に不正なアクセスとみなして、プロセッサー10が不揮発性メモリー20に記憶されている情報を消去する制御を行ってもよい。   In addition, any one or a plurality of predetermined external terminals (an example of the second external terminal) to be fixed to the high level or the low level of the semiconductor device 1 changes from the high level to the low level, or from the low level. When the level is changed to a high level, it may be regarded as an unauthorized access, and the processor 10 may perform control to erase information stored in the nonvolatile memory 20.

不揮発性メモリー20は、例えば、消去対象の情報のすべてのビットを1にすることで消去し、すべてのビットが1のコードがNOP命令に割り当てられていてもよい。すなわち、消去された情報はすべてNOP命令になるようにしてもよい。   For example, the nonvolatile memory 20 may be erased by setting all bits of the information to be erased to 1, and a code having all the bits 1 may be assigned to the NOP instruction. That is, all erased information may be NOP instructions.

図6は、不揮発性メモリー20の情報が全消去される場合のタイミングチャートの一例を示す図である。図6でも、図5の例と同様に、時刻tにおいて、外部端子DBGを介してデバッグ要求信号dbgreqが入力されている。時刻tにおいてリセットが解除されると、マスク期間信号maskとデバッグイネーブル信号dbgenはともにハイレベルになっており、プロセッサー10は、時刻t以降、クロック信号clkの立ち上がりエッジに同期して図4の例のプログラムを実行する。ここで、プロセッサー10は、時刻t〜時刻tにおいてデバッグ端子無効命令を読み出して実行することで、デバッグイネーブル信号dbgenがハイレベルからローレベルに変化する。 FIG. 6 is a diagram illustrating an example of a timing chart when information in the nonvolatile memory 20 is completely erased. Also in FIG. 6, the debug request signal dbgreq is input via the external terminal DBG at time t 0 as in the example of FIG. When reset is at time t 1 is released, the mask period signal mask and debug enable signal dbgen has become both a high level, the processor 10, after time t 1, in synchronization with the rising edge of the clock signal clk 4 Run the example program. Here, the processor 10 reads and executes the debug terminal invalid instruction from time t 2 to time t 3 , whereby the debug enable signal dbgen changes from high level to low level.

その後、時刻tにおいて、マスク期間信号maskがローレベルに変化するが、デバッグイネーブル信号dbgenがローレベルであるため、デバッグ回路70がデバッグ要求信号dbgreqを受け取ることができず、外部端子DBGからデバッグ応答信号dbgackが出力されない。 Then, at time t 4, but the mask period signal mask is changed to the low level, since the debug enable signal dbgen is at a low level, it is not possible to debug circuitry 70 receives a debug request signal Dbgreq, debug from the external terminal DBG The response signal dbback is not output.

そして、時刻tにおいて、外部端子P01からの入力信号gpio_nがハイレベルからローレベルに変化すると、プロセッサー10は、時刻t〜時刻tにおいて、割り込み処理によって、不揮発性メモリー20に記憶されている情報を全消去する。 Then, at time t 5, when the input signal gpio_n from the external terminal P01 is changed from the high level to the low level, the processor 10 at time t 5 ~ time t 6, the interrupt processing, and stored in the nonvolatile memory 20 Delete all information.

その後、時刻tにおいて、リセット信号rst_nがハイレベルからローレベルに変化して半導体装置1に再びリセットがかかり、時刻tにおいて、外部端子DBGを介してデバッグ要求信号dbgreqが再び入力されている。そして、時刻tにおいてリセットが解除されると、マスク期間信号maskとデバッグイネーブル信号dbgenはともにハイレベルになり、プロセッサー10は、クロック信号clkの立ち上がりエッジに同期して不揮発性メモリー20の0x0000アドレスに配置されている命令、すなわち、ベクターフェッチ命令が消去されることにより変化したNOP命令(nop)を読み出して実行する。不揮発性メモリー20は全消去されたため、すべてのアドレスにNOP命令(nop)が配置されている状態となっており、プロセッサー10は、その後、NOP命令(nop)を繰り返し実行する。 Then, at time t 7, again is reset to the semiconductor device 1 changes from the reset signal rst_n the high level to the low level at time t 8, the debug request signal dbgreq via the external terminals DBG is entered again . When at time t 9 the reset is released, the mask period signal mask and debug enable signal dbgen are both high level, the processor 10, 0x0000 address of the nonvolatile memory 20 in synchronization with the rising edge of the clock signal clk And the NOP instruction (nop) changed by erasing the vector fetch instruction is read and executed. Since the nonvolatile memory 20 has been completely erased, the NOP instruction (nop) is placed at all addresses, and the processor 10 then repeatedly executes the NOP instruction (nop).

その後、時刻t10において、マスク期間信号maskがローレベルに変化し、デバッ
グイネーブル信号dbgenがハイレベルであるため、デバッグ回路70がデバッグ要求信号dbgreqを受け取り、外部端子DBGを介してデバッグ応答信号dbgackを出力する。
Then, at time t 10, the mask period signal mask is changed to the low level, since the debug enable signal dbgen is at a high level, the debug circuit 70 receives the debug request signal Dbgreq, debugging response signal dbgack through the external terminals DBG Is output.

このように、不揮発性メモリー20の情報を全消去した後(あるいは、不正利用されたくないプログラムやデータを消去した後)は、マスク期間信号maskがローレベルの期間にデバッグ端子無効命令が実行されないため、当該期間の経過後は、外部端子DBGからデバッグ回路70にアクセス可能となるが、不揮発性メモリー20には有益な情報が含まれていないため、不正利用のおそれを低減させることができる。   As described above, after the information in the nonvolatile memory 20 is completely erased (or after the program or data that is not to be illegally used is erased), the debug terminal invalid instruction is not executed while the mask period signal mask is at the low level. Therefore, after the period has elapsed, the debug circuit 70 can be accessed from the external terminal DBG. However, since the nonvolatile memory 20 does not contain useful information, the risk of unauthorized use can be reduced.

さらに、当該期間の経過後は、外部端子DBGからデバッグ回路70にアクセス可能となるため、外部端子DBGから不揮発性メモリー20の0x0000アドレスにベクターフェッチ命令を書き込み、かつ、リセットベクターのアドレス以降に、先頭付近にデバッグ端子無効命令が配置された新たなプログラムを書き込むことが可能となる。これにより、不正利用のおそれを低減させながらプログラムを書き換えることが可能となる。   Furthermore, since the debug circuit 70 can be accessed from the external terminal DBG after the period has elapsed, a vector fetch instruction is written from the external terminal DBG to the 0x0000 address of the nonvolatile memory 20, and after the reset vector address, It becomes possible to write a new program in which a debug terminal invalid instruction is arranged near the head. This makes it possible to rewrite the program while reducing the risk of unauthorized use.

なお、不揮発性メモリー20は、複数の記憶領域(例えば、セクターやブロック)を有するように構成され、外部端子P01あるいはその他の所定の外部端子に所定の信号が入力された場合に、記憶している情報を記憶領域ごとに消去し、デバッグ端子無効命令が記憶されている記憶領域の情報を最後に消去するのが好ましい。例えば、図7に示すように、不揮発性メモリー20が、16個のセクターを有し、セクター単位で情報の消去を行う場合において、デバッグ端子無効命令がセクター1に記憶されている場合には、セクター2〜セクター16の情報の消去がすべて終了した後、最後に、セクター1の情報を消去する。このようにすれば、仮に、不揮発性メモリー20に記憶されている情報の消去が最後まで完了せずに、プログラムやデータの一部が消去されなかった場合でも、デバッグ端子無効命令も消去されずに残る確率が高まるので、消去されなかったプログラムやデータが不正に利用されるおそれを低減させることができる。   The nonvolatile memory 20 is configured to have a plurality of storage areas (for example, sectors and blocks), and stores a predetermined signal when input to the external terminal P01 or other predetermined external terminal. Preferably, the stored information is erased for each storage area, and the information in the storage area in which the debug terminal invalid instruction is stored is erased last. For example, as shown in FIG. 7, when the nonvolatile memory 20 has 16 sectors and erases information on a sector basis, when a debug terminal invalid instruction is stored in the sector 1, After erasing all the information in the sectors 2 to 16, the information in the sector 1 is finally erased. In this way, even if the information stored in the nonvolatile memory 20 is not completely erased and the program or part of the data is not erased, the debug terminal invalid instruction is not erased. Therefore, it is possible to reduce the risk of unauthorized use of programs and data that have not been erased.

[半導体装置の動作例4]
本実施形態において、制御回路90は、プロセッサー10がデバッグ端子有効命令(第2の命令)を実行した場合に、外部端子DBGとデバッグ回路70とを電気的に接続するようにしてもよい。例えば、所定の外部端子に所定の信号が入力された場合に、プロセッサー10が、割り込み処理によってデバッグ端子有効命令を実行してもよい。例えば、外部端子P01からの入力信号gpio_nがハイレベルからローレベルに変化した場合に、プロセッサー10がデバッグ端子有効命令を実行してもよい。
[Operation Example 4 of Semiconductor Device]
In the present embodiment, the control circuit 90 may electrically connect the external terminal DBG and the debug circuit 70 when the processor 10 executes a debug terminal valid instruction (second instruction). For example, when a predetermined signal is input to a predetermined external terminal, the processor 10 may execute a debug terminal valid instruction by interrupt processing. For example, when the input signal gpio_n from the external terminal P01 changes from the high level to the low level, the processor 10 may execute the debug terminal valid instruction.

図8は、デバッグ端子有効命令が実行される場合のタイミングチャートの一例を示す図である。図8でも、図5の例と同様に、時刻tにおいて、外部端子DBGを介してデバッグ要求信号dbgreqが入力されている。時刻tにおいてリセットが解除されると、マスク期間信号maskとデバッグイネーブル信号dbgenはともにハイレベルになっており、プロセッサー10は、時刻t以降、クロック信号clkの立ち上がりエッジに同期して図4の例のプログラムを実行する。ここで、プロセッサー10は、時刻t〜時刻tにおいてデバッグ端子無効命令を読み出して実行することで、デバッグイネーブル信号dbgenがハイレベルからローレベルに変化する。 FIG. 8 is a diagram illustrating an example of a timing chart when the debug terminal valid instruction is executed. Also in FIG. 8, as in the example of FIG. 5, at time t 0, the debug request signal dbgreq via the external terminals DBG is input. When reset is at time t 1 is released, the mask period signal mask and debug enable signal dbgen has become both a high level, the processor 10, after time t 1, in synchronization with the rising edge of the clock signal clk 4 Run the example program. Here, the processor 10 reads and executes the debug terminal invalid instruction from time t 2 to time t 3 , whereby the debug enable signal dbgen changes from high level to low level.

その後、時刻tにおいて、マスク期間信号maskがローレベルに変化するが、デバッグイネーブル信号dbgenがローレベルであるため、デバッグ回路70がデバッグ要求信号dbgreqを受け取ることができず、外部端子DBGからデバッグ応答信号dbgackが出力されない。 Then, at time t 4, but the mask period signal mask is changed to the low level, since the debug enable signal dbgen is at a low level, it is not possible to debug circuitry 70 receives a debug request signal Dbgreq, debug from the external terminal DBG The response signal dbback is not output.

そして、時刻tにおいて、外部端子P01からの入力信号gpio_nがハイレベルからローレベルに変化すると、プロセッサー10は、時刻tにおいて、割り込み処理によって、デバッグ端子有効命令を実行する。これにより、時刻tにおいて、デバッグイネーブル信号dbgenがローレベルからハイレベルに変化し、デバッグ回路70がデバッグ要求信号dbgreqを受け取り、外部端子DBGを介してデバッグ応答信号dbgackを出力する。 Then, at time t 5, when the input signal gpio_n from the external terminal P01 is changed from the high level to the low level, the processor 10 At time t 5, the interrupt processing and executes the debug terminal valid instruction. Thus, at time t 6, the debug enable signal dbgen is changed from low level to high level, the debug circuit 70 receives the debug request signal Dbgreq, outputs a debug response signal dbgack through the external terminals DBG.

その後、デバッグ装置2は、デバッグ応答信号dbgackを受け取り、時刻tにおいて、デバッグ要求信号dbgreqを停止し、以降は、外部端子DBGを介して、デバッグ回路70にデバッグ指令を入力可能になる。 Then, the debugging apparatus 2 receives the debug response signal DBGACK, at time t 7, to stop the debug request signal Dbgreq, since, through the external terminals DBG, allows the input debug command to the debug circuitry 70.

例えば、所定の外部端子に所定の信号が入力された場合に外部端子DBGからデバッグ回路70にアクセス可能であるという情報を正規のユーザーのみに公開しておけば、不揮発性メモリー20に記憶されているプログラムやデータの不正利用のおそれを低減させることができる。また、正規のユーザーは、プログラムにデバッグ端子無効命令が実装された後であっても、プログラムのデバッグを行うことが可能となる。   For example, if information that the debug circuit 70 can be accessed from the external terminal DBG when a predetermined signal is input to a predetermined external terminal is disclosed to only an authorized user, the information is stored in the nonvolatile memory 20. The risk of unauthorized use of existing programs and data can be reduced. In addition, the authorized user can debug the program even after the debug terminal invalid instruction is installed in the program.

[効果]
以上に説明したように、第1実施形態の半導体装置1によれば、リセット解除からの所定期間は、マスク回路80によって外部端子DBGとデバッグ回路70との電気的な接続が切断され、外部端子DBGとデバッグ回路70との電気的な接続が切断されている当該所定期間において、プロセッサー10がデバッグ端子無効命令を実行することによって、制御回路90が、所定期間の経過後も外部端子DBGとデバッグ回路70との電気的な切断するように制御する。従って、外部端子DBGからデバッグ回路70を介して不揮発性メモリー20に記憶されているプログラムが不正に利用されるおそれを低減させることができる。
[effect]
As described above, according to the semiconductor device 1 of the first embodiment, the electrical connection between the external terminal DBG and the debug circuit 70 is disconnected by the mask circuit 80 during a predetermined period after the reset is released, and the external terminal In the predetermined period in which the electrical connection between the DBG and the debug circuit 70 is disconnected, the processor 10 executes the debug terminal invalid instruction, so that the control circuit 90 can debug the external terminal DBG and the debug even after the predetermined period has elapsed. Control is performed so that the circuit 70 is electrically disconnected. Therefore, it is possible to reduce the possibility that the program stored in the nonvolatile memory 20 from the external terminal DBG via the debug circuit 70 is illegally used.

また、第1実施形態の半導体装置1は、マスク回路80と制御回路90により外部端子DBGとデバッグ回路70との電気的な接続を切断するという簡易な構成で実現することができる。従って、第1実施形態の半導体装置1によれば、コストの増加を低減しながらプログラムの不正利用のおそれを低減させることができる。   The semiconductor device 1 according to the first embodiment can be realized with a simple configuration in which the electrical connection between the external terminal DBG and the debug circuit 70 is disconnected by the mask circuit 80 and the control circuit 90. Therefore, according to the semiconductor device 1 of the first embodiment, it is possible to reduce the risk of unauthorized use of the program while reducing the increase in cost.

また、第1実施形態の半導体装置1によれば、外部端子DBGとデバッグ回路70との電気的な接続が切断されている当該所定期間において、プロセッサー10がデバッグ端子無効命令を実行しないことによって、制御回路90が、所定期間の経過後は外部端子DBGとデバッグ回路70とを電気的に接続するように制御する。従って、外部端子DBGからデバッグ回路70を介して不揮発性メモリー20に記憶されているプログラムのデバッグを容易に行うことができる。   Further, according to the semiconductor device 1 of the first embodiment, the processor 10 does not execute the debug terminal invalid instruction in the predetermined period in which the electrical connection between the external terminal DBG and the debug circuit 70 is disconnected. The control circuit 90 controls the external terminal DBG and the debug circuit 70 to be electrically connected after the predetermined period has elapsed. Accordingly, the program stored in the nonvolatile memory 20 can be easily debugged from the external terminal DBG via the debug circuit 70.

また、第1実施形態の半導体装置1によれば、プログラムの先頭付近にデバッグ端子無効命令を配置するか否かによって、外部端子DBGとデバッグ回路70とを電気的に接続させるか否かを制御することができる。従って、ユーザー(例えば、プログラムの開発者)が、外部端子DBGの有効/無効を任意に設定することができる。例えば、半導体装置1のリセット解除から所定期間の経過後、外部端子DBGが有効になり、デバッグ装置2が外部端子DBGからプログラムの先頭付近にデバッグ端子無効命令を書き込み、その後、半導体装置1をリセットすると外部端子DBGを無効にすることができる。   Further, according to the semiconductor device 1 of the first embodiment, whether or not the external terminal DBG and the debug circuit 70 are electrically connected is controlled depending on whether or not the debug terminal invalid instruction is arranged near the head of the program. can do. Therefore, a user (for example, a program developer) can arbitrarily set validity / invalidity of the external terminal DBG. For example, the external terminal DBG becomes valid after a lapse of a predetermined period from the reset release of the semiconductor device 1, the debug device 2 writes a debug terminal invalid instruction from the external terminal DBG near the beginning of the program, and then resets the semiconductor device 1. Then, the external terminal DBG can be invalidated.

1−2.第2実施形態
図9は、第2実施形態の半導体装置の構成例を示す図である。図9において、図1と同様の構成要素には、同じ符号を付している。図9に示すように、第2実施形態の半導体装
置1は、プロセッサー10、不揮発性メモリー20、RAM30、リセット回路40、発振回路50、GPIO回路60、GPIO回路62、デバッグ回路70、マスク回路80、制御回路90及びこれらの要素が接続されるバス100を含んで構成されている。なお、本実施形態の半導体装置1は、これらの要素の一部を省略又は変更し、あるいは他の要素を追加した構成としてもよい。以下では、第2実施形態の半導体装置1について、第1実施形態の半導体装置1との相違点を中心に説明し、重複する説明については適宜省略又は簡略する。
1-2. Second Embodiment FIG. 9 is a diagram illustrating a configuration example of a semiconductor device according to a second embodiment. In FIG. 9, the same components as those in FIG. As shown in FIG. 9, the semiconductor device 1 according to the second embodiment includes a processor 10, a nonvolatile memory 20, a RAM 30, a reset circuit 40, an oscillation circuit 50, a GPIO circuit 60, a GPIO circuit 62, a debug circuit 70, and a mask circuit 80. The control circuit 90 and the bus 100 to which these elements are connected are configured. Note that the semiconductor device 1 of the present embodiment may have a configuration in which some of these elements are omitted or changed, or other elements are added. Hereinafter, the semiconductor device 1 of the second embodiment will be described focusing on the differences from the semiconductor device 1 of the first embodiment, and overlapping descriptions will be omitted or simplified as appropriate.

第2実施形態の半導体装置1は、第1実施形態の半導体装置1(図1)と比較すると、制御回路90の機能及びマスク回路80と制御回路90との接続関係が異なり、また、GPIO回路62が追加されている。さらに第1実施形態におけるデバッグ用の外部端子DBGは、デバッグ用の外部端子DBGと汎用入出力用の外部端子P00として兼用される外部端子DBG/P00に置き換わっている。   The semiconductor device 1 of the second embodiment differs from the semiconductor device 1 of the first embodiment (FIG. 1) in terms of the function of the control circuit 90 and the connection relationship between the mask circuit 80 and the control circuit 90, and the GPIO circuit. 62 is added. Furthermore, the external terminal DBG for debugging in the first embodiment is replaced with an external terminal DBG / P00 that is also used as an external terminal DBG for debugging and an external terminal P00 for general purpose input / output.

第2実施形態の半導体装置1は、第1実施形態の半導体装置1と同様に、外部端子P01や不図示の通信インターフェース用の外部端子(クロック端子やデータ端子等)を介してホストCPU3と通信可能に構成されている。また、第2実施形態の半導体装置1は、スイッチ4が切り替えられることにより、外部端子DBG/P00を介してデバッグ装置2(デバッガーを実行する装置)及びホストCPU3のいずれか一方と通信可能に構成されている。外部端子DBG/P00は、スイッチ4によりデバッグ装置2と電気的に接続される時はデバッグ用の外部端子DBGとして機能し、スイッチ4によりホストCPU3と電気的に接続される時は汎用入出力用の外部端子P00として機能する。   Similar to the semiconductor device 1 of the first embodiment, the semiconductor device 1 of the second embodiment communicates with the host CPU 3 via the external terminal P01 and an external terminal for communication interface (not shown) (clock terminal, data terminal, etc.). It is configured to be possible. Further, the semiconductor device 1 of the second embodiment is configured to be able to communicate with either the debug device 2 (device that executes the debugger) or the host CPU 3 via the external terminal DBG / P00 by switching the switch 4. Has been. The external terminal DBG / P00 functions as an external terminal DBG for debugging when electrically connected to the debug device 2 by the switch 4, and is used for general purpose input / output when electrically connected to the host CPU 3 by the switch 4. Functions as an external terminal P00.

GPIO回路62は、外部端子DBG/P00(第1の外部端子の一例)とプロセッサー10との間における信号の入出力インターフェース回路であり、外部端子DBG/P00から入力される信号をプロセッサー10に伝搬させ、あるいは、プロセッサー10が出力する所望の信号を外部端子DBG/P00に伝搬させる。   The GPIO circuit 62 is a signal input / output interface circuit between the external terminal DBG / P00 (an example of a first external terminal) and the processor 10, and propagates a signal input from the external terminal DBG / P00 to the processor 10. Alternatively, a desired signal output from the processor 10 is propagated to the external terminal DBG / P00.

マスク回路80は、リセット解除から所定期間、外部端子DBG/P00とデバッグ回路70との電気的な接続を切断する回路である。第2実施形態でも、マスク回路80は、この所定期間のみ、内部信号である不図示のマスク期間信号maskをハイレベルにする。そして、マスク回路80は、マスク期間信号maskがハイレベルの期間は、外部端子DBG/P00から入力されるデバッグ要求信号dbgreqやデバッグ指令を伝搬させず、リセット解除から所定期間経過後(マスク期間信号maskがローレベルになった後)は、デバッグ要求信号dbgreqやデバッグ指令を伝搬させる。これにより、本実施形態でも、少なくともリセット解除から所定期間は、外部端子DB/P00Gに入力される信号がすべて無効となり、外部端子DBG/P00からデバッグ回路70に対するアクセスができない。   The mask circuit 80 is a circuit that disconnects the electrical connection between the external terminal DBG / P00 and the debug circuit 70 for a predetermined period from the reset release. Also in the second embodiment, the mask circuit 80 sets an unillustrated mask period signal mask, which is an internal signal, to a high level only during this predetermined period. Then, the mask circuit 80 does not propagate the debug request signal dbgreq or the debug command input from the external terminal DBG / P00 while the mask period signal mask is at a high level, and after a predetermined period has passed since the reset release (mask period signal After the mask becomes low level, the debug request signal dbgreq and the debug command are propagated. Thereby, also in this embodiment, all signals input to the external terminal DB / P00G are invalidated at least for a predetermined period from reset cancellation, and the debug circuit 70 cannot be accessed from the external terminal DBG / P00.

制御回路90は、リセット解除から所定期間(マスク期間信号maskがハイレベルの期間)において、当該所定期間の経過後も外部端子DBG/P00とデバッグ回路70との電気的な接続を切断するか否かを制御する回路である。例えば、制御回路90は、リセット解除後、外部端子DBG/P00とマスク回路80とを電気的に接続し、かつ、外部端子DBG/P00とGPIO62との電気的な接続を切断する。そして、制御回路90は、所定期間(マスク期間信号maskがハイレベルの期間)において、プロセッサー10がプログラムに含まれるデバッグ端子無効命令(第1の命令の一例)を実行した場合に、外部端子DBG/P00とGPIO回路62とを電気的に接続し、かつ、外部端子DBG/P00とデバッグ回路70との電気的な接続を切断することにより、当該所定期間の経過後も、外部端子DBG/P00とデバッグ回路70との電気的な接続を切断してもよい。また、制御回路90は、当該所定期間において、プロセッサー10がデバッグ端子無
効命令を実行しなかった場合には、当該所定期間の経過後も、外部端子DBG/P00とマスク回路80とを電気的に接続し、かつ、外部端子DBG/P00とGPIO回路62との電気的な接続を切断することにより、外部端子DBG/P00とデバッグ回路70とを電気的に接続してもよい。
The control circuit 90 determines whether or not to disconnect the electrical connection between the external terminal DBG / P00 and the debug circuit 70 even after the predetermined period has elapsed in a predetermined period (period in which the mask period signal mask is at a high level) after reset is released. This is a circuit for controlling the above. For example, after the reset is released, the control circuit 90 electrically connects the external terminal DBG / P00 and the mask circuit 80 and disconnects the electrical connection between the external terminal DBG / P00 and the GPIO 62. When the processor 10 executes a debug terminal invalid instruction (an example of a first instruction) included in the program in a predetermined period (a period in which the mask period signal mask is at a high level), the control terminal 90 outputs the external terminal DBG. / P00 and the GPIO circuit 62 are electrically connected, and the external terminal DBG / P00 and the debug circuit 70 are disconnected, so that the external terminal DBG / P00 is maintained even after the predetermined period has elapsed. And the debug circuit 70 may be disconnected from the electrical connection. If the processor 10 does not execute the debug terminal invalid instruction in the predetermined period, the control circuit 90 electrically connects the external terminal DBG / P00 and the mask circuit 80 even after the predetermined period has elapsed. The external terminal DBG / P00 and the debug circuit 70 may be electrically connected by connecting and disconnecting the electrical connection between the external terminal DBG / P00 and the GPIO circuit 62.

本実施形態では、制御回路90は、端子制御回路94及びセレクター96を含んで構成されている。   In the present embodiment, the control circuit 90 includes a terminal control circuit 94 and a selector 96.

端子制御回路94は、第1実施形態(図1)と同様に、リセット解除後にデバッグイネーブル信号dbgenをハイレベルに設定し、プロセッサー10がリセット解除後の所定期間(マスク期間信号maskがハイレベルの期間)においてデバッグ端子無効命令を実行した場合に、これ以降、デバッグイネーブル信号dbgenをローレベルに固定する。   Similarly to the first embodiment (FIG. 1), the terminal control circuit 94 sets the debug enable signal dbgen to high level after reset release, and the processor 10 sets a predetermined period after the reset release (mask period signal mask is high level). Thereafter, the debug enable signal dbgen is fixed to the low level.

セレクター96は、端子制御回路94からのデバッグイネーブル信号dbgenに応じて、外部端子DBG/P00とデバッグ回路70及びGPIO回路62のうちの一方とを電気的に接続し、外部端子DBG/P00とデバッグ回路70及びGPIO回路62のうちの他方との電気的な接続を切断する回路である。   The selector 96 electrically connects the external terminal DBG / P00 and one of the debug circuit 70 and the GPIO circuit 62 in response to the debug enable signal dbgen from the terminal control circuit 94, and debugs the external terminal DBG / P00. It is a circuit that disconnects electrical connection with the other of the circuit 70 and the GPIO circuit 62.

例えば、セレクター96は、デバッグイネーブル信号dbgenがハイレベルの時は、外部端子DBG/P00からの入力信号(例えば、デバッグ要求信号dbgreqやデバッグ指令)をマスク回路80に伝搬させ、あるいは、マスク回路80の出力信号(デバッグ回路70の出力信号(例えば、デバッグ応答信号dbgack))を外部端子DBG/P00に伝搬させる。また、セレクター96は、デバッグイネーブル信号dbgenがローレベルの時は、外部端子DBG/P00からの入力信号をGPIO回路62に伝搬させ、あるいは、GPIO回路62の出力信号を外部端子DBG/P00に伝搬させる。   For example, when the debug enable signal dbgen is at a high level, the selector 96 propagates an input signal (for example, a debug request signal dbgreq or a debug command) from the external terminal DBG / P00 to the mask circuit 80, or Output signal (the output signal of the debug circuit 70 (eg, debug response signal dbback)) is propagated to the external terminal DBG / P00. Further, when the debug enable signal dbgen is at a low level, the selector 96 propagates the input signal from the external terminal DBG / P00 to the GPIO circuit 62 or propagates the output signal of the GPIO circuit 62 to the external terminal DBG / P00. Let

第2実施形態の半導体装置1におけるその他の構成及び機能は、第1実施形態の半導体装置1と同様であるため、その説明を省略する。また、第2実施形態の半導体装置1の動作例は、例えば、第1実施形態で例示した動作例1〜4(図2〜図7)と同様であってもよいため、その図示及び説明を省略する。   Other configurations and functions of the semiconductor device 1 according to the second embodiment are the same as those of the semiconductor device 1 according to the first embodiment, and thus description thereof is omitted. Further, since the operation example of the semiconductor device 1 of the second embodiment may be the same as the operation examples 1 to 4 (FIGS. 2 to 7) illustrated in the first embodiment, for example, the illustration and description thereof will be omitted. Omitted.

このように構成された第2実施形態の半導体装置1によれば、プロセッサー10がリセット解除後の所定期間にデバッグ端子無効命令を実行しなければ、当該所定期間の経過後は外部端子DBG/P00からデバッグ回路70に対するアクセスが可能になる。従って、不揮発性メモリー20に記憶されるプログラムやデータのデバッグが可能となる。   According to the semiconductor device 1 of the second embodiment configured as described above, if the processor 10 does not execute the debug terminal invalid instruction in a predetermined period after reset release, the external terminal DBG / P00 is passed after the predetermined period has elapsed. Thus, the debug circuit 70 can be accessed. Therefore, it is possible to debug programs and data stored in the nonvolatile memory 20.

一方、プロセッサー10がリセット解除後の所定期間にデバッグ端子無効命令を実行した場合は、当該所定期間の経過後も外部端子DBG/P00からデバッグ回路70に対するアクセスができなくなる。従って、不揮発性メモリー20に記憶されるプログラムやデータのデバッグが完了した後は、例えば、当該プログラムの先頭付近においてデバッグ端子無効命令を追加し、又は置き換えることにより、外部端子DBG/P00からデバッグ回路70に対するアクセスができなくなり、デバッグ回路70を介したプログラムやデータの不正利用のおそれを低減させることができる。   On the other hand, when the processor 10 executes the debug terminal invalid instruction during a predetermined period after the reset is released, the debug circuit 70 cannot be accessed from the external terminal DBG / P00 even after the predetermined period has elapsed. Therefore, after the debugging of the program and data stored in the nonvolatile memory 20 is completed, for example, by adding or replacing the debug terminal invalid instruction in the vicinity of the head of the program, the debug circuit is connected from the external terminal DBG / P00. 70 becomes inaccessible, and the possibility of unauthorized use of programs and data via the debug circuit 70 can be reduced.

さらに、第2実施形態の半導体装置1によれば、1つの外部端子DBG/P00をデバッグ用の外部端子DBGと汎用入出力用の外部端子P00として兼用するので、外部端子数に制限がある場合にも適用することができる。   Furthermore, according to the semiconductor device 1 of the second embodiment, since one external terminal DBG / P00 is used as both the debugging external terminal DBG and the general-purpose input / output external terminal P00, the number of external terminals is limited. It can also be applied to.

1−3.第3実施形態
図10は、第3実施形態の半導体装置の構成例を示す図である。図10において、図1
と同様の構成要素には、同じ符号を付している。図10に示すように、第3実施形態の半導体装置1は、プロセッサー10、不揮発性メモリー20、RAM30、リセット回路40、発振回路50、GPIO回路60、テスト回路72、マスク回路80、制御回路90及びこれらの要素が接続されるバス100を含んで構成されている。なお、本実施形態の半導体装置1は、これらの要素の一部を省略又は変更し、あるいは他の要素を追加した構成としてもよい。以下では、第3実施形態の半導体装置1について、第1実施形態の半導体装置1との相違点を中心に説明し、重複する説明については適宜省略又は簡略する。
1-3. Third Embodiment FIG. 10 is a diagram illustrating a configuration example of a semiconductor device according to a third embodiment. In FIG. 10, FIG.
Constituent elements similar to those in FIG. As shown in FIG. 10, the semiconductor device 1 according to the third embodiment includes a processor 10, a nonvolatile memory 20, a RAM 30, a reset circuit 40, an oscillation circuit 50, a GPIO circuit 60, a test circuit 72, a mask circuit 80, and a control circuit 90. And a bus 100 to which these elements are connected. Note that the semiconductor device 1 of the present embodiment may have a configuration in which some of these elements are omitted or changed, or other elements are added. Hereinafter, the semiconductor device 1 of the third embodiment will be described focusing on the differences from the semiconductor device 1 of the first embodiment, and overlapping descriptions will be omitted or simplified as appropriate.

第3実施形態の半導体装置1は、第1実施形態の半導体装置1(図1)と比較すると、デバッグ回路70がテスト回路72に置き換わっており、また、マスク回路80及び制御回路90の機能が異なる。   In the semiconductor device 1 of the third embodiment, the debug circuit 70 is replaced with the test circuit 72 and the functions of the mask circuit 80 and the control circuit 90 are compared with the semiconductor device 1 (FIG. 1) of the first embodiment. Different.

第3実施形態の半導体装置1は、第1実施形態の半導体装置1と同様に、外部端子P01や不図示の通信インターフェース用の外部端子(クロック端子やデータ端子等)を介してホストCPU3と通信可能に構成されている。また、半導体装置1は、外部端子TSTを介して検査装置5と通信可能に構成されている。   Similar to the semiconductor device 1 of the first embodiment, the semiconductor device 1 of the third embodiment communicates with the host CPU 3 via the external terminal P01 and an external terminal for a communication interface (not shown) (clock terminal, data terminal, etc.). It is configured to be possible. The semiconductor device 1 is configured to be able to communicate with the inspection device 5 via the external terminal TST.

テスト回路72は、半導体装置1に含まれる各回路が設計通りに動作するか否かをテストするための検査回路である。すなわち、外部端子TST(第1の外部端子の一例)は、半導体装置1の検査に使用される外部端子であり、検査装置5は、外部端子TSTを介してテスト回路72にアクセスすることで半導体装置1の検査を実行うことができる。具体的には、検査装置5は、外部端子TSTを介してテスト回路72にテスト指令(各回路の動作をテストする指令)を送信し、テスト回路72はテスト指令に応じたテスト処理を行う。そして、テスト回路72は、外部端子TSTを介して、テスト指令に応じたテスト結果を検査装置5に送信する。   The test circuit 72 is an inspection circuit for testing whether or not each circuit included in the semiconductor device 1 operates as designed. That is, the external terminal TST (an example of the first external terminal) is an external terminal used for the inspection of the semiconductor device 1, and the inspection device 5 accesses the test circuit 72 via the external terminal TST, and thus the semiconductor. An inspection of the device 1 can be performed. Specifically, the inspection device 5 transmits a test command (command for testing the operation of each circuit) to the test circuit 72 via the external terminal TST, and the test circuit 72 performs a test process according to the test command. Then, the test circuit 72 transmits a test result corresponding to the test command to the inspection device 5 via the external terminal TST.

マスク回路80は、リセット解除から所定期間、外部端子TSTとテスト回路72との電気的な接続を切断する回路である。第3実施形態でも、マスク回路80は、この所定期間のみ、内部信号である不図示のマスク期間信号maskをハイレベルにする。そして、マスク回路80は、マスク期間信号maskがハイレベルの期間は、外部端子TSTから入力されるテスト指令を伝搬させず、リセット解除から所定期間経過後(マスク期間信号maskがローレベルになった後)は、テスト指令を伝搬させる。これにより、本実施形態では、少なくともリセット解除から所定期間は、外部端子TSTに入力される信号がすべて無効となり、外部端子TSTからテスト回路72に対するアクセスができない。   The mask circuit 80 is a circuit that disconnects the electrical connection between the external terminal TST and the test circuit 72 for a predetermined period from the reset release. Also in the third embodiment, the mask circuit 80 sets an unillustrated mask period signal mask, which is an internal signal, to a high level only during this predetermined period. Then, the mask circuit 80 does not propagate the test command input from the external terminal TST while the mask period signal mask is in the high level, and after a predetermined period has elapsed since the reset was released (the mask period signal mask became low level). After), the test command is propagated. As a result, in this embodiment, all signals input to the external terminal TST are invalidated at least for a predetermined period from reset cancellation, and the test circuit 72 cannot be accessed from the external terminal TST.

制御回路90は、リセット解除から所定期間(マスク期間信号maskがハイレベルの期間)において、当該所定期間の経過後も外部端子TSTとテスト回路72との電気的な接続を切断するか否かを制御する回路である。例えば、制御回路90は、所定期間(マスク期間信号maskがハイレベルの期間)において、プロセッサー10がプログラムに含まれるテスト端子無効命令(第1の命令の一例)を実行した場合に、当該所定期間の経過後も外部端子TSTとテスト回路72との電気的な接続を切断してもよい。また、制御回路90は、当該所定期間において、プロセッサー10がテスト端子無効命令を実行しなかった場合には、当該所定期間の経過後、外部端子TSTとテスト回路72とを電気的に接続するようにしてもよい。リセット解除からの所定期間(マスク期間信号maskがハイレベルの期間)は、プロセッサー10がテスト端子無効命令を実行するのに要する時間よりも長く設定される。   The control circuit 90 determines whether or not to disconnect the electrical connection between the external terminal TST and the test circuit 72 even after the predetermined period elapses in a predetermined period (period in which the mask period signal mask is high level) after reset is released. It is a circuit to control. For example, when the processor 10 executes a test terminal invalid instruction (an example of a first instruction) included in the program in a predetermined period (a period in which the mask period signal mask is high level), the predetermined period After the elapse of time, the electrical connection between the external terminal TST and the test circuit 72 may be disconnected. In addition, when the processor 10 does not execute the test terminal invalid instruction during the predetermined period, the control circuit 90 electrically connects the external terminal TST and the test circuit 72 after the predetermined period has elapsed. It may be. A predetermined period after the reset is released (a period in which the mask period signal “mask” is at a high level) is set longer than the time required for the processor 10 to execute the test terminal invalid instruction.

第3実施形態でも、第1実施形態と同様に、制御回路90は、スイッチ回路92及び端子制御回路94を含んで構成されている。   Also in the third embodiment, the control circuit 90 includes a switch circuit 92 and a terminal control circuit 94 as in the first embodiment.

スイッチ回路92は、端子制御回路94からのテストイネーブル信号tstenがハイレベルの時は、マスク回路80の出力信号(例えば、テスト指令)をテスト回路72に伝搬させ、あるいは、テスト回路72の出力信号(例えば、テスト結果)をマスク回路80に伝搬させる。また、スイッチ回路92は、テストイネーブル信号tstenがローレベルの時は、マスク回路80の出力信号をテスト回路72に伝搬させず、かつ、テスト回路72の出力信号をマスク回路80に伝搬させない。   When the test enable signal tsten from the terminal control circuit 94 is at a high level, the switch circuit 92 propagates the output signal (for example, a test command) of the mask circuit 80 to the test circuit 72 or the output signal of the test circuit 72 (For example, a test result) is propagated to the mask circuit 80. The switch circuit 92 does not propagate the output signal of the mask circuit 80 to the test circuit 72 and does not propagate the output signal of the test circuit 72 to the mask circuit 80 when the test enable signal tsten is at a low level.

端子制御回路94は、リセット解除後にテストイネーブル信号tstenをハイレベルに設定し、プロセッサー10がリセット解除後の所定期間(マスク期間信号maskがハイレベルの期間)においてテスト端子無効命令を実行した場合に、これ以降、テストイネーブル信号tstenをローレベルに固定する。例えば、端子制御回路94は、テストイネーブル信号tstenに対応するテストイネーブルビット(初期値は1)を含むレジスタ(不図示)を備え、テスト端子無効命令は、このテストイネーブルビットを0に設定するロード命令であってもよい。   The terminal control circuit 94 sets the test enable signal tsten to the high level after the reset is released, and the processor 10 executes the test terminal invalid instruction in a predetermined period after the reset is released (the period in which the mask period signal mask is at the high level). Thereafter, the test enable signal tsten is fixed at a low level. For example, the terminal control circuit 94 includes a register (not shown) including a test enable bit (initial value is 1) corresponding to the test enable signal tsten, and the test terminal invalid instruction is a load that sets this test enable bit to 0. It may be an instruction.

第3実施形態の半導体装置1におけるその他の構成及び機能は、第1実施形態の半導体装置1と同様であるため、その説明を省略する。また、第3実施形態の半導体装置1の動作例は、例えば、第3実施形態で例示した動作例1〜4(図2〜図7)において、「デバッグ端子無効命令」を「テスト端子無効命令」に、「デバッグイネーブル信号dbgen」を「テストイネーブル信号tsten」に、「デバッグ要求信号dbgreq」や「デバッグ指令」をテスト指令に、「デバッグ応答信号dbgack」を「テスト結果」に、「デバッグ端子有効命令」を「テスト端子有効命令」に、それぞれ置き換えたものと同様であってもよいため、その図示及び説明を省略する。   Other configurations and functions of the semiconductor device 1 according to the third embodiment are the same as those of the semiconductor device 1 according to the first embodiment, and thus description thereof is omitted. Further, the operation example of the semiconductor device 1 of the third embodiment is, for example, in the operation examples 1 to 4 (FIGS. 2 to 7) illustrated in the third embodiment, the “debug terminal invalid instruction” is changed to the “test terminal invalid instruction”. ”,“ Debug enable signal dbgen ”as“ test enable signal tsten ”,“ debug request signal dbgreq ”or“ debug command ”as test command,“ debug response signal dbgack ”as“ test result ”,“ debug terminal ” Since the “valid command” may be the same as the “test terminal valid command” respectively replaced, illustration and description thereof will be omitted.

このように構成された第3実施形態の半導体装置1によれば、プロセッサー10がリセット解除後の所定期間にテスト端子無効命令を実行しなければ、当該所定期間の経過後は外部端子TSTからテスト回路72に対するアクセスが可能になる。半導体装置1の検査が可能となる。   According to the semiconductor device 1 of the third embodiment configured as described above, if the processor 10 does not execute the test terminal invalid command in a predetermined period after the reset is released, the test is performed from the external terminal TST after the predetermined period has elapsed. Access to the circuit 72 becomes possible. The semiconductor device 1 can be inspected.

一方、プロセッサー10がリセット解除後の所定期間にテスト端子無効命令を実行した場合は、当該所定期間の経過後も外部端子TSTからテスト回路72に対するアクセスができなくなる。従って、半導体装置1の検査が終了した後は、例えば、不揮発性メモリー20に記憶されるプログラムの先頭付近においてテスト端子無効命令を追加し、又は置き換えることにより、外部端子TSTからテスト回路72に対するアクセスができなくなり、テスト回路72の不正利用(意図しない使用も含む)のおそれを低減させることができる。   On the other hand, when the processor 10 executes the test terminal invalid instruction in a predetermined period after reset is released, the test circuit 72 cannot be accessed from the external terminal TST even after the predetermined period has elapsed. Therefore, after the inspection of the semiconductor device 1 is completed, for example, an access to the test circuit 72 from the external terminal TST is performed by adding or replacing a test terminal invalid instruction near the beginning of the program stored in the nonvolatile memory 20. The possibility of unauthorized use (including unintended use) of the test circuit 72 can be reduced.

その他、第3実施形態の半導体装置1によれば、第1実施形態の半導体装置1と同様の効果を奏することができる。   In addition, according to the semiconductor device 1 of the third embodiment, the same effects as the semiconductor device 1 of the first embodiment can be obtained.

2.電子機器
図11は、本実施形態の電子機器の構成の一例を示す機能ブロック図である。また、図12(A)は、本実施形態の電子機器の一例であるスマートフォンの外観の一例を示す図であり、図12(B)は、本実施形態の電子機器の一例である電子時計の外観の一例を示す図である。
2. Electronic Device FIG. 11 is a functional block diagram showing an example of the configuration of the electronic device of the present embodiment. FIG. 12A is a diagram illustrating an example of the appearance of a smartphone that is an example of the electronic device of the present embodiment, and FIG. 12B is a diagram of an electronic timepiece that is an example of the electronic device of the present embodiment. It is a figure which shows an example of an external appearance.

本実施形態の電子機器300は、半導体装置310、電源生成部320、操作部330、CPU(Central Processing Unit)340、通信部350、表示部360及び音出力部370を含んで構成されている。なお、本実施形態の電子機器は、図11の構成要素(各部)の一部を省略又は変更し、あるいは、他の構成要素を付加した構成としてもよい。   The electronic device 300 according to this embodiment includes a semiconductor device 310, a power generation unit 320, an operation unit 330, a CPU (Central Processing Unit) 340, a communication unit 350, a display unit 360, and a sound output unit 370. Note that the electronic device of the present embodiment may have a configuration in which some of the components (each unit) in FIG. 11 are omitted or changed, or other components are added.

電源生成部320は、電子機器300で使用される各種電源を生成するためのものである。   The power generation unit 320 is for generating various power sources used in the electronic device 300.

操作部330は、操作キーやボタンスイッチ等により構成される入力装置であり、ユーザーによる操作に応じた操作信号を半導体装置310あるいはCPU340に出力する。   The operation unit 330 is an input device including operation keys, button switches, and the like, and outputs an operation signal corresponding to an operation by a user to the semiconductor device 310 or the CPU 340.

CPU340は、各種の計算処理や制御処理を行うものであり、例えば、上記の各実施形態におけるホストCPU3であってもよい。   The CPU 340 performs various types of calculation processing and control processing, and may be, for example, the host CPU 3 in each of the above embodiments.

通信部350は、半導体装置310と外部装置との間のデータ通信を成立させるための各種制御を行う。   The communication unit 350 performs various controls for establishing data communication between the semiconductor device 310 and an external device.

表示部360は、LCD(Liquid Crystal Display)等により構成される表示装置であり、半導体装置310あるいはCPU340から入力される表示信号に基づいて各種の情報を表示する。表示部360には操作部330として機能するタッチパネルが設けられていてもよい。   The display unit 360 is a display device configured by an LCD (Liquid Crystal Display) or the like, and displays various types of information based on display signals input from the semiconductor device 310 or the CPU 340. The display unit 360 may be provided with a touch panel that functions as the operation unit 330.

音出力部370は、半導体装置310あるいはCPU340から入力される音信号に基づいて各種の音(音声を含む)を出力するためのものであり、例えば、スピーカーやブザー等により構成される。   The sound output unit 370 is for outputting various sounds (including sound) based on a sound signal input from the semiconductor device 310 or the CPU 340, and is configured by, for example, a speaker or a buzzer.

半導体装置310は、操作部330からの操作信号に応じた各種の処理、CPU340とのデータ通信に基づく各種の処理、通信部350を介して外部装置との間で行うデータ通信処理、表示部360に各種の情報を表示させるための表示信号を生成する処理、音出力部370に各種の音を出力させるための音出力信号を生成する処理等を行う。半導体装置310は、例えば、MCUであってもよい。   The semiconductor device 310 includes various processes according to operation signals from the operation unit 330, various processes based on data communication with the CPU 340, data communication processes performed with an external device via the communication unit 350, and a display unit 360. A process for generating a display signal for displaying various types of information on the screen, a process for generating a sound output signal for causing the sound output unit 370 to output various types of sound, and the like are performed. The semiconductor device 310 may be an MCU, for example.

半導体装置310として例えば上述した各実施形態の半導体装置1を適用することにより、不正利用のおそれを低減させた信頼性の高い電子機器を実現することができる。   By applying, for example, the semiconductor device 1 of each embodiment described above as the semiconductor device 310, it is possible to realize a highly reliable electronic device with reduced risk of unauthorized use.

このような電子機器300としては種々の電子機器が考えられ、例えば、パーソナルコンピューター(例えば、モバイル型パーソナルコンピューター、ラップトップ型パーソナルコンピューター、タブレット型パーソナルコンピューター)、スマートフォンや携帯電話機などの移動体端末、ディジタルスチールカメラ、インクジェット式吐出装置(例えば、インクジェットプリンター)、ルーターやスイッチなどのストレージエリアネットワーク機器、ローカルエリアネットワーク機器、移動体端末基地局用機器、テレビ、ビデオカメラ、ビデオレコーダー、カーナビゲーション装置、電子時計、リアルタイムクロック装置、ページャー、電子手帳(通信機能付も含む)、電子辞書、電卓、電子ゲーム機器、ゲーム用コントローラー、ワードプロセッサー、ワークステーション、テレビ電話、防犯用テレビモニター、電子双眼鏡、POS端末、医療機器(例えば電子体温計、血圧計、血糖計、心電図計測装置、超音波診断装置、電子内視鏡)、魚群探知機、各種測定機器、計器類(例えば、車両、航空機、船舶の計器類)、フライトシミュレーター、ヘッドマウントディスプレイ、モーショントレース、モーショントラッキング、モーションコントローラー、PDR(歩行者位置方位計測)等が挙げられる。   Various electronic devices can be considered as such an electronic device 300, for example, a personal computer (for example, a mobile personal computer, a laptop personal computer, a tablet personal computer), a mobile terminal such as a smartphone or a mobile phone, Digital still cameras, inkjet discharge devices (for example, inkjet printers), storage area network devices such as routers and switches, local area network devices, mobile terminal base station devices, televisions, video cameras, video recorders, car navigation devices, Electronic clock, real-time clock device, pager, electronic notebook (including communication function), electronic dictionary, calculator, electronic game device, game controller, word Processor, workstation, video phone, TV monitor for crime prevention, electronic binoculars, POS terminal, medical equipment (for example, electronic thermometer, blood pressure monitor, blood glucose meter, electrocardiogram measuring device, ultrasonic diagnostic device, electronic endoscope), fish finder , Various measuring devices, instruments (for example, vehicles, aircraft, ships), flight simulators, head mounted displays, motion traces, motion tracking, motion controllers, PDR (pedestrian position direction measurement), and the like.

本発明は本実施形態に限定されず、本発明の要旨の範囲内で種々の変形実施が可能である。   The present invention is not limited to the present embodiment, and various modifications can be made within the scope of the gist of the present invention.

例えば、上記の第3実施形態の半導体装置1は、テスト回路72の不正利用からの保護
を可能とするように、第1実施形態の半導体装置1を変形したものであったが、本発明は、テスト回路72の不正利用からの保護を可能とするように、第1実施形態の半導体装置1を第3実施形態の半導体装置1に変形したのと同様の方法により、第2実施形態の半導体装置1を変形した半導体装置にも適用することができる。
For example, the semiconductor device 1 according to the third embodiment is a modification of the semiconductor device 1 according to the first embodiment so that the test circuit 72 can be protected from unauthorized use. The semiconductor device according to the second embodiment is obtained by a method similar to that in which the semiconductor device 1 according to the first embodiment is transformed into the semiconductor device 1 according to the third embodiment so that the test circuit 72 can be protected from unauthorized use. The present invention can also be applied to a semiconductor device in which the device 1 is modified.

上述した実施形態および変形例は一例であって、これらに限定されるわけではない。例えば、各実施形態および各変形例を適宜組み合わせることも可能である。   The above-described embodiments and modifications are merely examples, and the present invention is not limited to these. For example, it is possible to appropriately combine each embodiment and each modification.

本発明は、実施の形態で説明した構成と実質的に同一の構成(例えば、機能、方法及び結果が同一の構成、あるいは目的及び効果が同一の構成)を含む。また、本発明は、実施の形態で説明した構成の本質的でない部分を置き換えた構成を含む。また、本発明は、実施の形態で説明した構成と同一の作用効果を奏する構成又は同一の目的を達成することができる構成を含む。また、本発明は、実施の形態で説明した構成に公知技術を付加した構成を含む。   The present invention includes configurations that are substantially the same as the configurations described in the embodiments (for example, configurations that have the same functions, methods, and results, or configurations that have the same objects and effects). In addition, the invention includes a configuration in which a non-essential part of the configuration described in the embodiment is replaced. In addition, the present invention includes a configuration that exhibits the same operational effects as the configuration described in the embodiment or a configuration that can achieve the same object. Further, the invention includes a configuration in which a known technique is added to the configuration described in the embodiment.

1 半導体装置、2 デバッグ装置、3 ホストCPU、4 スイッチ、5 検査装置、10 プロセッサー、20 不揮発性メモリー、30 RAM、40 リセット回路、50 発振回路、60 GPIO回路、62 GPIO回路、70 デバッグ回路、72 テスト回路、80 マスク回路、90 制御回路、92 スイッチ回路、94 端子制御回路、96 セレクター、100 バス、300 電子機器、310 半導体装置、320 電源生成部、330 操作部、340 CPU、350 通信部、360 表示部、370 音出力部 DESCRIPTION OF SYMBOLS 1 Semiconductor device, 2 Debugging device, 3 Host CPU, 4 Switch, 5 Inspection device, 10 Processor, 20 Non-volatile memory, 30 RAM, 40 Reset circuit, 50 Oscillation circuit, 60 GPIO circuit, 62 GPIO circuit, 70 Debug circuit, 72 test circuit, 80 mask circuit, 90 control circuit, 92 switch circuit, 94 terminal control circuit, 96 selector, 100 bus, 300 electronic device, 310 semiconductor device, 320 power generation unit, 330 operation unit, 340 CPU, 350 communication unit 360 display unit, 370 sound output unit

Claims (6)

不揮発性メモリーと、
前記不揮発性メモリーに記憶されているプログラムを実行するプロセッサーと、
前記プログラムのデバッグ機能を備えたデバッグ回路と、
前記プログラムのデバッグに使用される第1の外部端子と、
第2の外部端子と、
リセット解除から所定期間、前記第1の外部端子と前記デバッグ回路との電気的な接続を切断するマスク回路と、
前記所定期間において、前記所定期間の経過後も前記第1の外部端子と前記デバッグ回路との電気的な接続を切断するか否かを制御する制御回路と、を含み、
前記制御回路は、
前記所定期間において、前記プロセッサーが前記プログラムに含まれる第1の命令を実行した場合に、前記所定期間の経過後も前記第1の外部端子と前記デバッグ回路との電気的な接続を切断し、
前記不揮発性メモリーは、
複数の記憶領域を有し、
前記第2の外部端子に所定の信号が入力された場合に、記憶している情報を前記記憶領域ごとに消去し、前記第1の命令が記憶されている前記記憶領域の情報を最後に消去する、半導体装置。
Non-volatile memory,
A processor for executing a program stored in the nonvolatile memory;
A debugging circuit having a debugging function of the program;
A first external terminal used for debugging the program;
A second external terminal;
A mask circuit for disconnecting the electrical connection between the first external terminal and the debug circuit for a predetermined period from reset release;
Wherein the predetermined period, see contains a control circuit for controlling whether or not to disconnect after also with the first external terminal electrical connection between the debug circuit of the predetermined period,
The control circuit includes:
In the predetermined period, when the processor executes a first instruction included in the program, the electrical connection between the first external terminal and the debug circuit is disconnected even after the predetermined period has elapsed,
The nonvolatile memory is
A plurality of storage areas;
When a predetermined signal is input to the second external terminal, the stored information is erased for each storage area, and the information in the storage area in which the first instruction is stored is erased last. A semiconductor device.
前記第1の外部端子と前記プロセッサーとの間における信号の入出力インターフェース回路をさらに含み、
前記制御回路は、
前記所定期間において、前記プロセッサーが前記第1の命令を実行した場合に、前記第1の外部端子と前記入出力インターフェース回路とを電気的に接続する、請求項に記載の半導体装置。
A signal input / output interface circuit between the first external terminal and the processor;
The control circuit includes:
Wherein the predetermined period, when the processor executes the first instruction, electrically connecting the first external terminal and the input-output interface circuit, a semiconductor device according to claim 1.
前記所定期間は、前記プロセッサーが前記第1の命令を実行するのに要する時間よりも長い、請求項1又は2に記載の半導体装置。 The predetermined period, the longer than the time required to execute the first instruction processor, a semiconductor device according to claim 1 or 2. 前記制御回路は、
前記プロセッサーが第2の命令を実行した場合に、前記第1の外部端子と前記デバッグ回路とを電気的に接続する、請求項1乃至のいずれか一項に記載の半導体装置。
The control circuit includes:
When the processor executes the second instruction, the first electrically connecting the external terminal and the debug circuit, a semiconductor device according to any one of claims 1 to 3.
不揮発性メモリーと、
前記不揮発性メモリーに記憶されているプログラムを実行するプロセッサーと、
検査回路と、
検査に使用される第1の外部端子と、
第2の外部端子と、
リセット解除から所定期間、前記第1の外部端子と前記検査回路との電気的な接続を切断するマスク回路と、
前記所定期間において、前記所定期間の経過後も前記第1の外部端子と前記検査回路との電気的な接続を切断するか否かを制御する制御回路と、を含み、
前記制御回路は、
前記所定期間において、前記プロセッサーが前記プログラムに含まれる第1の命令を実行した場合に、前記所定期間の経過後も前記第1の外部端子と前記検査回路との電気的な接続を切断し、
前記不揮発性メモリーは、
複数の記憶領域を有し、
前記第2の外部端子に所定の信号が入力された場合に、記憶している情報を前記記憶領域ごとに消去し、前記第1の命令が記憶されている前記記憶領域の情報を最後に消去する、半導体装置。
Non-volatile memory,
A processor for executing a program stored in the nonvolatile memory;
An inspection circuit;
A first external terminal used for inspection;
A second external terminal;
A mask circuit for disconnecting the electrical connection between the first external terminal and the inspection circuit for a predetermined period from reset release;
Wherein the predetermined period, see contains a control circuit for controlling whether or not to disconnect after also with the first external terminal electrically connected with the inspection circuit of the predetermined period,
The control circuit includes:
In the predetermined period, when the processor executes a first instruction included in the program, the electrical connection between the first external terminal and the inspection circuit is disconnected even after the predetermined period has elapsed,
The nonvolatile memory is
A plurality of storage areas;
When a predetermined signal is input to the second external terminal, the stored information is erased for each storage area, and the information in the storage area in which the first instruction is stored is erased last. A semiconductor device.
請求項1乃至のいずれか一項に記載の半導体装置を備えた、電子機器。 Comprising the semiconductor device according to any one of claims 1 to 5, electronic apparatus.
JP2014206361A 2014-10-07 2014-10-07 Semiconductor device and electronic equipment Active JP6390840B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2014206361A JP6390840B2 (en) 2014-10-07 2014-10-07 Semiconductor device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2014206361A JP6390840B2 (en) 2014-10-07 2014-10-07 Semiconductor device and electronic equipment

Publications (2)

Publication Number Publication Date
JP2016076106A JP2016076106A (en) 2016-05-12
JP6390840B2 true JP6390840B2 (en) 2018-09-19

Family

ID=55949967

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2014206361A Active JP6390840B2 (en) 2014-10-07 2014-10-07 Semiconductor device and electronic equipment

Country Status (1)

Country Link
JP (1) JP6390840B2 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11256605B2 (en) 2017-10-19 2022-02-22 Samsung Electronics Co., Ltd. Nonvolatile memory device
KR102396448B1 (en) * 2017-10-19 2022-05-11 삼성전자주식회사 Nonvolatile memory device and operation method thereof
JP7413832B2 (en) * 2020-02-27 2024-01-16 セイコーエプソン株式会社 semiconductor equipment

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4260984B2 (en) * 1999-06-04 2009-04-30 株式会社東芝 Information processing apparatus and information processing method
EP1920377A2 (en) * 2005-08-22 2008-05-14 Nxp B.V. Embedded memory protection
JP2008152421A (en) * 2006-12-15 2008-07-03 Renesas Technology Corp Semiconductor integrated circuit
US7657722B1 (en) * 2007-06-30 2010-02-02 Cirrus Logic, Inc. Method and apparatus for automatically securing non-volatile (NV) storage in an integrated circuit
JP2012079152A (en) * 2010-10-04 2012-04-19 Yokogawa Electric Corp Semiconductor device

Also Published As

Publication number Publication date
JP2016076106A (en) 2016-05-12

Similar Documents

Publication Publication Date Title
US8316200B2 (en) Microcomputer, electronic instrument, and flash memory protection method
US8621298B2 (en) Apparatus for protecting against external attack for processor based on arm core and method using the same
US20150253387A1 (en) Programmable interface-based validation and debug
KR20170055933A (en) Method and apparatus for protecting kernel control-flow integrity using static binary instrumentaiton
KR20090118863A (en) Reducing power-on time by simulating operating system memory hot add
JPH11282713A (en) Microcomputer, electronic equipment and debug system
CN109388345B (en) Data reading method of memory, display device and computer readable storage medium
JP6390840B2 (en) Semiconductor device and electronic equipment
CN113077834A (en) Storage device testing method and device, television and storage medium
US20080010541A1 (en) Integrated circuit device, debugging tool, debugging system, microcomputer, and electronic instrument
KR100506031B1 (en) Microcomputer, electronic equipment and emulation method
JP4235831B2 (en) Target system, debug system, integrated circuit device, microcomputer and electronic device
US8924788B2 (en) Replaying architectural execution with a probeless trace capture
JP4910119B2 (en) Measuring device control method
JP6433966B2 (en) Information processing apparatus, information processing method, and program
US7370186B1 (en) Multi-tasking bootstrap system and method
KR100623279B1 (en) Embedded system debugging device and method thereof
US9291672B2 (en) Debug system, apparatus and method thereof for providing graphical pin interface
JP2007207075A (en) Cpu, integrated circuit device, microcomputer, electronic equipment and method for controlling cpu
JP2010231607A (en) Emulator
JP2007193572A (en) Cpu, integrated circuit device, microcomputer, and electronic equipment
TW201321972A (en) Debugging method and computer system using the same
CN117709253B (en) Chip testing method and device, electronic equipment and readable storage medium
KR0150161B1 (en) Device for displaying register and ram data
TWI760673B (en) Electronic device

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20171003

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20180418

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20180516

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20180711

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20180725

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20180807

R150 Certificate of patent or registration of utility model

Ref document number: 6390840

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150