How to generate emedded code that doesn't use MATLAB/Simulink libraries?

I have a Simulink model that uses a UDP block. When I compile the generated embedded code in an embedded Linux system I also have to compile HostLib_Network.c. But HostLib_Network.c requires that I have the library libmwnetworkdevice.so. MATLAB has this library, but it is compiled for a 64-bit native Linux desktop environment and I will be running Simulink code on an ARM processor.
So how can I get Simulink to generate embedded code that doesn't rely on native environment libraries?

 採用された回答

Josh
Josh 2015 年 5 月 14 日
So I have figured out what you need to do to get the Simulink generated UDP code to compile on an ARM processor.
HostLib_Network.c has two sets of functions. Below is a snippet from HostLib_Network.c:
void CreateUDPInterface(void *hl)
{
#ifndef _USE_TARGET_UDP_
CreateHostLibrary(libName_Network, hl);
#else
CreateTargetUDPInterface(hl);
#endif
}
As you can see if _USE_TARGET_UDP_ is not defined then it uses a library name. If it is defined then it uses the OS's own UDP library.
So all you have to do is add the flag _USE_TARGET_UDP_ to your ARM compiler and it will compile and run fine.

その他の回答 (2 件)

Aravind Singh
Aravind Singh 2015 年 3 月 5 日

0 投票

You can generate c code only from simulink. Compile those c code using compiler that generates binary for ARM processor.
Josh
Josh 2015 年 3 月 5 日

0 投票

That's what I am doing. But when I execute my code on the ARM processor it asks for the MATLAB library.

カテゴリ

ヘルプ センター および File ExchangeSimulink Coder についてさらに検索

質問済み:

2015 年 2 月 13 日

回答済み:

2015 年 5 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by