PowerPC MPC5200B, changing mode to run in little endian

Started by Taran August 22, 2007
Hi,

We are using Lite5200B eval board, out software is compiled using the
Windriver diab 5.3.1.0 with the 5200B patch. We are using the
WindRiver ICE for downloading the executable to the board and stepping
through.

We have our software with the MPC5200B running in default big endian
mode. Because the PCI bus is little endian mode we are evaluating the
impact on software if we switch the processor from big-to-little
endian mode. We have a lot of graphics data on PCI.

I have gone through the e300 core and the MPC5200B user manual. All
that I could find is that the MSR[LE] bit has to be set followed by
HID2[LET] bit to run the processor in the little endian mode. The diab
compiler option -Xendian-little was added so that the source is
compiled for little endian mode.

The setting of MSR[LE] and HID2[LET] is done in the crt0 at the reset
vector (section of crt0):

#This is the reset vector
START:
_start:
       xor r2,r2,r2
       oris r2,r2,0x800  #get into r2 0x0800_0000
       mtspr HID2,r2	  #set LET in HID2
       isync
       sync		    # wait for completion
       mfmsr r3          # move value from MSR
       ori r3,r3, 0x01	 # set the LE  bit to run in little endian mode
       mtmsr r3	 # move the value back to the MSR
       isync
       sync                 #initialize stack
       addis		r11,r0,_ld_stack_end@ha	   # Initialize stack pointer r1
to

# THIS IS WHERE THE emulator cannot step through

	addi		r1,r11,_ld_stack_end@l	     # value in linker command file.
	addis		r13,r0,_SDA_BASE_@ha	# Initialize r13 to sdata base
	addi		r13,r13,_SDA_BASE_@l	 # (provided by linker).
	addis		r2,r0,_SDA2_BASE_@ha	# Initialize r2 to sdata2 base
	addi		r2,r2,_SDA2_BASE_@l	  # (provided by linker).
	addi		r0,r0,0			               # Clear r0.
	stwu		r0,-64(r1)	 	             # Terminate stack.

Is there something extra that needs to be done to change the endian-
ness of the processor to little endian?

Any help or pointers are appreciated.
Thanks in advance.

Regards,
Taran Tripathi

Another option should be to set the PCI up in the MMU with the 'E'
option. This would effectively create an MMU page for PCI that
operates in little endian - the MMU would essentially do the big/
little endian conversion for you.

 ... Paul


On Aug 22, 1:05 am, Taran <taran.tripa...@gmail.com> wrote:
> Hi, > > We are using Lite5200B eval board, out software is compiled using the > Windriver diab 5.3.1.0 with the 5200B patch. We are using the > WindRiver ICE for downloading the executable to the board and stepping > through. > > We have our software with the MPC5200B running in default big endian > mode. Because the PCI bus is little endian mode we are evaluating the > impact on software if we switch the processor from big-to-little > endian mode. We have a lot of graphics data on PCI. > > I have gone through the e300 core and the MPC5200B user manual. All > that I could find is that the MSR[LE] bit has to be set followed by > HID2[LET] bit to run the processor in the little endian mode. The diab > compiler option -Xendian-little was added so that the source is > compiled for little endian mode. > > The setting of MSR[LE] and HID2[LET] is done in the crt0 at the reset > vector (section of crt0): > > #This is the reset vector > START: > _start: > xor r2,r2,r2 > oris r2,r2,0x800 #get into r2 0x0800_0000 > mtspr HID2,r2 #set LET in HID2 > isync > sync # wait for completion > mfmsr r3 # move value from MSR > ori r3,r3, 0x01 # set the LE bit to run in little endian mode > mtmsr r3 # move the value back to the MSR > isync > sync #initialize stack > addis r11,r0,_ld_stack_end@ha # Initialize stack pointer r1 > to > > # THIS IS WHERE THE emulator cannot step through > > addi r1,r11,_ld_stack_end@l # value in linker command
file.
> addis r13,r0,_SDA_BASE_@ha # Initialize r13 to sdata base > addi r13,r13,_SDA_BASE_@l # (provided by linker). > addis r2,r0,_SDA2_BASE_@ha # Initialize r2 to sdata2 base > addi r2,r2,_SDA2_BASE_@l # (provided by linker). > addi r0,r0,0 # Clear r0. > stwu r0,-64(r1) # Terminate stack. > > Is there something extra that needs to be done to change the endian- > ness of the processor to little endian? > > Any help or pointers are appreciated. > Thanks in advance. > > Regards, > Taran Tripathi