PIC compiler ERROR: "fixup overflow storing..." (PIC16F628A)

PIC, AVR, Arduino, Raspberry Pi, Basic Stamp, PLC mm.
Användarvisningsbild
squiz3r
Inlägg: 5424
Blev medlem: 5 september 2006, 20:06:22
Ort: Lund
Kontakt:

PIC compiler ERROR: "fixup overflow storing..." (PIC16F628A)

Inlägg av squiz3r »

Hej. Jag försöker programmera en PIC16F628A att styra alla sina utgångar med individuella PWM signaler. För detta så har jag en timer (timer 0, intosc, 1:16) som rullar på, jag jämför då i mjukvaran när timern har rullat förbi det önskade PWM värdet och stänger av den utgången. Detta fungerar perefekt med ~5 utgångar, men när jag la in alla 16 så fick jag error medelanden...

PIC: 16F628A
Compiler: Hi-tech C compiler
Utvecklingsmiljö: MPLAB IDE

Så här ser det ut.

Kod: Markera allt

Omniscient Code Generation not available in Lite mode (warning)

Error   [1346] ; 0. can't find 0x0 words for psect "strings" in segment "CODE" (largest unused contiguous range 0x0)
Error   [1346] ; 0. can't find 0x1E words for psect "idata" in segment "CODE" (largest unused contiguous range 0x0)

Error   [1268] G:\PIC\Projekt\LED_Blomma\main.c; 162. fixup overflow storing 0x815 in 2 bytes at 0xFC2 (LED_Blomma.obj 92/0xC6)
Error   [1268] G:\PIC\Projekt\LED_Blomma\main.c; 162. fixup overflow storing 0x815 in 2 bytes at 0xFCA (LED_Blomma.obj 95/0x4)
Error   [1268] G:\PIC\Projekt\LED_Blomma\main.c; 162. fixup overflow storing 0x815 in 2 bytes at 0xFF0 (LED_Blomma.obj 95/0x2A)
Error   [1268] G:\PIC\Projekt\LED_Blomma\main.c; 162. fixup overflow storing 0x80C in 2 bytes at 0x1012 (LED_Blomma.obj 95/0x4C)
Error   [1268] G:\PIC\Projekt\LED_Blomma\main.c; 162. fixup overflow storing 0x80F in 2 bytes at 0x101A (LED_Blomma.obj 95/0x54)
Error   [1268] G:\PIC\Projekt\LED_Blomma\main.c; 162. fixup overflow storing 0x810 in 2 bytes at 0x101C (LED_Blomma.obj 95/0x56)
Error   [1268] G:\PIC\Projekt\LED_Blomma\main.c; 162. fixup overflow storing 0x815 in 2 bytes at 0x101E (LED_Blomma.obj 95/0x58)
Error   [1268] G:\PIC\Projekt\LED_Blomma\main.c; 162. fixup overflow storing 0x818 in 2 bytes at 0x102C (LED_Blomma.obj 95/0x66)
Error   [1268] G:\PIC\Projekt\LED_Blomma\main.c; 162. fixup overflow storing 0x819 in 2 bytes at 0x102E (LED_Blomma.obj 95/0x68)
Error   [1268] G:\PIC\Projekt\LED_Blomma\main.c; 162. fixup overflow storing 0x849 in 2 bytes at 0x1030 (LED_Blomma.obj 95/0x6A)
Error   [1268] G:\PIC\Projekt\LED_Blomma\main.c; 162. fixup overflow storing 0x828 in 2 bytes at 0x104A (LED_Blomma.obj 95/0x84)
Error   [1268] G:\PIC\Projekt\LED_Blomma\main.c; 162. fixup overflow storing 0x82B in 2 bytes at 0x1052 (LED_Blomma.obj 95/0x8C)
Error   [1268] G:\PIC\Projekt\LED_Blomma\main.c; 162. fixup overflow storing 0x82C in 2 bytes at 0x1054 (LED_Blomma.obj 95/0x8E)
Error   [1268] G:\PIC\Projekt\LED_Blomma\main.c; 162. fixup overflow storing 0x848 in 2 bytes at 0x1056 (LED_Blomma.obj 95/0x90)
Error   [1268] G:\PIC\Projekt\LED_Blomma\main.c; 162. fixup overflow storing 0x83F in 2 bytes at 0x1078 (LED_Blomma.obj 95/0xB2)
Error   [1268] G:\PIC\Projekt\LED_Blomma\main.c; 162. fixup overflow storing 0x842 in 2 bytes at 0x1080 (LED_Blomma.obj 95/0xBA)
Error   [1268] G:\PIC\Projekt\LED_Blomma\main.c; 162. fixup overflow storing 0x843 in 2 bytes at 0x1082 (LED_Blomma.obj 95/0xBC)
Error   [1268] G:\PIC\Projekt\LED_Blomma\main.c; 162. fixup overflow storing 0x848 in 2 bytes at 0x1084 (LED_Blomma.obj 97/0x0)
Error   [1268] G:\PIC\Projekt\LED_Blomma\main.c; 162. fixup overflow storing 0x87C in 2 bytes at 0x1090 (LED_Blomma.obj 97/0xC)
Error   [1268] G:\PIC\Projekt\LED_Blomma\main.c; 162. fixup overflow storing 0x84C in 2 bytes at 0x1094 (LED_Blomma.obj 97/0x10)
Error   [1268] G:\PIC\Projekt\LED_Blomma\main.c; 162. fixup overflow storing 0x84D in 2 bytes at 0x1096 (LED_Blomma.obj 97/0x12)
Error   [1268] G:\PIC\Projekt\LED_Blomma\main.c; 162. fixup overflow storing 0x87C in 2 bytes at 0x1098 (LED_Blomma.obj 97/0x14)
Error   [1268] G:\PIC\Projekt\LED_Blomma\main.c; 162. fixup overflow storing 0x85C in 2 bytes at 0x10B2 (LED_Blomma.obj 97/0x2E)
Error   [1268] G:\PIC\Projekt\LED_Blomma\main.c; 162. fixup overflow storing 0x85F in 2 bytes at 0x10BA (LED_Blomma.obj 97/0x36)
Error   [1268] G:\PIC\Projekt\LED_Blomma\main.c; 162. fixup overflow storing 0x860 in 2 bytes at 0x10BC (LED_Blomma.obj 97/0x38)
Error   [1268] G:\PIC\Projekt\LED_Blomma\main.c; 162. fixup overflow storing 0x87C in 2 bytes at 0x10BE (LED_Blomma.obj 97/0x3A)
Error   [1268] G:\PIC\Projekt\LED_Blomma\main.c; 162. fixup overflow storing 0x873 in 2 bytes at 0x10E0 (LED_Blomma.obj 97/0x5C)
Error   [1268] G:\PIC\Projekt\LED_Blomma\main.c; 162. fixup overflow storing 0x876 in 2 bytes at 0x10E8 (LED_Blomma.obj 97/0x64)
Error   [1268] G:\PIC\Projekt\LED_Blomma\main.c; 162. fixup overflow storing 0x877 in 2 bytes at 0x10EA (LED_Blomma.obj 97/0x66)

