Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic <project>.with_bootloader.hex: bad file format (Read 3872 times)
Martin Boissonneault
Newbies
*
Offline


Posts: 6
Location: near Montreal, Quebec, Canada
Joined: Sep 19th, 2018
<project>.with_bootloader.hex: bad file format
Sep 30th, 2018 at 11:55pm
Print Post  
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.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: <project>.with_bootloader.hex: bad file format
Reply #1 - Oct 1st, 2018 at 4:22pm
Print Post  
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
Location: near Montreal, Quebec, Canada
Joined: Sep 19th, 2018
Re: <project>.with_bootloader.hex: bad file format
Reply #2 - Oct 1st, 2018 at 5:06pm
Print Post  
Hi!

Tim@Visual Micro wrote on Oct 1st, 2018 at 4: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
Select All
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
Select All
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.
« Last Edit: Oct 1st, 2018 at 5:12pm by Martin Boissonneault »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: <project>.with_bootloader.hex: bad file format
Reply #3 - Oct 1st, 2018 at 5:20pm
Print Post  
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.
« Last Edit: Oct 1st, 2018 at 5:21pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Martin Boissonneault
Newbies
*
Offline


Posts: 6
Location: near Montreal, Quebec, Canada
Joined: Sep 19th, 2018
Re: <project>.with_bootloader.hex: bad file format
Reply #4 - Oct 1st, 2018 at 6:09pm
Print Post  
Tim@Visual Micro wrote on Oct 1st, 2018 at 5: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?

Tim@Visual Micro wrote on Oct 1st, 2018 at 5: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
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: <project>.with_bootloader.hex: bad file format
Reply #5 - Oct 1st, 2018 at 6:30pm
Print Post  
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
Location: near Montreal, Quebec, Canada
Joined: Sep 19th, 2018
Re: <project>.with_bootloader.hex: bad file format
Reply #6 - Oct 1st, 2018 at 6:44pm
Print Post  
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
Select All
:(.bss.radioArgvList+0x0): multiple definition of radioArgvList
ores\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 TopicPrint