J-Link RDI User Guide

J-Link RDI User Guide

55

Chapter 6

Breakpoints in flash memory

This chapter describes how to configure and use breakpoints in flash memory.

J-Link RDI(UM08004) © 2004-2013 SEGGER Microcontroller GmbH & Co. KG

56 CHAPTER 6 Breakpoints in flash memory

6.1

Introduction

The J-Link RDI software contains an additional feature, called flash breakpoints

(short FlashBPs). Flash breakpoints allow the user to set an unlimited number of software breakpoints when debugging in flash memory, rather than just the 2 hardware breakpoints. Setting the breakpoints in flash is executed very fast using a RAM code specifically designed for this purpose; on chips with fast flash, the difference between breakpoints in RAM and flash is unnoticeable. This feature requires an additional license from SEGGER.

6.2

How do breakpoints work?

There are basically 2 types of breakpoints in a computer system: Hard ones and soft ones. Hardware breakpoints require a dedicate hardware unit for every breakpoint.

In other words, the hardware dictates how many hardware breakpoints can be set simultaneously. ARM7 and ARM 9 cores have 2 breakpoint units (called "watchpoint units" in ARM's documentation), allowing 2 hardware breakpoints to be set. Hardware breakpoints do not require modification of the program code. Software breakpoints are different: The debugger modifies the program and replaces the breakpointed instruction with a special value. Additional software breakpoints do not require additional hardware units in the processor, since simply more instructions are replaced.

This is a standard procedure that most debuggers are capable of, however, it requires the program to be located in RAM.

6.3

What is special about software breakpoints in flash?

FlashBP allows you to set an unlimited number of breakpoints even if your application program is not located in RAM, but in flash memory. This is a scenario which was very rare before ARM-microcontrollers hit the market. This new technology makes very powerful, yet inexpensive ARM microcontrollers available for systems, which required external RAM before. The downside of this new technology is that it is not possible to debug larger programs on these micros in RAM, since the RAM is not big enough to hold program and data (typically, these chips contain about 4 times as much flash as

RAM), and therefore with standard debuggers, only 2 breakpoints can be set. The 2 breakpoint limit makes debugging very tough; a lot of times the debugger requires 2 breakpoints to simply step over a line of code. With software breakpoints in flash, this limitation is gone.

6.4

How does this work?

Basically very simple:

The J-Link RDI software reprograms a sector of the flash to set or clear a breakpoint.

6.5

What performance can I expect?

A RAMCode, specially designed for this purpose, sets and clears flash breakpoints extremely fast; on micros with fast flash the difference between breakpoints in RAM and flash is hardly noticeable.

6.6

How is this performance achieved?

We have put a lot of effort in making flash breakpoints really usable and convenient.

Flash sectors are programmed only when necessary; this is usually the moment execution of the target program is started. A lot of times, more then one breakpoint is

J-Link RDI(UM08004) © 2004-2013 SEGGER Microcontroller GmbH & Co. KG

57 located in the same flash sector, which allows programming multiple breakpoints by programming just a single sector. The contents of program memory are cached, avoiding time consuming reading of the flash sectors. A smart combination of software and hardware breakpoints allows us to use hardware breakpoints a lot of times, especially when the debugger is source level-stepping, avoiding reprogramming flash in these situations. A built-in instruction set simulator further reduces the number of flash operations which need to be performed. This minimizes delays for the user, maximizing the life time of the flash. All resources of the ARM micro are available to the application program, no memory is lost for debugging. All of the optimizations described above can be disabled.

6.7

Setting up flash breakpoints

For more information please refer to Setting up flash download & unlimited flash

breakpoints

on page 51.

J-Link RDI(UM08004) © 2004-2013 SEGGER Microcontroller GmbH & Co. KG

58 CHAPTER 6 Breakpoints in flash memory

J-Link RDI(UM08004) © 2004-2013 SEGGER Microcontroller GmbH & Co. KG

Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement

Table of contents