- In general MathWorks does not provide C/C++ source code for S-Functions
- There is no way to deconstruct the .mexw64 file. The .mexw64 file is compiled C/C++ code in the form of a windows DLL
- The s-function block already points to the mexw64 file. The S-Function Name field in your screen shot is the name of the .mexw64 file.
How do I make a copy of a C28x (TI C2000) block with a corrected .tlc file?
4 ビュー (過去 30 日間)
古いコメントを表示
I'm trying to use the eCAN Receive block in the Embedded Coder Package for TI C2000 Processors.
Looking at the block I noticed that the receive message mask parameter was missing. In the .tlc file in C:\ProgramData\MATLAB\SupportPackages\R2018b\toolbox\target\supportpackages\tic2000\blocks\mex\tlc_c it looks like a copy/paste error and a missing parameter.
tCANMsgObject sRXCANMessage;
unsigned char ucRXMsgData[8]= {0,0,0,0,0,0,0,0};
sRXCANMessage.ui32MsgID = %<messageID>; // CAN message ID
sRXCANMessage.ui32MsgIDMask = 0; // no mask needed for TX
No big deal. I should be able to make a copy of the .tlc file and a new S-function block that points to the corrected .tlc file in my project. This is where I am stuck. I'll explain my thinking, but please point out where I'm wrong as I'm new to this topic.
After reading many posts on custom S-functions, my understanding is that the block actually points to the source file (some .c file) that implements it. That source file is then compiled into a .mexw64 file (some kind of Matlab byte code?) via MinGW. That .mexw64 file is a generic matlab function that can be used to genereate .c code and that .c code can be customized on a per-target/enviornment basis using a .tlc file.
Great, the problem is the source file does not exist, or I cannot find it. The mexw64 file exists here:
C:\ProgramData\MATLAB\SupportPackages\R2018b\toolbox\target\supportpackages\tic2000\blocks\mex\c28xcanrcv.mexw64
and the .tlc file exists here:
C:\ProgramData\MATLAB\SupportPackages\R2018b\toolbox\target\supportpackages\tic2000\blocks\mex\tlc_c\c28xcanrcv.tlc
but what source was used to create the .mexw64 file?
I don't really understand where to go from here, but I'll ask a couple of succinct qustions to try and move forward:
- What source does the C280x eCAN Receive block point to? When I create a custom S-function I have to point it to a valid source (.c, .cpp, etc...) file. When I open the S-function for this eCAN Receive block, that option is grayed out and I can't inspect it.
- Is there any way to deconstruct the .mexw64 file to see the source? For this block all of the interesting code seems to be in the .tlc file, but the .mexw64 file is 135 kB, so it's obviouslly doing something.
- Is there a way to point the S-function block to the .mexw64 file instead of the source file?
0 件のコメント
回答 (1 件)
Mark McBroom
2022 年 1 月 29 日
If there is in fact a bug in the TLC file, you can edit and modify this file. You can also use the TLC debugger to set a breakpoint in the TLC file to check the values of other variables and single step through TLC code.
参考
カテゴリ
Help Center および File Exchange で Target Language Compiler についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!