Generate C/C++ code for ARM processor using Simulink Coder

4 views (last 30 days)
Hello,
I see that there are several option for porting simulink code into c/c++ ARM for Altera.
In http://www.mathworks.com/help/supportpkg/alterasoc/ref/coder-target-pane-alterasoc-hardware.html#bujddtf-10 http://www.mathworks.com/help/supportpkg/alterasoc/ug/build-and-run-executable-on-ljklkjasdf-platform.html It is said "You can configure a Simulink® model to generate code, build an executable, and then run the executable on your Altera® SoC platform. The executable runs in the Linux® environment on the ARM® Cortex-A9 processor on the Altera SoC platform."
1. There is something basic that I don't understand here, c/c++ code is independent of architecture (ARM/Intel, etc.), therefore why is there is need to configure the generating code to one process of another, if the result is C/C++ independent source code, which is built somewhere else (not in Simulink).
2. Another thing - Why is it for Linux ? What can I do to make it OS independent (bare-metal - no OS) ?
Thank you,
Ran

Accepted Answer

Walter Roberson
Walter Roberson on 25 Jun 2015
C and C++ have never been independent of architecture. Especially C. C implementations have always had differences in matters such as word length, whether characters are signed or unsigned, whether "int" and "long" are the same type, which end of a byte that a bitfield starts packing from, and other issues.
Standard C by itself does not give device access. Standard C only supports buffered I/O such as fread() and fwrite(). These are, of course, inadequate for low-level control of devices such as you would like to do. The result of type-punning an integer into a pointer in order to point to an absolute address to do I/O is a common extension to C but is not part of C (and seldom works on systems that implement virtual memory.)

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by