Hi Everybody there.
I use Nuvoton NUC130LD3AN chip. It is from ARM Cortex-M0 core family.
I wrote a program for it, and use uVision4 (v4.20, v4.60) Simulator to debug it.
A global variable was defined in main.c module (global variable!):
volatile uint32_t AN2 = 0;
It does not matter, whether it is volatile or not.
Then, I use next INI file for the simulator:
MAP 0x00000000, 0x0001EFFF READ EXEC MAP 0x0001F000, 0x0001FFFF READ WRITE EXEC MAP 0x20000000, 0x20003FFF READ WRITE MAP 0x50000000, 0x5001C3FF READ WRITE MAP 0x40004000, 0x400EFFFF READ WRITE MAP 0x40100000, 0x401A3FFF READ WRITE MAP 0xE000E010, 0xE000ED8F READ WRITE SIGNAL void COMP_SIGNAL ( void ) { swatch(0.0002783); // chip initialization delay while (1) { AN2 = 0x000; // clear printf ("AN2 == 0x%X\n", AN2); // print out the value swatch(0.000150); // make square wave AN2 = 0xFFF; // set printf ("AN2 == 0x%X\n", AN2); // print out the value swatch(0.000150); // make square wave } } COMP_SIGNAL ();
As for AN2 variable - it changes. printf does show right output. WATCH window does show changes from 0x000 to 0xFFF and back, as well. Break point, set at
if (AN == 0xFFF)
and
if (AN == 0x000)
, works fine - it stops simulation.
But LA does show one stable state. Either max, or min. Some straight line.
What is interesting - if I change the value from inside .C program (say - from main.c module) - LA works. If the change comes from the Command (INI) file - it stops to work right.
I have tried many ways and many variables, at different addresses (IO addresses, CMP addresses etc). No change. It does not work.
I have tried to use Generic Cortex-M0 chip definitions - no change. Cortex-M0 SDK - no change.
Who knows, what could it be?
Alex.