<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Forcing a breakpoint from application code in LPCXpresso IDE</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/Forcing-a-breakpoint-from-application-code/m-p/596860#M32002</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lpcxpresso-support on Mon Feb 03 02:00:00 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;If you link with &lt;/SPAN&gt;&lt;STRONG&gt;Redlib (semihost)&lt;/STRONG&gt;&lt;SPAN&gt; then you will basically get the assert behaviour you are looking for.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you want to put your own BKPT instructions into your code, then the latest release of CMSIS (v3.20) provides a macro to do this…&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;/** \brief&amp;nbsp; Breakpoint

&amp;nbsp;&amp;nbsp;&amp;nbsp; This function causes the processor to enter Debug state.
&amp;nbsp;&amp;nbsp;&amp;nbsp; Debug tools can use this to investigate system state when the instruction at a particular address is reached.

&amp;nbsp;&amp;nbsp;&amp;nbsp; \param [in]&amp;nbsp;&amp;nbsp;&amp;nbsp; value&amp;nbsp; is ignored by the processor.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If required, a debugger can use it to store additional information about the breakpoint.
 */
#define __BKPT(value)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; __ASM volatile ("bkpt "#value)&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Note that you do need to be careful with this sort of thing, because if you leave such instructions in code that is executed without debug tools attached, then if the BKPT is executed you will get an processor exception triggered.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPCXpresso Support&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 23:02:54 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T23:02:54Z</dc:date>
    <item>
      <title>Forcing a breakpoint from application code</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Forcing-a-breakpoint-from-application-code/m-p/596859#M32001</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by DaveNadler on Sun Feb 02 10:11:39 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Background: Experienced programmers know that using "assert" liberally to confirm things like values in expected ranges can save enormous amounts of time debugging, by catching logical errors early rather than waiting for something to blow up downstream of the error. Consequently, we want to force a break into the debugger on an assertion failure (by recoding the "assert" macro).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Will this do the trick?&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;__asm("BKPT #0\n")&amp;nbsp; ;&amp;nbsp; // Break into the debugger&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;SPAN&gt;If not, what's the recommended way to do this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[u]The debugger should stop at this point, and provide full visibility into the local stack and call stack...[/u]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Best Regards, Dave&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;PS: Sorry I don't have a handy LPCxpresso module and project to try this on...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 23:02:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Forcing-a-breakpoint-from-application-code/m-p/596859#M32001</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T23:02:53Z</dc:date>
    </item>
    <item>
      <title>Re: Forcing a breakpoint from application code</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Forcing-a-breakpoint-from-application-code/m-p/596860#M32002</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lpcxpresso-support on Mon Feb 03 02:00:00 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;If you link with &lt;/SPAN&gt;&lt;STRONG&gt;Redlib (semihost)&lt;/STRONG&gt;&lt;SPAN&gt; then you will basically get the assert behaviour you are looking for.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you want to put your own BKPT instructions into your code, then the latest release of CMSIS (v3.20) provides a macro to do this…&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;/** \brief&amp;nbsp; Breakpoint

&amp;nbsp;&amp;nbsp;&amp;nbsp; This function causes the processor to enter Debug state.
&amp;nbsp;&amp;nbsp;&amp;nbsp; Debug tools can use this to investigate system state when the instruction at a particular address is reached.

&amp;nbsp;&amp;nbsp;&amp;nbsp; \param [in]&amp;nbsp;&amp;nbsp;&amp;nbsp; value&amp;nbsp; is ignored by the processor.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If required, a debugger can use it to store additional information about the breakpoint.
 */
#define __BKPT(value)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; __ASM volatile ("bkpt "#value)&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Note that you do need to be careful with this sort of thing, because if you leave such instructions in code that is executed without debug tools attached, then if the BKPT is executed you will get an processor exception triggered.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPCXpresso Support&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 23:02:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Forcing-a-breakpoint-from-application-code/m-p/596860#M32002</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T23:02:54Z</dc:date>
    </item>
  </channel>
</rss>

