EmbeddedRelated.com
Forums

Breakpoints in external FLASH on LPC2468?

Started by Dennis Clark October 16, 2011
Hi all,

We've been working on a project using IAR/j-link with uC/OS and
having issues. We got the USB and FS modules working together well when
debugging in external RAM, but the USB stops working when loading into
external FLASH. To compound the confusion, I've been totally unable to
set breakpoints in the external FLASH. Is there some secret to this
that I just don't know? I've had no problems with breakpoints in
external RAM debugging, but all I get is "unable to set breakpoint"
errors in the external FLASH debug sessions. Any clues?

Thanks,
DLC

--
Dennis Clark
TTT Enterprises

An Engineer's Guide to the LPC2100 Series

On 16.10.2011 07:58, Dennis Clark wrote:
> ... I've been totally unable to set breakpoints in the external
> FLASH...

When your program is in RAM, debuggers can set an arbitrary number of
breakpoints by modifying the code in the RAM. With FLASH you need
hardware assisted breakpoints. I know nothing about IAR but it might use
HW breakpoints automatically when your program is in the internal FLASH.
Regarding the external FLASH it could be that you have to somehow tell
the IAR debugger to use HW breakpoints. In GDB/OpenOCD one can specify
this in configuration files or use 'hbreak' on command line.

--

Timo
Hi,

the functionality of Flash breakpoints is tight to the Segger J-Link, not to the IAR EWARM but as long as you are using a J-Link with IAR the option exists.
I do not know whether external Flash is supported, for sure internal flash of the LPC24xx is supported.

recommended reading:
Article about flash breakpoints in IQ Magazine
http://www.segger.com/cms/admin/uploads/userfiles/file/PressReleases/091016_Flash_breakpoints_IQ_magazine.pdf

Information from Segger
http://www.segger.com/cms/jlink-flash-breakpoints.html

Robert

--- In l..., Dennis Clark wrote:
>
> Hi all,
>
> We've been working on a project using IAR/j-link with uC/OS and
> having issues. We got the USB and FS modules working together well when
> debugging in external RAM, but the USB stops working when loading into
> external FLASH. To compound the confusion, I've been totally unable to
> set breakpoints in the external FLASH. Is there some secret to this
> that I just don't know? I've had no problems with breakpoints in
> external RAM debugging, but all I get is "unable to set breakpoint"
> errors in the external FLASH debug sessions. Any clues?
>
> Thanks,
> DLC
>
> --
> Dennis Clark
> TTT Enterprises
>

Robert,

Thanks for the info. The links you give show how what I would need to pay extra for to get more than the two "built in" hardware breakpoints when using a j-link. That is certainly food for thought! However, I'd be happy right now to even get the two hardware breakpoints the articles maddeningly refer to, but never reference. It appears that something needs to be set in some file somewhere to enable those hardware breakpoints. This seems to be JTAG emulator specific so it makes sense that it isn't in any of the IAR docs that I've read. Now that I know that I can try to find the Segger doc that explains it. A very valuable pointer! I'm new to IAR in specific, and ARM in general, my background is in Microchip, AVR and Motorola where this separation between FLASH and RAM debugging does not seem to exist.

Thanks guys. If anyone has a pointer to the document or location of the document that helps with this script setting I'd appreciate it. When I solve my problem I'll post the results. I've seen the question asked several times on the 'net, but no one has posted a solution.

regards,
DLC
--- In l..., "robert_teufel" wrote:
>
> Hi,
>
> the functionality of Flash breakpoints is tight to the Segger J-Link, not to the IAR EWARM but as long as you are using a J-Link with IAR the option exists.
> I do not know whether external Flash is supported, for sure internal flash of the LPC24xx is supported.
>
> recommended reading:
> Article about flash breakpoints in IQ Magazine
> http://www.segger.com/cms/admin/uploads/userfiles/file/PressReleases/091016_Flash_breakpoints_IQ_magazine.pdf
>
> Information from Segger
> http://www.segger.com/cms/jlink-flash-breakpoints.html
>
> Robert
>
> --- In l..., Dennis Clark wrote:
> >
> > Hi all,
> >
> > We've been working on a project using IAR/j-link with uC/OS and
> > having issues. We got the USB and FS modules working together well when
> > debugging in external RAM, but the USB stops working when loading into
> > external FLASH. To compound the confusion, I've been totally unable to
> > set breakpoints in the external FLASH. Is there some secret to this
> > that I just don't know? I've had no problems with breakpoints in
> > external RAM debugging, but all I get is "unable to set breakpoint"
> > errors in the external FLASH debug sessions. Any clues?
> >
> > Thanks,
> > DLC
> >
> > --
> > Dennis Clark
> > TTT Enterprises
>

