Found the mistake
I was doing
But it should be
extern datatype variable_name ;
extern BYTE x;
... and you may spend some more days, with such a fricken bug.
I can assure you that your environment as you described it will run as expected.
When reducing your code to the absolute necessary (a main.c with the variable declared as volatile extern and inspecting it, a second file with a timer-isr incrementing that global var here).
Did you qualify your variable as volatile? Have a look here in my favourite online C-manual what it is for: http://publications.gbdirect.co.uk/c_book/chapter8/const_and_volatile.html
When we don't declare a datatype for a variable, compiler assumes it as "int" - a 2 byte variable. In c2 file, it is being treated as "int". This will cause problems. For instance, if you try to copy this variable to a byte type variable, it will take the data from a (address+1) location of "int" variable; but the data will be actually in (address). Try it out with a simple program and look into the .lst file.
The size of INT is compiler dependent,and varies in ANSI from one revision level
to another. Basically stating an INT should be close to the HW implementation of
the machine. In Imagcraft and HiTech 16 bits.
I saw a reference current ANSI is 4 bytes for a 32 bit platform.
The only relevancy this has to PSOC 1 is porting in and out of PSOC 1.