Currently I'm playing a bit around with a MSP430 microcontroller board from TI, using the mspgcc port of gcc. Everything works fine using the c compiler, and now I'm trying to get it to work using only the assembler (msp430-as). I'd like to write an assembler equivilant to the minimal c program:
int main(void) { while(1) {} return 0; }
Looking at the disassembly (msp430-objdump -D a.out) of the above c program, there's a special .section called ".vectors", that holds a list of interrupt vectors and the reset vector. This list is always located at 0x0000ffe0. Now for the problem: I really can't get msp430-as to produce exactly the same disassembly as the c program. I can't even get it to reconize the .vectors section as something worth outputing in the objdump.
I've tryed to use the ".org" assembler directive to force placement of the sections. But that doesn't produce the same results either...
Where should I go from here? Any good documents that explains everything in a way, a complete newbie like myself, can understand?
Btw, I'm not totally sure this is the right newsgroup to ask this question - if it isn't, please flame me. :)
mvh Rasmus Neckelmann
Didn't find your answer? Ask the community — no account required.
R
Roland Zitzke
"Rasmus Neckelmann" schrieb im Newsbeitrag news:bq4n3t$ki6$ snipped-for-privacy@sunsite.dk... the minimal c
program,
Why don't you simply use the -S option of gcc when compiling? This will give you a .s file containing input for gas.
/Roland
R
Rasmus Neckelmann
Well... I runs the following commands, where "test.c" is the above program:
0000114c : 114c: 02 df bis r15, r2 ; 114e: fe 3f jmp $-2 ;abs 0x114c Disassembly of section .data: Disassembly of section .vectors:
0000ffe0 : ffe0: 3a 11 interrupt service routine at 0x113a ffe2: 3a 11 interrupt service routine at 0x113a ffe4: 3a 11 interrupt service routine at 0x113a ffe6: 3a 11 interrupt service routine at 0x113a ffe8: 3a 11 interrupt service routine at 0x113a ffea: 3a 11 interrupt service routine at 0x113a ffec: 3a 11 interrupt service routine at 0x113a ffee: 3a 11 interrupt service routine at 0x113a fff0: 3a 11 interrupt service routine at 0x113a fff2: 3a 11 interrupt service routine at 0x113a fff4: 3a 11 interrupt service routine at 0x113a fff6: 3a 11 interrupt service routine at 0x113a fff8: 3a 11 interrupt service routine at 0x113a fffa: 3a 11 interrupt service routine at 0x113a fffc: 3a 11 interrupt service routine at 0x113a fffe: 00 11 interrupt service routine at 0x1100
----- END OF OUTPUT ------
Not exactly the same, right? I guess I have to give extra instructions to the linker/assembler, or something. Still kind of lost, sorry. Anyone?
mvh Rasmus Neckelmann
T
Tauno Voipio
give
If you're using gas, the mantra
-Wa,ahlms=myfile.lst
added to the GCC command line produces an assembly listing to myfile.lst, in addition to the other outputs.
Tauno Voipio tauno voipio @ iki fi
H
Hans-Bernhard Broeker
Rasmus Neckelmann wrote: [...]
[...]
No, but you *will* have to *run* the linker. When you dropped the -S option, you used gcc in its default mode of operation, where it compiles
*and* immediately links the code you give it to a complete executable.
In your manual test with the -S option, you didn't link at all.
gives you exactly the same output as a direct compilation of test.c. I put in the '-v' flag so you can watch gcc call the linker after assembling test.s.
Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.
R
Rasmus Neckelmann
"msp430-gcc -mmcu=msp430x149 -Wa,ahlms=myfile.lst test.c" produces the following output:
---- START OF OUTPUT ---- Assembler messages: Error: can't open ahlms=myfile.lst for reading ahlms=myfile.lst: No error
----- END OF OUTPUT ----
Isn't "gas" and "as" the same thing? Or am I wrong?
mvh Rasmus Neckelmann
R
Rasmus Neckelmann
Now it seems to work! :) Thanks!
mvh Rasmus Neckelmann
T
Tauno Voipio
Sorry, mea culpa...
-Wa,-ahlms=myfile.lst
Note the minus after the comma. Please note also that there may be no spaces in the mantra.
HTH
Tauno Voipio tauno voipio @ iki.fi
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required
Report Content
You are reporting this content to the moderators. They will look at it
ASAP.