Welcome, Guest. Please Login or Register
Arduino IDE for Visual Studio
 
 
When Logging a Support Issue in the Forum, please ensure you have also:-
  • Enabled vMicro > Compiler > Show Build Properties and Verbose
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
Support requests without the output above may be impossible to answer, so please help us to help you
 
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
<project>.with_bootloader.hex: bad file format (Read 1078 times)
Martin Boissonneault
Newbies
*
Offline



Posts: 6
near Montreal, Quebec, Canada
<project>.with_bootloader.hex: bad file format
Oct 1st, 2018 at 12:55am
 
Hi!
  I'm using an Adafruit Metro M0 Express, and the file <project>.with_bootloader.hex generated is just wrong. The first part is the project in normal Intel .hex format, but it looks like the end of the file is the bootloader in binary format. Of course, the result is a bad file.

  It's not a big problem for me, I can manually combine my bootloader with the good <project>.hex and use that instead, but is it a bug with Visual Micro?

Martin

Attached: The zipped BlinkWithoutDelay.with_bootloader.hex and the bootloader in both .bin and .hex.
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10395
United Kingdom
Re: <project>.with_bootloader.hex: bad file format
Reply #1 - Oct 1st, 2018 at 5:22pm
 
Thanks for the post. It's an interesting issue that you might be able to help with.

The arduino ide does not produce a merged hex for the M0 Express so Visual Micro should not be attempting to create the file.

The checks as far as I can see boil down to the board having a bootloader.file=. In this case the bootloader.file= points to a file that is not a conventional bootloader. Therefore I guess this is why the arduino ide doesn't bother to produce any result.

Can you please shed any light on this issue. What do you do to create the file yourself?
Back to top
 
WWW  
IP Logged
 
Martin Boissonneault
Newbies
*
Offline



Posts: 6
near Montreal, Quebec, Canada
Re: <project>.with_bootloader.hex: bad file format
Reply #2 - Oct 1st, 2018 at 6:06pm
 
Hi!

Visual Micro wrote on Oct 1st, 2018 at 5:22pm:
The checks as far as I can see boil down to the board having a bootloader.file=. In this case the bootloader.file= points to a file that is not a conventional bootloader. Therefore I guess this is why the arduino ide doesn't bother to produce any result.

Can you please shed any light on this issue. What do you do to create the file yourself?

The boards.txt does have a bootloader.file= section pointing to a binary file: Code:
adafruit_metro_m0.bootloader.file=metroM0/bootloader-metro_m0-v2.0.0-adafruit.5.bin 



What I did to create the bootloader .hex file?
I have a J-Link EDU mini connected to the board. I used AS7 Tools>Device programming> Fuses/Memories.
  1. I cleared bootloader protection fuses,
  2. erased the entire flash chip,
  3. re-uploaded the .bin file and
  4. restored bootloader protection fuses.
  5. Then, I read back the flash in .hex format.
I might have edited the file to keep only the bootloader lines and delete those from memory 0x2000 and above.

Now, the .bin files (with .elf and .uf2) are provided with the Adafruit SAMD board package from the Arduino Manager. Code:
https://adafruit.github.io/arduino-board-index/package_adafruit_index.json 


There is a dependency on the Arduino SAMD package, install it first.

If you need more detail, just ask!
Thanks,
Martin
Edit: I may have misunderstood the question, clarification below:
The <project>.with_bootloader.hex file is auto-generated when I select to Build>Build Solution or Build Project in AS7.
Back to top
« Last Edit: Oct 1st, 2018 at 6:12pm by Martin Boissonneault »  
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10395
United Kingdom
Re: <project>.with_bootloader.hex: bad file format
Reply #3 - Oct 1st, 2018 at 6:20pm
 
Thanks very much.

I suspect that if it doesn't have a line ending with FF it should be ignored. I'll take a look at it but because the arduino ide doesn't use it I think visual micro won't be able to either.

Does the board support "burn bootloader". This is normally how the bootloader is uploaded.
Back to top
« Last Edit: Oct 1st, 2018 at 6:21pm by Visual Micro »  
WWW  
IP Logged
 
Martin Boissonneault
Newbies
*
Offline



Posts: 6
near Montreal, Quebec, Canada
Re: <project>.with_bootloader.hex: bad file format
Reply #4 - Oct 1st, 2018 at 7:09pm
 
Visual Micro wrote on Oct 1st, 2018 at 6:20pm:
I suspect that if it doesn't have a line ending with FF it should be ignored. I'll take a look at it but because the arduino ide doesn't use it I think visual micro won't be able to either.

  I am not sure about what you mean by that, the bad .hex file is a (crude) cat between the compiled project in Intel .hex format (that is good, but without Intel .hex file end marker) with the unprocessed, raw binary bootloader code from the .bin file (not in Intel .hex format, BAD!). Since the .hex file is NOT ENTIRELY in Intel .hex format, it is unusable and rejected by the flash programmer.

It looks like something expects the binary bootloader to be in .hex format. I don't know if Visual micro is at fault or if Adafruit mistakenly feeds a binary instead of a .hex, but in the end, the file in the Release or Debug folder is messed up because some code expects .hex but does not check. Maybe a bug in AS7?

Visual Micro wrote on Oct 1st, 2018 at 6:20pm:
Does the board support "burn bootloader". This is normally how the bootloader is uploaded.


  Yes, the board has a Burn bootloader option in the Arduino IDE.

Anyway, this bug not a show stopper for me whatever who or what causes it. Visual Micro's upload mechanism works well.

Thanks!
Martin
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10395
United Kingdom
Re: <project>.with_bootloader.hex: bad file format
Reply #5 - Oct 1st, 2018 at 7:30pm
 
Why can't you just use the standard output <project_name>.ino.hex or <project_name>.ino.bin.

The "with_bootloader" isn't supposed to be created.

Back to top
 
WWW  
IP Logged
 
Martin Boissonneault
Newbies
*
Offline



Posts: 6
near Montreal, Quebec, Canada
Re: <project>.with_bootloader.hex: bad file format
Reply #6 - Oct 1st, 2018 at 7:44pm
 
Even better: Don't erase the bootloader and use the normal mechanism!

But yeah, I changed the setting to erase the program only instead of Erase chip... I found the bug while trying all sorts of ways to get the Debug to work previously.

  Since, I learned how to erase, reload and protect my bootloader, and some ways to debug my project. I am still struggling at times, I started this whole adventure in Arduino programming in July! I had no knowledge in C/C++ programming then!

Now if I could figure this: (not in this thread!)
Code:
:(.bss.radioArgvList+0x0): multiple definition of radioArgvList
:C:\Users\Martin\AppData\Local\arduino15\packages\adafruit\hardware\samd\1.2.3\cores\arduino\Print.h:62: first defined here
: error: ld returned 1 exit status 

Tongue

Martin
Back to top
 
 
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print