如何确定目标内部闪存的大小?

How to determin size of internal flash for target?

我想使用 dfu-util 将设备固件上传到文件。如何确定闪存的正确大小?

将设备启动到 DFU 后,可以使用以下方法找到它:

dfu-util -l

为此我收到以下信息:

Found DFU: [0483:df11] ver=2200, devnum=8, cfg=1, intf=0, alt=1, name="@Option Bytes  /0x1FFFF800/01*016 e", serial="FFFFFFFEFFFF"
Found DFU: [0483:df11] ver=2200, devnum=8, cfg=1, intf=0, alt=0, name="@Internal Flash  /0x08000000/064*0002Kg", serial="FFFFFFFEFFFF"

要将闪存配置上传到文件,我需要确定闪存的大小。基于 this article,大小为 64 x 1kB 闪存。

0002Kg中的'Kg'是什么意思?
我遵循的说明(在其他地方,对于不同的设备,见上文)使用的是 128 x 1kB,我认为这是不正确的。
如何计算闪存的大小以及如果将内存设置的太大而无法下载图片会发生什么情况?

命令是:

dfu-util -a 0 -s 0x08000000:131072 -U ./original.bin

我觉得应该是

dfu-util -a 0 -s 0x08000000:65536 -U ./original.bin

请参阅UM0290,其中我们发现:

Each Alternate setting string descriptor must follow this memory mapping else the PC Host Software would be able to decode the right mapping for the selected device:

  • @: To detect that this is a special mapping descriptor (to avoid decoding standard descriptor)
  • /: for separator between zones
  • Maximum 8 digits per address starting by “0x”
  • /: for separator between zones
  • Maximum of 2 digits for the number of sectors
  • * : For separator between number of sectors and sector size
  • Maximum 3 digits for sector size between 0 and 999
  • 1 digit for the sector size multiplier. Valid entries are: B (byte), K (Kilo), M (Mega)
  • 1 digit for the sector type as follows:
    • a (0x41): Readable
    • b (0x42): Erasable
    • c (0x43): Readable and Erasable
    • d (0x44): Writeable
    • e (0x45): Readable and Writeable
    • f (0x46): Erasable and Writeable
    • g (0x47): Readable, Erasable and Writeable

所以你的字符串确实意味着内部闪存是 2 KB 的 64 个扇区,并且它们是 "readable, erasable and writable"(即闪存)。您确定您对设备的闪存布局的期望吗?