CW10.2 Undefined Label

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CW10.2 Undefined Label

Jump to solution
731 Views
StevenBak
Contributor I

I am porting a  CW4 project to CW10.2. I created a new project from the project wizzard in 10.2 and have added all the source files and removed almost all of the errors. This one has me stumped.

 

In the CW4 project, there is a declaration in file.c:

volatile uint8 OS_Task = MAX_TASK_NUMBER

 

Then the file mcf5282_lo.s has the following:

.extern _OS_Task

c_switch:
_c_switch:

.

.

.

move.b d1,_OS_Task

 

 

Now, in the CW10.2 project I have eliminated the mcf5282_lo.s in favor of the generated startcf.c.

file.c still has the same declaration noted above.

In startcf.c, the c_switch has been changed to:

asm __declspec(register_abi) void c_switch(void)
{

.

.

.

move.b d1,_OS_Task       // This line gives me error "illegal addressing mode"

 

 

} // This line gives me error "undefined label '_OS_Task'

 

 

So how and where can I tell the assembly routine c_switch that OS_Task is defined in file.c????

i.e. how can add .extern OS_Task in the c file???

Regretfully, i've randomly tried every thing I could thing of before coming here.

 

 

Thanks,

Steve

Labels (1)
0 Kudos
1 Solution
507 Views
CrasyCat
Specialist III

Hello

 

Try

       move.b d1,OS_Task

instead of

      move.b d1,_OS_Task

CrasyCat

View solution in original post

0 Kudos
4 Replies
507 Views
CrasyCat
Specialist III

Hello

 

Did you try putting a n external declaration for OS_Task either in the startcf.c or in one of the file included in there?

 

     extern volatile uint8 OS_Task;

 

CrasyCat

0 Kudos
507 Views
StevenBak
Contributor I

CrassyCat,

 

Yes. When declaring OS_Task as extern volatile uint8 I get an additional error on white space:

 

 

asm __declspec(register_abi) void c_switch(void)
{

.

.

.

move.b d1,_OS_Task        // This line gives me error "illegal addressing mode"

.

.

.

rte

                // this white space line gives me error "undefined label '_OS_Task'

 

 

} // This line gives me error "undefined label '_OS_Task'

 

 

0 Kudos
508 Views
CrasyCat
Specialist III

Hello

 

Try

       move.b d1,OS_Task

instead of

      move.b d1,_OS_Task

CrasyCat

0 Kudos
507 Views
StevenBak
Contributor I

CrasyCat,


That worked. I read in one of the manuals that the assembler prepended the '_' to variables; which explained to me why the existing code worked in CW4. So I'm not sure why the underscore is needed in c_switch in cw4 but not needed in cw10? Oh well, thanks for the help!

 

Steve

0 Kudos