Column: Embedded design
architecture of a standard CPU (such as an ARM processor) is designed to effi ciently perform integer operations, but not so fl oating-point operations. Hence what happens when a code performs fl oating- point operations? In the case of our fi rst Makefi le, which had
none of the additional options, the compiler converted the fl oating-point instructions that constituted the sine operation into a series of integer-based instructions. Of course, this results in a substantially larger number of instructions for the CPU to execute. T us there is a greater opportunity for another task in the system to preempt the sine-wave computations. To confi rm that this is actually what goes
on, let’s look at the Trace View in Tracealyzer. Here, the process responsible for the sine- wave calculations gets preempted by other processes. We can also see that this particular process at one time is suspended for 900 microseconds; see Figure 5. When we specifi ed the “-mfl oat-
abi=hard” option in the second Makefi le we instructed the compiler to use a set of instructions designed specifi cally for fl oating-point operations. However, that produced no real diff erence in the outcome; there was still a similar discontinuity. As a matter of fact, looking at the Trace View of the second trace reveals that the sine- wave process was suspended for the same amount of time; see Figure 6. So, why was that? Well, within this set
of fl oating-point instructions there are specifi c extensions that enable a separate, heavily-optimised fl oating-point unit (FPU) in the processor itself. However, if we don’t specify the “fpu” option to the compiler, it doesn’t use these extensions, which means the fl oating-point instructions will still be emulated using the standard integer instructions. Adding the “-mfpu=neon” option, as we
did in the third run, instructs the compiler to enable a specifi c set of extensions for this particular FPU (NEON). And, with most of the fl oating-point calculations running on a separate coprocessor, there is little opportunity for other processes to preempt the sine-wave generation, resulting in the much smaller discontinuity we see in this user-event signal plot.
Figure 1: User event signal plot
Figure 2: Graph of the contents of the fi le
Figure 3: Tracealyzer’s user event signal plot
www.electronicsworld.co.uk June 2021 09
Page 1 |
Page 2 |
Page 3 |
Page 4 |
Page 5 |
Page 6 |
Page 7 |
Page 8 |
Page 9 |
Page 10 |
Page 11 |
Page 12 |
Page 13 |
Page 14 |
Page 15 |
Page 16 |
Page 17 |
Page 18 |
Page 19 |
Page 20 |
Page 21 |
Page 22 |
Page 23 |
Page 24 |
Page 25 |
Page 26 |
Page 27 |
Page 28 |
Page 29 |
Page 30 |
Page 31 |
Page 32 |
Page 33 |
Page 34 |
Page 35 |
Page 36 |
Page 37 |
Page 38 |
Page 39 |
Page 40 |
Page 41 |
Page 42 |
Page 43 |
Page 44 |
Page 45 |
Page 46