Code Comments
Programming Forum and web based access to our favorite programming groups.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
Post Follow-up to this messageHi 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
Post Follow-up to this messageTitus 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)
Post Follow-up to this messageThank 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
Post Follow-up to this messageMatthew 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
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.