Extract strings from AVR ihex file - avr-gcc

I'm using avr-gcc to produce an elf file and later
avr-objcopy -O ihex -R .eeprom main.elf main.hex
to create a hex file for programming. How can I extract all strings from the generated hex file? I've tried
avr-objdump -j .sec1 -D -m avr5 main.hex
But this doesn't show any string.
Background: The .hex file is stored on a separate medium without .elf and I want to check a version string before programming with avrdude

Related

Link errors using Qt custom types instead of STL types in gsoap binding

I'm developing a Qt C++ program which must send data to a web-service.
I have used gsoap (v2.8.111) to generate the data binding source code this way:
wsdl2h -v -c++ -t ./typemap.dat -o binding/DonaldDuck.h ./DonaldDuck.wsdl
wsdl2h -v -c++ -t ./typemap.dat -o binding/MickeyMouse.h ./MickeyMouse.wsdl
wsdl2h -v -c++ -t ./typemap.dat -o binding/DaisyDuck.h ./DaisyDuck.wsdl
wsdl2h -v -c++ -t ./typemap.dat -o binding/ScroogeMcDuck.h ./ScroogeMcDuck.wsdl
soapcpp2 -C -c++ -j -qDonaldDuck -dbinding binding/DonaldDuck.h
soapcpp2 -C -c++ -j -qMikeyMouse -dbinding binding/MickeyMouse.h
soapcpp2 -C -c++ -j -qDaisyDuck -dbinding binding/DaisyDuck.h
soapcpp2 -C -c++ -j -qScroogeMcDuck -dbinding binding/ScroogeMcDuck.h
wsdl2h -c++ -g -t ./typemap.dat -o ./binding/Common.h *.wsdl
soapcpp2 -C -c++ -r -n -i -L -j -dbinding ./binding/Common.h
If I use the typemap.dat configured for use of STL types I can successfully build and run the program.
But because I'm developing with Qt I would like to use Qt types (specially QString and QDateTime), so I changed the typemap.dat file as explained here https://www.genivia.com/doc/databinding/html/index.html.
With the new typemap.dat The generation using the same commands listed above was successful but during build a lot of multiple definitions are unexpectedly signaled.
I can't understand why this problem occurs, can anyone help me?
I am available to provide other information if needed.

tar compress with -C argument doesn't work

This set of commands aren't working as they're supposed to:
mkdir -p /home/git/root_backup_folder
cd /home/git/gitlab/git-data/repositories
tar zcvf dailybackup.tar.gz * -C /home/git/root_backup_folder
It is completely ignoring the -C argument and creating the file in /home/git/gitlab/git-data/repositories. What I'm doing wrong?
The -C flag doesn't specify the output directory. You need to do this at the point at which you specify the archive file. So, your command could become:
tar zcvf /home/git/root_backup_folder/dailybackup.tar.gz *

"ifort: no match" error in csh script

I'm trying to compile a program called ZEUS and I am following the included instructions exactly but I came across the following error.
The instructions asked me to type csh -v namelist.s in the folder containing namelist.s. This is a fairly large assembly file which invokes another file given in the source files called bldlibo which is the csh file mentioned in the title. The contents of this file are:
#==== SCRIPT TO BUILD AN OBJECT LIBRARY FROM A FORTRAN SOURCE FILE====#
#
# Syntax: bldlibo <library name> <source code>
# eg: bldlibo namelist.a namelist.f
#
rm -rf bldlibo.dir
mkdir bldlibo.dir
cp $2 bldlibo.dir
cd bldlibo.dir
fsplit $2 >& /dev/null
rm $2
#
# When -fast option is used, this leads to the __vsincos_ unsatisfied
# external errors when zeus is compiled with -g option. Thus, use -O4
# instead.
#
ifort -c -O4 *.f
#f77 -c -g -C -ftrap=common *.f
ar rv $1 *.o >& /dev/null
ranlib $1
cd ..
mv bldlibo.dir/$1 .
rm -r bldlibo.dir
When I run csh -v namelist.s it begins to run bldlibo and works fine up until ifort is invoked at which point it says ifort: no match. I have tried adding #!/bin/csh at the start and also source .../ifortvars.csh but that didn't work.
Can anybody help me, sorry if I haven't explained it well enough.

How to specify names in LD with binary text?

I am attempting to wrap a text file with ld into a .o. Given how the Makefiles for my project are set up, the full path to the text file is being passed to ld. This causes the generated names to include that path. I don't want that as I can't link against that name in my C++ source.
Is there a way to change the names or prefixes when I run ld?
ld -r -b binary /path/to/source/Value.txt -o Value.o
objdump -x Value.o | grep binary
0000000000000142 g .data 0000000000000000 _binary__path_to_source_Value_txt_end
0000000000000142 g *ABS* 0000000000000000 _binary__path_to_source_Value_txt_size
0000000000000000 g .data 0000000000000000 _binary__path_to_source_Value_txt_start
I would like to see names like _binary_Value_txt_end.
Based on Captain Oblivious' comment, I was able to develop a Makefile rule:
%.o: %.txt
pushd $(dir $<) ; $(LD) -r -b binary $(notdir $<) -o $# ; popd
This changes to the directory location of the text file so that ld creates nice, known names. I needed to do some work to ensure that $# was an absolute path so the .o would be created in the build directory.

Custom command to generate object(.o) from binary file using autoconf

We have a project (c++) and it needs to include a binary file into shared library. This is done on windows by referencing the binary file from a resource file. On Linux it can be achieved by using objcopy as shown here
The question is how can this be automated this using autoconf/automake? There exists Makefile.am and configure.ac files. Is this going to be a manual task?
(Maybe this question needs to be on the unix stack exchange site?)
Does your binary file have a distinctive extension? If so, refer to the Suffixes chapter of the manual:
.bin.o:
bin2o -o $# $<
And you then list foo.bin in your foo_SOURCES variable.
If you don't have a distinctive extension, try something like this:
foo_SOURCES = foo.c bar.c baz.c
foo_LDADD = foobin$(OBJEXT)
foobin$(OBJEXT): foobin
bin2o -o $# $<