언어 설정

Menu
Sites
Language
Assembly Code And Neon

Is it possible to write neon asm code into native tizen project?

If possible then what will be the settings to compile that code?

 

Can we build *.s or *.asm file in native tizen project?

Edited by: Brock Boland on 17 3월, 2014 Reason: Paragraph tags added automatically from tizen_format_fix module.

Responses

12 댓글
MooChang Kim
It is possible.. default assemble source file extentions are *.S (capital) and *.asm. you can use IDE setting 'Project -> Properties -> C/C++Build -> Settings -> Assembler -> Expert settings' to add '-mfpu=neon' option. but once you start use ARM assemble source file, you can't compile and run it in Emulator because Emulator is i386 architecture..
Benjamin Blois
Hi, I'm also trying to integrate Neon code in my app, but I'm getting "garbage following instruction" errors with instruction like : "and r10, r7, lsl#5". The errors are always the same and happen on "and" and "add" with two registers and a left shift with an immediate. Any idea of where it can come from ?
MooChang Kim
I can't reproduce this error, could you share the 'console' window log for this error?
Benjamin Blois
clang++.exe -I"pch" -D_DEBUG -I"C:\src\kti\inc" -O0 -g3 -Wall -c -fmessage-length=0 -target arm-tizen-linux-gnueabi -gcc-toolchain "C:/tizen-sdk/tools/smart-build-interface/../arm-linux-gnueabi-gcc-4.5/" -ccc-gcc-name arm-linux-gnueabi-g++ -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mtune=cortex-a8 -Wno-gnu -fPIE --sysroot="C:/tizen-sdk/platforms/tizen2.1/rootstraps/tizen-device-2.1.native" -I"C:/tizen-sdk/platforms/tizen2.1/rootstraps/tizen-device-2.1.native/usr/include/libxml2" -I"C:\tizen-sdk\library" -I"C:/tizen-sdk/platforms/tizen2.1/rootstraps/tizen-device-2.1.native/usr/include" -I"C:/tizen-sdk/platforms/tizen2.1/rootstraps/tizen-device-2.1.native/usr/include/osp" -D_APP_LOG -MMD -MP -MF"src/neon.d" -MT"src/neon.d" -o "src/neon.o" "../src/neon.cpp" -mfpu=neon src/subdir.mk:135: recipe for target 'src/neon.o' failed C:/DOCUME~1/BBlois/LOCALS~1/Temp/neon-047859.s: Assembler messages: C:/DOCUME~1/BBlois/LOCALS~1/Temp/neon-047859.s:939: Error: garbage following instruction -- `and r10,r7,lsl#5' C:/DOCUME~1/BBlois/LOCALS~1/Temp/neon-047859.s:946: Error: garbage following instruction -- `and r10,r7,lsl#10' C:/DOCUME~1/BBlois/LOCALS~1/Temp/neon-047859.s:1010: Error: garbage following instruction -- `and r10,r6,lsl#4' C:/DOCUME~1/BBlois/LOCALS~1/Temp/neon-047859.s:1017: Error: garbage following instruction -- `and r10,r6,lsl#8' C:/DOCUME~1/BBlois/LOCALS~1/Temp/neon-047859.s:1024: Error: garbage following instruction -- `and r10,r6,lsl#12' C:/DOCUME~1/BBlois/LOCALS~1/Temp/neon-047859.s:1044: Error: garbage following instruction -- `add r0,r1,lsl#2' clang++: error: assembler (via gcc) command failed with exit code 1 (use -v to see invocation) By the way, I don't know if it makes a big difference, but the assembly in inside a "asm volatile ()" block into the C code.
MooChang Kim
from the log, I see 'clang++.exe' is trying to compile 'neon.s'. if you change 'neon.s' to 'neon.S' then it will be compiled with 'arm-linux-gnueabi-as.exe'. and move '-mpu-neon' option to assembler option. (Project -> Properties -> C/C++ Build -> Settings -> Assembler -> Expert settings) good luck.
Benjamin Blois
The problem is that neon[...].s is an automatically generated file, and I did not find where to change the name of the generated file. Furthermore, I tried to add the -mfpu=neon flag to the assembler, with no success.
MooChang Kim
then try to change association for *.s file in the project setting, and clean build. Project -> Properties -> C/C++ General -> File Types -> Use project settings -> New -> add "*.s" as Pattern, and "Assembly Source File" for Type. try to add "-mpu=neon" option in the "Command line pattern", not in the "Command" field. Project -> Properties -> C/C++ Build -> Settings -> Assembler -> "Command line pattern" edit box. good luck~
Benjamin Blois
I tried that with no success, and to be sure that it's not my code that isn't working, tried to move it outside the C code in a .s (or .S it worked the same). When assembled alone, there is no problems with my code... I think that the problem comes from the Assembler call from inside the C compiler, which maybe is not done the right way, or which does not pass the arguments right, or maybe something else. An interesting point is that in order to get the flag -mfpu=neon working for my code (when it's inside the C code), it must be in the C/C++ compiler instead of the assembler. I'm gonna investigate on this
MooChang Kim
Hi Benjamin. now I see, you are using inline assemble.. in that case.. that is a known issue for Tizen clang.. I suggest to change your default toolchain to gcc instead of llvm.. that will help.. Project -> Properties -> C/C++ Build -> Tizen Settings -> Toolchain Informations -> Name -> change LLVM-3.1 to GCC-4.5 good luck.
Benjamin Blois
Thank you very much for your answers. It worked for me. But do you know if clang will support this feature soon ? I'm having trouble with segfaults occurring in inline assembly compiled with gcc-4.5 but not in the same code compiled with llvm3.1.
MooChang Kim
Hi Benjamin. I discussed with clang team and found the reason. for example, "and r10,r7,lsl#5" is meaning of "r10=r10 & (r7<<5)" in this case, it should be "and r10,r10,r7,lsl#5". this issue happens because clang accepts UAL(Unified Assembler Language) only and your source is pre-UAL. if you change your source code to UAL form, then it will work for both gcc and clang. you mentioned your source code is generated... I guess there may be an option to generate assemble with UAL form in that tool. Regards
Benjamin Blois
Hi Kim, I didn't even know that there was this kind of standard, I will document myself a bit on that. I modified the source without any problem and it seems to work fine. Thank you very much for your help ! It really helped me on that Regards Benjamin