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# 18808

6.1 / 3.2 EDK - Using a single global unsigned short or char in a program causes improper memory initialization

Description

Keywords: EDK, XPS, GNU, variable, BSS, char, short

Urgency: Standard

General Description:
The following program compiled in XPS does not work correctly. The CRT which initializes the BSS section causes incorrect variable initialization. The PPC counter gets loaded with 0 and then decremented to 0xFFFFFFFF such that initialization takes forever. This can be seen in GDB on hardware as it never hits the breakpoints set in main and is stuck in the CRT.

unsigned short i;
void main()
{
while (1);
}

Solution

This is easily resolved by changing the code so that the variable "i" is initialized in the code:

unsigned short i = 0;
AR# 18808
Date Created 01/20/2004
Last Updated 04/28/2006
Status Archive
Type General Article