Matlab codegen generate version-script for gcc

9 views (last 30 days)
Hello,
Is there any way to generate a .map file that can be passed as version-script to gcc similar to what is described here ? I'm generating the code on windows (for a linux platform) because of some compatibility issues and I move the generated code to a Ubuntu machine so that I can generate a shared library .so file using gcc and the shared library will be used in a product that runs on Ubuntu.
I would like that this library exports only the minimum functions so that the user of the library will not get confused by all the internal functions. That's why this .map file should contains only the bare minimum functions required to execute the matlab generated code (the function names passed to codegen). Since I'm generating code on Windows, it seems that this .map file is not generated even if I've setup my configuration for Linux. Here is my embedded coder configuration:
Description: 'class EmbeddedCodeConfig: C code generation Embedded Coder configuration objects.'
Name: 'EmbeddedCodeConfig'
-------------------------------- Report -------------------------------
EnableTraceability: true
GenerateCodeMetricsReport: true
GenerateCodeReplacementReport: true
GenerateReport: true
HighlightPotentialDataTypeIssues: true
LaunchReport: true
ReportPotentialDifferences: true
------------------------------- Debugging -----------------------------
RuntimeChecks: false
---------------------------- Code Generation --------------------------
BuildConfiguration: 'Faster Runs'
CodeExecutionProfiling: false
CustomToolchainOptions: [[] cell]
DataTypeReplacement: 'CBuiltIn'
FilePartitionMethod: 'MapMFileToCFile'
GenCodeOnly: true
GenerateExampleMain: 'GenerateCodeOnly'
GenerateMakefile: true
HighlightPotentialRowMajorIssues: true
MultiInstanceCode: false
OutputType: 'LIB'
PassStructByReference: true
PostCodeGenCommand: ''
PreserveArrayDimensions: false
RowMajor: false
SILDebugging: false
SILPILCheckConstantInputs: true
TargetLang: 'C'
Toolchain: 'Automatically locate an installed toolchain'
VerificationMode: 'None'
------------------------ Language And Semantics -----------------------
CodeReplacementLibrary: 'GNU C99 extensions'
CompileTimeRecursionLimit: 50
ConstantFoldingTimeout: 40000
DynamicMemoryAllocation: 'Threshold'
DynamicMemoryAllocationThreshold: 65536
EnableAutoExtrinsicCalls: false
EnableRuntimeRecursion: true
EnableVariableSizing: true
GenerateNonFiniteFilesIfUsed: true
InitFltsAndDblsToZero: true
PreserveVariableNames: 'None'
PurelyIntegerCode: false
SILPILSyncGlobalData: true
SaturateOnIntegerOverflow: true
SupportNonFinite: true
TargetLangStandard: 'C99 (ISO)'
---------------- Function Inlining and Stack Allocation ---------------
InlineStackLimit: 4000
InlineThreshold: 10
InlineThresholdMax: 200
StackUsageMax: 50000
----------------------------- Optimizations ---------------------------
ConvertIfToSwitch: true
EnableMemcpy: true
EnableOpenMP: false
EnableStrengthReduction: true
LoopUnrollThreshold: 5
MemcpyThreshold: 32
------------------------------- Comments ------------------------------
GenerateComments: true
MATLABFcnDesc: true
MATLABSourceComments: false
Verbose: true
------------------------------ Custom Code ----------------------------
CustomHeaderCode: ''
CustomInclude: ''
CustomInitializer: ''
CustomLibrary: ''
CustomSource: ''
CustomSourceCode: ''
CustomTerminator: ''
ReservedNameArray: ''
-------------------------- Third Party Library ------------------------
CustomBLASCallback: ''
CustomFFTCallback: ''
CustomLAPACKCallback: ''
------------------------------ Code Style -----------------------------
CastingMode: 'Nominal'
CodeTemplate: [1x1 coder.MATLABCodeTemplate]
ColumnLimit: 80
CommentStyle: 'Auto'
CustomSymbolStrEMXArray: 'emxArray_$M$N'
CustomSymbolStrEMXArrayFcn: 'emx$M$N'
CustomSymbolStrFcn: '$M$N'
CustomSymbolStrField: '$M$N'
CustomSymbolStrGlobalVar: '$M$N'
CustomSymbolStrMacro: '$M$N'
CustomSymbolStrTmpVar: '$M$N'
CustomSymbolStrType: '$M$N'
EnableSignedLeftShifts: true
EnableSignedRightShifts: true
GenerateDefaultInSwitch: false
IncludeTerminateFcn: true
IndentSize: 2
IndentStyle: 'K&R'
MaxIdLength: 31
ParenthesesLevel: 'Nominal'
PreserveExternInFcnDecls: true
------------------------------- Hardware ------------------------------
Hardware: []
HardwareImplementation: [1x1 coder.HardwareImplementation]
And this is the HardwareImplemetation struct where I specify Linux as target:
Description: 'class HardwareImplementation: Hardware implementation specifications.'
Name: 'HardwareImplementation'
------------------------------- Hardware ------------------------------
ProdBitPerChar: 8
ProdBitPerDouble: 64
ProdBitPerFloat: 32
ProdBitPerInt: 32
ProdBitPerLong: 64
ProdBitPerLongLong: 64
ProdBitPerPointer: 64
ProdBitPerPtrDiffT: 64
ProdBitPerShort: 16
ProdBitPerSizeT: 64
ProdEndianess: 'LittleEndian'
ProdEqTarget: true
ProdHWDeviceType: 'Intel->x86-64 (Linux 64)'
ProdIntDivRoundTo: 'Zero'
ProdLargestAtomicFloat: 'Float'
ProdLargestAtomicInteger: 'Char'
ProdLongLongMode: false
ProdShiftRightIntArith: true
ProdWordSize: 64
TargetBitPerChar: 8
TargetBitPerDouble: 64
TargetBitPerFloat: 32
TargetBitPerInt: 32
TargetBitPerLong: 64
TargetBitPerLongLong: 64
TargetBitPerPointer: 64
TargetBitPerPtrDiffT: 64
TargetBitPerShort: 16
TargetBitPerSizeT: 64
TargetEndianess: 'LittleEndian'
TargetHWDeviceType: 'Intel->x86-64 (Linux 64)'
TargetIntDivRoundTo: 'Zero'
TargetLargestAtomicFloat: 'Float'
TargetLargestAtomicInteger: 'Char'
TargetLongLongMode: false
TargetShiftRightIntArith: true
TargetWordSize: 64
This is what the command line says when I gerate code:
### Using toolchain: Microsoft Visual C++ 2017 v15.0 | nmake (64-bit Windows)
### Creating 'C:\Users\Admin\AppData\Local\Temp\tp1a8d2527_b6a1_4501_b6be_4dc2359394fd\dll\nirJob_rtw.mk' ...
Code generation successful: View report
It seems that it uses Visual Studio toolchain but I don't want to to build I only need to generate the code and the .map file.
Do I need to set other flags so that the .map file is also generated ? Do I have to generate the code on Linux host?
Thank you.

Answers (0)

Categories

Find more on Build Configuration in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!