【无标题】

系列文章目录

提示:这里可以添加系列文章的所有文章的目录,目录需要自己手动添加
例如:第一章 Python 机器学习入门之pandas的使用


提示:写完文章后,目录可以自动生成,如何生成可参考右边的帮助文档


前言

提示:这里可以添加本文要记录的大概内容:

I’m trying to learn advanced embedded software debugging techniques, and I can see one good way to do this is to be able to read ELF, MAP and HEX files. Are there any good tutorials for this? What other good advanced debugging techniques have really helped you? Thanks


提示:以下是本篇文章正文内容,下面案例可供参考

The only one intended for “human consumption” is the .map file, which lets you see the address assigned to each symbol (function, global variable) etc in your code. It also gives the size of each function, which can be useful when optimizing for space. You can directly read a .map file with any text editor / viewer and they are quite simple to understand

The other file types aren’t intended to be directly read by humans but as input to other tools.

.hex files basically consist of a set of address/data blocks and say “this data goes here, that data goes there” the data just being hex values with no context. They are textual so you can read them at a pinch but that’s not very useful.

They are normally used as input to various flashing / update tools and are generated as one of the final steps of the build process. Because they contain the destination addresses they are standalone and can be used to program a device without prior knowledge of the load address and can also be used where there are several non contiguous chunks of data, unlike .bin files which are straight binary dumps from an assumed start address.

.elf files are the result of the compile and link phase and contain lots of information, such as code, data, load addresses, debug information. They are complex structured binary formats. Understanding the format itself is not very important unless you are writing tools to consume on generate them (and there are libraries that can help with that) but it is useful to know the tools that can be used eith them and the type of information inside.

A .bin or .hex file can be generated from an .elf file as can more elaborate programming formats like .dfu

.elf files are are, of course, used by debuggers but simpler tools like addr2line use them too (this tool finds the function / line number corresponding to an address, which can be useful if you have a crash dump from the field when no debugger was in use)

objdump and readelf are good tools for exploring .elf files.

参考:
原文链接

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值