Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
16 years ago

Wear behavior in the memory

Hello!

I have a very very wear behavior in my orogram. I have this code:

//message is a char array
const unsigned int* command =((unsigned int*)(message+2));
When I observe the debugger 'Variables' tab I can see:

command 0x02ffcf0a

*command 1

'1' is the expected value, it's a command that I'm sending to the Nios from my PC. The wear is the next code:

printf("*command = %d", *command);
 if(  (*command) == 1U){
        TCPSSReport("Never enters here!!!!!!!!\n");
 }
The test it's always false. The output is this:

*command = 66684 //The actual value seems to be random

So, the program behavior is very very wrong!. I have no optimization enable. My memory map is the following:

.bss : onchip_mem

.entry : reset

.exceptions : onchip_mem

.heap : sram1

.rodata : sram2

.rwdata : onchip_mem

.stack : sram2

.data :sram2

the instruction (in the disassambly tab)used to load the variable is 'ldw'.

any ideas what is causing this?
No RepliesBe the first to reply