This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Mixing Assembly and C Code in KEIL

Hullo guys , I want to write some performance-critical sections in Assembly to be called from the C code , The C compiler in my KEIL is ARMCC and the Assembler is ARMASM .
Any help or guide to good documentation or examples ?

Parents
  • Add the assembler file to the project. The IDE understands what to do with them. And if you aren't happy, then you can modify the rules for individual source files.

    When it gets to linking, the linker will not care if the object file came from a *.c file, a *.cpp file or a *.asm file. All it cares about is that the object files are of the proper format and exports meaningful symbols where all the "I require" can be matched with corresponding "I supply".

    But note that only add assembler if you need it - like having a teacher that requires you to do it, or using a tool chain that requires the startup file to be in assembler or when you need extra performance and also have the required skills to actually be able to produce faster code. Assembler-written routines are not automatically faster than compiled C/C++ code - todays compilers are much better at optimizing code than they were 20 years ago.

Reply
  • Add the assembler file to the project. The IDE understands what to do with them. And if you aren't happy, then you can modify the rules for individual source files.

    When it gets to linking, the linker will not care if the object file came from a *.c file, a *.cpp file or a *.asm file. All it cares about is that the object files are of the proper format and exports meaningful symbols where all the "I require" can be matched with corresponding "I supply".

    But note that only add assembler if you need it - like having a teacher that requires you to do it, or using a tool chain that requires the startup file to be in assembler or when you need extra performance and also have the required skills to actually be able to produce faster code. Assembler-written routines are not automatically faster than compiled C/C++ code - todays compilers are much better at optimizing code than they were 20 years ago.

Children
No data