Forum : ARM
Original Post
Post Information | Post |
---|---|
August 15, 2010 - 6:50pm
|
Hello ASSEMBLY CODE C Code Thanks in advance |
Forum : ARM
Post Information | Post |
---|---|
August 15, 2010 - 6:50pm
|
Hello ASSEMBLY CODE C Code Thanks in advance |
Hi,
I don't see what you mean by 'regular gcc tools', but Ride uses the standard GCC executables, so this can probably be considered as 'regular gcc tools'.
Your problem is probably in the project options, which could generate wrong command lines. You can check the command lines that Ride launches, in the build log window of Ride. Compare them with the command lines that work.
I hope it helps.
Best Regards,
Vincent
Hi
'regular gcc tools'- I regularly use MinGw and gcc arm tools. Using a makefile I am able to link the object codes of assembly and C.
As you suggested I have been viewing the project options . I have enabled the assembly file to be debugged and linked.
Is there any project option that I have to enable so that the assembly files's object code links to the C code ?
The following is the build log that I am getting when I build the project. Both the assembly and C files have already built properly and list,object files for them are also generated . Test_app is the name of the application and its located on my desktop.
Running: LD Linker
"C:\Program Files\Raisonance\Ride\arm-gcc\bin\arm-none-eabi-gcc.exe" -mcpu=cortex-m3 -mthumb -Wl,-T -Xlinker "C:\Users\Lokesh\Desktop\testing\test_appl.elf.ld" -u _start -Wl,-static -Wl,--gc-sections -nostartfiles -Wl,-Map -Xlinker "C:\Users\Lokesh\Desktop\testing\test_appl.map" -Wl,--warn-once
"C:\Program Files\Raisonance\Ride\arm-gcc\bin\arm-none-eabi-objcopy.exe" "C:\Users\Lokesh\Desktop\testing\test_appl.elf" --target=ihex "C:\Users\Lokesh\Desktop\testing\test_appl.hex"
"C:\Program Files\Raisonance\Ride\Bin\rexrdr.exe" "C:\Users\Lokesh\Desktop\testing\test_appl.elf.sizetmp" 0 "C:\Program Files\Raisonance\Ride\arm-gcc\bin\arm-none-eabi-size.exe" "C:\Users\Lokesh\Desktop\testing\test_appl.elf"
"C:\Program Files\Raisonance\Ride\Bin\dwf2xml.exe" "C:\Users\Lokesh\Desktop\testing\test_appl.dbi" "C:\Users\Lokesh\Desktop\testing\test_appl-globals.Standard.xml" "C:\Users\Lokesh\Desktop\testing\test_appl.Standard.xml"
Regards
Lokesh
Also the bl instruction to fun() during the debug session is replaced by UNDEF in case I use assembly coding . But a C code of the same function works correctly.
Hi,
You must add another ".thumb_func" assembler directive for telling the linker that the code is a thumb function:
I checked on the files that you sent by email that this solves the problem.
In general, the procedure for writing an assembler function to be called by C is this:
1. Write a C file that contains just a basic function with the same name and prototype as the assembler function you want to write. (it should read the parameters and return something)
2. Select the "Save Temp Files" compiler options and compile your C file. The compiler will then generate a ".s" file in the folder where your C file is.
3. Open the .s file generated by the compiler, copy it and use it as basis for your assembler file. It includes all the required directives and declarations for your function, and examples about how to access the parameters and return a value. You just need to remove references to the original c file, in order to allow debugging.
This is how I found out the missing directive in your example: I compiled this C code and looked at the generated asm:
Best Regards,
Vincent
Thank you for such a wonderful support. I had been in been facing trouble for the last few days on this issue of C and Assembly inter-networking.
Keep up the good work.
Regards
Lokesh Siddhu