[Scilab-Dev] code generation for microcontroller target

Markus Valtin valtin at control.tu-berlin.de
Mon Aug 11 19:02:31 CEST 2014


Am Mittwoch, 25. Juni 2014, 22:29:25 schrieb Matías Silva Bustos:
> Hello,
Hello,

> I am about to begin the developement of a coder that takes a xcos diagram
> and generates C code  suitable to be ran on a ARM Cortex M3 uC, a STM32FXXX
> in particular.
That sounds interesting. I could recommend using the STM32F4XXX chips because 
of the floating point unit. http://blog.stm32f4.eu/category/fpu/

> Here my questions:
> 
> a) Is the code generated by the xcos CodeGenerator suitable for this
> purpose without much code rewritting?
Imho it is not. You might find http://hart.sf.net interesting. This toolbox 
compiles a Scicos Diagram into a RTAI or Preempt Binary. It uses a customized 
do_compile_superblock.sci function which looks not really straight forward.
To resulting code is also not easy to grasp but it works :-) and it might give 
you an idea.

> a_1) i.e. has the generated code too many library dependencies? I tryed to
> compile the XXX_standalone.c  but it seems to require many scilab
> libraries, Am I right?.
Yeah but this is just for the recompiled Scilab blocks.
The real questing would be, what standard functions arm supports in there 
cross-compiler tool chain. (I assume you want to use a free tool chain? I also 
not sure if you can use IAR or Keil from within scripts/makefiles.)

> b) Should I begin from scratch? I think I can reuse the xcos parser and
> some other code involving the diagram description.
> b_1) But from there, Is there other classes or functions I can use?

You also need to consider the I/O side on the micro controller. How do you 
receive or send data? This could be implemented as Scicos Block but this 
requires knowledge about the micro controller used and the setup (like clock 
speed...).

> c) Scilab is the preferred programming language? I have seen many languages
> such as C, C++, Java, Modelica (i'm not sure what this is), FORTRAN.

Depends on what you do. Each block has two functions, an interfacing function 
(Scilab) and a computational function (Scilab, C, C++, Fortran).

The interfacing function is used by Xcos for the GUI,  some I/O size things 
and the parameter. This function is not important for you.

The computational function on the other hand does all the real work during 
simulation and this function must be ported to the micro controller.
I think you need all computational functions to be C/C++ functions because I 
don't think there is a Fortran compiler for ARM and there is definitely no 
Scilab interpreter available.

Maybe you should create your own Scicos block to get more familiar with it.

> d) What is the format of the zcos files? Which issues has the xcos (XML)? :(
Size. zcos is a compressed format.

> I'm electronic engineer student from Argentina. I was asked to do this
> project by a professor and I accepted the challenge.
> 
> Many thanks for considering my request.
> Sincerely,
> Matías Silva Bustos.

Is there an open source repository?

Sincerely  M. Valtin

-- 
Markus Valtin
Technische Universität Berlin,  FG Regelungssysteme (Control Systems Group)
Room: EN 229   -   Phone: +49-30-314-24893   -   Fax: +49-30-314-21137
Post: TU Berlin  -  Sek. EN 11  -  Einsteinufer 17  -  D-10587 Berlin, Germany
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.scilab.org/pipermail/dev/attachments/20140811/0e4bba2a/attachment.sig>


More information about the dev mailing list