Earlier today a spent a long time trying to figure out why everything in my application started to go haywire.
I was given a “…used only once” error when compiling and at the time I was unable to find the problem.
Whats worse, my application started behaving wierd.
I feard that I may have reached my RAM memory limit so I began looking for places to optimize.
I was able to completely remove a 32 element array and the compiler message below went away.
From then on, everything started to work again unit I saw the error again. This time, I was able to pinpoint the line in the source that produce the error… but I cannot determine why I get the error.
Below is the output of make.bat with the compiler message:
C:\MATRIX~1\MIOSAP~1\MATRIX~1>make
Makefile generated.
Makefile.bat generated.
Assembling MIOS SDCC wrapper
==========================================================================
Compiling pic18f452.c
Processor: 18F452
==========================================================================
Compiling main.c
Processor: 18F452
MOVFF PREINC1, r0x00
pcoderegs.c:367: removing reg r0x00 because it is used only once
==========================================================================
Linking project
==========================================================================
Converting to project.syx
Block 003000-0033FF allocated - Checksum: 1A
Block 003400-0037FF allocated - Checksum: 22
Block 003800-003BFF allocated - Checksum: 55
Block 003C00-003FFF allocated - Checksum: 54
Block 004000-0043FF allocated - Checksum: 1D
Block 004400-0047FF allocated - Checksum: 04
Block 004800-004BFF allocated - Checksum: 24
Block 004C00-004FFF allocated - Checksum: 24
Block 005000-0053FF allocated - Checksum: 1D
Block 005400-0057FF allocated - Checksum: 2C
Block 005800-005BFF allocated - Checksum: 2B
Block 005C00-005FFF allocated - Checksum: 2D
Block 006000-0063FF allocated - Checksum: 3E
Block 006400-0067FF allocated - Checksum: 5A
Block 006800-006BFF allocated - Checksum: 6C
Block 006C00-006FFF allocated - Checksum: 7D
==========================================================================
SUCCESS!
Here is the segment of code that created the error.
case 2: // LFO2 Select
Selected_LFO = 1;
// set the LED
MIOS_DOUT_PinSet(ButtonConfigMap[pin].dout_pin, DIN_STATE_ON); // <---- THIS LINE
//MIOS_DOUT_PinSet(ButtonConfigMap[pin].dout_pin, (MIOS_DOUT_PinGet(pin)== DIN_STATE_ON) ? DIN_STATE_OFF : DIN_STATE_ON);
// toggle the other buttons
MIOS_DOUT_PinSet(ButtonConfigMap[0].dout_pin,DIN_STATE_OFF);
Update_LFO_LED_Status();
break;
Now, if I comment out that line, and uncomment the line below, it compiles without the error.
P.S.
I’ll be posting some photos of my work in progress today in the HUI forum.