I am currently using a Kogna to control my custom 3D printer, and for the past few months now have been compiling and linking my firmware external to the KMotion.exe application - mainly for scalability and portability of the source code, as well as for customizability of the build process, external libraries, optimizations, etc.
Thus far, when compiling my source code with the TI C6000 7.4.21 compiler, I have been using the -mv6710 compilation flag, just as is done in the KMotionDLL.cpp source code:
Code: Select all
cmd.Format(L" %ls -k -q -as --diag_suppress=163 --mem_model:data=far "
"-i \"" + IncSrcPath1 + "\" -i \"" + IncSrcPath2 + "\" -i \"" + IncSrcPath3 + "\" -mu -ml3 -mv6710 -o%d", FileType, Opt);
Recently, however, I've been developing a portable space-efficient messaging protocol to be used over RS485 which uses packed structs to remove excess padding from the message structure and reduce packet size, but began encountering build errors as a result. According to the TMS320C6000 Optimizing Compiler v 7.4 User's Guide:
Section 6.15.3 Variable Attributes
2.13 Linking C6400 Code With C6200/C6700/Older C6400 Object CodeThe packed attribute for structure and union types is available only when there is hardware support for
unaligned accesses. For C6000 this means C6400+, C6400, C6740, and C6600.
As such, I began by changing my silicon version from -mv6710 to -mv6740 - this got rid of the Invalid attribute for "struct rs485_pkt_hdr_v1" compiler error, but resulted in a new error error: file "lib/KMotionSDK/KMotion5.3.3/DSP_KOGNA/user_boot.obj" aligns arrays to 4 bytes, but previous files expect arrays to be aligned to 8 bytes.If you are linking C6400/C6400+/C6740/C6600 with C6200/C6700 code or older C6400 code, you may
need to take steps to ensure compatibility. The following lists the potential alignment conflicts and possible
solutions.
Potential alignment conflicts occur when:
• Linking new C6400/C6400+/C6740/C6600 code with any C6400 code already compiled with the 4.0
tools.
• Linking new C6400/C6400+/C6740/C6600 code with code already compiled with any version of the
tools for the C6200 or C6700 family.
Solutions (pick one):
• Recompile the entire application with the --silicon_version=6400 switch. This solution, if possible, is
recommended because it can lead to better performance.
• Compile the new code with the --target_compatibility_6200 option. When using this option, link with the
6200 RTS library to ensure proper compatibility. The --target_compatibility_6200 option changes the
alignment of top-level arrays to 4 bytes when the --silicon_version=6400 or --silicon_version=6400+
option is used.
Following the recommendations from TI shown above, I added the --target_compatibility_6200 compiler flag, and my code compiled successfully! That being said, I have some uneducated/untested concerns/suspicions about the potential implications that this mixed-target compilation scheme may have on the performance and stability of the code once it's running on the Kogna. Do you have any ideas regarding how severe these implications would be, if present in the first place?
Lastly, if it isn't too much to ask and is even possible, I would really appreciate it if you could provide me with a version of the DSPKOGNA.out and user_boot.obj (and DSPKOGNA.sym if that would be necessary) files which have been compiled with the silicon version -mv6740 - or better yet a copy of the actual source code which I can compile myself (I assume this is not a possibility considering it is your proprietary firmware, but I figured I might as well ask) - so that I can build my firmware with code which has all been compiled for the same target, maximizing potential performance advances and removing any possibility of undefined behavior resulting from the mixed-target compilation.
Many thanks in advance,
Griffin Boyle