29.10.2014 Views

ARM Compiler toolchain v4.1 for µVision Using the Compiler

ARM Compiler toolchain v4.1 for µVision Using the Compiler

ARM Compiler toolchain v4.1 for µVision Using the Compiler

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Compiler</strong> Coding Practices<br />

5.52 About trapping integer division-by-zero errors with __aeabi_idiv0()<br />

Integer division-by-zero errors can be trapped with <strong>the</strong> C library helper function<br />

__aeabi_idiv0() so that division by zero returns some standard result, <strong>for</strong> example zero.<br />

Integer division is implemented in code through <strong>the</strong> C library helper functions __aeabi_idiv()<br />

and __aeabi_uidiv(). Both functions check <strong>for</strong> division by zero.<br />

When integer division by zero is detected, a branch to __aeabi_idiv0() is made. To trap <strong>the</strong><br />

division by zero, <strong>the</strong>re<strong>for</strong>e, you only have to place a breakpoint on __aeabi_idiv0().<br />

5.52.1 See also<br />

Concepts<br />

• Integer division-by-zero errors in C code on page 5-67<br />

• About trapping integer division-by-zero errors with __rt_raise() on page 5-69.<br />

O<strong>the</strong>r in<strong>for</strong>mation<br />

• Run-time ABI <strong>for</strong> <strong>the</strong> <strong>ARM</strong> Architecture,<br />

http://infocenter.arm.com/help/topic/com.arm.doc.ihi0043-/index.html.<br />

<strong>ARM</strong> DUI 0375C Copyright © 2007-2008, 2011 <strong>ARM</strong>. All rights reserved. 5-68<br />

ID061811<br />

Non-Confidential

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!