#35288 - ProblemBaby - Wed Feb 02, 2005 5:29 pm
Hi
I need some about the asm directives.
Do someone know a tutorial or something that describes them in detail?
I couldnt find any!
Well I ask some questions anyway here
When I write .section .iwram, "ax", %progbits
what does "ax", %progbits mean
I just say it somewhere and started to write it myself=)
Am I right: If I want to put data somewhere is it this I should use?
.section .rodata
.section .iwram, "ax", %progbits
.section .ewram
?
And when I want to put data it is
.text
.section .iwram, "ax", %progbits
.section .ewram
?
Thanks for helping
#35354 - mentz - Thu Feb 03, 2005 3:29 pm
Once upon a time...nice programmer creating their program with big guide full of word about using in the best mode their program...
Now programmer are afraid that someone could grab their ideas...
The only who made a good guide for his program, was the creator of goldroad assembler (the doc is 'half-hided' in his web site).
goldroad create clean code instead of other gcc that put a lot of garbage in their assembled files...(using ARM for each compiler)
(try to create the same program with goldroad and gcc and disassemble it)
i think the best method to know certain things is to view inside the output file (.gba) and follow step by step with a disassembler (like the one with the VBA) and a memory viewer...
I hope someone could give a reply to your answer...
_________________
xXx
#35359 - sasq - Thu Feb 03, 2005 4:26 pm
Wow that was a waste of reply-space...
The format of section is:
.section name[, "flags"[, @type]]
"name" is used by the linker to decide where to put the section - iwram means in - you gussed it - to place it in iwram. "ax" are the two flags "allocate" and "executable" and the %progbits type says that the section contains data. That is probably default anyway - I have never included flags or type in my sections and had no problems.
".section rodata" is for data (not code) that goes into ROM (0x08000000->)
".section text" is for normal code, also goes into ROM
(Oh and if you dont know, IWRAM is tha fast 32KByte RAM at 0x03000000 and EWRAM is the 256KByte work ram at 0x02000000)
#35362 - poslundc - Thu Feb 03, 2005 4:33 pm
I was writing a response, but sasq gave a much clearer and consise one than mine, so there wasn't much point after that...
I will, however, point you to this page: http://re-eject.gbadev.org/. Grab the GAS ARM reference off of it for a useful reference sheet to the most useful GAS directives for GBA programming.
Dan.
#35426 - ProblemBaby - Fri Feb 04, 2005 3:05 pm
sasq: Thanks for the information!
is it true what mentz said that gcc puts a lot of garbage in the assembled files, does that mean that gcc compiled ASM are slower?
#35427 - poslundc - Fri Feb 04, 2005 3:36 pm
ProblemBaby wrote: |
is it true what mentz said that gcc puts a lot of garbage in the assembled files, does that mean that gcc compiled ASM are slower? |
If you write your own assembly, it doesn't make a whit of difference if you use GCC, Goldroad, or anything else to assemble it. There is no compilation stage when going from assembly to binary.
When it comes to how good a job the compiler does of optimizing your C code, GCC is probably not the best out there for the ARM processor. The ARM SDT reportedly does a much better job. I don't know how Goldroad compares.
BUT, keep this in mind when selecting a compiler:
- GCC is the most widely adopted and supported free compiler out there. The ARM SDT is expensive, and Goldroad is abandonware and hasn't been updated (to my knowledge) in years. Almost everyone who posts to this forum uses GCC, and there is a big advantage in using the compiler that everyone else uses, especially if you think you're going to be asking questions of people in the forums that will require them to be familiar with the development environment you use.
- The probability that GCC produces sub-optimal code doesn't matter for 95% of the programming you're doing; it just has to be "good enough". For the 5% where it does matter, you can always recode it in assembly if necessary.
Dan.
#35436 - sasq - Fri Feb 04, 2005 4:40 pm
ProblemBaby wrote: |
is it true what mentz said that gcc puts a lot of garbage in the assembled files, does that mean that gcc compiled ASM are slower? |
No offense but menz was talking out of his ass ;)
Goldroad is a very primitive assembler - it's full of bugs and you have to write all code in one file (putting code in include files doesnt count!) since it has no linking capabilities. At the top of my head the only advantage it has over gas that I can come up with is it's incbin directive, and that it can assemble directly to a GBA-file (but a simple objcopy takes care of that in the gas case).
#35445 - Lupin - Fri Feb 04, 2005 9:04 pm
DevKitARM supports .incbin too.
I found the GCC assembler not bad or confusing at all. I would definately take GCC over Goldroad.
_________________
Team Pokeme
My blog and PM ASM tutorials