I am developing a project in Platformio using the mbed framework, and I find my computer paths in the compiled binary, e.g.:
00010440h: 9E 46 70 47 43 3A 5C 55 73 65 72 73 5C 47 47 47 ; žFpGC:\Users\GGG
00010450h: 5C 2E 70 6C 61 74 66 6F 72 6D 69 6F 5C 70 61 63 ; \.platformio\pac
00010460h: 6B 61 67 65 73 5C 66 72 61 6D 65 77 6F 72 6B 2D ; kages\framework-
00010470h: 6D 62 65 64 2F 70 6C 61 74 66 6F 72 6D 2F 53 69 ; mbed/platform/Si
00010480h: 6E 67 6C 65 74 6F 6E 50 74 72 2E 68 00 70 20 3D ; ngletonPtr.h.p =
00010490h: 3D 20 72 65 69 6E 74 65 72 70 72 65 74 5F 63 61 ; = reinterpret_ca
000104a0h: 73 74 3C 54 20 2A 3E 28 26 5F 64 61 74 61 29 00 ; st<T *>(&_data).
I could find the error strings in the mentioned files, and it points to .platformio\packages\framework-mbed\platform\mbed_error.h. This file says
/** Define this macro to include filenames in error context. For release builds, do not include filename to save memory.
* MBED_PLATFORM_CONF_ERROR_FILENAME_CAPTURE_ENABLED
*/
So I tried to compile in release mode, but nothing changes. I also tried put this on top of my main.cpp:
#undef MBED_PLATFORM_CONF_ERROR_FILENAME_CAPTURE_ENABLED
#undef MBED_CONF_PLATFORM_ERROR_FILENAME_CAPTURE_ENABLED
notice that there are 2 similar defines, I found the other one in an auto-generated (so non-editable) mbed_config.h in my build directory, and I’m confident that’s the right one because I could find it’s used in the mbed_error.h (so the comment on top of that file is wrong).
I tried finding that define in all the paths I could think of, but I can’t find the code that auto-generates the mbed_config.h file.
I also tried
#define MBED_CONF_PLATFORM_MAX_ERROR_FILENAME_LEN 1
but it still shows the full path.
How can I compile my binaries without showing the full path of my files?