From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robert Floyd To: Stan Katz Cc: crossgcc@sources.redhat.com Subject: Re: Invalid Operands with Inline assembly Date: Tue, 31 Oct 2000 14:46:00 -0000 Message-id: <39FF4B40.6CE3189D@inet.com> References: X-SW-Source: 2000-10/msg00158.html Hi Stan, I used your example and everything compiles and links just great. With one slight problem that you might be aware of with your Hitachi SH experience... I have asm files that initialize the chip, turns on an LED to RED and sends out a boot string over the serial port to my PC. These actually work. I used the example that you set up for me as a C file with inline assembly that I wanted to link into my working assembly language files. Well after the chip runs thru all the asm code (which I can see is working ok because the LED comes on and the boot string comes out over the serial port), I simply... bra pmain ! branch to global _main in another object file This pmain is a label in the asm file, i.e. pmain: .long _main But instead the chip seems to branch off into the weeds because after several seconds the chip resets, (watchdog timeout?). I actually went thru the code, looked at the srec file and can see that the linker did put in the right address for _main. But oddly enough, nothing happens except it eventually resets itself. Do you think that I should be branching to the dummy global ___main instead? Thanks for any advice on this. Robert F. Stan Katz wrote: > > Robert Floyd [ mailto:robert.floyd@inet.com]wrote: > > Stan, > > > > Well, I want to say thanks for bearing with me on this...I guess I am > > going to have to show my ignorance now... > > > > Your example is confusing to me because you are not assigning your > > pointers with anything. Either it is obviously elementary and so you > > left out the assignments or else there is some magic going on > > here that > > I am unaware by simply putting in unassigned pointers. Maybe you can > > enlighten me on this...thanks so much. > > > > Robert, I apologise, the problem was mine. In the snippet the variable > declarations should have been : > > register long pointer = TxChar; > register long *string = pHelloStr; > > which is where the assignment of the values to the registers > is handled by the compiler. > > Stan ------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com