Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Using Legacy Code with RTW and Embedded Targets
Hello,

I am trying to stream line our modeling to development phase of code
generation for our group. Currently we are using TI C2000 DSPs, and
would like to be using RTW with the C2000 target to automatically
generate our control code from a simulink model. I have this working
with very few problems.

The problem is that we have some sections (functions) in the current
production control code I want to leave alone which are written in
assembler and C. What I would ideally like to be able to do is create
a block which simulates the legacy function but which passes the
legacy code to the complier when real time workshop builds the
function.

To explain this a different way I want to be able to model the legacy
code in simulink (which is easy) but when RTW does the code
generation for that block(s) I want it to pass my legacy assembler/C
code to the compiler rather then generate it from that section of the
model.

I know this is somewhat confusing to read, but I would appreciate any
help,

Matthew

Report this thread to moderator Post Follow-up to this message
Old Post
Matthew Dares
05-30-05 09:01 PM


Re: Using Legacy Code with RTW and Embedded Targets
Hi Matthew,
the best (but also I admit, not the easiest way) is to write a non-inlined
S-Function, i.e,
- write a "usual" S-function in C, which simulates your legacy function
- write a TLC-File for your S-function, which just passes your legacy
code to RTW

Titus

"Matthew Dares" <mdares@rogers.com> schrieb im Newsbeitrag
news:ef07837.-1@webx.raydaftYaTP...
> Hello,
>
> I am trying to stream line our modeling to development phase of code
> generation for our group. Currently we are using TI C2000 DSPs, and
> would like to be using RTW with the C2000 target to automatically
> generate our control code from a simulink model. I have this working
> with very few problems.
>
> The problem is that we have some sections (functions) in the current
> production control code I want to leave alone which are written in
> assembler and C. What I would ideally like to be able to do is create
> a block which simulates the legacy function but which passes the
> legacy code to the complier when real time workshop builds the
> function.
>
> To explain this a different way I want to be able to model the legacy
> code in simulink (which is easy) but when RTW does the code
> generation for that block(s) I want it to pass my legacy assembler/C
> code to the compiler rather then generate it from that section of the
> model.
>
> I know this is somewhat confusing to read, but I would appreciate any
> help,
>
> Matthew



Report this thread to moderator Post Follow-up to this message
Old Post
Titus Edelhofer
05-31-05 02:14 PM


Re: Using Legacy Code with RTW and Embedded Targets
Titus Edelhofer wrote:
>
>
> Hi Matthew,
> the best (but also I admit, not the easiest way) is to write a
> non-inlined
> S-Function, i.e,
> - write a "usual" S-function in C, which simulates your legacy
> function
> - write a TLC-File for your S-function, which just passes your
> legacy
> code to RTW
>
> Titus
>
> "Matthew Dares" <mdares@rogers.com> schrieb im Newsbeitrag
> news:ef07837.-1@webx.raydaftYaTP... 
> code 
> and 
automatically 
> working 
> current 
> in 
> create 
the 
> legacy 
> assembler/C 
of
> the 
appreciate
> any 
>
>
>

Matthew,
if you are lucky enough (i.e. depending on you legacy code) a TLC
wrapper may turn out to be what you need.
Have a look at the s-function builder block (same library as the
s-function block): if you can use it, the associated TLC wrapper is
generated automatically.
HTH
riccardo
riccardo~-_carrozzo~@-yahoo-~.~co-.uk~
(no tildes nor hyphens in my address)

Report this thread to moderator Post Follow-up to this message
Old Post
riccardo
05-31-05 02:14 PM


Re: Using Legacy Code with RTW and Embedded Targets
Thank you both,

I see how this works now, and a closer read of the documentation
would have served me well. I misunderstood the use of the tlc
wrappers.

Thanks,
Dares

Report this thread to moderator Post Follow-up to this message
Old Post
Matthew Dares
05-31-05 09:05 PM


Re: Using Legacy Code with RTW and Embedded Targets
Matthew Dares wrote:
> Hello,
>
> The problem is that we have some sections (functions) in the current
> production control code I want to leave alone which are written in
> assembler and C. What I would ideally like to be able to do is create
> a block which simulates the legacy function but which passes the
> legacy code to the complier when real time workshop builds the
> function.

Matthew,

My company provides a blockset which enables you to inline legacy code
into the block diagram without any knowledge of the S-Function API or
having to write TLC. You just need to specify the location of the C file
s and header files and the code you wish to insert into the generated code.

The block parses your piece of C code and automatically assigns the
correct number of input and output ports.

If this is of interest to you then there is more detailed information here

http://xtargets.com/cms/XTargets-Ne...et.htm
l
http://xtargets.com/products/xteb/d...d_blockset.html

With regards to switching between two different control paths depending
on simulation or code generation have a look at the "environment
controller block" under the "signal routing" sub menu. This block has
two inputs "sim" and "rtw". The smart thing about the block is that all
blocks upstream from the "sim" port are eliminated during code
generation and that during simulation all blocks upstream from the "RTW"
port are ignored.


--
Brad Phelan
http://xtargets.com



Report this thread to moderator Post Follow-up to this message
Old Post
Brad Phelan
05-31-05 09:05 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Matlab archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:36 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.