cancel
Showing results for 
Search instead for 
Did you mean: 

touchgfx : binary contains debug infos

SBACO
Associate III

Hello,

When building my project using touchgfx, I generate a specific binary file for some images. So for the testing purpose I create a section with only one image of one black pixel. So basically this image in binary format should be around 2 bytes in 16BPP. However the binary seems to include in addition to this image some debug information like "GCC: (GNU Tools for ARM Embedded Processors 6-2017-q2-update) 6.3.1 20170620 (release) [ARM/embedded-6-branch revision 249437]" etc.

It does not seems to have a specific release or debug configuration in the makefile. the overhead in the in quite unlikely and in some of the other binary, I also have some absolute path of my own computer. Is there any way to remove all those information ?

Regards,

13 REPLIES 13

The GNU toolchain should contain this tool - arm-none-eabi-strip

It can "strip" the debug (and other) symbols from the binary.

Docs: https://www.mankier.com/1/strip

The object file (.ELF/.AXF) or the binary (.BIN) written to the device memory?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
SBACO
Associate III

@After Forever​ I have tried strip as objcopy parameter or directly within the tools. It does not change anything :\ I tried strip-all or just the debug, does not change anything. I precise that each time I clean/rebuild my whole program for the testing.

@Community member​ I generate the binary using objcopy with --only-section parameter with the hex file as input. the image itself i generated with the touchgfx tools imageconverter.out.

Ok, so sounds like it is embedded in the code coming from some other libraries or objects. Your options there would be to check if it is using release versions of those objects/libraries, or if any command line settings into the compiler and/or linker are causing these things to appear.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
SBACO
Associate III

Thanks for your reply.

I am using the default Makefile of touchgfx sample projects with just light modification to create stecific binaries for the images.

basically the options are :

linker_options += -g -Wl,-static -specs=nosys.specs -specs=nano.specs \

                 -mno-thumb-interwork \

                 -fno-exceptions \

                 -O0 -fno-strict-aliasing -Wl,--gc-sections

linker_options += -mcpu=cortex-m7 -Wno-psabi $(float_options)

c_compiler_options += -g \

                   -nostartfiles -mthumb -fno-exceptions \

                   -mno-thumb-interwork -std=c99 \

                   -O0 -fno-strict-aliasing -fdata-sections -ffunction-sections

c_compiler_options += -mthumb -mcpu=cortex-m7 -Wno-psabi $(float_options) -DCORE_M7 -D__irq=""

cpp_compiler_options += -g -mthumb \

                   -nostartfiles \

                   -mno-thumb-interwork -fno-rtti -fno-exceptions \

                   -O0 -fno-strict-aliasing -fdata-sections -ffunction-sections

cpp_compiler_options += -mthumb -mcpu=cortex-m7 -Wno-psabi $(float_options) -DCORE_M7 -D__irq=""

I tried to remove the -g option (not so sure about the meaning) but does not change anything. I also try to remove the "-fdata-sections -ffunction-sections" options.

As the imageconverter.out binary is provided by touchgfx, I am not sure about the way it is build.

What I can tell is that the .o of my 1 pixel image already include those "useless?" data. There is no real specs on the imageconverter options except the one in the project example which concerns only image format as I can understand.

SBACO
Associate III

My bad, imageconverter.out has nothing to do with the problem as it generates only one C++ file for each image.

SBACO
Associate III

sorry for pushing, but any other idea ?

Disclaimer - I have no direct experience with TouchGFX and the build environment.

> I generate the binary using objcopy with --only-section parameter with the hex file as input.

Ummm... hex files have no section information. So if you use a HEX file as input to objcopy, I would expect you would get nothing out. How about posting the exact commands for all of the steps used to generate the binary file for this image.

SBACO
Associate III

Thanks @Bob S​ for your reply.

Sorry I mean elf file and not hex file.

I can post the whole makefile but it is quite big. Here is the generation part of the different ouput.

The build and linker options are listed in the other comment a bit further in this thread.

Removing the -g seems make the binaries a bit lighter, but most of "useless?" information are still there.

$target_executable is "target.elf".

build_executable: $(binary_output_path)/$(target_executable)
 
 
$(binary_output_path)/$(target_executable): $(object_files) $(object_asm_files)
 
   @echo Linking $(@)
 
   @mkdir -p $(@D)
 
   @mkdir -p $(object_output_path)
 
   @$(file >$(build_root_path)/objects.tmp) $(foreach F,$(object_files),$(file >>$(build_root_path)/objects.tmp,$F))
 
   @$(linker) \
 
      $(linker_options) -T $(makefile_path_relative)/application.ld -Wl,-Map=$(@D)/target.map $(linker_options_local) \
 
      $(patsubst %,-L%,$(library_include_paths)) \
 
      @$(build_root_path)/objects.tmp $(object_asm_files) -o $@ \
 
      -Wl,--start-group $(patsubst %,-l%,$(libraries)) -Wl,--end-group
 
   #@rm -f $(build_root_path)/objects.tmp
 
 
   @echo "Producing additional output formats..."
 
   @echo " target.hex  - Combined internal+external hex"
 
   @$(objcopy) -O ihex $@ $(@D)/target.hex
 
 
 
   @echo " intflash.elf - Internal flash, elf debug"
 
   @$(objcopy) --remove-section=ExtFlashSection_Images_V1_0_0 --remove-section=ExtFlashSection_Images_V1_0_1 $@ $(@D)/intflash.elf
 
   @echo " intflash.hex - Internal flash, hex"
 
   @$(objcopy) -O ihex --remove-section=ExtFlashSection_Images_V1_0_0 --remove-section=ExtFlashSection_Images_V1_0_1 $@ $(@D)/intflash.hex
 
   @echo " intflash.hex - Internal flash, binary"
 
   @$(objcopy) -O binary --remove-section=ExtFlashSection_Images_V1_0_0 --remove-section=ExtFlashSection_Images_V1_0_1 $@ $(@D)/intflash.bin
 
 
   @echo " extflash.bin - External flash, binary"
 
   @$(objcopy) -O binary --only-section=ExtFlashSection_Images_V1_0_0 $@ $(@D)/extflash_V1_0_0.bin
 
   @echo " extflash.bin - External flash, elf debug"
 
   @$(objcopy) --only-section=ExtFlashSection_Images_V1_0_0 $@ $(@D)/extflash_V1_0_0.elf
 
 
   @echo " extflash.bin - External flash, binary"
 
   @$(objcopy) -O binary --only-section=ExtFlashSection_Images_V1_0_1 $@ $(@D)/extflash_V1_0_1.bin
 
   @echo " extflash.bin - External flash, elf debug"
 
   @$(objcopy) --only-section=ExtFlashSection_Images_V1_0_1 $@ $(@D)/extflash_V1_0_1.elf