Advisory[1] too many errors (31)
********** Build failed! **********
Som jag fattar det så beror det på att jag har för många variabler inne i samma while() loop eller nått i den stilen. Är det korrekt tänkt? Vad gör jag i så fall åt problemet??

Så här ser min (GIGANTISKA) evighets while() loop ut.

Kod: Markera allt

		while(1){

			// ***************************************
			// ******** PWM THE OUTPUTS **************
			// ***************************************
			// Sätt på alla PWM utgångar som inte är 0 % duty cyle.
			if (bottenLVar > 1)
				bottenL = ON;
			if (bottenRVar > 1)
				bottenR = ON;
			if (vitTop1Var > 1)
				vitTop1 = ON;
			if (vitTop2Var > 1)
				vitTop2 = ON;
			if (vitTop3Var > 1)
				vitTop3 = ON;
			if (vitTop4Var > 1)
				vitTop4 = ON;
			if (vitTop5Var > 1)
				vitTop5 = ON;
			if (vit1Var > 1)
				vit1 = ON;
			if (vit2Var > 1)
				vit2 = ON;
			if (vit3Var > 1)
				vit3 = ON;
			if (vit4Var > 1)
				vit4 = ON;
			if (gron1Var > 1)
				gron1 = ON;
			if (gron2Var > 1)
				gron2 = ON;
			if (gron3Var > 1)
				gron3 = ON;
			if (gron4Var > 1)
				gron4 = ON;

			//Zero the timer
			TMR0 = 0;

			// Decide how long each output shall be high.
			while (T0IF != 1){
				if (TMR0 > bottenLVar)
					bottenL = OFF;
				if (TMR0 > bottenRVar)
					bottenR = OFF;
				if (TMR0 > vitTop1Var)
					vitTop1 = OFF;
				if (TMR0 > vitTop2Var)
					vitTop2 = OFF;
				if (TMR0 > vitTop3Var)
					vitTop3 = OFF;
				if (TMR0 > vitTop4Var)
					vitTop4 = OFF;
				if (TMR0 > vitTop5Var)
					vitTop5 = OFF;
				if (TMR0 > vit1Var)
					vit1 = OFF;
				if (TMR0 > vit2Var)
					vit2 = OFF;
				if (TMR0 > vit3Var)
					vit3 = OFF;
				if (TMR0 > vit4Var)
					vit4 = OFF;
				if (TMR0 > gron1Var)
					gron1 = OFF;
				if (TMR0 > gron2Var)
					gron2 = OFF;
				if (TMR0 > gron3Var)
					gron3 = OFF;
				if (TMR0 > gron4Var)
					gron4 = OFF;
			}

			// Turn off not turned off outputs if they isn't 100% DC
			if (bottenLVar != 255) 
				bottenL = OFF;
			if (bottenRVar != 255)
				bottenR = OFF;
			if (vitTop1Var != 255)
				vitTop1 = OFF;
			if (vitTop2Var != 255)
				vitTop2 = OFF;
			if (vitTop3Var != 255)
				vitTop3 = OFF;
			if (vitTop4Var != 255)
				vitTop4 = OFF;
			if (vitTop5Var != 255)
				vitTop5 = OFF;
			if (vit1Var != 255)
				vit1 = OFF;
			if (vit2Var != 255)
				vit2 = OFF;
			if (vit3Var != 255)
				vit3 = OFF;
			if (vit4Var != 255)
				vit4 = OFF;
			if (gron1Var != 255)
				gron1 = OFF;
			if (gron2Var != 255)
				gron2 = OFF;
			if (gron3Var != 255)
				gron3 = OFF;
			if (gron4Var != 255)
				gron4 = OFF;
			
			// Clear interupt flag
			T0IF = 0;


			// ******************************************
			// ******** Change the PWM to wanted value **
			// ******************************************
			
			// ********** bottenL ************************************
			// If it shall go brighter
			if (bottenLDir == 1){
				bottenLVarFractions += 10;
				if (bottenLVarFractions >= 20){
					bottenLVarFractions = 10;
					bottenLVar += 1;
					if (bottenLVar >= 255){
						bottenLVar = 255;
						bottenLDir = 0;
					}
				}
			}
			// If it shall go less brighter
			else if (bottenLDir == 0){
				bottenLVarFractions -= 10;
				if (bottenLVarFractions <= 0){
					bottenLVarFractions = 10;
					bottenLVar -= 1;
					if (bottenLVar <= 0){
						bottenLVar = 0;
						bottenLDir = 1;
					}
				}
			}
			// ********** bottenR ************************************
			// If it shall go brighter
			if (bottenRDir == 1){
				bottenRVarFractions += 10;
				if (bottenRVarFractions >= 20){
					bottenRVarFractions = 10;
					bottenRVar += 1;
					if (bottenRVar >= 255){
						bottenRVar = 255;
						bottenRDir = 0;
					}
				}
			}
			// If it shall go less brighter
			else if (bottenRDir == 0){
				bottenRVarFractions -= 10;
				if (bottenRVarFractions <= 0){
					bottenRVarFractions = 10;
					bottenRVar -= 1;
					if (bottenRVar <= 0){
						bottenRVar = 0;
						bottenRDir = 1;
					}
				}
			}
			// ********** vitTop1 ************************************
			// If it shall go brighter
			if (vitTop1Dir == 1){
				vitTop1VarFractions += 10;
				if (vitTop1VarFractions >= 20){
					vitTop1VarFractions = 10;
					vitTop1Var += 1;
					if (vitTop1Var >= 255){
						vitTop1Var = 255;
						vitTop1Dir = 0;
					}
				}
			}
			// If it shall go less brighter
			else if (vitTop1Dir == 0){
				vitTop1VarFractions -= 10;
				if (vitTop1VarFractions <= 0){
					vitTop1VarFractions = 10;
					vitTop1Var -= 1;
					if (vitTop1Var <= 0){
						vitTop1Var = 0;
						vitTop1Dir = 1;
					}
				}
			}
			// ********** vitTop2 ************************************
			// If it shall go brighter
			if (vitTop2Dir == 1){
				vitTop2VarFractions += 10;
				if (vitTop2VarFractions >= 20){
					vitTop2VarFractions = 10;
					vitTop2Var += 1;
					if (vitTop2Var >= 255){
						vitTop2Var = 255;
						vitTop2Dir = 0;
					}
				}
			}
			// If it shall go less brighter
			else if (vitTop2Dir == 0){
				vitTop2VarFractions -= 10;
				if (vitTop2VarFractions <= 0){
					vitTop2VarFractions = 10;
					vitTop2Var -= 1;
					if (vitTop2Var <= 0){
						vitTop2Var = 0;
						vitTop2Dir = 1;
					}
				}
			}
			// ********** vitTop3 ************************************
			// If it shall go brighter
			if (vitTop3Dir == 1){
				vitTop3VarFractions += 10;
				if (vitTop3VarFractions >= 20){
					vitTop3VarFractions = 10;
					vitTop3Var += 1;
					if (vitTop3Var >= 255){
						vitTop3Var = 255;
						vitTop3Dir = 0;
					}
				}
			}
			// If it shall go less brighter
			else if (vitTop3Dir == 0){
				vitTop3VarFractions -= 10;
				if (vitTop3VarFractions <= 0){
					vitTop3VarFractions = 10;
					vitTop3Var -= 1;
					if (vitTop3Var <= 0){
						vitTop3Var = 0;
						vitTop3Dir = 1;
					}
				}
			}
			// ********** vitTop4 ************************************
			// If it shall go brighter
			if (vitTop4Dir == 1){
				vitTop4VarFractions += 10;
				if (vitTop4VarFractions >= 20){
					vitTop4VarFractions = 10;
					vitTop4Var += 1;
					if (vitTop4Var >= 255){
						vitTop4Var = 255;
						vitTop4Dir = 0;
					}
				}
			}
			// If it shall go less brighter
			else if (vitTop4Dir == 0){
				vitTop4VarFractions -= 10;
				if (vitTop4VarFractions <= 0){
					vitTop4VarFractions = 10;
					vitTop4Var -= 1;
					if (vitTop4Var <= 0){
						vitTop4Var = 0;
						vitTop4Dir = 1;
					}
				}
			}
			// ********** vitTop5 ************************************
			// If it shall go brighter
			if (vitTop5Dir == 1){
				vitTop5VarFractions += 10;
				if (vitTop5VarFractions >= 20){
					vitTop5VarFractions = 10;
					vitTop5Var += 1;
					if (vitTop5Var >= 255){
						vitTop5Var = 255;
						vitTop5Dir = 0;
					}
				}
			}
			// If it shall go less brighter
			else if (vitTop5Dir == 0){
				vitTop5VarFractions -= 10;
				if (vitTop5VarFractions <= 0){
					vitTop5VarFractions = 10;
					vitTop5Var -= 1;
					if (vitTop5Var <= 0){
						vitTop5Var = 0;
						vitTop5Dir = 1;
					}
				}
			}
			// ********** vit1 ************************************
			// If it shall go brighter
			if (vit1Dir == 1){
				vit1VarFractions += 10;
				if (vit1VarFractions >= 20){
					vit1VarFractions = 10;
					vit1Var += 1;
					if (vit1Var >= 255){
						vit1Var = 255;
						vit1Dir = 0;
					}
				}
			}
			// If it shall go less brighter
			else if (vit1Dir == 0){
				vit1VarFractions -= 10;
				if (vit1VarFractions <= 0){
					vit1VarFractions = 10;
					vit1Var -= 1;
					if (vit1Var <= 0){
						vit1Var = 0;
						vit1Dir = 1;
					}
				}
			}
			// ********** vit2 ************************************
			// If it shall go brighter
			if (vit2Dir == 1){
				vit2VarFractions += 10;
				if (vit2VarFractions >= 20){
					vit2VarFractions = 10;
					vit2Var += 1;
					if (vit2Var >= 255){
						vit2Var = 255;
						vit2Dir = 0;
					}
				}
			}
			// If it shall go less brighter
			else if (vit2Dir == 0){
				vit2VarFractions -= 10;
				if (vit2VarFractions <= 0){
					vit2VarFractions = 10;
					vit2Var -= 1;
					if (vit2Var <= 0){
						vit2Var = 0;
						vit2Dir = 1;
					}
				}
			}
			// ********** vit3 ************************************
			// If it shall go brighter
			if (vit3Dir == 1){
				vit3VarFractions += 10;
				if (vit3VarFractions >= 20){
					vit3VarFractions = 10;
					vit3Var += 1;
					if (vit3Var >= 255){
						vit3Var = 255;
						vit3Dir = 0;
					}
				}
			}
			// If it shall go less brighter
			else if (vit3Dir == 0){
				vit3VarFractions -= 10;
				if (vit3VarFractions <= 0){
					vit3VarFractions = 10;
					vit3Var -= 1;
					if (vit3Var <= 0){
						vit3Var = 0;
						vit3Dir = 1;
					}
				}
			}
			// ********** vit4 ************************************
			// If it shall go brighter
			if (vit4Dir == 1){
				vit4VarFractions += 10;
				if (vit4VarFractions >= 20){
					vit4VarFractions = 10;
					vit4Var += 1;
					if (vit4Var >= 255){
						vit4Var = 255;
						vit4Dir = 0;
					}
				}
			}
			// If it shall go less brighter
			else if (vit4Dir == 0){
				vit4VarFractions -= 10;
				if (vit4VarFractions <= 0){
					vit4VarFractions = 10;
					vit4Var -= 1;
					if (vit4Var <= 0){
						vit4Var = 0;
						vit4Dir = 1;
					}
				}
			}
			// ********** gron1 ************************************
			// If it shall go brighter
			if (gron1Dir == 1){
				gron1VarFractions += 10;
				if (gron1VarFractions >= 20){
					gron1VarFractions = 10;
					gron1Var += 1;
					if (gron1Var >= 255){
						gron1Var = 255;
						gron1Dir = 0;
					}
				}
			}
			// If it shall go less brighter
			else if (gron1Dir == 0){
				gron1VarFractions -= 10;
				if (gron1VarFractions <= 0){
					gron1VarFractions = 10;
					gron1Var -= 1;
					if (gron1Var <= 0){
						gron1Var = 0;
						gron1Dir = 1;
					}
				}
			}
			// ********** gron2 ************************************
			// If it shall go brighter
			if (gron2Dir == 1){
				gron2VarFractions += 10;
				if (gron2VarFractions >= 20){
					gron2VarFractions = 10;
					gron2Var += 1;
					if (gron2Var >= 255){
						gron2Var = 255;
						gron2Dir = 0;
					}
				}
			}
			// If it shall go less brighter
			else if (gron2Dir == 0){
				gron2VarFractions -= 10;
				if (gron2VarFractions <= 0){
					gron2VarFractions = 10;
					gron2Var -= 1;
					if (gron2Var <= 0){
						gron2Var = 0;
						gron2Dir = 1;
					}
				}
			}
			// ********** gron3 ************************************
			// If it shall go brighter
			if (gron3Dir == 1){
				gron3VarFractions += 10;
				if (gron3VarFractions >= 20){
					gron3VarFractions = 10;
					gron3Var += 1;
					if (gron3Var >= 255){
						gron3Var = 255;
						gron3Dir = 0;
					}
				}
			}
			// If it shall go less brighter
			else if (gron3Dir == 0){
				gron3VarFractions -= 10;
				if (gron3VarFractions <= 0){
					gron3VarFractions = 10;
					gron3Var -= 1;
					if (gron3Var <= 0){
						gron3Var = 0;
						gron3Dir = 1;
					}
				}
			}
			// ********** gron4 ************************************
			// If it shall go brighter
			if (gron4Dir == 1){
				gron4VarFractions += 10;
				if (gron4VarFractions >= 20){
					gron4VarFractions = 10;
					gron4Var += 1;
					if (gron4Var >= 255){
						gron4Var = 255;
						gron4Dir = 0;
					}
				}
			}
			// If it shall go less brighter
			else if (gron4Dir == 0){
				gron4VarFractions -= 10;
				if (gron4VarFractions <= 0){
					gron4VarFractions = 10;
					gron4Var -= 1;
					if (gron4Var <= 0){
						gron4Var = 0;
						gron4Dir = 1;
					}
				}
			}


		}
