开发者

Arduino: how to debug hex file in AVR Studio

开发者 https://www.devze.com 2023-03-14 02:01 出处:网络
When compiling an Arduino sketch, it creates a .hex file (stored in a temporary folder). When I open this file in AVR Studio 4.18, it tries to start at a location where no code exists. What 开发者_开发

When compiling an Arduino sketch, it creates a .hex file (stored in a temporary folder). When I open this file in AVR Studio 4.18, it tries to start at a location where no code exists. What 开发者_开发百科should I do to be able to debug those Arduino hex files in the AVR Studio simulator?


You can't, you will need the object files. If you want to use AVR simulator, you will have to write your code in C or assembly and build it in the AVR studio using GCC compiler or equivalent.


Hm, works well when I choose the Simulator 2...


Look up the man pages for avr-objdump and hex2bin from atmel. That should enable you to disassemble the program file in order to generate what you might need for the simulator.

Check out this topic, it explains the difference between object code and the machine code: Assembly code vs Machine code vs Object code?

In short, your hex file is the raw machine code: opcodes, arguments, strings etc - i.e. the data, code and text portions and all mashed together and hex-encoded for convenience. It is easier to read the program file as hex-encoded than in binary format :)

EDIT:

As far as I remember (it's been years since I've used AVR Studio), you can load the hex file in AVR Studio and create a disassembly. Then copy/paste that to an .asm file and generate the object files -- if that is indeed what you need.

This page has some info on AVR Studio and generating the disassembly: http://www.avrfreaks.net/index.php?name=PNphpBB2&file=printview&t=50456&start=0

0

精彩评论

暂无评论...
验证码 换一张
取 消