CW for ColdFire 6.4, target MCF5307, conversion problem MBAR to register *

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

CW for ColdFire 6.4, target MCF5307, conversion problem MBAR to register *

2,133 次查看
Veter
Contributor I

I have following statement that does not compile:

volatile register MCF5307_IMM *imm = &__MBAR;

Where : ___MBAR        = ADDR(sim); defined in lcf file.

The error states: Error   :

 illegal implicit conversion from 'unsigned long *' to
'volatile MCF5307_IMM *'
led.c line 40       volatile register MCF5307_IMM *imm = &__MBAR;

Any idea why it does not compile?

As long as it's register, it should not have a problem.

Thank you.

 

标签 (1)
0 项奖励
回复
2 回复数

1,210 次查看
mjbcswitzerland
Specialist V
Hi Veter

I don't know the answer and I don't work with the configuration files as they are supplied - so please forgive me if I am off track.
Are you however sure that it is a problem with register and not just that a cast is missing?
1. the definition of ___MBAR in the lcf shouldn't have anything to do with the compiler. It is only used when linking. __MBAR is defined elsewhere and I think as extern uint8 __MBAR[]; (? not sure though?)
2. If the above is true &__MBAR may be a source of problem since this doesn't have an address - the address is either __MBAR; or &__MBAR[0].
3. Possible the above is off-track because I don't understand why it would say "illegal implicit conversion from 'unsigned long *' to" since it looks as though the compiler understands it as pointer to unsigned long.
4. Have you tried casing:
volatile register MCF5307_IMM *imm = (MCF5307_IMM *)&__MBAR;
or something like this?

As I said - please ignore if the comments are way off.

Regards

Mark Butcher

0 项奖励
回复

1,210 次查看
Veter
Contributor I
I resulved it by defining __MBAR in the include.h as:
extern MCF5307_IMM __MBAR;
 
The reference to the MBAR in the sources looks like:
volatile register MCF5307_IMM *imm = &__MBAR;
 
This solved casting problem and type comparibility of the register.
0 项奖励
回复