Error 1346 finns inte med i manualen (!), men så här står det om error 1268:
(1268) fixup overflow storing 0x* in * bytes at * (Linker)
Fixup is the process conducted by the linker of replacing symbolic references to variables etc, in an
assembler instruction with an absolute value. This takes place after positioning the psects (program
sections or blocks) into the available memory on the target device. Fixup overflow is when the
value determined for a symbol is too large to fit within the allocated space within the assembler
instruction. For example, if an assembler instruction has an 8-bit field to hold an address and the
linker determines that the symbol that has been used to represent this address has the value 0x110,
then clearly this value cannot be inserted into the instruction.
Mvh. Daniel Andersson

Edit: Ändrade "funktion" till "loop"
Användarvisningsbild
Icecap
Inlägg: 26659
Blev medlem: 10 januari 2005, 14:52:15
Ort: Starup (Haderslev), Danmark

Re: PIC compiler ERROR: "fixup overflow storing..." (PIC16F628A)

Inlägg av Icecap »

De 2 första meddelanden betyder: inte minne nog.
Användarvisningsbild
squiz3r
Inlägg: 5424
Blev medlem: 5 september 2006, 20:06:22
Ort: Lund
Kontakt:

Re: PIC compiler ERROR: "fixup overflow storing..." (PIC16F628A)

