CW10.2 Undefined Label

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

CW10.2 Undefined Label

跳至解决方案
742 次查看
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

标签 (1)
标记 (1)
0 项奖励
1 解答
518 次查看
CrasyCat
Specialist III

Hello

 

Try

       move.b d1,OS_Task

instead of

      move.b d1,_OS_Task

CrasyCat

在原帖中查看解决方案

0 项奖励
4 回复数
518 次查看
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 项奖励
518 次查看
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 项奖励
519 次查看
CrasyCat
Specialist III

Hello

 

Try

       move.b d1,OS_Task

instead of

      move.b d1,_OS_Task

CrasyCat

0 项奖励
518 次查看
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 项奖励