Problem running code on i386ex

Samuel Bitton S.Bitton at sstl.co.uk
Fri Apr 7 09:03:11 UTC 2006


Sorry, follow to my previous email below, I've realised that my example was not a good example. If I had actually tried to write to the P1.4 line after disabling expanded IO, of course it wouldn't work as the P1LTC register is mapped in the expanded IO area!!!
Anyway one thing for sure that I have tried is to first toggle the P1.4 line, then try to initialise the USC chip select, and then try to toggle the line again. And I never saw the second toggle.

One more thing. I have recently tried similar code but assembled with MASM and it works. So I have the impression that this is something to do with the GASM.
BTW I'm using RTEMS 4.6.4.

Any thoughts?

Thanks
Regards

Sam Bitton

		 -----Original Message-----
		From: 	Samuel Bitton  
		Sent:	07 April 2006 10:36
		To:	rtems-users at rtems.com
		Subject:	Problem running code on i386ex

		Hi

		I'm currently working on a new RTEMS BSP for a custom made board based around the i386ex processor.
		I've based my initialisation files start.S and bspstart.c on the ones provided in the existing i386ex BSP.

		I'm having problems getting the software to run.
		I'm loading the application with a bootloader which I know leaves the processor in real-mode and with expanded I/O enabled. I also believe that the code segment register is correctly set.
		To have an idea how far I get in my initialisation code before the crash, I've added some instructions which toggle pin 4 on port 1. My findings so far are that the instructions which toggle that pin seem to work (well sort of - see my comments below) as I can monitor that on a scope, but as soon as I try to do anything else the thing crashes.

		Here is an example:

		/* Very beginning of the code in my start.S file */

		cli /* clear all interrupts */

		/* Produce a short pulse on P1.4 pin:
		 *------------------------------------------ */
		/* First set P1.4 pin high */
		movw  $0x10, ax
		movw  $P1LTC, dx
		outw    ax, dx /* Write 1 on P1.4 pin */
		movw  $0x0, ax
		movw  $P1DIR, dx
		movw  ax, dx /* Configure Port 1 pins as all outputs */
		movw  $0x0, ax
		movw  $P1CFG, dx
		movw  ax, dx /* Configure Port 1 pins as all I/O */
		nop /* a few nops to allow the pulse to be long enough to be seen on the scope */
		nop
		nop
		nop
		nop
		/* Set P1.4 pin low */
		movw  $0x00, ax
		movw  $P1LTC, dx
		outw    ax, dx /* Write 1 on P1.4 pin */
		movw  $0x0, ax
		movw  $P1DIR, dx
		movw  ax, dx /* Configure Port 1 pins as all outputs */
		movw  $0x0, ax
		movw  $P1CFG, dx
		movw  ax, dx /* Configure Port 1 pins as all I/O */
		nop
		nop
		nop
		nop

		/* Until that point the code runs and I can see the pulse on the scope on P1.4 pin.
		 * However note that if I would expect to have to write to the P1DIR and P1CFG registers only
		 * once to initialise the pins as required and then after that only write to the P1LTC to set the
		 * P1.4 high or low. However, if don't write to the P1DIR and P1CFG register after every write to the
		 * the LTC register, P1.4 does not seem to change.
		 * So for a start I don't believe this is normal. */

		/* Then I try to do something as simple as disabling expanded I/0 like so: */
		movb $0x0, al
		outb  al, $REMAPCFGH

		/* Then I toggle again P1.4 here (using the same code as above but I never see that toggle on the
		 * scope which leads me to the conclusion that my code has failed just above when trying to disable 
		 * expanded I/O */

		[End of code example]


		Has anyone got an idea of what I'm doing wrong here?

		Note that I have been looking at the list files of my code and some other old code which does run on that board but was built from MASM rather then GASM and I can see that the opcodes used for the same instructions differ.
		Example:
		On my code produced from GASM:
		mov $0xf862, %dx        => opcode is 66BA62F8
		On some other code produced from MASM:
		mov $0xf862, %dx        => opcode is BA62F8

		I can't manage to find much information about this extra 66 in the 386 documentation so don't know if that could be the source of my problem.
		I can't see any options on the i386-rtems-as which seem to control different ways of encoding my assembly. Am I missing something here? Could that be the source of my problem?

		Thanks in advance.
		Regards

		Sam Bitton
		



More information about the users mailing list