Inlägg av squiz3r »

Ajdå.. Det är alltså programminnet, eller är det för variablerna?
sodjan
EF Sponsor
Inlägg: 43251
Blev medlem: 10 maj 2005, 16:29:20
Ort: Söderköping

Re: PIC compiler ERROR: "fixup overflow storing..." (PIC16F628A)

Inlägg av sodjan »

"...in segment "CODE"..."

Kolla (t.ex i MAP filen) hur stort allt är just innan du får
felet och kolla vad som ligger på gränsen. Det är sannolikt
det som spricker när du går över gränsen...
Användarvisningsbild
squiz3r
Inlägg: 5424
Blev medlem: 5 september 2006, 20:06:22
Ort: Lund
Kontakt:

Re: PIC compiler ERROR: "fixup overflow storing..." (PIC16F628A)

Inlägg av squiz3r »

Jag löste problemet genom att ta bort alla IF-satserna i "// Sätt på alla PWM utgångar som inte är 0 % duty cyle." stycket och det där den stänger av dem. Detta gör att även om duty cyclen är 0% så kommer signalen vara hög i några klockcykler innan den stängs av igen. Inget som påverkar mig i denna tillämpningen.

Det var programminnet som var problemet, nu ligger jag på 99,1% när jag tog bort det. Men sen är det något annat problem också, verkar vara kompilatorn som inte kan ha så många if-satser i en loop eftersom adresserna i ASM instruktionerna bara är 8-bitar. Men det löste sig på samma sätt, denna gången i alla fall.

Jag tänkte att jag skulle ta en 16F648A istället, den ska ju vara helt kompatibel, men när jag ställde in kompilatorn på 16F648A så hände inte nått alls, PIC'en verkade vara helt död... (Den gick ju att programmera, men sen hände inte mer...) men så testade jag att ställa in kompilatorn på 16F628A igen och tankade ner det programmet i samma 16F648A och då fungerade det exakt som det skulle... (Men då kunde jag ju inte utnyttja det större minnet i den) Undrar om det är någon bugg i kompilatorn eller av mig.. Jaja, Jag hinner tyvärr inte felsöka mer angående det :(.

Det gick i alla fall med 628A'n med denna fulhacken. Tack för hjälpen!
sodjan
EF Sponsor
Inlägg: 43251
Blev medlem: 10 maj 2005, 16:29:20
Ort: Söderköping

Re: PIC compiler ERROR: "fixup overflow storing..." (PIC16F628A)

Inlägg av sodjan »

Det ka ha något med "Lite mode" att göra.
Skriv svar