Keidan/hex2bin

terminate called after throwing an instance of 'std::invalid_argument'

Closed this issue · 3 comments

When doing:

$ hex2bin -i test.ihx -o output.com

hex2bin fails after these messages:

terminate called after throwing an instance of 'std::invalid_argument'
  what():  stol

test.ihx.gz

Hello,

thanks for your feedback.

Indeed, I hadn't foreseen this kind of use case.

@misterwrong
Hi,

Normally the problem should be solved.
I tested the file you gave and it decodes correctly.

Based on your use case (and via the issue you mentioned), you've two solutions to use this fix:

  • You execute the application with the -s (or --start) option: hex2bin -i test.ihx -o output.com -s 1
  • You specify the option -DDEFSTART=1 when executing the cmake command.

Example of solution 2:

cmake -DDISTRIBUTION=release -DDEFSTART=1 .
make
hex2bin -i test.ihx -o output.com

Be careful, in the case of solution 2, if you do not specify the -s or --start option, all executions will've a start offset corresponding to the value given via -DDEFSTART.

The first option still responded with the same message, now with a memory dump. The second option produced the output file without any messages. Thanks!