This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ULINK download doesn't work if application has local arrays with initialisation

We started to use the phyCoreXC161-Board from Phytec and now we have got a strange problem.
We started with the Project
"C:\Keil\Boards\PhyCORE XC16x\Blinky.uv2".
The only modification in the complete project we made was the declaration and the initialisation of the array cIEC[] in Blinky.c, as you can see below. We build the target as an "external flash"-application, no setting was changed.
When we compiled it there were no errors and no warnings. But when we tried to download it with ULINK, we get the message "Flash download failed" at about address 0x4000. When we delete the new declared array and rebuild it, the download works fine again as well as the debugging. We are also able to declare the array without an initialisation. It is also possible to declare it as static, as well as a global declaration outside the function (each time with initialisation.)
It is also strange that we we can load the built HEX-File with the Flash-tool of Phytec via RS232. If we do so we can also debug it with the ULINK. But this can not be a practical solution.
This problem also occurs in all off our other projects.

Best regards
M.Ubbenhorst

/*-----------------------------------------------------BLINKY.C: adapted for XC161/XC164 Board

Copyright 2003 Keil Software, Inc.
-------------------------------------*/

#include <stdio.h> e
#include <XC161.h>
#include <math.h>

sbit P9_0 = P9^0;
sbit DP9_0 = DP9^0;

char const xhuge a[0x60000] = 0;

/****************/
/* main program */
/****************/
void main (void) { unsigned long i=0;

char cIEC[5] = {0x39,0x37,0x37,0x36,0x36};

DP9_0 = 1;

do {

P9_0 = 1;

for (i=0; i<100000; i++) {;}

P9_0 = 0;

for (i=0; i<100000; i++) {;}

} while(1);
}

0