
15
4 Analysis of the Generated Code
4.1 Memory Usage RAM, ROM and Execution Time
To make a comparison between the generated code and the hand written code, the
system is built for host and target with the generated code from both TargetLink
and the code generated from Real-Time Workshop Embedded Coder. Memory
usage and execution time are calculated. The tables below show the execution
times, RAM and ROM memory usage. The tested program code is the code for
the pressure controller including a PID controller. See Appendix IV The Model.
The hand written code in Haldex base software was replaced by the generated
code and a model was built and run on a C166 microprocessor as a target. Many
tests were carried out while running on the target to see if the controller behaves
as expected. ROM and RAM memory usage were calculated after the whole
model was built. ROM and RAM memory usage were saved in a map file.
The generated code that was used in the tests is ANSI-C code when generated
with TargetLink and optimised for Infineon C16x, XC16x when generated with
RTW EC.
Pressure Controller
& PID
TargetLink
(bytes)
Real-Time Workshop
Embedded Coder
(bytes)
Hand-written
Code (bytes)
ROM
1594 2676 2282
RAM
31 2 52
Table 2: RAM and ROM memory usage
It should be mentioned here that calibrated parameters were not chosen in RTW
EC. The use of calibrated parameters in RTW EC was not investigated in this
work due to lack of time. This can be why RTW EC gives less RAM memory
usage than TargetLink as shown in Table 2 above. However, for future studies the
option Inline Parameters should be investigated.
The generated code from TargetLink uses functions for all saturation checks in the
whole code while RTW EC uses if-sets in every saturation checking everywhere
in the code. This makes the RTW EC code less efficient and that is one of the
reasons for the memory usage differences between TargetLink and RTW EC as
shown in Table 2 above. An example of this is the following code which is
generated for the same block:
Kommentare zu diesen Handbüchern