DSPRelated.com
Forums

simple I/O access (non-indexed) for 568000 parts using codewarrior

Started by bobtransformer February 5, 2006
OK, I have tried to get a simple answer for this, but I'll try here...

I am trying to access I/O and peripherals in X: memory in C on, in this
case, a 56F8014 demo board.  I can access I/O if I define the ports
like this:

#define PORTB   (*(char*) (0x00F101))   // port B

However, this works in indirect addressing mode using index registers
as I would expect it to, and of course takes at least 4 or 5 assembly
instructions.  It's inefficient.

I received a support message from freescale that tells me to access
the ports in the linker command file.   This is not how I would like
to do what should be a simple thing in embedded C, as it is for almost
any other processor I have used, including other 8 bit freescale 6805
parts.

Any ideas would be very much appreciated.

Thanks,
boB
K7IQ
Everett, WA
	
I don't know which version of CodeWarrior do you use.
However, maybe you could find some hints in Processor Expert (The
latest CodeWarriror version is 7.3, the 8k code-limited version is
freely available).

Processor Expert automatically generates a file IOMap.h with 
all registers definitions.

For example the GPIO B data register is defined:

 /*** GPIO_B_DR - GPIO B Data Register; 0x0000F111 ***/
#define GPIO_B_DR                     *((volatile word *)0x0000F111)

Processor Expert can also help you generating peripheral drivers and
much more.

best regards
Petr Hradsky
Processor Expert Support Team
UNIS

--- In motoroladsp@moto..., "bobtransformer"
<bobtransformer@...> wrote:
>
> 
> OK, I have tried to get a simple answer for this, but I'll try here...
> 
> I am trying to access I/O and peripherals in X: memory in C on, in this
> case, a 56F8014 demo board.  I can access I/O if I define the ports
> like this:
> 
> #define PORTB   (*(char*) (0x00F101))   // port B
> 
> However, this works in indirect addressing mode using index registers
> as I would expect it to, and of course takes at least 4 or 5 assembly
> instructions.  It's inefficient.
> 
> I received a support message from freescale that tells me to access
> the ports in the linker command file.   This is not how I would like
> to do what should be a simple thing in embedded C, as it is for almost
> any other processor I have used, including other 8 bit freescale 6805
> parts.
> 
> Any ideas would be very much appreciated.
> 
> Thanks,
> boB
> K7IQ
> Everett, WA
>