I'm using KDS 3.0 and am wondering why two binaries built from the same revision of source on identically (or so I think) installations of KDS result in different information in the binaries.
One thing that is very clear is that full paths are present in the binaries built using my release configuration, which is essentially the same as my debug configuration, but debug information is set to "None".
The only thing I have been able to come up with is that the __FILE__ macro generates a full path to the file, rather than the "short" path that takes the include folders into account.
Can anyone suggest a way to resolve this?
EDIT -- I just saw a post on StackOverflow where IAR added a --no_path_in_file_macros compiler flag to avoid this problem. Does anyone know of an equivalent for gcc that has worked for you? I'm currently looking that up now. http://stackoverflow.com/questions/8487986/file-macro-shows-full-path
已解决! 转到解答。
Hi Dave,
I'm experiencing the same problem - looks like my post is a duplicate of yours (https://community.freescale.cohttp://m/thread/380862)
It's not only files path that are in the binary, some other printf-like text are also included.
Hi @dave408 ,
if you want the __FILE__ macro just having the file name without the path, see assert(), __FILE__, Path and other cool GNU gcc Tricks to be aware of | MCU on Eclipse
I hope this helps,
Erich
Hi Dave,
I'm experiencing the same problem - looks like my post is a duplicate of yours (https://community.freescale.cohttp://m/thread/380862)
It's not only files path that are in the binary, some other printf-like text are also included.
Hi Dave,
Please have a look to (https://community.freescale.cohttp://m/thread/380862)
Probably you should have same problem.
Add the preprocessor compiler macro NDEBUG.
Have a great day,
Pascal
Freescale Technical Support
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Dave,
KDS is using GCC build tool chain.
The project generates the .elf file.
The .elf includes the code and debug information.
By debug information I mean all information that the debugger needs to debug the application.
This is including the path of all source files in order to display the file associated to the executed code.
Now you can generate a Srecord file (bin, hex, ...) containing code only without debug info.
To enable the Hex/Bin Converter you need to enable the "Create flash image" option under C/C++ build - Settings - Toolchains tab.
now back to Tool Settings tab, a new config is available:
Cross ARM GNU create Flash Image
Is it the option/process you're looking for ?
Have a great day,
Pascal
Freescale Technical Support
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Pascal, that's what I am already doing -- creating a binary (.bin) flash image. It's the bin itself that has the full pathnames in it. From what I understand, that's just how it goes, gcc will put whatever is passed to it from the command line into the binary. So the only option is to build in a different folder.
Hi Dave,
do you use an external editor to open/edit the binary file ?
Which one ?
According to the gcc manual there are some options we can use on "arm-none-eabi-objcopy" tool.
By default KDS proposes -j .text and -j .data.
These options will have an impact on the bin file.
Have a great day,
Pascal
Freescale Technical Support
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
It sounds like __FILE__ just uses whatever was passed to gcc on the command line. So it seems that I will need to figure out how to change everything to relative paths. Has anyone here done this and know exactly what project settings need to be changed?
My initial guess was that I'll have to go into the include directories setting and change everything to relative paths. This could affect portability across developers' machines. In addition, the binary shows the full path to .cpp files, which would not be covered by the Includes directories. There must be another way to deal with this...