Basics of Code Generation
From the series: Improving Your Racecar Development
Spend more time on algorithm development and less time manually producing code. With the click of a button, you can bring algorithms to C/C++ code and hardware with code generation. Christoph Hahn and Application Engineer Andreas Uschold, both of bat365, walk through the basics of code generation and the tools available to simplify and speed up the process.
Code generation tools are a great alternative to manual coding, which is time consuming and error prone. There is a benefit to having the entire process in one tool chain where, for example, an electrical Formula Student team developing vehicle dynamics controllers, such as torque vectoring, can bring it to its CPU as quickly as possible.
Andreas depicts a typical industry workflow for code generation using the Design V, which is a design workflow used by many automotive companies. Looking at this in Simulink®, the example shown is a typical, closed-loop control system with a controller and a piece of hardware you want to control. To generate code out of the system, you simply press a button in MATLAB® and Simulink and get C/C++ code. The generated code complies with the ANSI ISO C standard and is as readable as good manual generated C code.
Having the code does not mean it is running on the hardware so Andreas then gives an overview of hardware support packages and their benefits. Hardware support packages are available for different hardware platforms and enable you to embed and deploy your code.
Ultimately, Model-Based Design helps detect bugs early and speeds up the development process. This is a great overview of code generation and we will go into the individual steps in more detail in future episodes.
Below are links to software and hardware products and services mentioned in the episode:
- Simulink Real-Time™
- Speedgoat hardware and services for rapid control prototyping
- Hardware support packages
Two episodes of the MATLAB and Simulink student lounge are closely connected to that topic. In the first video processor-in-the-loop (PIL) testing is explained more in detail and in the second video a top of the world electric Formula Student team explains their approach to code generation and testing.
Related Products
Learn More
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other bat365 country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)