Jump to content

Recommended Posts

Posted

I keep getting the following warning after compiling.

Warning; need to allocate new register by name. 

I have had this warning in the past and have ignored it.  Can anyone help?

Regards Robin

There is a sequel to this warning.  In the past I ignored Compiler Warnings.  In this case the for loop fails to work for some reason. The code looks OK. 

Posted

As before, the warning has now disappeared.  The name the warning was referring to was a function.

I cannot now send you the full message.  I tried the sdcc website but could not find anything. 

Thanks Robin

Posted

It has happened again. This time I know the circumstances.

I am trying to minimise my code by introducing a for loop. (see below).  As soon as I compiled I received the following warning.

There is a sequel to this warning.  In the past I ignored Compiler Warnings.  In this case the for loop fails to work for some reason. The code looks OK. 

Robin

Microsoft Windows XP [Version 5.1.2600]

© Copyright 1985-2001 Microsoft Corp.

C:\C_Stops>make

Makefile generated.

Makefile.bat generated.

Assembling MIOS SDCC wrapper

==========================================================================

Compiling main.c

Processor: 18F452

pic16_allocRegByName:963 symbol name _ReadStoredValues_d_1_1    regop= 00D471E8

gen.c:1890: WARNING: need to allocate new register by name -> _ReadStoredValues_

d_1_1

==========================================================================

Compiling pic18f452.c

Processor: 18F452

==========================================================================

Linking project

==========================================================================

Converting to project.syx

Block 003000-0033FF allocated - Checksum: 2D

Block 003400-0037FF allocated - Checksum: 26

Block 003800-003BFF allocated - Checksum: 09

Block 003C00-003FFF allocated - Checksum: 7D

Block 004000-0043FF allocated - Checksum: 09

Block 004400-0047FF allocated - Checksum: 34

Block 004800-004BFF allocated - Checksum: 60

==========================================================================

SUCCESS!

C:\C_Stops>

/////////////////////////////////////////////////////////////////////

void ReadStoredValues( unsigned char pin) //__wparam

/////////////////////////////////////////////////////////////////////

{

unsigned char memorised_stored_pin;

unsigned char d;//to increment EEprom reads

q = ((pin-1)<< 5)  + 10;//determines EEProm address depending on Memory pin number.

for(d<=1; d>=13;d++)

SendDump(MIOS_EEPROM_Read(q + d));

//SendDump(MIOS_EEPROM_Read(q + 1));

MemorisedStopsSetLed (8, 14, 15, MIOS_EEPROM_Read(q + 1));//pedal stops

//SendDump(MIOS_EEPROM_Read(q + 2));

MemorisedStopsSetLed (24, 24, 25, MIOS_EEPROM_Read(q + 2));//tremelo strength

//SendDump(MIOS_EEPROM_Read(q + 3));

Posted

Problem solved.  Did anyone spot the error in the for loop?  I didn't.

for(d<=1; d>=13;d++)

It should be for(d=1; d>=13;d++)  the < before the = is the culprit.

I am going to take Warnings more seriously from now on.

Robin

Posted

robinfawell

It's good that you were able to discover the error on your own.

I've learned to compiled after just about any change, so I can correct a problem while it's still fresh in my memory.

I wouldn't ignore any compiler warnings... even if the code looks to be working fine. Jumping on any warning as soon as you see it will save you a lot of time and grief later on.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...