Strange to me

wei.li4 at elf.mcgill.ca wei.li4 at elf.mcgill.ca
Mon Oct 16 07:43:49 EST 2006


Hi All,

I am trying to add a C function in m8xx_setup.c and call it in 
head_8xx.S. I checked the final assembler and compared it with other 
functions same called in head_8xx.S (e.g.platform_init()), they used 
the different registers for stack poniter, and normal one used r0 to 
store and recover Link register. How to control comlier or linker, so 
that my own function is treated as same way? Thanks.

Here is my code:

void __init
debugger_init(unsigned char case_NO)
{
	//volatile immap_t      *immap;
	volatile cpm8xx_t     *cp;

	// Get pointer to Communication Processor
	cp = cpmp;

	/* PortB setting */
	/* These setting may be different for you.
	   Refer example 16-443 MPC823 Manual*/

// Port B pin 29, 30 configured as Open-Drain general purpose output

	cp->cp_pbodr &= ~0x0009;              // set 0
	cp->cp_pbdir |=  0x0006;              // set 1
	cp->cp_pbpar &= ~0x0009;              // set 0

	switch (case_NO)
	{
	  case 1:
	// Turn on at BP29(=0) and off at BP30(=1)
	    cp->cp_pbdat &= ~0x0004;
	    cp->cp_pbdat |=  0x0002;
	    break;

	  case 2:
	// Turn off at BP29(=1) and on at BP30(=0)
	    cp->cp_pbdat |=  0x0004;
	    cp->cp_pbdat &= ~0x0002;
	    break;

	  default:
	// Turn on at BP29, BP30(=0)
	    cp->cp_pbdat &= ~0x0006;
	    break;
	}

}

It's working fine if put in the utilitise, the fist part of EFL image.


Regard,
Wei



More information about the Linuxppc-embedded mailing list