Hello, After two years of happy working with the keil C166/C167 compiler I've just ran into a problem I don't understand / can't solve. Running phytec kitcon 167 Memory model Hlarge Declared two unsigned long variables :
unsigned long v1; unsigned long v2;
if (v1!=0) { v2 := v1; ..... ..... }
MOV R6,DPP2:0x1750 MOV R7,DPP2:0x1752 MOV R4,R6 OR R4,R7 JMPR CC_Z,0x003A3C MOV DPP2,0x1776,R6 MOV DPP2,0x1778,R7
if (v1!=0)
v2:=v1
"For my project I used to drive all isr's with independent signal generators on their input pins." Yep, that's a good stress test, but my point still stands: the fact that you didn't detect any problems does not guarantee that there are no problems. eg, i had a problem a while back where a certain event was occasionally mis-handled. To capture the behaviour, I connected up all the logging stuff like you, and increased the event rate in the hope that the error would manifest more often. It didn't; in fact, it totally stopped happening! It eventually turned out to be an interaction with a background activity lasting 20 seconds or so, and occurring only when the system had been "idle" for 5 minutes or so - so increasing the event rate actually stopped the problem from manifesting! Heisenberg strikes again! I'm not trying to say that testing is worthless; just pointing out that statements like "It's been working for xx months without a problem" are not sufficient to conclude that there are no bugs still lurking!
Problem is solved ! Declaring the variables :
unsigned long volatile v1; unsigned long volatile v2;
/* note: variables that are modified in interrupts are volatile! */