Hi Robert,

The distinction between flash and RAM always exists since it's not possible
to re-write a single location in flash. Unlike EEPROM, flash needs a block
to be programmed to all zeros then erased to all 1's then programmed to the
final values. ( although the erase operation usually hides the setting to
all zero's ).

For RAM the debugger replaces the instruction at the target address with a
break instruction, then traps the break handler and restores the actual
instruction to execute, for Flash this is not possible so the breakpoints in
flash require dedicated HW monitoring the address of the instruction
executed and triggering a HW event when a targeted instruction is executed,
this requires dedicated address comparators for each breakpoint so the
number is limited.

Most good debuggers handle this transparently when you set a breakpoint, so
I can't understand why the IAR tools appear not to be doing this.

The breakpoint logic is NOT specific to the debugger, it's part of the
cortex and is documented in the ARM V6 architecture reference manual.

You can set this up manually but will not be able to single step these
instructions easily unless the debugger is aware of them.

If you really can't get IAR to support this then you may work around it by
re-linking the code so that the function you want to breakpoint is in RAM,
but it's far from an ideal solution.

Regards

Phil.

From: l... [mailto:l...] On Behalf Of
Dennis
Sent: 17 October 2011 14:56
To: l...
Subject: [lpc2000] Re: Breakpoints in external FLASH on LPC2468?

Robert,

Thanks for the info. The links you give show how what I would need to pay
extra for to get more than the two "built in" hardware breakpoints when
using a j-link. That is certainly food for thought! However, I'd be happy
right now to even get the two hardware breakpoints the articles maddeningly
refer to, but never reference. It appears that something needs to be set in
some file somewhere to enable those hardware breakpoints. This seems to be
JTAG emulator specific so it makes sense that it isn't in any of the IAR
docs that I've read. Now that I know that I can try to find the Segger doc
that explains it. A very valuable pointer! I'm new to IAR in specific, and
ARM in general, my background is in Microchip, AVR and Motorola where this
separation between FLASH and RAM debugging does not seem to exist.

Thanks guys. If anyone has a pointer to the document or location of the
document that helps with this script setting I'd appreciate it. When I solve
my problem I'll post the results. I've seen the question asked several times
on the 'net, but no one has posted a solution.

regards,
DLC

--- In l... ,
"robert_teufel" wrote:
>
> Hi,
>
> the functionality of Flash breakpoints is tight to the Segger J-Link, not
to the IAR EWARM but as long as you are using a J-Link with IAR the option
exists.
> I do not know whether external Flash is supported, for sure internal flash
of the LPC24xx is supported.
>
> recommended reading:
> Article about flash breakpoints in IQ Magazine
>
http://www.segger.com/cms/admin/uploads/userfiles/file/PressReleases/091016_
Flash_breakpoints_IQ_magazine.pdf
>
> Information from Segger
> http://www.segger.com/cms/jlink-flash-breakpoints.html
>
> Robert
>
> --- In l... , Dennis
Clark wrote:
> >
> > Hi all,
> >
> > We've been working on a project using IAR/j-link with uC/OS and
> > having issues. We got the USB and FS modules working together well when
> > debugging in external RAM, but the USB stops working when loading into
> > external FLASH. To compound the confusion, I've been totally unable to
> > set breakpoints in the external FLASH. Is there some secret to this
> > that I just don't know? I've had no problems with breakpoints in
> > external RAM debugging, but all I get is "unable to set breakpoint"
> > errors in the external FLASH debug sessions. Any clues?
> >
> > Thanks,
> > DLC
> >
> > --
> > Dennis Clark
> > TTT Enterprises
>



Check if you have watchdog enabled. I have seen it many times when the
watchdog is enabled, the debugger can't halt the processor.

-Ananda

On Mon, Oct 17, 2011 at 8:11 AM, Phil Young wrote:

> **
> Hi Robert,
>
> The distinction between flash and RAM always exists since it's not possible
> to re-write a single location in flash. Unlike EEPROM, flash needs a block
> to be programmed to all zeros then erased to all 1's then programmed to the
> final values. ( although the erase operation usually hides the setting to
> all zero's ).
>
> For RAM the debugger replaces the instruction at the target address with a
> break instruction, then traps the break handler and restores the actual
> instruction to execute, for Flash this is not possible so the breakpoints
> in
> flash require dedicated HW monitoring the address of the instruction
> executed and triggering a HW event when a targeted instruction is executed,
> this requires dedicated address comparators for each breakpoint so the
> number is limited.
>
> Most good debuggers handle this transparently when you set a breakpoint, so
> I can't understand why the IAR tools appear not to be doing this.
>
> The breakpoint logic is NOT specific to the debugger, it's part of the
> cortex and is documented in the ARM V6 architecture reference manual.
>
> You can set this up manually but will not be able to single step these
> instructions easily unless the debugger is aware of them.
>
> If you really can't get IAR to support this then you may work around it by
> re-linking the code so that the function you want to breakpoint is in RAM,
> but it's far from an ideal solution.
>
> Regards
>
> Phil.
>
> From: l... [mailto:l...] On Behalf
> Of
> Dennis
> Sent: 17 October 2011 14:56
> To: l...
> Subject: [lpc2000] Re: Breakpoints in external FLASH on LPC2468?
> Robert,
>
> Thanks for the info. The links you give show how what I would need to pay
> extra for to get more than the two "built in" hardware breakpoints when
> using a j-link. That is certainly food for thought! However, I'd be happy
> right now to even get the two hardware breakpoints the articles maddeningly
> refer to, but never reference. It appears that something needs to be set in
> some file somewhere to enable those hardware breakpoints. This seems to be
> JTAG emulator specific so it makes sense that it isn't in any of the IAR
> docs that I've read. Now that I know that I can try to find the Segger doc
> that explains it. A very valuable pointer! I'm new to IAR in specific, and
> ARM in general, my background is in Microchip, AVR and Motorola where this
> separation between FLASH and RAM debugging does not seem to exist.
>
> Thanks guys. If anyone has a pointer to the document or location of the
> document that helps with this script setting I'd appreciate it. When I
> solve
> my problem I'll post the results. I've seen the question asked several
> times
> on the 'net, but no one has posted a solution.
>
> regards,
> DLC
>
> --- In l... ,
>
> "robert_teufel" wrote:
> >
> > Hi,
> >
> > the functionality of Flash breakpoints is tight to the Segger J-Link, not
> to the IAR EWARM but as long as you are using a J-Link with IAR the option
> exists.
> > I do not know whether external Flash is supported, for sure internal
> flash
> of the LPC24xx is supported.
> >
> > recommended reading:
> > Article about flash breakpoints in IQ Magazine
> > http://www.segger.com/cms/admin/uploads/userfiles/file/PressReleases/091016_
> Flash_breakpoints_IQ_magazine.pdf
> >
> > Information from Segger
> > http://www.segger.com/cms/jlink-flash-breakpoints.html
> >
> > Robert
> >
> > --- In l... ,
> Dennis
>
> Clark wrote:
> > >
> > > Hi all,
> > >
> > > We've been working on a project using IAR/j-link with uC/OS and
> > > having issues. We got the USB and FS modules working together well when
>
> > > debugging in external RAM, but the USB stops working when loading into
> > > external FLASH. To compound the confusion, I've been totally unable to
> > > set breakpoints in the external FLASH. Is there some secret to this
> > > that I just don't know? I've had no problems with breakpoints in
> > > external RAM debugging, but all I get is "unable to set breakpoint"
> > > errors in the external FLASH debug sessions. Any clues?
> > >
> > > Thanks,
> > > DLC
> > >
> > > --
> > > Dennis Clark
> > > TTT Enterprises
> > >
> >
>
>
>