1. I started with assembly language by first creating a simple C Project,
e.g. "Hello Led"
2. I set compiler flag --save-temps
3. I added a new C file "sample1.c" to the project,e.g with following code
and called the function from the main loop
...
void sample1(void) {
int i;
i = 0;
while (i<200000) {
i++;
}
}
4. you can now check under Debug/sample1.s the generated assemply language
5. I then added a file "test.S" (remark upper'S') to the project.
.file "test.S"
.section .text
.align 3
.global samplefunction
.type samplefunction,@function
samplefunction:
addi sp, sp, -48
stw r16, 36(sp)
stw r17, 32(sp)
stw r18, 28(sp)
stw r19, 24(sp)
stw r20, 20(sp)
stw r21, 16(sp)
stw r22, 12(sp)
stw r23, 8(sp)
stw fp, 4(sp)
stw ra, 0(sp)
# here we start
.. some usefull code
ldw r16, 36(sp)
ldw r17, 32(sp)
ldw r18, 28(sp)
ldw r19, 24(sp)
ldw r20, 20(sp)
ldw r21, 16(sp)
ldw r22, 12(sp)
ldw r23, 8(sp)
ldw fp, 4(sp)
ldw ea, 0(sp)
addi sp, sp, 48
ret
6. I added a call to samplefunction() in the main loop
The file should compile normal, it should generate a file DEBUG/test.s and
DEBUG/obj/test.o, the last is important for debugging
assembler debugging:
the problem seams to be that the assembly routines are not shown in the
Outline Window.
the only trick I found, is the following
1. switch to C/C++ Development Perspective
2. in C/C++ Projects go to
yourProject/Debug/obj/yourAssemblerFile.o
You should see there your assembly subroutines with a green point in front
Right Click the function you want to debug, and click
"Add/Remove Breakpoint"
3. Switch back to Debug Perspective, and check under Breakpoints, if your
breakpoint was set.
start your program, it should now stop at the beginning of your assembler
function, showing the assembly instructions.
Remark: Perhaps you must already check under
"Windows->Preferences->C/C++->Debug"
"Automatically switch to dissassembly mode"
hope this helps