DE102005032558B4 - Method for operating a microcontroller in a test environment and electronic test unit for analyzing program codes - Google Patents
Method for operating a microcontroller in a test environment and electronic test unit for analyzing program codes Download PDFInfo
- Publication number
- DE102005032558B4 DE102005032558B4 DE102005032558A DE102005032558A DE102005032558B4 DE 102005032558 B4 DE102005032558 B4 DE 102005032558B4 DE 102005032558 A DE102005032558 A DE 102005032558A DE 102005032558 A DE102005032558 A DE 102005032558A DE 102005032558 B4 DE102005032558 B4 DE 102005032558B4
- Authority
- DE
- Germany
- Prior art keywords
- program
- instruction
- processor
- test environment
- test
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3664—Environments for testing or debugging software
Abstract
Die Erfindung betrifft ein Verfahren zum Betrieb eines Datenprozessors, insbesondere eines Ein-Chip-Mikrocontrollers in einer Testumgebung (debugger), in welcher der zu testende Programm-Code vor, während und/oder nach der Ausführung des zu testenden Programms durch Austausch von einzelnen Programm-Instruktionen verändert wird, wobei die Programm-Instruktionen in einem nicht flüchtigen und wiederbeschreibbaren Speicher (flash) vorgehalten werden. Erfindungsgemäß wird unter anderem vorgeschlagen, den zeitlich oder sequentiell letzten Befehl zur Änderung einer Programm-Instruktion durch eine Befehlssequenz zu ersetzen, die den Datenprozessor dazu veranlasst, eine Programm-Zeiger-Überwachung für die betroffene Programm-Instruktion zu aktivieren. Hierdurch wird die Anzahl der Wiederbeschreibungszyklen des nicht flüchtigen, wiederbeschreibbaren Speichers bei der interaktiven Analyse des zu testenden Programm-Codes minimiert.The invention relates to a method for operating a data processor, in particular a one-chip microcontroller in a test environment (debugger), in which the program code to be tested before, during and / or after the execution of the program to be tested by exchanging individual programs Instructions are changed, the program instructions being held in a non-volatile and rewritable memory (flash). According to the invention, it is proposed, inter alia, to replace the last time or sequentially last command to change a program instruction with a command sequence which causes the data processor to activate program pointer monitoring for the program instruction concerned. This minimizes the number of rewrite cycles of the non-volatile, rewritable memory during the interactive analysis of the program code to be tested.
Description
Die Erfindung betrifft ein Verfahren zum Betrieb eines Prozessors, insbesondere eines Ein-Chip-Mikrocontrollers in einer Testumgebung, in welcher der zu testende Programm-Code vor, während und/oder nach der Ausführung des zu testenden Programms durch Austausch von einzelnen Programm-Instruktionen verändert wird, wobei die Programm-Instruktionen in einem nicht flüchtigen und wiederbeschreibbaren Speichher vorgehalten werden.The The invention relates to a method for operating a processor, in particular a one-chip microcontroller in a test environment in which the program code to be tested before, during and / or after the execution of the program to be tested by exchanging individual program instructions changed is, with the program instructions in a non-volatile and rewritable Speichher be kept.
Weiterhin betrifft die Erfindung eine elektronische Testeinheit zur Analyse von Program-Codes.Farther The invention relates to an electronic test unit for analysis of program codes.
Vorrichtungen zum Testen von Programmen sind beispielsweise aus EP-A- 0615187 und US 2003/0065984 A1 bekannt.devices for testing programs are for example from EP-A-0615187 and US 2003/0065984 A1 known.
Zum Testen von Programmen auf Maschinensprachebene werden unterschiedliche Konzepte verfolgt, die wirksame Ausführung des zu testenden Programm-Codes durch den Prozessor zu unterbrechen: Je nach Bauart des Prozessors wird dieser beispielsweise bei vorbestimmbaren Zuständen des Prozessors angehalten oder der Prozessor wird durch den Programm-Code dazu veranlasst, den aktuellen Programm-Code nicht mehr auszuführen. In beiden Konzepten wird entweder ein Programm-Code oder eine interne Kommunikationsschnittstelle aktiviert, die eine interaktive Kommunikation eines Anwenders mit dem Prozessor erlaubt. Es sind aber auch Konzepte bekannt, in denen Prozessoren eigens zu Testzwecken implementierte Instruktionen zur Verfügung stellen, die den Prozessor dazu veranlassen, seinen kompletten inneren Status in vorbestimmter Weise im Speicher zu hinterlegen und zu einer vorbestimmbaren Programmadresse zu springen, in der Programm-Code zur interaktiven Manipulation und Analyse des zu testenden Programmcodes hinterlegt ist. Trotz der Vielfältigkeit der Konzepte zur Analyse von möglicherweise fehlerhaftem oder für einen Entwickler zunächst unbekanntem Programm-Code, wird der zu analysierende Programm-Code zu Testzwecken zumeist gezielt verändert.To the Testing programs at the machine language level will be different Concepts, the effective execution of the program code to be tested to break through the processor: Depending on the design of the processor this is for example at predeterminable states of the Processor paused or the processor is controlled by the program code prompted to stop executing the current program code. In Both concepts will be either a program code or an internal one Communication interface enabled, which is an interactive communication of a user with the processor. But there are also concepts in which processors were specifically implemented for testing purposes Instructions available which cause the processor to complete its entire interior Status in a predetermined manner in the memory to deposit and a predeterminable program address to jump in the program code for interactive manipulation and analysis of the program code to be tested is deposited. Despite the diversity of concepts for possibly analyzing faulty or for a developer first unknown program code, becomes the program code to be analyzed mostly modified for test purposes.
Zum Testen des Programms wird dieses in ausführbarer, meist compilierter Form im Speicher abgelegt und eine Testumgebung wird, je nach oben beschriebenem Konzept, an einer weiteren Speicherstelle hinterlegt oder extern an die Peripherie des zu testenden und zu analysierenden Systems angeschlossen (zum Beispiel JTAG oder BDM Schnittstelle).To the Testing the program will make this executable, mostly compiled Form stored in memory and a test environment will, depending on the top described concept, deposited at another storage location or externally to the periphery of the device being tested and analyzed System connected (for example JTAG or BDM interface).
Nachdem das zu testende Programm angehalten wurde, ermöglicht die Testumgebung die Analyse des Prozessorstatus, die Überwachung des Inhalts seiner Register und üblicherweise auch den Inhalt des Speichers.After this the program being tested has been stopped, the test environment allows the Analysis of the processor status, monitoring the content of his Register and usually also the contents of the memory.
Bei der interaktiven Analyse des zu testenden Programms werden in den meisten Test- und Analysekonzepten durch die Testumgebung einzelne Instruktionen des zu testenden Programms durch eine andere Instruktion ersetzt, wobei diese Instruktion eine spezielle, vom Prozessor eigens für Test- und Analysezwecke zur Verfügung gestellte Instruktionen sein kann, aber auch eine beliebige andere Instruktion, die von der Testumgebung zum Anhalten des Prozessors eingesetzt wird. Es ist beispielsweise auch denkbar, als Ersatzinstruktion eine im Befehlssatz des Prozessors nicht vorkommende Instruktion als Ersatzinstruktion in den Programm-Code einzufügen, wobei der Prozessor über eine Einrichtung verfügen kann, diese Ersatzinstruktionen zu erkennen und darauf in vorbestimmter Weise zu reagieren. Die zu Testzwecken eingesetzte Ersatzinstruktion wird im folgenden Text 'Stoppinstruktion' genannt.at The interactive analysis of the program under test will be included in the most test and analysis concepts through the test environment individual Instructions of the program to be tested by another instruction replaced, this instruction is a special, the processor specifically for testing and analysis purposes disposal instructions, but also any other Instruction issued by the test environment for stopping the processor is used. It is also conceivable, for example, as a replacement instruction an instruction not found in the instruction set of the processor insert as a replacement instruction in the program code, where the processor over have a facility can recognize these substitute instructions and set out in predetermined Way to react. The replacement instruction used for testing purposes is called 'stop instruction' in the following text.
Nach dem die Stoppinstruktionen in den zu testenden Programm-Code hineingeschrieben worden sind, veranlasst die Testumgebung den Prozessor dazu, den Programm-Code des zu testenden Programms auszuführen. Daraufhin wird das zu testende Programm in der realen Umgebung, in der sich das spätere fertige Programm auch befinden wird, ausgeführt und, wenn der Prozessor auf die oben beschriebenen Stoppinstruktionen stößt, reagiert der Prozessor auf vorbestimmte Weise, wobei die tatsächliche Prozessorreaktion vom Test- und Analysekonzept abhängig ist. Beispielsweise dokumentiert der Prozessor seinen internen Status und springt zu einer vorbestimmten Programmadresse. Meist ist diese eine Einsprungadresse eines lokal vorhandenen Code-Teils der Testumgebung, welcher dem Anwender der Testumgebung das Resultat der Dokumentation des Prozessorstatus zur Verfügung stellt. In anderen Konzepten wird der Prozessor angehalten und die Ausführung jeglicher Programminstruktionen unterbunden, wobei der Status des Prozessors über eine Schnittstelle nach außen von der Testumgebung ermittelt werden kann; ebenso kann der Prozessorstatus von außen manipuliert werden.To the stop instructions are written into the program code to be tested The test environment causes the processor to run the Execute program code of the program to be tested. Then that's going to happen testing program in the real environment where the later finished Program will also be executed, and if the processor Upon encountering the stop instructions described above, the processor responds in a predetermined manner, the actual processor response from Test and analysis concept dependent is. For example, the processor documents its internal status and jumps to a predetermined program address. Usually this is an entry address of a locally existing code part of the test environment, which gives the user of the test environment the result of the documentation the processor status provides. In other concepts, the processor is stopped and the execution any program instructions, with the status of the Processor over an interface to the outside can be determined by the test environment; likewise, the processor status from the outside be manipulated.
Zur Fortführung des zu testenden Programms wird in den meisten Test- und Analysekonzepten durch die Testumgebung genau ein Instruktionszählerschritt nach der durch eine erste Stoppinstruktion ersetzten ersten Instruktion eine erneute, zweite Stoppinstruktion hinter die Stelle der ersten Stoppinstruktion in den Programmcode des zu testenden Programms geschrieben. Sofern es sich bei den ersetzten Instruktionen um Sprungbefehle oder um Verzweigungen, die in Abhängigkeit einer Bedingung, wie beispielsweise ein Registervergleich, gewählt werden, handelt, wird nicht die in Bezug auf die Speicheradresse nächste Instruktion durch eine Stoppinstruktion ersetzt, sondern bei Sprungbefehlen, die Instruktion, auf die der Sprungbefehl zeigt oder bei bedingten Verzweigungen werden die Instruktionen durch je eine Stoppinstruktion ersetzt, die der bedingten Verzweigung folgen. Bei unvorhersehbaren bedingten Verzweigungen, die bei einem einfachen Vergleich in zwei Äste, bei sogenannten "switch"-Anweisungen aber auch in mehrere Äste verzweigen können, wird jede erste Instruktion je eines möglichen Zweigs durch eine Stoppinstruktion ersetzt. Diese Verfahrensweise ist immer dann notwendig, wenn der ausführende Prozessor des zu testenden Programms nicht über einen Einzelschrittmodus verfügt, in der der Prozessor nach individueller Aufforderung nur je eine einzelne Instruktion ausführt.to continuation of the program being tested will work in most test and analysis concepts through the test environment exactly one instruction counter step after a first stop instruction replaced first instruction with a new, second stop instruction after the location of the first stop instruction written in the program code of the program to be tested. Provided the replaced instructions are jump instructions or um Branching in dependence a condition, such as a register comparison, are selected, is not the next in terms of memory address instruction through replaces a stop instruction, but with jump instructions, the instruction, to which the jump instruction points or conditional branches the instructions are replaced by a stop instruction, that follow the conditional branching. In case of unpredictable conditional Branches, in a simple comparison in two branches, at so-called "switch" statements but also in several branches can branch every first instruction of a possible branch by a stop instruction replaced. This procedure is always necessary when the executive Processor of the program to be tested not via a single-step mode features, in the the processor after individual request only ever one executes a single instruction.
An dieser Stelle gleichen sich die meisten Test- und Analysekonzepte. Die ursprünglich durch eine erste Stoppinstruktion ersetzte erste Instruktion wird hingegen wieder durch die eigentliche erste Instruktion ersetzt und diese erste Instruktion wird durch den Prozessor ausgeführt. Nach Ausführung der ersten Instruktion stößt der Prozessor auf die zweite Stoppinstruktion, was den Prozessor diesmal wieder dazu veranlasst, in Abhängigkeit vom gewählten Test- und Analysekonzept, die Programm-Ausführung zu unterbrechen. Diese zweite Unterbrechung wird von der Testumgebung dazu genutzt, die erste Stoppinstruktion wieder an die Stelle der ersten Instruktion zu schreiben und die zweite Stoppinstruktion wieder durch die zweite ursprüngliche Instruktion zu ersetzen. An dieser Stelle wird der Prozessor durch die Testumgebung dazu veranlasst, den Programm-Code mit der zweiten Instruktion fortzuführen und dieser führt daraufhin den Programm-Code des zu testenden Programms solange aus, bis dieser wieder auf die erste Stoppinstruktion oder eine andere im zu testenden Programm-Code durch eine Stoppinstruktion ersetzte Instruktion stößt.At This point is similar to most test and analysis concepts. The original is replaced by a first stop instruction replaced first instruction but again replaced by the actual first instruction and this first instruction is executed by the processor. To execution the first instruction is encountered by the processor on the second stop instruction, giving the processor this time again induced, depending on of the chosen Test and analysis concept to interrupt the program execution. These second break is used by the test environment, the first stop instruction again in place of the first instruction to write and the second stop instruction again by the second original Replace instruction. At this point, the processor goes through the test environment causes the program code with the second Continue instruction and this leads then the program code of the program to be tested until it returns to the first stop instruction or another in the program code to be tested replaced by a stop instruction Instruction comes up.
Diese Vorgehensweise ermöglicht, den Programm-Code unter sehr realitätsnahen Bedingungen zu testen, wobei jedoch der Programm-Code des zu testenden Programms auch während der Ausführung nach Bedarf verändert wird. Somit ist diese realitätsnahe Überprüfung des zu testenden Programms nur in einer Umgebung möglich, in welcher der Programm-Code in einem flüchtigen und wiederbeschreibbaren flüchtigen Speicher (RAM) vorliegt.These Procedure allows to test the program code under very realistic conditions however, the program code of the program under test is also during the execution changed as needed becomes. Thus, this realistic review of the program to be tested only possible in an environment in which the program code in a fleeting and rewritable volatile memory (RAM) is present.
Für Programme, die aus einem nicht flüchtigen und nicht wiederbeschreibbaren Speicher (ROM) ausgeführt werden, ist dieses Verfahren des ständigen Austausches von Programminstruktionen nicht möglich, da der nicht wiederbeschreibbare Speicher eine Änderung der Daten im Programm-Code nicht zulässt. Für diesen Fall sind in Prozessoren elektronisch implementierte Überwachungsfunktionen vorhanden, die beispielsweise den internen Programmzeiger oder den Datenbus überwachen und eine Unterbrechung der Ausführung des Programm-Codes auslösen, wenn der Programmzeiger oder der Datenbus einen vorbestimmten Wert aufweist. Der Programmzeiger wird vom Prozessor dazu verwendet, die nächste Programminstruktion aus dem Speicher zu lesen, so dass eine Überwachung des Programmzeigers dazu führt, dass vor oder nach Ausführung einer Programminstruktion, die an der Stelle im Programmspeicher liegt, auf die der Programmzähler zeigt, der Prozessor die Ausführung des Programms unterbricht.For programs, from a non-volatile and non-rewritable memory (ROM) are executed, is this procedure of permanent Exchange of program instructions not possible because of non-rewritable Memory a change the data in the program code does not allow. For this case are in processors electronically implemented monitoring functions present, for example, the internal program pointer or the Monitor data bus and an interruption of the execution of the Trigger program codes, if the program pointer or the data bus has a predetermined value having. The program pointer is used by the processor to the next Read program instruction from the memory, so that monitoring the program pointer causes that before or after execution a program instruction that is in place in program memory which the program counter points to, the processor the execution program interrupts.
Während bei der Verwendung von Stoppinstruktionen in einem wiederbeschreibbaren Speicher der Anzahl der Stoppinstruktionen im Speicher nur durch die Größe des Speichers selbst Grenzen gesetzt sind, so ist der Anzahl der Programmabbruchspunkte im Falle der elektronisch implementierten Überwachungsfunktion eine Grenze durch die Anzahl der durch die Elektronik überwachbaren Zustände des Programmzeigers gegeben.While at the use of stop instructions in a rewritable Memory of the number of stop instructions in memory only by the size of the memory even limits are set, this is the number of program termination points in the case of the electronically implemented monitoring function, a limit by the number of states of the monitorable by the electronics Program pointer given.
Moderne hochkostenoptimierte Prozessoren weisen eine nur sehr geringe Anzahl von elektronischen Überwachungsfunktionen auf, da diese ausschließlich zu Entwicklungszwecken genutzt werden und somit nur von einem sehr geringen Bruchteil der Anwender überhaupt genutzt werden. Dies kann bei der Analyse und beim Testen komplexer Programme zu erheblichen Erschwernissen bis Hindernissen führen.modern High-cost-optimized processors have only a very small number of electronic monitoring functions because these are exclusive used for development purposes and therefore only by a very small fraction of users at all be used. This can be more complex in analysis and testing Programs lead to significant impediments to obstacles.
Hoch integrierte Prozessoren, welche ausschließlich auf dem Chip verfügbare Speicherbereiche aufweisen, die in einem flüchtigen, wiederbeschreibbaren Speicher (RAM) und einem nicht flüchtigen, wiederbeschreibbaren Speicher (flash) aufgeteilt sind, wobei der flüchtige, wiederbeschreibbare Speicheranteil nur so groß gewählt ist, dass dieser zur Speicherung der Daten und zur Nutzung als Stapelspeicher während der Ausführung von Programmen gerade geeignet ist, jedoch nicht dazu geeignet ist, den gesamten Programmcode aufzunehmen, können durch die oben beschriebenen Testmethoden nicht im ausreichenden Maße untersucht werden, weil der Testbetrieb unter Verwendung von Stoppinstruktionen mit einem gezielten Austausch einzelner Programminstruktionen in nicht flüchtigen; wiederbeschreibbaren Speichern aufgrund der fehlenden Möglichkeit der selektiven Änderung einzelner Speicherelemente in diesen Speichern nicht möglich ist und weil die zur Verfügung stehenden elektronisch implementierten Überwachungsfunktionen bei hochkostenoptimierten Prozessoren üblicher Weise für eine umfangreiche Analyse des zu testenden Programms nicht ausreichen.Highly integrated processors, which have exclusively on-chip memory areas, which are divided into a volatile, rewritable memory (RAM) and a non-volatile, rewriteable memory (flash), wherein the volatile, rewritable memory portion is only so large that this is suitable for storing the data and for use as a stack during the execution of programs, but is not suitable, the entire program code can not be sufficiently examined by the test methods described above, because the test operation using stop instructions with a targeted replacement of individual program instructions in non-volatile; rewritable memory due to the lack of possibility of selectively changing individual memory elements in these memories is not possible and because the available electronically implemented monitoring functions in high-cost optimized processors usually not sufficient for a comprehensive analysis of the program to be tested.
Aufgabe der Erfindung ist es, ein Verfahren zum Betrieb eines Datenprozessors in einer Testumgebung und eine elektronische Testeinheit zur Ausführung dieses Verfahrens zu schaffen, das in nicht flüchtigen, wiederbeschreibbaren Speichern verwendet werden kann, wie es auch in wiederbeschreibbaren Speichern möglich ist.task The invention is a method for operating a data processor in a test environment and an electronic test unit to perform this To create a process that is non-volatile, rewriteable Save can be used as it is in rewritable Saving possible is.
Vorzugsweise soll das Verfahren erreichen, dass der zu testende Programm-Code aufgrund der Bauart des Prozessors zumindest zum Teil vorgehalten wird.Preferably If the procedure is to achieve that the program code under test is due to the Type of processor is at least partially held.
Vorzugsweise soll die Zeit zur Änderung von Programminstruktionen im zu testenden Programm-Code minimiert werden, um ein flüssiges Arbeiten und Analysieren zu ermöglichen.Preferably should change the time minimized by program instructions in the program code to be tested become a liquid one To enable working and analyzing.
Vorzugsweise soll es ermöglicht werden, den nicht flüchtigen, wiederbeschreibbaren Speicher so selten wie möglich im Analyseprozess wiederzubeschreiben, um die Funktion des nicht flüchtigen, wiederbeschreibbaren Speichers nicht vorzeitig zu verschleißen.Preferably it should be possible become the non-volatile, to rewrite rewriteable memory as rarely as possible in the analysis process, to the function of the non-volatile, rewriteable memory does not prematurely wear out.
Die erfindungsgemäße Aufgabe wird durch die in den unabhängigen Ansprüchen definierte Erfindung gelöst. Insbesondere wird die Aufgabe durch die Ausführung eines kompletten Wiederbeschreibungszyklus des gesamten die veränderten Programminstruktionen. aufweisenden Datenblocks im nicht flüchtigen und wiederbeschreibbaren-Speicher durch die Testumgebung gelöst. Weitere vorteilhafte Ausgestaltungen der Erfindung ergeben sich aus den Unteransprüchen.The inventive task is through the in the independent claims solved invention solved. In particular, the object is achieved by performing a complete rewrite cycle of the the whole changed Program instructions. containing data block in non-volatile and rewritable memory solved by the test environment. Further advantageous embodiments of the invention will become apparent from the Dependent claims.
Durch das erfindungsgemäße Verfahren wird erreicht, dass Stoppinstruktionen auch in nicht flüchtigen, wiederbeschreibbaren Speichern verwendet werden können, wie es auch in wiederschreibbaren Speichern möglich ist, obwohl aufgrund der Eigenart der nicht flüchtigen und wiederbeschreibbaren Speicher das selektive Verändern einer einzelnen Speicherstelle nicht möglich ist.By the inventive method is achieved that stop instructions also in non-volatile, rewriteable memories can be used, such as It is also possible in rewritable storage, though due the peculiarity of the non-volatile and rewritable memory, selectively changing one single storage location not possible is.
Im erfindungsgemäßen Verfahren zum Betrieb eines Prozessors in einer Testumgebung wird zum Austausch einzelner Instruktionen der Datenblock ermittelt, der die zu ersetzende Instruktion im Programm-Code enthält. Dieser Datenblock wird komplett aus dem Speicher des Prozessors ausgelesen und über eine Kommunikationsschnittstelle an die Testumgebung übertragen. In diesem Rechnersystem, welches als Teil der Testumgebung den interaktiven Teil des Test-Programms enthält, wird die Programminstruktion in diesem Datenblock ersetzt und der komplette Datenblock wird zum Prozessor rückübertragen, wobei ein schreibender Modus gewählt wird. Gegebenenfalls wird, sofern notwendig, der Datenblock im nicht flüchtigen, wiederbeschreibbaren Speicher, der zuvor ausgelesen wurde, mit einem Löschbefehl komplett gelöscht und durch die Rückübertragung des modifizierten Programm-Codes wieder beschrieben.in the inventive method to operate a processor in a test environment becomes an exchange individual instructions determines the data block that contains the Contains instruction in the program code. This data block will completely read from the memory of the processor and over a Transfer the communication interface to the test environment. In this computer system, which as part of the test environment is the interactive part of the test program contains the program instruction in this data block is replaced and the complete data block is returned to the processor, with a write Mode selected becomes. If necessary, the data block is not volatile, rewriteable Memory that was previously read with a delete command completely deleted and by the retransmission of the modified program code.
In einer alternativen Ausführungsform des erfindungsgemäßen Verfahrens wird der Datenblock des nicht flüchtigen, wiederbeschreibbaren Speichers durch den Prozessor selbst in den flüchtigen Speicher übertragen und der Prozessor erhält von der Testumgebung zumindest einen Ersetzungsbefehl zum Austausch einer Instruktion durch eine Stoppinstruktion. Nach dem Austausch der mindestens einen Instruktion wird der nicht flüchtige, wiederbeschreibbare Speicher mit dem Datenblock aus dem flüchtigen Speicher des Prozessors, gegebenenfalls unter vorheriger Löschung des Datenblocks im nicht flüchtigen, wiederbeschreibbaren Speicher, an entsprechender Stelle überschrieben. Durch die interne Übertragung des Datenblocks vom nicht flüchtigen, wiederbeschreibbaren in den flüchtigen Speicher wird auf eine Übertragung über eine Kommunikationsschnittstelle verzichtet, was bei häufigem automatischen Ersetzen einzelner Instruktionen zu erheblichem Zeitgewinn und damit zur realistischeren Ausführung des Programm-Codes führt.In an alternative embodiment the method according to the invention becomes the data block of the non-volatile, rewritable memory by the processor itself in the volatile Transfer memory and the processor receives at least one replacement command from the test environment for replacement an instruction by a stop instruction. After the exchange the at least one instruction becomes the non-volatile, rewritable memory with the data block from the volatile Memory of the processor, if necessary with previous deletion of the Data blocks in the non-volatile, rewritable memory, overwritten at the appropriate place. Through the internal transmission the data block from the non-volatile, rewritable in the volatile Memory is transferred to over one Communication interface waived, resulting in frequent automatic Replacement of individual instructions at a considerable time and thus to the more realistic execution of the program code.
In einer weiteren Ausgestaltung der Erfindung wird auf ein Auslesen vor dem Ersatz einer Instruktion vollständig verzichtet, wobei der Inhalt des nicht flüchtigen, wiederbeschreibbaren Speichers in der Testumgebung protokolliert wird und nur jeweils der manipulierte Datenblock zum Beschreiben des nicht flüchtigen, wiederbeschreibbaren Speichers übermittelt wird.In A further embodiment of the invention is based on a read-out completely waived before the replacement of an instruction, wherein the Content of the non-volatile, rewritable memory in the test environment is and only the manipulated data block for describing of the non-volatile, rewritable memory transmitted becomes.
Gleich an den unterschiedlichen Ausgestaltungen der Erfindung ist, dass je ein kompletter Datenblock, der beispielsweise je 512 Byte betragen kann, zur Änderung einer einzelnen oder mehrerer einzelner Instruktionen in einem mit einem Wiederbeschreibungszyklus in den nicht flüchtigen, wiederbeschreibbaren Speicher geschrieben wird.Equal in the different embodiments of the invention is that one complete data block each, for example 512 bytes each can, to change a single or several individual instructions in one with a rewrite cycle into the nonvolatile, rewritable Memory is written.
Durch diese Verfahrensweise, jeweils einen kompletten Datenblock an gewünschter Stelle zu verändern und komplett wieder zurückzuschreiben, ist es möglich, Prozessoren auch in einer Testumgebung so zu betreiben, wie es für Prozessoren in einer Umgebung möglich ist, die über ausreichend flüchtige Speicher verfügen, um den Programm-Code darin abzulegen und entsprechend dem Stand der Technik zu testen.By This procedure, each a complete data block to the desired Change position and completely write back, Is it possible, Processors also operate in a test environment as it does for processors possible in an environment is that over sufficiently volatile Have memory, to store the program code in it and according to the state to test the technique.
In vorteilhafter Ausgestaltung der Erfindung wird der Datenblock erst dann von der Testumgebung rückübertragen und in den nicht flüchtigen, wiederbeschreibbaren Speicher des Prozessors geschrieben, wenn der Befehl zur Ausführung des präparierten Programms gegeben wird. Hierdurch wird erreicht, dass gegebenenfalls eine umfangreiche Anzahl von Stoppinstruktionen, die an ausgewählten Stellen des Programm-Codes eingefügt beziehungsweise durch Überschreiben eingefügt werden sollen, mit nur einem Wiederbeschreibungszyklus simultan in den nicht flüchtigen, wiederbeschreibbaren Speicher geschrieben werden. Hierdurch ist es möglich, unnötige Lösch- und Wiederbeschreibungsfunktionen zu vermeiden, was die Lebensdauer der Daten im Prozessor, der diese Speichereinheit bereits auf den Chip integriert hat, erhöht. Denn die nicht flüchtigen, wiederbeschreibbaren Speicher haben eine nur begrenzte Anzahl an Wiederbeschreibungszyklen, ohne dass hierdurch die Haltbarkeit der Daten in dem Speicher begrenzt wird.In Advantageous embodiment of the invention, the data block is only then retransferred from the test environment and in the non-volatile, rewritable memory of the processor written when the Command to execute of the prepared Program is given. This ensures that, if necessary an extensive number of stop instructions at selected locations of the program code or by overwriting added with only one rewrite cycle simultaneously in the non-volatile, rewritable memory are written. This is it is possible unnecessary erasable and rewriting functions to avoid what the life the data in the processor that already has this memory unit on the Integrated chip has increased. Because the non-volatile, rewriteable memory has a limited number of Rewriting cycles, without thereby the durability of the Data in the memory is limited.
Die Manipulation des Programm-Codes wird somit unabhängig vom Prozessor im zu testenden System von einem Anwender durchgeführt und erst unmittelbar vor einem Ausführungsbefehl durch den Anwender wird der manipulierte Programm-Code in einem Wiederbeschreibungszyklus auf den Prozessor mit integriertem Speicher übertragen.The Manipulation of the program code is thus independent of the processor to be tested System performed by a user and only immediately before an execution command by the user, the manipulated program code is in one Rewriting cycle transferred to the processor with built-in memory.
Durch die Ausführung eines einzigen Wiederbeschreibungszyklus vor einem Ausführungszyklus des zu testenden Programms durch den Prozessor wird erreicht, dass mehrere Instruktionen simultan ersetzt werden. Bei dem bekannten Verfahren im Stand der Technik wird die Ersetzung von Instruktionen nicht simultan erreicht, sondern jede einzelne Instruktion wird einzeln im Speicher ersetzt, was bei nicht flüchtigen, wiederbeschreibbaren Speichern (flash) nicht möglich ist.By execution a single rewrite cycle before an execution cycle the program under test is achieved by the processor several instructions are replaced simultaneously. In the known Prior art methods will be the replacement of instructions not achieved simultaneously, but every single instruction is individually replaced in memory, resulting in non-volatile, rewritable Saving (flash) not possible is.
In einer weiteren Ausgestaltung der Erfindung ist vorgesehen, dass die durch eine Stoppinstruktion ersetzten Instruktionen simuliert werden. Die Simulation wird von der Testumgebung durchgeführt. Die simulierten Prozessorzustandsdaten werden dann von der Testumgebung an den sich im Warte- oder Testzustand befindlichen Prozessor übermittelt und der Prozessor startet darauf mit den neuen Zustandsdaten einen neuen Ausführungszyklus des zu testenden Programm-Codes.In A further embodiment of the invention provides that simulates the instructions replaced by a stop instruction become. The simulation is performed by the test environment. The Simulated processor state data is then taken from the test environment transmitted to the processor in the waiting or test state and the processor then starts with the new state data new execution cycle of the program code to be tested.
Im Gegensatz zum Stand der Technik wird bei der Simulation aber nicht der ausgetauschte Programmbefehl wieder an die Stelle des Testbefehles zurückgeschrieben, sondern der ersetzte Befehl wird durch die Testumgebung simuliert. Die simulierten Daten werden an den Prozessor im zu testenden System übermittelt. Daraufhin wird der Prozessor veranlasst, an die Stelle nach dem simulierten Befehl zu springen und dort die Programmausführung mit den neuen Zustandsdaten fortzusetzen. Durch die Simulation einzelner Programminstruktionen ist es unnötig, die Stoppinstruktionen mehrfach auszutauschen und so werden gegebenenfalls umfangreiche Wiederbeschreibungszyklen vermieden, was nicht nur eine Lebensdauerverlängerung des nicht flüchtigen, wiederbeschreibbaren Speichers Prozessors zur Folge hat, sondern die zum Teil langwierigen Wiederbeschreibungszeiten werden eingespart, was ein flüssigeres Arbeiten während der Programmanalyse zur Folge hat.in the Contrary to the state of the art is not in the simulation but the replaced program command replaces the test command written back, but the replaced command is simulated by the test environment. The simulated data is transmitted to the processor in the system under test. thereupon the processor is forced to replace the simulated one Command to jump and there the program execution with the new status data continue. By simulating individual program instructions is it unnecessary to exchange the stop instructions several times and so become possibly extensive Avoid rewriting cycles, which is not just a lifetime extension of the non-volatile, rewritable memory processor has, but the sometimes lengthy rewriting times are saved, something more fluid Working while results in program analysis.
Um dieses Verfahren den Erfordernissen eines flüssigen Analysierens durch einen Entwickler oder Benutzer anzupassen, wenn die Datenblöcke eines nicht flüchtigen, wiederbeschreibbaren Speichers groß sind und jeweils ein Wiederbeschreibungszyklus für einen größeren Datenblock durchgeführt werden muss, ist in besonderer Ausgestaltung der Erfindung vorgesehen, den Ersatz eines Austausches durch die Aktivierung einer Programm-Zeiger-Überwachung für die mindestens eine zeitlich oder sequentiell zuletzt von der Testumgebung zur Überwachung mitgeteilten oder die durch eine prediktive Bestimmung der in einer Befehlsequenz des zu testenden Programms wahrscheinlich am häufigsten ausgeführten Programm-Instruktion vorzunehmen. Speziell wenn eine Programminstruktion vom Entwickler oder Benutzer häufig als Programmunterbrechungspunkt gewählt wird, bedeutet das Durchführen eines kompletten Wiederbeschreibungszyklus eine Verzögerung von mehreren Sekunden, was bei der Analyse bei dauerhafter Untersuchung an diesem Programm-Abbruchspunkt eine erhebliche Erschwernis bedeuten kann und flüssiges Arbeiten unterbindet. Durch die Aktivierung einer Programm-Zeiger-Überwachung wird dieses Problem vermieden.In order to adapt this method to the requirements of liquid analysis by a developer or user, when the data blocks of a non-volatile, rewritable memory are large and one rewriting cycle has to be performed for a larger data block, a replacement of an exchange is provided in a special embodiment of the invention by the activation of a program pointer monitoring for the at least one temporally or sequentially last notified of the test environment for monitoring or by making a predictive determination of the most frequently executed in a command sequence of the program to be tested program instruction. Specifically, if a program instruction is often chosen by the developer or user as a program interruption point, performing a complete rewrite cycle will result in a delay of several seconds, which can be a significant complication in the ongoing investigation analysis at this program abort point and inhibit fluidity. By activating a program pointer monitoring avoids this problem.
Im Fachjargon ausgedrückt wird ein Mikrocontroller mit On-Chip-Flash-ROM und geringer Anzahl von Hardware-Breakpoints dadurch auch beim Debuggen komplexerer Programme leichter zu debuggen, weil das Setzen von Software-Breakpoints zunächst in einer internen Liste des Debuggers gesammelt wird und erst kurz vor einem run- oder single-step-Befehl alle Software-Breakpoints in das Flash-ROM geschrieben werden. Um die Anzahl der Flash-ROM-Rewrite-Zyklen zu minimieren, wird erfindungsgemäß vorgeschlagen, den jeweils letzten Breakpoint in Bezug auf das Setzen von Breakpoints aus Sicht der debug unit in zeitlicher oder sequentieller Hinsicht, als Hardware-Breakpoint umzusetzen. Dieses ist deshalb besonders effizient, weil der Debugger beim source-level steppen und bei einem go- oder run-Befehl ab einer Instruktion, die durch eine Stoppinstruktion ersetzt wurde, automatisch und ohne weiteres Zutun des Benutzers einen Breakpoint setzt und diesen kurze Zeit später wieder löscht, nämlich wenn der source-level-single-step durchgeführt wurde.in the Technical jargon expressed becomes a microcontroller with on-chip flash ROM and low number This also makes hardware breakpoints more complex when debugging Programs easier to debug because putting software breakpoints in first an internal list of the debugger is collected and only briefly before a run or single-step command, all software breakpoints be written to the flash ROM. To increase the number of flash ROM rewrite cycles minimize is proposed according to the invention, the last breakpoint in relation to the setting of breakpoints from the point of view of the debug unit in terms of time or sequential implement as a hardware breakpoint. This is special efficient because the debugger queues at source-level and at a go or run command from an instruction through a stop instruction has been replaced automatically and without further intervention by the user sets a breakpoint and deletes it a short time later, namely when the source-level single-step was done.
Noch effizienter kann die Minimierung der Flash-ROM-Write-Zyklen durch eine prediktive Bestimmung des Breakpoints sein, der in einem Debug-Zyklus am häufigsten durch den Prozessor im Zielsystem angefahren wird.Yet The minimization of flash ROM write cycles can be more efficient be a predictive determination of the breakpoint in a debug cycle most frequently is approached by the processor in the target system.
Durch den Austausch des Schrittes der Ersetzung einer Programm-Instruktion durch eine Stoppinstruktion (Software-Breakpoint) durch den Schritt, diese Programm-Instruktion durch eine Programm-Zeiger-Überwachung (Hardware-Breakpoint) zu überwachen, wird die Anzahl der notwendigerweise durchgeführten Wiederbeschreibungszyklen (Flash-Write-Zyklus) erheblich reduziert. Dies hat ein flüssigeres Arbeiten und Analysieren, besonders im Falle von nicht flüchtigen, wiederbeschreibbaren Speichern mit großen Datenblöcken zur Folge und der durch die Wiederbeschreibungszyklen allmählich degenerierende Speicher wird nicht vorzeitig verschlissen.By the replacement of the step of replacing a program instruction through a stop instruction (software breakpoint) through the step, this program instruction by a program pointer monitoring (Hardware breakpoint) to monitor is the number of rewritable cycles necessarily performed (Flash write cycle) significantly reduced. This has a smoother Working and analyzing, especially in the case of non-volatile, rewritable storage with large blocks of data and through the rewriting cycles gradually degenerate memory will not wear out prematurely.
Der Ersatz zumindest des zuletzt -in Bezug auf die Zeit oder in Bezug auf eine eingegebene Sequenz- von einer Testumgebung gesetzten Programm-Abbruchspunktes in Form des Austausches einer Programm-Instruktion durch eine Stoppinstruktion (Software-Breakpoint) durch eine Programm-Zeiger-Überwachung (Hardware-Breakpoint) führt zu einer deutlichen Erniedrigung der Anzahl der notwendigen Wiederbeschreibungszyklen. Bei einem durchschnittlichen Analyseverfahren eines Entwicklers oder Benutzers ist es die Strategie, mehrere Programm-Abbruchspunkte zu setzen und an einer vom Entwickler oder Benutzer ausgewählten und im vom Entwickler oder Benutzer vermuteten logischen Ablauf zuletzt vorkommenden Stelle wird ein Programm-Abbruchspunkt gesetzt, an der die Ergebnisse eines Analysezyklus (debug cycle) vom Entwickler oder Benutzer ausgewertet werden. Dabei wird häufig vom Entwickler oder Benutzer an dieser Stelle eine verdächtige Änderung des Programm-Zustandes erwartet. Folglich wird dieser Programm-Abbruchspunkt so häufig angefahren und zwar in interaktiver Weise, dass dieser letzte vom Entwickler oder Benutzer gewählte Punkt häufig auch der im Analysezyklus tatsächlich am häufigsten angefahrene Punkt ist. Folglich bedeutet der Einsatz der Programm-Zeiger-Überwachungsfunktion für genau diesen Programm-Abbruchspunkt eine erhebliche Reduktion der Anzahl der notwendigen Wiederbeschreibungszyklen, wobei der wünschenswerte Nebeneffekt erreicht wird, dass gerade an dieser Stelle, wo der Stress des analysierenden Benutzers gegebenenfalls hoch sein kann, die Wiederaufnahme der Programm-Ausführung oder die Durchführung eines Einzelschrittes besonders schnell und ohne Verzögerung durch einen Wiederbeschreibungszyklus durchgeführt wird. Der letzte Programm-Abbruchspunkt, der von einem Entwickler oder Benutzer gesetzt wird, ist in Abhängigkeit der Übersetzungsstufe des Programm-Codes nicht unbedingt identisch mit dem letzten Programm-Abbruchspunkt, der durch die Testumgebung und ihre Hilfsmodule gesetzt wird. Wird in der Testumgebung ein Programm-Abbruchspunkt in einem nicht übersetzten Programm-Quellcode gesetzt, so kann dieser einen Programm-Abbruchspunkt bei verzweigenden Befehlen im übersetzen Programm-Code auf Maschinensprachebene durchaus von der Testumgebung oder Modulen hiervon in mehr als einem Programm-Abbruchspunkt übersetzt werden, weil der Verzweigungsbefehl auf Maschinensprache-Ebene nicht mehr unterteilbar ist und daher der im Programmlauf dem Verzweigungsbefehl tatsächlich folgende Befehl an mehreren Stellen stehen kann. Alle diese möglichen Verzweigungspunkte werden von einer debug unit, die unter anderem für eine Testumgebung einzelne Programm-Abbruchspunkte an die Stellen im Programm-Code auf Maschinensprachen-Ebene setzt, mit einer Stoppinstruktion belegt.Of the Replacement at least of the last - in terms of time or in relation to an entered sequence of program demolition point set by a test environment in Form of exchange of a program instruction by a stop instruction (Software breakpoint) by a program pointer monitoring (Hardware breakpoint) leads to a significant reduction in the number of rewriting cycles required. In an average analysis process of a developer or user, it is the strategy to have multiple program break points to put and at one of the developer or user selected and in the logic flow assumed by the developer or user last occurring location, a program break point is set at which the results analysis cycle (debug cycle) evaluated by the developer or user become. It becomes common from the developer or user at this point a suspicious change of the program state expected. As a result, this program crash point becomes so often approached in an interactive way that this last of Developer or user selected point often also in the analysis cycle actually most frequently started point is. Consequently, the use of the program pointer monitoring function means for exactly this program break point a significant reduction in the number of rewrite cycles required, being the desirable one Side effect is achieved that just at this point, where the Stress of the analyzing user may be high, the resumption of the program execution or the implementation a single step especially fast and without delay a rewrite cycle is performed. The last program breakpoint, that is set by a developer or user is dependent the translation level the program code is not necessarily identical to the last program breakpoint, which is set by the test environment and its auxiliary modules. Becomes in the test environment, a program crash point in an untranslated one Program source code set, this can be a program break point at branching Commands in translate Program code at the machine language level quite by the test environment or modules thereof translated into more than one program breakpoint because the branch level instruction is not at the machine language level is more subdividable and therefore in the program run the branch instruction indeed following command can be in several places. All these possible Branch points are taken from a debug unit, among others for one Test environment single program break points to the places in the Program code sets at machine language level, with a stop instruction busy.
Durch eine prediktive Bestimmung der in einer Befehlsequenz des zu testenden Programms wahrscheinlich am häufigsten ausgeführten Programm-Instruktion wird erreicht, dass der nicht flüchtige, wiederbeschreibbare Speicher (flash) nur selten wiederbeschrieben werden muss, da eine Programm-Zeiger-Überwachung keine Änderung von Programm-Instruktionen im Programm-Code benötigt, sondern die Überwachungsfunktion im zu testenden System (On-Chip-Debug-Unit) kann durch Schreiben eines Registers schnell und unkompliziert zur Überwachung des Programm-Zeigers (program counter) aktiviert werden.By a predictive determination of in an instruction sequence of the one to be tested Program probably the most common executed Program instruction is achieved that the non-volatile, rewritable memory (flash) rarely rewritten must be, as a program pointer monitoring no change required by program instructions in the program code, but the monitoring function in the system under test (on-chip debug unit) can by writing a register quickly and easily for monitoring of the program pointer.
Um eine prediktive Bestimmung der Programm-Instruktion durchzuführen, kann auf verschiedene Verfahren zurückgegriffen werden. Zunächst ist es möglich, eine Statistik der in einem Analyse-Zyklus durch den Prozessor des zu testenden Systems (Zielsystem) angefahrenen Programm-Instruktionen durchzuführen und die Programm-Instruktion als die häufigste Programm-Instruktion zu bestimmen, die in vergangenen Analysezyklen am häufigsten angefahren wurde. In diesem Verfahren wird die Prediktion, also die Vorhersage des nächsten Programm-Abbruchpunktes einfach aus der Vergangenheit extrapoliert. Es ist aber auch denkbar, mit heuristischen Regeln den nächst wahrscheinlichen Programm-Abbruchpunkt zu bestimmen. Dies ist am besten durch ein Beispiel an einer Verzweigungs-Instruktion (branch instruction) zu verdeutlichen. Eine Verzweigung unter Prüfung eines Speicherwertes, Registerzustandes oder anderen Prozessorzustandsdaten unter Vergleich mit einem bestimmten Wert wird in aller Regel eine Ausnahme sein und häufiger wird der der Verzweigung zugrundeliegende Wert nicht dem eines Vergleichswert gleichen. Dies ist besonders in Zähl- oder Warteschleifen der Fall. Für die Analyse (debuggen) einer Verzweigung (branch instruction) müssen von der Testumgebung (debugger) und ihren Hilfsmodulen mehr als ein Programm-Abbruchspunkt durch Austausch einer Programm-Instruktion durch eine Stoppinstruktion (Software-Breakpoint) und/oder durch eine Programm-Zeiger-Überwachung (Hardware-Breakpoint) gewählt werden. Wenn beispielsweise nur eine elektronisch implementierte Programm-Zeiger-Überwachungsfunktion zur Verfügung steht, wird durch die heuristische Regel in der Testumgebung der Zweig durch eine Programm-Zeiger-Überwachung als Programm- Abbruchpunkt überwacht, der auch durch die oben dargelegte heuristische Regel wahrscheinlich häufiger im Programm angefahren wird.Around can perform a predictive determination of the program instruction resorted to different methods become. First Is it possible, a statistic of in an analysis cycle by the processor of the program to be tested (target system) perform and determine the program instruction as the most common program instruction which has been approached most frequently in past analysis cycles. In this procedure, the prediction, ie the prediction of the next program abort point simply extrapolated from the past. But it is also possible with heuristic rules the next Probable program break point to determine. This is best by an example to a branch instruction to clarify. A branch while checking a memory value, Register state or other processor state data under comparison with a certain value will usually be an exception and more often the value underlying the branching will not be that of a comparison value same. This is especially in counting or holding loops of Case. For the analysis (debugging) of a branch instruction must be done by the test environment (debugger) and its auxiliary modules more than one Program breakpoint by exchanging a program instruction with a stop instruction (Software breakpoint) and / or through program pointer monitoring (hardware breakpoint) chosen become. For example, if only one electronically implemented Program pointer monitoring function to disposal stands by the heuristic rule in the test environment of the Branch monitored by a program pointer monitor as a program breakpoint, which is also likely due to the heuristic rule outlined above frequently is approached in the program.
Heuristische Regeln, besonders in Verbindung mit typischen Programm-Instruktions-Blöcken, die von einem Compiler erzeugt werden, sind aus der Technologie des Pipelining von Programm-Instruktionen in hochoptimierten Prozessoren bekannt. Diese Regeln können zur Minimierung von Wiederbeschreibungszyklen des nicht flüchtigen, wiederbeschreibbaren Speichers ebenso verwendet werden.heuristic Rules, especially in connection with typical program instruction blocks that are generated by a compiler, are from the technology of Pipelining of program instructions in highly optimized processors known. These rules can to minimize rewriting cycles of the non-volatile, rewritable memory also be used.
In vorteilhafter Ausgestaltung der Erfindung ist in einer elektronischen Testeinheit (debug unit), die zwei Kommunikationsschnittstellen aufweist, das erfindungsgemäße Verfahren implementiert. Dazu wird die elektronische Testeinheit mit einem gattungsgemäßen Computer (PC), der über eine Testumgebung (debugger) verfügt, verbunden, beispielsweise über ein USB-Kabel. Mit der anderen Kommunikationsschnittstelle ist die elektronische Einheit mit dem Zielsystem verbunden, beispielsweise über eine JTAG- oder BDM-Schnittstelle. Die debug unit erhält von einer gattungsgemäßen Testumgebung einen Befehl zum Setzen eines Programm-Abbruchpunktes (breakpoint). Dieser Befehl wird von der debug unit quittiert, aber von der elektronischen Einheit zunächst nicht in das Zielsystem übertragen. Erst wenn alle Programm-Abbruchspunkte mitgeteilt wurden, und das ist der Fall, wenn ein Programm-Ausführungsbefehl (run) oder ein Einzelschrittbefehl (single-step-instruction) der elektronischen Einheit mitgeteilt wurde, wird von der elektronischen Einheit ein Prozess initiiert, der das Zielsystem dazu veranlasst, alle Programm-Abbruchspunkte dadurch zu setzen, in dem einzelne oder mehrere Programm-Instruktionen simultan durch Stoppinstruktionen ersetzt werden. Dies wird durch Wiederbeschreiben eines die betroffenen Programm-Instruktionen enthaltenen Datenblocks erreicht, wobei in dem Datensatz zur Wiederbeschreibung der zumindest eine Programm-Abbruchspunkt enthalten ist.In Advantageous embodiment of the invention is in an electronic Debug unit, the two communication interfaces comprising, the inventive method implemented. For this purpose, the electronic test unit with a generic computer (PC) who over has a test environment (debugger) connected, for example via a USB cable. With the Another communication interface is the electronic unit connected to the target system, for example via a JTAG or BDM interface. The debug unit receives from a generic test environment a command for setting a program breakpoint. This command is acknowledged by the debug unit, but by the electronic one Unit first not transferred to the target system. Only when all program breakpoints have been communicated, and that is the case when a program execution command (run) or a single step instruction (single-step-instruction) the electronic unit is notified by the electronic Unit initiates a process that causes the target system to all program breakpoints by putting in the single or multiple program instructions simultaneously be replaced by stop instructions. This is done by rewriting a data block containing the affected program instructions achieved, wherein in the data set for rewriting the at least a program abort point is included.
Die elektronische Einheit kann eine zur Prediktion verwendete Statistik selber führen oder die heuristischen Regeln zur prediktiven Bestimmung der am häufigsten frequentierten Befehle selber ausführen, es ist aber auch möglich, dass die Statistik oder die heuristischen Regeln zur prediktiven Bestimmung in einem Programmteil in dem gattungsgemäßen Computer mit Testumgebung (debugger) durchgeführt werden.The electronic unit can use a statistic used for the prediction lead yourself or the heuristic rules for the predicative determination of the am common it is also possible that the statistics or heuristic rules for predictive determination in a program part in the generic computer with test environment (debugger) performed become.
Die elektronische Einheit kann lediglich Kommunikationsaufgaben übernehmen und die gesamte Logik zur Bestimmung und zum Austausch der Programm-Instruktionen kann in einem Software-Teil, beispielsweise als sogenannte DLL (dynamic link library oder dynamically linked library) implementiert sein, es ist aber auch möglich, dass die elektronische Einheit sämtliche Aufgaben selbst erfüllt und der Testumgebung (debugger) die Kommunikation und den Austausch der Programm-Instruktionen abnimmt.The electronic unit can only take over communication tasks and all the logic for determining and exchanging program instructions in a software part, for example as so-called DLL (dynamic link library or dynamically linked library), but it is also possible that the electronic unit all Tasks fulfilled and the test environment (debugger) the communication and the exchange the program instructions decreases.
Das erfindungsgemäße Verfahren wird anhand der folgenden Figuren näher erläutert.The inventive method will be explained in more detail with reference to the following figures.
Es zeigtIt shows
In
Zunächst führt der Prozessor das zu testende Programm aus, wie in dem obersten Programmausschnitt der linken Spalte schematisch dargestellt ist, bis es auf eine Stoppinstruktion, hier willkürlich BRKPOINT genannt, stößt. Die Stoppinstruktion veranlasst den Prozessor, je nach Bauart auf unterschiedliche Weise, beispielsweise einfach anzuhalten und auf interaktive Befehle an einer speziellen Kommunikationsschnittstelle zu warten oder auch beispielsweise, den gesamten Prozessorstatus abzuspeichern und diesen gegebenenfalls interaktiv zu dokumentieren. In der Testumgebung folgen dieser Unterbrechung des Prozessors im zu testenden System logische Instruktionen, die den Inhalt der Speicherstelle, hier der Speicherstelle #008030f8h durch einen ursprünglich dort stehenden Befehl 3 zu ersetzen. Dieser Befehl 3 wird in der Testumgebung in einer Tabelle oder einer Datenbank hinterlegt. Darüber hinaus wird der Befehl 4, der auf Befehl 3 folgt, durch eine Stoppinstruktion, hier BRKPOINT, ersetzt.First, the leads Processor executes the program under test as in the topmost program excerpt the left column is shown schematically until it clicks on a stop instruction, here arbitrarily Called BRKPOINT, bumps. The Stop instruction causes the processor, depending on the design in different ways, for example, just stop and click on interactive commands a special communication interface to wait or even For example, to save the entire processor status and this if necessary to document interactively. In the test environment, this interruption will follow of the processor in the system under test logical instructions that the contents of the memory location, here the memory location # 008030f8h by an original replace there existing command 3. This command 3 will appear in the Test environment stored in a table or database. Furthermore command 4, which follows command 3, is terminated by a stop instruction, here BRKPOINT, replaced.
Danach wird von der Testumgebung der Prozessorstatus wieder hergestellt und der Prozessor wird von der Testumgebung veranlasst, das zu testende Programm, das jetzt im Zustand gemäß der linken Spalte in der Mitte ist, an der Speicherstelle #008030f8h, fortzuführen, wo jetzt Befehl 3 gespeichert ist. Der Befehl 3 wird ausgeführt und der Prozessor stößt jetzt auf die Speicherstelle #08030fch, an der vorher der Befehl 4 gestanden hat und jetzt durch eine Stoppinstruktion ersetzt worden ist. An dieser Stelle wird abermals der Prozessor in einen Haltezustand versetzt und gegebenenfalls der Status gesichert, die Stoppinstruktion BRKPOINT in Speicherstelle #008030fch wird wieder durch Befehl 4 ersetzt und danach wird der Befehl 3 wieder durch die Stoppinstruktion BRKPOINT ersetzt. Danach wird der Prozessorstatus wieder hergestellt und das Testprogramm veranlasst den Prozessor dazu, den Programmablauf an Speicherstelle #008030fch, dort wo jetzt wieder Befehl 4 steht, fortzuführen.After that the test environment will restore processor status and the processor is caused by the test environment to test it Program that is now in the state according to the left column in the Center is to continue at location # 008030f8h, where now command 3 is stored. Command 3 is executed and the processor is now poking to the location # 08030fch, where previously the command 4 stood and has now been replaced by a stop instruction. At At this point, the processor again goes into a hold state and, if necessary, the status saved, the stop instruction BRKPOINT in location # 008030fch will be replaced by command 4 replaced and then the command 3 again by the stop instruction BRKPOINT replaced. Thereafter, the processor status is restored and the test program causes the processor to run the program at location # 008030fch, where now again command 4 stands, continue.
Dieses Verfahren ist für Prozessoren geeignet, die in einer Umgebung operieren, wo flüchtiger Speicher zur Aufnahme des Programmcodes vorhanden ist, sofern kein Einzelschrittmodus verfügbar ist. Das beschriebene Verfahren wird so angewendet, sofern der in diesem Beispiel beschriebene Befehl 3 kein Sprungbefehl oder bedingter Verzweigungsbefehl ist. In diesem Falle würden nicht die in Bezug auf den Programmzeiger nächsten Befehle durch Stoppinstruktionen ersetzt, sondern die logisch folgenden Befehle, beispielsweise die Befehle, auf die ein Sprungbefehl zeigt oder die Befehle, die am Anfang eines Programm-Zweiges stehen, die durch den bedingten Verzweigungsbefehl verfolgt werden können.This Procedure is for Processors that operate in an environment where more volatile Memory for receiving the program code is present, if no Single step mode available is. The method described is applied as far as the in In this example, command 3 described no jump command or conditional Branch instruction is. In this case, those would not be in relation to the program pointer next Commands replaced by stop instructions, but the logical following Commands, such as the commands pointed to by a jump command or the commands that are at the beginning of a program branch, the can be tracked by the conditional branch instruction.
Zum Testen von Programmen, die ausschließlich in einem nicht flüchtigen, wiederbeschreibbaren Speicher (flash) abgelegt werden, ist dieses Verfahren hingegen nicht geeignet.To the Testing programs that are exclusively in a non-volatile, rewritable memory (flash) is stored, this is Procedure, however, not suitable.
In
In
der obersten Zeile der linken Spalte in
Daraufhin wird der Prozessorstatus wieder hergestellt und die Testumgebung veranlasst den Prozessor das zu testende Programm an der Speicherstelle #008030f8h, dort wo Befehl 3 jetzt steht, fortzuführen, wobei der Prozessor im direkten Anschluss an Befehl 3 abermals auf eine Stoppinstruktion stößt. Diese neue Stoppinstruktion veranlasst den Prozessor wie oben beschrieben dazu, beispielsweise den Prozessorstatus zu retten oder beispielsweise anzuhalten und auf interaktive Befehle an der Kommunikationsschnittstelle zu warten und den gesamten Inhalt des Datenblocks, in dem die Stoppinstruktion anstelle Befehl 4 steht, in ein anderes System zu transferieren. Der Transfer vom Prozessor in die Testumgebung ist aber dann nicht notwendig, wenn die Testumgebung den Inhalt des nicht flüchtigen, wiederbeschreibbaren Speichers protokolliert und entsprechend dem Prozessor nur den Inhalt des neu zu beschreibenden Datenblocks mitteilt oder in einem anderen alternativen Fall, den Prozessor dazu veranlasst den betreffenden Datenblock intern vom nicht flüchtigen, wiederbeschreibbaren Speicher in den flüchtigen Speicher zu transferieren, dort einzelne Änderungen vorzunehmen und den gesamten Datenblock wieder unter Durchführung eines kompletten Wiederbeschreibungszyklus in den nicht flüchtigen, wiederbeschreibbaren Speicher zu schreiben. Im Falle des kompletten Auslesens wird im anderen System diese Stoppinstruktion BRKPOINT nun durch Befehl 4 aus einer Tabelle zurückersetzt und der Befehl 3 innerhalb dieses Datenblocks wird durch eine Stoppinstruktion, BRKPOINT, ersetzt. Danach wird dieser Datenblock gegebenenfalls unter Löschung des Datenblocks im nicht flüchtigen, wiederbeschreibbaren Speicher zurücktransferiert und die Testumgebung veranlasst den Prozessor dazu, das zu testende Programm an der Speicherstelle #008030fch, dort wo jetzt Befehl 4 steht, fortzuführen.thereupon the processor status is restored and the test environment causes the processor to test the program at the memory location # 008030f8h, where command 3 is now to continue, where the processor in the direct connection to command 3 again on one Stop instruction encounters. These new stop instruction causes the processor as described above for example, to save the processor status or for example stop and on interactive commands at the communication interface to wait and see the entire contents of the data block in which the stop instruction instead of command 4 is to transfer to another system. The transfer from the processor to the test environment is then not necessary if the test environment is the content of the non-volatile, rewritable memory is logged and according to the Processor only communicates the contents of the data block to be rewritten or in another alternative case, cause the processor to do so the relevant data block internally from the non-volatile, rewritable Memory in the volatile To transfer memory, there to make individual changes and the whole data block again by performing a complete rewrite cycle in the non-volatile, to write rewritable memory. In case of complete readout In the other system, this stop instruction BRKPOINT is now through Command 4 is reset from a table and the instruction 3 within this data block is terminated by a stop instruction, BRKPOINT, replaced. Thereafter, this data block becomes optional under deletion of the data block in the non-volatile, rewritable memory and the test environment causes the processor to place the program under test at the memory location # 008030fch, where now Command 4 is to continue.
In
Die Simulation einzelner Befehle, die durch eine Stoppinstruktion überschrieben worden sind, ermöglicht einerseits einen Verzicht auf zeitaufwändige und die Lebensdauer von Daten in dem Prozessor beeinträchtigende Wiederbeschreibungszyklen. Durch diese Art des Testens wird auch ein erheblicher Zeitvorteil gewonnen, denn der Wiederbeschreibungszyklus, kann, abhängig von der Bauart des nicht flüchtigen, wiederbeschreibbaren Speichers bis zu 2 Sekunden dauern.The Simulation of individual commands overwritten by a stop instruction been made possible On the one hand a waiver of time-consuming and the life of Interfering with data in the processor Rewrites. By this kind of testing will also gained a significant time advantage because the rewrite cycle, can, dependent of the type of non-volatile, rewritable memory can take up to 2 seconds.
In
In
In
In
In
Claims (9)
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
DE102005032558A DE102005032558B4 (en) | 2005-03-22 | 2005-07-11 | Method for operating a microcontroller in a test environment and electronic test unit for analyzing program codes |
GB0605675A GB2424500A (en) | 2005-03-22 | 2006-03-21 | Debugging code stored in EEPROM by inserting a breakpoint into code using a read/modify/write cycle on block containing individual instruction to be modified |
Applications Claiming Priority (5)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
DE102005013717.2 | 2005-03-22 | ||
DE102005013717 | 2005-03-22 | ||
DE102005015061.6 | 2005-03-31 | ||
DE102005015061 | 2005-03-31 | ||
DE102005032558A DE102005032558B4 (en) | 2005-03-22 | 2005-07-11 | Method for operating a microcontroller in a test environment and electronic test unit for analyzing program codes |
Publications (2)
Publication Number | Publication Date |
---|---|
DE102005032558A1 DE102005032558A1 (en) | 2006-09-28 |
DE102005032558B4 true DE102005032558B4 (en) | 2007-03-01 |
Family
ID=36973747
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
DE102005032558A Active DE102005032558B4 (en) | 2005-03-22 | 2005-07-11 | Method for operating a microcontroller in a test environment and electronic test unit for analyzing program codes |
Country Status (2)
Country | Link |
---|---|
DE (1) | DE102005032558B4 (en) |
GB (1) | GB2424500A (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN100444127C (en) * | 2006-12-12 | 2008-12-17 | 北京中星微电子有限公司 | System and method for testing software |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP0615187A1 (en) * | 1993-03-11 | 1994-09-14 | Olympus Optical Co., Ltd. | One-chip microcomputer system having function for substantially correcting contents of program |
US20030065984A1 (en) * | 2001-09-10 | 2003-04-03 | Kazuyoshi Takeda | Processor device equipped with flash memory and debugger apparatus |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH10214201A (en) * | 1997-01-29 | 1998-08-11 | Mitsubishi Electric Corp | Microcomputer |
JPH1165884A (en) * | 1997-08-25 | 1999-03-09 | Nec Corp | Microcomputer and debugging method therefor |
JP4475709B2 (en) * | 1999-11-15 | 2010-06-09 | 株式会社ルネサステクノロジ | Microcomputer |
JP2001265621A (en) * | 2000-03-22 | 2001-09-28 | Kyocera Corp | On-rom program debugging system |
-
2005
- 2005-07-11 DE DE102005032558A patent/DE102005032558B4/en active Active
-
2006
- 2006-03-21 GB GB0605675A patent/GB2424500A/en not_active Withdrawn
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP0615187A1 (en) * | 1993-03-11 | 1994-09-14 | Olympus Optical Co., Ltd. | One-chip microcomputer system having function for substantially correcting contents of program |
US20030065984A1 (en) * | 2001-09-10 | 2003-04-03 | Kazuyoshi Takeda | Processor device equipped with flash memory and debugger apparatus |
Also Published As
Publication number | Publication date |
---|---|
GB0605675D0 (en) | 2006-05-03 |
GB2424500A (en) | 2006-09-27 |
DE102005032558A1 (en) | 2006-09-28 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
DE69919404T2 (en) | ON-LINE TROUBLESHOOTING AND EXHAUST TRACKING SYSTEM AND METHOD | |
EP1720100B1 (en) | Method and apparatus for emulating a programmable unit | |
DE102005022192B4 (en) | Backup drive with removable storage media to back up data from a host computer | |
DE60010420T2 (en) | Automatic regression testing of workstation software | |
EP2881857B1 (en) | Method for modifying the software in the memory of an electronic control device | |
DE10127170A1 (en) | Troubleshooting procedures and troubleshooting device | |
EP2881858B1 (en) | Method for modifying the software in the memory of an electronic control device | |
EP1565825A2 (en) | Device and method for analysing embedded systems | |
EP0721620B1 (en) | Tracer system for analysing errors of running real time systems | |
DE102005032558B4 (en) | Method for operating a microcontroller in a test environment and electronic test unit for analyzing program codes | |
EP1119801B1 (en) | Method for operating an automation system | |
WO2003060747A2 (en) | Reconfigurable processor | |
EP2634700A1 (en) | Method and development environment for monitoring a running program | |
DE10260103A1 (en) | Method and device for changing software in a control unit and corresponding control unit | |
DE102022202541A1 (en) | Method for testing a computer program | |
EP2386952A1 (en) | Method and development environment for monitoring a running program | |
EP1646946B1 (en) | Access to a programmable logic controller | |
DE102009038177B4 (en) | Tracing in a running computer system | |
DE102006030607A1 (en) | Embedded system testing device, has emulator adjusted for testing different systems, and memory storing instructions and data for operating emulator, where instructions and data are adjusted and extended by user of computer over interface | |
DE19954810B4 (en) | Method for generating and debugging a machine program | |
EP0809183A1 (en) | Method and apparatus for updating part of a program whilst it is running | |
DE19828611C2 (en) | Data processing device and associated method | |
DE102022202338A1 (en) | Method for testing a computer program | |
EP1248197A2 (en) | Method for emulating a program-controlled unit | |
DE102008028702A1 (en) | Method for monitoring progress of application in virtual machine of integrated system for portable data carrier, involves carrying out transmission of state information at debug-unit |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
OP8 | Request for examination as to paragraph 44 patent law | ||
8127 | New person/name/address of the applicant |
Owner name: SEGGER MICROCONTROLLER SYSTEME GMBH, 40721 HILDEN, |
|
8181 | Inventor (new situation) |
Inventor name: SEGGER, ROLF, 40593 DUESSELDORF, DE |
|
8364 | No opposition during term of opposition | ||
R081 | Change of applicant/patentee |
Owner name: SEGGER SOFTWARE GMBH, DE Free format text: FORMER OWNER: SEGGER MICROCONTROLLER SYSTEME GMBH, 40721 HILDEN, DE |
|
R082 | Change of representative |
Representative=s name: RUMMLER, FELIX, DIPL.-ING.UNIV., DE |