UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

AR# 19804

9.1i EDK - The "getchar" and other newlib library function calls do not work when the code is run from OCM memory

Description

The "getchar" function call does not work when I run the code from OCM memory.

Similarly, other newlib C library routines do not work when run in certain memory configurations. The newlib library delivered with EDK is compiled with the "-mrelocatable-lib" option. This option produces code that READS from the ".text" section for self-referencing entries.

When I execute the code, there are certain load instructions which load from addresses that are in the .text section (i.e., this requires that the .text should be readable/data-side accessible). OCM is one memory configuration which exhibits this issue. OCM designs do not HAVE a D-side interface to the ISOCM memory. If there was a D-side i/f to the same OCM memory address, the load would succeed.

For example, the same problem will occur with PLB BRAM if the user had two BRAM blocks, one for I-side and one for D-side and they are mapped to different addresses. So, if such code runs out of the first block, it will have illegal memory access when coming to those particular instructions in the Newlib routines. Such memory organization is not common, as you will not be able to download/debug such designs, but yet it is possible.

Solution

To work around this issue, you can do one of the following:

- Do not run the application code containing "getchar" or other newlib function calls from OCM memory.

- Use the UART driver function calls to read characters directly from the UART peripheral.

For example:

XUartLite_RecvByte(Xuint32 BaseAddress);

AR# 19804
Date Created 09/03/2007
Last Updated 12/15/2012
Status Active
Type General Article