MATLAB Answers

How can I generate code for my embedded processor, for example the Kinetis Microcontroller K60F120, using Embedded Coder 6.5 (R2013b)?

3 views (last 30 days)
The system we are using at university has the following setup:
K60F120 Microcontroller on a so called TowerSystem Board.
It is a Cortex M4F (floating point) based microcontroller. We are using the actual version of the CodeWarrior that is CW10.4. The programming exercises for the students are mainly in the area of control (beside basic things like digital and analog I/O).

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 25 Oct 2013
There are three ways one can use Simulink and Embedded Coder with any embedded processor.
Targeting Level 1. Generate ANSI/ISO-C from the control algorithm model. Manually integrate the generated algorithm C code into a hand written basic software framework consisting of RTOS/scheduler and device drivers code for I/O.
Targeting Level 2. Generate processor-optimized code from the control algorithm model. Manually integrate the generated optimized algorithm C code as described above.
Targeting Level 3. Generate ANSI/ISO-C (or optimized) code from control algorithm model but also generate code from custom Simulink blocks for the I/O devices. The algorithm and basic software code can then automatically be integrated.
Levels 1&2 are typically used by our industrial customers because they have a lot of experience in embedded software and prefer a nice separation between the algorithm code and basic software.
Level 3 is often preferred by our educational/hobbyist customers because they lack this experience and want to focus their user on the control system strategies.
In R2013a, MathWorks support Level 1 for ARM Cortex M4F (and thus Kinetis).
In R2013b, MathWorks support Levels 1 & 2 for ARM Cortex M4F (and thus Kinetis). We also support Level 3 for the STM32F4 Discovery Board (which is based on ARM Cortex M4F).
Unfortunately we have not tested if our ARM Cortex M4F optimized code (which uses ARM's CMSIS DSP libraries) works on CodeWarrior (most compilers support CMSIS, but we do not know about Code Warrior.)
We have tested this with ARM GCC, Keil, Attolic, and IAR. As far as we know CodeWarrior is using ARM GCC so we suspect it should work.
We have no plans to support Level 3 for Kinetis, but we developed our Level 3 support for the Discovery Board as an example for companies like Freescale to build their own Level 3 support.
Freescale has lots of experience in building Embedded Coder targets so they could be asked if they have plans to build any for Kinetis.
It is also possible to build a target oneself (if one of the students cares to study our Discovery Board target documentation), or it is possible to pay someone (like a MathWorks consultant) to build a target or show how to build one. But as stated above, one may not need a Level 3 target if having a working example that simply needs to replace the hand written algorithm code with generated C code.

Sign in to comment.

More Answers (0)




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!