0
\$\begingroup\$

I recently started programming with STM32F4Discovery board and am using IAR workbench as the IDE. I am supposed to use an already developed program in Eclipse as a part of my project. When I imported this into IAR Workbench, I get the following error and warnings: Error[Pe020]: identifier "_impure_ptr" is undefined Warning[Pe223]: function "_REENT_INIT_PTR" declared implicitly Warning[Pe223]: function "_reclaim_reent" declared implicitly C

I have realized that the _impure_ptr, _REENT_INIT_PTR, _reclaim_reent are a part of the reent.h file which are present in the GNU ARM Toolchain. This is being used as a part of the using FreeRTOS functionality. With Eclipse, this is not a problem, but when using IAR workbench, is there any other file similar to the reent.h for IAR Workbench that I am supposed to include?

I know it is a naive question but I am a beginner to embedded programming and still in the initial stages of setting up this project.

\$\endgroup\$

2 Answers 2

1
\$\begingroup\$

The global variable _impure_ptr is part of newlib libc as used by the GNU ARM Toolchain. IAR uses, as far as I can tell, it's own implementation of the standard C library called CLIB.

The standard C library usually contains all/most function defined in the C standard. As far as these function (printf, strlen...) go, the two libraries should be rather compatible. In other areas these libraries tend to differ. The variable _impure_ptr is used by newlib to support multi threading and contains all global variables used by that thread (e.g. errno).

FreeRTOS has builtin support for newlib reentrancy (although not officially supported by the developers). If this is activated, FreeRTOS keeps a copy of this reentrancy context for every task and replaces the global variable on context switch. You can disable this in your FreeRTOSConfig.h, by setting configUSE_NEWLIB_REENTRANT to 0. But make sure that the IAR libc is reentrant, otherwise you might get into trouble later on.

\$\endgroup\$
0
\$\begingroup\$

You are using IAR's own compiler in the Embedded Workbench IDE. That is different from the gcc compiler for which the application was developed.

If you just want to build and run the application on your board, I suggest you use an Eclipse environment. Google for "stm32f4discovery eclipse debug" and read the tutorial others have put together.

\$\endgroup\$
1
  • \$\begingroup\$ I get it that IAR uses its own compiler. But in order to use the functionality of FreeRTOS, are there any libraries specific for IAR. I am unfortunately unable to find any. The errors occur due to the downloaded files from FreeRTOS and not any own code. \$\endgroup\$
    – smyslov
    Jul 30, 2015 at 11:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.