[coldfire-gnu-discuss] Port access with gcc

Nathan Sidwell nathan at codesourcery.com
Thu Feb 1 14:54:39 UTC 2007


Alex Parkinson wrote:
> Hi,
> 
> I've run through the getting started guide and have gotten the tools 
> working with my M52233DEMO board.  I'm now trying to write a simple LED 
> blinkey program, but I have so far been unable to find any information 
> on setting up and writing a port.  I'm new to gcc, so the best help 
> someone could provide is to let me know where I can find such 
> information on my own, as I'm sure many more questions will pop up as I 
> go along.

The port will be a memory mapped address.  You can access it from C with 
something like

#define my_port (*(volatile int)NNNNN)

where NNNNN is the address of the port.  If the port is not 32 bits wide, use 
short or char as appropriate.

int Foo ()
{
   myport = 0;
   myport = 1;
   return myport;
}

nathan

-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::         CodeSourcery
nathan at codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk




More information about the coldfire-gnu-discuss mailing list