C/C ++ & Assembly mixed programming material

Click For Summary
SUMMARY

This discussion focuses on acquiring expertise in mixed programming using C/C++ and assembly for embedded systems. Key recommendations include studying architecture manuals specific to the platform in use, which detail instruction sets and flow control essential for optimization. The conversation emphasizes the importance of understanding parameter usage in function calls and name mangling in C/C++. It also highlights that while mixed programming is beneficial, most embedded systems primarily utilize either C/C++ or assembly without mixing due to optimization concerns.

PREREQUISITES
  • Proficiency in C/C++ programming languages
  • Understanding of assembly language fundamentals
  • Familiarity with embedded systems architecture
  • Knowledge of parameter passing conventions in C/C++
NEXT STEPS
  • Study ARM architecture manuals for instruction sets and optimization techniques
  • Learn about context switching and interrupt handling in embedded systems
  • Research name mangling in C/C++ to understand assembly integration
  • Explore optimization strategies for specific CPU architectures, such as Intel's Pentium
USEFUL FOR

Embedded systems developers, software engineers working with low-level programming, and anyone interested in optimizing mixed C/C++ and assembly code for performance-critical applications.

pairofstrings
Messages
411
Reaction score
7
Can anyone suggest me good books on 'C/C ++ & assembly mixed programming' for embedded system coding. I am trying to gain expertise in mixed C/C++ & assembly mixed programming for writing embedded system codes. I am fairly new to mixed programming. I know C/C++ and assembly languages. Now, I need to know mixed programming. Can you please suggest me any good books for mixed programing.
 
Last edited:
Technology news on Phys.org
If you know C++ and assembly, then you're almost there already. I've worked on embedded systems, and normally each source module is all C, C++, or assembly, and not mixed (no _asm() directives used in C code, because it interferes with the optimizer). Generally the amount of assembly code is small, mostly for the operating system used in a device, and perhaps some time critical routines. In the case of a cpu with a lot of registers, like an ARM with 16 registers, it's difficult to improve on the optimization of the code, but you need assembly to deal with context switching and dealing with interrupts (ARM uses secondary shadow registers for fast interrupt, normal interrupt, supervisor mode, ... ), or any math routine that needs to use low level hardware like the carry bit or paired registers.

The other thing to learn is how parameters are used in calls (registers versus stack), and how names are "mangled" in C or C++ so you can use the proper parameters and names in assembly. This can usually be done by writing a test module in C or C++ and having the compiler produce assembly code, which gives you the parameter setup and names.

Unless you get involved with the operating system itself, there's not much to learn. Most companies will just buy a basic operating system or hire a consultant if no one in house is famliar with the internals of an operating system.
 
Last edited:
pairofstrings said:
Can anyone suggest me good books on 'C/C ++ & assembly mixed programming' for embedded system coding. I am trying to gain expertise in mixed C/C++ & assembly mixed programming for writing embedded system codes. I am fairly new to mixed programming. I know C/C++ and assembly languages. Now, I need to know mixed programming. Can you please suggest me any good books for mixed programing.

For the assembler, it's probably a good idea to get the specific architecture manuals for the platform you are using. Get both the manuals that outline the instruction set complete with opcodes and binary representation (just in case you can't get an assembler).

Also in the architecture manuals it should give details about the flow control of the hardware platform: this is the key thing you need for optimization and critical routines.

As an example of what I'm talking about, when the pentium chip came out from intel, there was a thing called a U and V pipe. Now the pentium chip had only one core and one main CPU, but if you put certain instructions in a certain order it could process them quicker due to the UV pipe architecture. If you are interested in fast optimized code, its the tricks like this that will give you the speed edge.

As for C/C++, there are plenty of resources out there and its hard to give recommendations for that.
 

Similar threads

  • · Replies 102 ·
4
Replies
102
Views
4K
Replies
6
Views
3K
Replies
86
Views
3K
  • · Replies 49 ·
2
Replies
49
Views
5K
  • · Replies 122 ·
5
Replies
122
Views
18K
  • · Replies 16 ·
Replies
16
Views
5K
  • · Replies 397 ·
14
Replies
397
Views
22K
Replies
38
Views
4K
  • · Replies 8 ·
Replies
8
Views
3K
Replies
16
Views
4K