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

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

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

1,257 Views
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.

 

Labels (1)
0 Kudos
2 Replies

334 Views
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 Kudos

334 Views
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 Kudos