How to disable position independent code (PIC) in CMake code generation for PIL?
Hi. I’m trying to create a PIL connectivity configuration for a board with a Cortex-M3 processor, using the "modern" method of target package and CMake. The code that is being generated is PIC, and I need it to not be PIC because I really do not want to write a bootloader. I simply want to run a PIL simulation and confirm that everything is calculated correctly. Handling a PIE is wasted effort.
However, I cannot see any way to disable PIC. In the internal files of the coder toolbox, file "writeCMakeLists.m" which generates the CMakeLists.txt from what I can see, the following is written:
% Always compile using position independent code
% Static libraries built without PIC might cause a failure when linked by a shared library
% See g2329017
cmakeTarget.Properties(end+1) = coder.make.internal.cmake.NameValuePair(‘PREFIX’, ‘""’);
cmakeTarget.Properties(end+1) = coder.make.internal.cmake.NameValuePair(‘POSITION_INDEPENDENT_CODE’, ‘ON’);
So from that I take that PIC is forced on the generated code. I would like to know if there is any way to disable PIC, or, as a last resort, if modifying the above Matlab file to disable PIC would have any unintended consequences (this is a bit complicated since I don’t have admin at work to modify program files, but as a last resort can be done).
Thank you.Hi. I’m trying to create a PIL connectivity configuration for a board with a Cortex-M3 processor, using the "modern" method of target package and CMake. The code that is being generated is PIC, and I need it to not be PIC because I really do not want to write a bootloader. I simply want to run a PIL simulation and confirm that everything is calculated correctly. Handling a PIE is wasted effort.
However, I cannot see any way to disable PIC. In the internal files of the coder toolbox, file "writeCMakeLists.m" which generates the CMakeLists.txt from what I can see, the following is written:
% Always compile using position independent code
% Static libraries built without PIC might cause a failure when linked by a shared library
% See g2329017
cmakeTarget.Properties(end+1) = coder.make.internal.cmake.NameValuePair(‘PREFIX’, ‘""’);
cmakeTarget.Properties(end+1) = coder.make.internal.cmake.NameValuePair(‘POSITION_INDEPENDENT_CODE’, ‘ON’);
So from that I take that PIC is forced on the generated code. I would like to know if there is any way to disable PIC, or, as a last resort, if modifying the above Matlab file to disable PIC would have any unintended consequences (this is a bit complicated since I don’t have admin at work to modify program files, but as a last resort can be done).
Thank you. Hi. I’m trying to create a PIL connectivity configuration for a board with a Cortex-M3 processor, using the "modern" method of target package and CMake. The code that is being generated is PIC, and I need it to not be PIC because I really do not want to write a bootloader. I simply want to run a PIL simulation and confirm that everything is calculated correctly. Handling a PIE is wasted effort.
However, I cannot see any way to disable PIC. In the internal files of the coder toolbox, file "writeCMakeLists.m" which generates the CMakeLists.txt from what I can see, the following is written:
% Always compile using position independent code
% Static libraries built without PIC might cause a failure when linked by a shared library
% See g2329017
cmakeTarget.Properties(end+1) = coder.make.internal.cmake.NameValuePair(‘PREFIX’, ‘""’);
cmakeTarget.Properties(end+1) = coder.make.internal.cmake.NameValuePair(‘POSITION_INDEPENDENT_CODE’, ‘ON’);
So from that I take that PIC is forced on the generated code. I would like to know if there is any way to disable PIC, or, as a last resort, if modifying the above Matlab file to disable PIC would have any unintended consequences (this is a bit complicated since I don’t have admin at work to modify program files, but as a last resort can be done).
Thank you. code generation, pil, cmake MATLAB Answers — New Questions