Inconsistent Binary Output When Building STM32CubeIDE Project on Linux and Windows
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-30 5:11 AM
I am facing an issue where the binary output of my STM32CubeIDE project built on Linux and Windows is inconsistent. I have installed STM32CubeIDE Version 1.6.1 and the fixed Toolchain: GNU Tools for STM32 (7-2018-q2-update) on both platforms. Upon comparing the makefiles, I found that they match, but the resulting binaries do not.
Can you suggest steps that I can take to ensure consistent binary output on both platforms? Additionally, which files should I compare to troubleshoot the issue?
Solved! Go to Solution.
- Labels:
-
STM32CubeIDE
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-04-03 7:52 AM
So BIN files are same size and doiffer only in a "few" bytes. FInd the addresses of those bytes that differ, then look in the related MAP file. Or even better, generate a disassembly (.lss ot .list) file. Go to project settings, "C/C++ Build", "Settings", "MCU Post build outputs" and check "generate list file". See what is at those addresses. Realizing that the start of the BIN file is actually 0x08000000 in the listing/map files.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-30 8:13 AM
Is the source code tree exactly the same in both versions (including the HAL libraries and startup code)? Did you generate the project from CubeIDE (or CubeMX) on both systems, or copy the source from one to the other? Do the binaries differ in a few bytes or are the significantly different (like - do you ever use __DATE__ or __TIME__ to put the build date/time in the binary)?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-30 8:19 AM
@Bob S​, thank you for the answer. Yes, the source code is exactly the same. I copied it from one system to the other. I don't put the build timestamp in the binaries. Furthermore, I also built the same source code on different Windows machines, and the binaries did match.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-30 8:32 AM
or __FILE__
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-31 11:44 AM
So as I asked before - do the binaries differ by a few bytes, or are the significantly different?
Are they the same size?
Have the make file output the compiler version of what is ACTUALLY being used (a dummy target that just calls "gcc -v" or whatever the "get version" switch is).
Look at the build console files and compare them. If you are building in the IDE, the build log files are stored somewhere in the .metadata directory (.metadata/.plugins/org.eclipse.cdt.ui).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-04-03 2:17 AM
@Bob S​, sorry for not answering all of your questions. The binaries differ just by a few bytes and they have the same size.
I now compared the actually used compiler version by adding the --version tag to GCC and G++ Miscellaneous Compiler Flags. They do match.
I also compared the .metadata/.plugins/org.eclipse.cdt.ui logs. They do not match because the paths are different. Just the end of the log does match:
text data bss dec hex filename
413732 3576 108948 526256 807b0 ***.elf
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-04-03 4:35 AM
@Community member​ do you compare .elf files or .bin ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-04-03 5:12 AM
@Pavel A.​, I compared the .bin file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-04-03 7:52 AM
So BIN files are same size and doiffer only in a "few" bytes. FInd the addresses of those bytes that differ, then look in the related MAP file. Or even better, generate a disassembly (.lss ot .list) file. Go to project settings, "C/C++ Build", "Settings", "MCU Post build outputs" and check "generate list file". See what is at those addresses. Realizing that the start of the BIN file is actually 0x08000000 in the listing/map files.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-04-05 5:22 AM
@Community member​ Have you been able to explain the differences?
