"file format not recognized" when trying to debug

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

"file format not recognized" when trying to debug

Jump to solution
2,906 Views
mouser
Contributor I

I was unable to get a project of mine to debug on an MKL02Z32CAF4 via a J-link Ultra+ debug adapter using MCUXpresso 11.7.0 b9198. It was throwing errors I didn't understand so I tried to push the code to another board I have that uses the same processor, and that was known to work (but was developed back in the Kinetis Studio days). I got the same errors so that leads me to believe that the problem I am having is a toolchain issue and not one with the chip or the board. 

So, I reinstalled MCUXpresso and made a blank project targeting the same MCU and tried to upload it ang all I get is: 

Error in final launch sequence:

Failed to execute MI command:
-file-exec-file "D:\\Windows Libraries\\Documents\\Projects\\DIN\\DIN_MCU2_2\\DIN_MCU2_2\\Debug\\libDIN_MCU2_2.a"
Error message from debugger back end:
"016ff8c4s": not in executable format: file format not recognized
Failed to execute MI command:
-file-exec-file "D:\\Windows Libraries\\Documents\\Projects\\DIN\\DIN_MCU2_2\\DIN_MCU2_2\\Debug\\libDIN_MCU2_2.a"
Error message from debugger back end:
"016ff8c4s": not in executable format: file format not recognized
"016ff8c4s": not in executable format: file format not recognized

This is the same error I was getting when I tried to debug my actual project with real code in it, so now I think I've ruled out a hardware issue or a code problem... it's just the toolchain's configuration. I'm not sure how to proceed at this point. This is an empty default-configuration project created within MCUXpresso.  

Anyone have a hint as to where I should start looking?

mouser_0-1679940958948.png

 

 

0 Kudos
Reply
1 Solution
2,894 Views
ErichStyger
Specialist I

Did you build the project? If you build a library project, then you get a library (you will not be able to debug the library). You need to build an executable (maybe link with the library) and debug that output.

View solution in original post

0 Kudos
Reply
4 Replies
2,897 Views
ErichStyger
Specialist I

Your file

libDIN_MCU2_2.a

is an archive (.a) library file, and not an executable (ELF/Dwarf, e.g. .elf or .axf).

The file extension does not really matter, but .a is usually used for that file types, see https://mcuoneclipse.com/2017/07/23/how-to-use-custom-library-names-with-gnu-linker-and-eclipse/

0 Kudos
Reply
2,896 Views
mouser
Contributor I

Agreed, but I didn't ask it to make that file. This is literally a fresh project out of the box with whatever configuration was default.  There are no files in the project that weren't auto-generated by the IDE (and a main.c that just increments an integer forever).  

0 Kudos
Reply
2,895 Views
ErichStyger
Specialist I

Did you build the project? If you build a library project, then you get a library (you will not be able to debug the library). You need to build an executable (maybe link with the library) and debug that output.

0 Kudos
Reply
2,890 Views
mouser
Contributor I

Yep, looks like I had somehow created a library project.  <facepalm>  thanks for the assist. 

 

0 Kudos
Reply