Hi, my eval board is Phytec KC-161 (with 64k ext RAM, and 256k ext FLASH). Why the target doesn't initialize arrays in free running? Thank you.
Could you provide the following information to see what might be your problem?
1) The size of your array? 2) The address of the array from the map file? 3) The declaration of the array in the C file?
...and the startup file (startup.a66) that initializes the vars.
Hi, Joost Leeuwesteijn. ...and the startup file (startup.a66) that initializes the vars. But what should I modify in statup.a66 file that could initialize vars?
> But what should I modify in statup.a66 file that could initialize vars?
See: http://www.keil.com/support/docs/2330.htm http://www.keil.com/support/man/docs/c166/c166_ap_start167_a66.htm INIT_VARS and CLR_MEMORY http://www.keil.com/forum/docs/thread8190.asp
But your array is not a global so this should not apply... I expect the values to be in the "?tpl?0001" section but I'm not sure.
Maybe the compiler optimized it away, if this really is all your code. You could check the assembly file.
Thanks for those links, I'll see what can I do. Maybe the compiler optimized it away, if this really is all your code. You could check the assembly file. No. That code was just where I discovered the problem. I also tryed the follow code using Hyper Terminal. In debug mode the target is running well, but in free running not:
#include <reg161.h> #include <stdio.h> void setup_serial(); void main (void) { unsigned char cnt,array[6]={1,1,1,1,1,1}; setup_serial(); for(cnt=0; cnt<6; cnt++){ if(array[cnt] != 1) putchar('!'); else putchar('1'); //in hyper terminal is displaying six of '!', WHY? //it must be six of '1'! } while (1) { } } void setup_serial(){ P3 |= 0x0400; /* SET PORT 3.10 OUTPUT LATCH (TXD) */ DP3 |= 0x0400; /* SET PORT 3.10 DIRECTION CONTROL (TXD OUTPUT) */ DP3 &= 0xF7FF; /* RESET PORT 3.11 DIRECTION CONTROL (RXD INPUT) */ S0TIC = 0x80; /* SET TRANSMIT INTERRUPT FLAG */ S0RIC = 0x00; /* DELETE RECEIVE INTERRUPT FLAG */ S0BG = 0x19; /* SET BAUDRATE TO 19200 BAUD AT 16MHZ */ S0CON = 0x8011; /* SET SERIAL MODE */ }
> In debug mode the target is running well, but in free > running not
What do you mean exactly? Debug mode is on a simulator? Or on the target? And free run is on the target? Could there be a problem in the memory map/linker file? Is everything located in RAM?
What does the array contain in the incorrect situation?
- What do you mean exactly? Debug mode is on a simulator? Or on the target? I mean debug mode is on the target. - And free run is on the target? Yes. Free running I mean the execution of the device after I download the .H86 file to flash of the board.
- What does the array contain in the incorrect situation? I think that the length is not defined. When I tryed to determine what the array contains i think is 0xFF...
Thank you...
View all questions in Keil forum