EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

IAR, assertions and error e46 in release mode

Started by Jon Garcia de Salazar Bilbao February 13, 2009
Hi everyone,

I'm using IAR Embedded Workshop for MSP430F149. I'm using assertions in my C
code. It works OK while working on debug mode but when I switch to release
mode I get the error below:

Error[e46]: Undefined external "__write" referred in ?puts ( C:\Archivos de
programa\IAR Systems\Embedded Workbench Evaluation
4.0\430\LIB\DLIB\dl430fn.r43 )

When I remove assertions it works fine.

I even checked if NDEBUG was defined, in order to disable assertions, while
on release mode, and it was.

I also read this on the internet:

When linking the application, the following linker error might be generated:

Error [e46]: Undefined external "?xxxxx_Lnn" referred in Example1

This error message is generated if the version 3.x or 2.x object module is
referring a

runtime library function which is not available in the version 4.x runtime
library. In this

case, you can extract the referred function from the version 3.x or 2.x
runtime library

module and include it in your version 4.x project by using the IAR XLIB
Librarian.

But as far as I know that's not my case, am I right?

Am I missing something?

Thanks, Jon.



Beginning Microcontrollers with the MSP430

Jon Garcia de Salazar Bilbao wrote:
> I'm using IAR Embedded Workshop for MSP430F149. I'm using assertions in my C
> code. It works OK while working on debug mode but when I switch to release
> mode I get the error below:
>
> Error[e46]: Undefined external "__write" referred in ?puts ( C:\Archivos de
> programa\IAR Systems\Embedded Workbench Evaluation
> 4.0\430\LIB\DLIB\dl430fn.r43 )

Hi!

The basic idea is that when you build an application in Debug mode, and
your application prints something, it is sent to the C-Spy debugger
using a special version of __write.

However, in release mode, you have to send the same output through some
kind of real hardware (UART, or whatever). In that case you should
provide the low-level output function yourself.

The best way to avoid this is to ensure that your application does not
contain anything that calls __write directly or indirectly, for example
"printf", "putchar" etc.

-- Anders Lindgren, IAR Systems
--
Disclaimer: Opinions expressed in this posting are strictly my own and
not necessarily those of my employer.

Thanks Anders.

_____

De: m... [mailto:m...] En nombre de
Anders Lindgren
Enviado el: lunes, 16 de febrero de 2009 14:24
Para: m...
Asunto: Re: [msp430] IAR, assertions and error e46 in release mode

Jon Garcia de Salazar Bilbao wrote:
> I'm using IAR Embedded Workshop for MSP430F149. I'm using assertions in my
C
> code. It works OK while working on debug mode but when I switch to release
> mode I get the error below:
>
> Error[e46]: Undefined external "__write" referred in ?puts ( C:\Archivos
de
> programa\IAR Systems\Embedded Workbench Evaluation
> 4.0\430\LIB\DLIB\dl430fn.r43 )

Hi!

The basic idea is that when you build an application in Debug mode, and
your application prints something, it is sent to the C-Spy debugger
using a special version of __write.

However, in release mode, you have to send the same output through some
kind of real hardware (UART, or whatever). In that case you should
provide the low-level output function yourself.

The best way to avoid this is to ensure that your application does not
contain anything that calls __write directly or indirectly, for example
"printf", "putchar" etc.

-- Anders Lindgren, IAR Systems
--
Disclaimer: Opinions expressed in this posting are strictly my own and
not necessarily those of my employer.




The 2024 Embedded Online Conference