你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

【NUCLEO-L476RG】IAR flash loader 下载流程简要分析

[复制链接]
andey 发布时间:2022-12-31 12:51
1.IAR 下载配置
本次使用的硬件环境为MUCLEO-L476开发板,官方下载的软件包中打开IAR的工程文件,IAR的下载配置如下:
IAR_DOWNLOAD.png

默认配置是使用IAR 系统默认配置文件,我们勾选上Oveerride default .board file文件。
IAR_OVERRIDE.png

从下载配置中看IAR环境下载使用的是flash loader 进行下载,使用的配置文件为   IAR  安装路径下的此文件$TOOLKIT_DIR$\config\flashloader\ST\FlashSTM32L4xxxG.board
官方的帮助文档中对flash loader 的描述如下,从如下描述中可知,flash loader 是运行在目标系统(MUCLEO-L476开发板)的一段实现特定flash 操作的接口函数集合,IAR 通过C-SPY将flash loader 加载到目标系统(MUCLEO-L476开发板)RAM中运行,完成目标falsh 的更新任务。
The flash loader
A flash loader is usually a rather small program which can program one or more flash memories.
The flash loader consists of a small set of functions, mainly for erasing or writing designated
portions of the flash memory. C-SPY downloads this program into RAM (it must be linked to an
address in RAM). To run the program, C-SPY sets the PC to one of the functions in the flash
loader, writes data and directives for that function into a RAM buffer, and starts execution.
When the function returns, execution will hit a breakpoint. C-SPY will then know that the
function has finished and can proceed to make further

从如下图片能更清晰的看出flash loader 的工作流程:

flah_load.png
  • 通过 C-SPY 将 flash loader 程序加载到目标系统预留的RAM区域。
  • 通过 C-SPY 将需要下载测程序加载到目标系统预留的RAM区域,如果可执行程序比较大预留的RAM空间可能不能一次完全放下可以分割成多次传输。
  • 将 IMAGE 镜像通过 flash loader 将 IMAGE 镜像下载至flash.
  • 镜像下载完成后可以释放预留的RAM空间,至此已经完成下载。

2. *.board 文件格式说明
此*.board 配置文件的总入口,*.board 文件是什么文件,从IAR的帮助文档摘出如下说明,.board 文件是flash loader 下载镜像的配置文件被IAR 的C-SPY debug 对象引用。

Ext.Type of file
Output fromInput to
board Configuration file for flash loader Text editor C-SPY

$TOOLKIT_DIR$\config\flashloader\ST\FlashSTM32L4xxxG.board文件内容如下:
  1. <?xml version="1.0" encoding="iso-8859-1"?>

  2. <flash_board>
  3.   <pass>
  4.     <loader>$TOOLKIT_DIR$\config\flashloader\ST\FlashSTM32L4xxxG.flash</loader>
  5.     <range>CODE 0x08000000 0x080FFFFF</range>
  6.   </pass>
  7. </flash_board>
复制代码

从如上xml 的配置指定了,flash 的配置说明及FLASH的范围:

3. *.flash 文件格式说明
从配置选项可以看出,此.board主要的配置信息是告诉flash loader 要根据Flash STM32L4xxxG.flash 文件的配置下载镜像,此.flash 的文件是什么文件呢,从iar 的文件说明可知,.flash 文件也是C-SPY加载的文件,主要定义了flash 的相关属性配置。

Ext. Type of file Output from Input to
flash Configuration file for flash loader Text editor C-SPY

  1. <?xml version="1.0" encoding="iso-8859-1"?>

  2. <flash_device>
  3.   <exe>$TOOLKIT_DIR$\config\flashloader\ST\FlashSTM32L4xxxRAM48K_DUALBANK.out</exe>
  4.   <page>8</page>
  5.   <block>512 0x800</block>
  6.   <flash_base>0x08000000</flash_base>
  7.   <macro>$TOOLKIT_DIR$\config\flashloader\ST\FlashSTM32L4xxx.mac</macro>
  8.   <online>1</online>
  9.   <aggregate>1</aggregate>  
  10.   <args_doc>"--skip_erase" -Don't erase blocks that read empty.</args_doc>
  11. </flash_device>
复制代码
如下是上述 xml 文件的配置项说明:
To accommodate a large range of different flash memories, C-SPY uses a few concepts which
detail the characteristics of flash memories.
Page
A page is the smallest writable unit of the flash memory. Many flash
memories cannot write less than for example 128 or 256 bytes in a
single write operation. C-SPY will never request the flash loader to write
anything smaller than a page, and uses padding if necessary to fill out a
page. Of course, some flash memories have no such restrictions and can
specify a page size of 1 byte.
Block
A block is the smallest erasable unit of the flash memory. For example,
a flash memory with a 256-byte page size could still require that flash
memory should be erased in 4-Kbyte chunks. The block size must
always be a multiple of the page size. A flash memory can consist of
several blocks of different sizes. It can also lack such restrictions, in
which case the block size would be the same as the page size.
Base address
This is the start address of the flash memory, when it is written. Some
flash memories are simply memory mapped into a fixed address range
and the base address is then the start of that range. Other flash memories
are mapped into different addresses when being programmed and when
the application is later executing. The base address is then the address
where these memories are mapped when being programmed. Yet other
flash memories are not memory mapped at all, but work more like
external disk-like devices. The base address is then simply the preferred
address to be used for the start of the memory when it is being
programmed.
From the C-SPY perspective, a flash memory starts at a given address and consists of a sequence
of blocks (possibly of different sizes), each of which consists of a number of pages. The
sequence can also contain gaps.

从上述配置文件解析:
STM32L476 的 page 为8byte,共有512 个block 每个  block 大小为2k,总大小为1M,base 地址为0x0800 0000。
flash_page.png

FLASH main features
• Up to 1 Mbyte of Flash memory with dual bank architecture supporting read-while-write
capability (RWW).
• Memory organization: 2 banks (Bank 1 and Bank 2)
– main memory: 512 Kbyte per bank
– information block: 32 Kbyte per bank
• 72-bit wide data read (64 bits plus 8 ECC bits)
• 72-bit wide data write (64 bits plus 8 ECC bits)
• Page erase (2 Kbyte), bank erase and mass erase (both banks)

从上述描述可以看出flash 的最小读写单位是64bit 8bit ECC,最小的编程单位是8byte,每个最小擦除单位为2kbyte,xml 配置和芯片手册里FLASH 的layout 布局是保持一致的。


4. *.mac 文件格式说明
.mac 文件定义了 C-SPY 调用的宏函数,如下宏函数会在 flash loader 的不同阶段调用宏函数。


Ext. Type of file Output from Input to
mac C-SPY macro definition Text editor C-SPY
macro Specifies the path to a C-SPY macro file, which will be loaded in
conjunction with downloading the flash loader.
There are three C-SPY
macro functions that will be called automatically if they are defined in
this macro file:
execUserFlashInit is called immediately before loading the flash
loader.
execUserFlashReset is called immediately after the reset that
follows the loading of the flash loader.
execUserFlashExit is called immediately after flash loading has
finished, but before the flash loader is unloaded.

FlashSTM32L4xxx.mac 内容如下:
  1. __var RCC_CFGR;
  2. __var RCC_CR;
  3. __var RCC_CIR;
  4. __var IWDG_PR;
  5. __var IWDG_RLR;
  6. __var FLASH_ACR;

  7. execUserFlashInit()
  8. {
  9. __var tmp;

  10. __message "Entry execUserFlashInit";

  11.   //Stop watchdogs when CPU is halted
  12.   __writeMemory32(__readMemory32(0xE0042008, "Memory") | 0x1800, 0xE0042008, "Memory");

  13.   //Check if hardware watchdog is enabled
  14.   if(!((1<<16) & __readMemory32(0x40022020,"Memory")))
  15.   {
  16.     // wait PVU reset
  17.     while(0x3 & __readMemory32(0x4000300C,"Memory"));
  18.     IWDG_PR  = __readMemory32(0x40003004, "Memory");
  19.     IWDG_RLR = __readMemory32(0x40003008, "Memory");
  20.   
  21.     // unlock WDT registers
  22.     __writeMemory32(0x5555,0x40003000,"Memory");
  23.     // Prescaler
  24.     __writeMemory32(0x7,0x40003004,"Memory");
  25.     // Reload
  26.     __writeMemory32(0xFFF,0x40003008,"Memory");
  27.     // reload WDT
  28.     __writeMemory32(0xAAAA,0x40003000,"Memory");
  29.   }

  30.   RCC_CR   = __readMemory32(0x40021000, "Memory");
  31.   RCC_CFGR = __readMemory32(0x40021008, "Memory");
  32.   RCC_CIR  = __readMemory32(0x40021018, "Memory");
  33.   
  34.   /*Enable HSI16 oscilator and select it as system clock*/
  35.   __writeMemory32(0x00000000, 0x40021018, "Memory");             // RCC_CIR  = 0;
  36.   __writeMemory32(RCC_CR | (1<<8), 0x40021000, "Memory");   // RCC_CR_HSION  = 1;
  37.   while(!((1<<10) & __readMemory32(0x40021000,"Memory")));
  38.   tmp = (RCC_CFGR & ~(3<<0)) | (1<<0);
  39.   __writeMemory32(tmp, 0x40021008, "Memory");                                 // RCC_CFGR_SW  = 1;
  40.   
  41.   FLASH_ACR = __readMemory32(0x40022000, "Memory");
  42.   tmp = (FLASH_ACR & ~(0x7<<0)) | (2<<0);
  43.   tmp &= ~(3<<9);
  44.   __writeMemory32(tmp, 0x40022000, "Memory"); // 2 WS (3 CPU cycles) & disable caches
  45.   tmp |= (3<<11);
  46.   __writeMemory32(tmp, 0x40022000, "Memory"); // reset caches
  47.   
  48.   if ((0xFF & __readMemory32(0x40022020,"Memory")) != 0xAA)
  49.   {
  50.    
  51.     if (!__messageBoxYesCancel("Do you want to perform mass erase to unlock the device?", "Unlocking device"))
  52.     {
  53.       __abortLaunch("Unlock cancelled. Debug session cannot continue.");
  54.     }

  55.     __writeMemory32(0x45670123, 0x40022008, "Memory"); // FLASH->FKEYR = FLASH_KEY1;
  56.     __writeMemory32(0xCDEF89AB, 0x40022008, "Memory"); // FLASH->FKEYR = FLASH_KEY2;
  57. //    __writeMemory32(0x00000000, 0x40022000, "Memory"); // Flash 0 wait state
  58.     __writeMemory32(0x08192A3B, 0x4002200C, "Memory"); // FLASH->OPTKEYR = FLASH_OPTKEY1;
  59.     __writeMemory32(0x4C5D6E7F, 0x4002200C, "Memory"); // FLASH->OPTKEYR = FLASH_OPTKEY2;
  60.       
  61.     __message "Setting FLASH readout protection level 0 (disabled)";
  62.   
  63.     __writeMemory32((__readMemory32(0x40022020,"Memory") & 0xFFFFFF00) | 0xAA, 0x40022020, "Memory");     // Disable readout protection
  64.    
  65.    
  66.     __writeMemory32((1<<17) | __readMemory32(0x40022014,"Memory"), 0x40022014, "Memory");                 // Set the Options Start bit OPTSTRT

  67.     while((1<<16) & __readMemory32(0x40022010,"Memory"));  // Wait while FLASH busy
  68.         
  69.     __writeMemory32((1<<27) | __readMemory32(0x40022014,"Memory"), 0x40022014, "Memory");                 // Set the OBL_LAUNCH to Force the option byte loading
  70.       
  71.   }
  72. }

  73. execUserFlashExit()
  74. {
  75. __message "Entry execUserFlashExit";
  76.   if(!((1<<16) & __readMemory32(0x40022020,"Memory")))
  77.   {
  78.     __writeMemory32(0x5555,0x40003000,"Memory");
  79.     __writeMemory32(IWDG_PR,0x40003004,"Memory");
  80.     __writeMemory32(IWDG_RLR,0x40003008,"Memory");
  81.     __writeMemory32(0xAAAA,0x40003000,"Memory");
  82.   }

  83.   //Restore registers modified earlier
  84.   __writeMemory32(RCC_CFGR, 0x40021008, "Memory");
  85.   __writeMemory32(RCC_CR, 0x40021000, "Memory");
  86.   __writeMemory32(RCC_CIR, 0x40021018, "Memory");

  87.   __writeMemory32(FLASH_ACR, 0x40022000, "Memory");
  88. }
复制代码

从上述.mac 文件中定义了如下宏函数,并在入口中添加了打印输出:

execUserFlashInit()

execUserFlashExit()


5.下载验证

macros 文件是可以被C-SPY 调用的执行文件,为了验证个人的猜想在execUserFlashInit 入口和出口追加了log 输出,来确认猜测是否正确。
有了上述的配置信息及flash 的初始化处理,flash loader程序就可以吧编译的二进制下载到板子上执行了。准备下环境验证下上述猜测是否正确。

debug_loader.png


从debug log 窗口可以发现mac 文件内定义的函数入口打印输出跟预期的是一致的,同时从log 个中也可以看出flash loader(FlashSTM32L4xxxRAM48K_DUALBANK.out) 程序是按照上述描述的方式被C-SPY 加载到目标系统。

  1. Flash loader example
  2. The following example shows the source code for a complete flash loader (except the source
  3. code for the framework), but with a flash programming algorithm which simply copies bytes
  4. from the RAM buffer to the destination address:
  5. #include "flash_loader.h"
  6. uint32_t FlashInit(void *base_of_flash, uint32_t image_size,
  7. uint32_t link_address, uint32_t flags)
  8. {
  9. return RESULT_OK;
  10. }
  11. uint32_t FlashWrite(void *block_start,
  12. uint32_t offset_into_block,
  13. uint32_t count,
  14. char const *buffer)
  15. {
  16. char *to = (char*)block_start + offset_into_block;
  17. while (count--)
  18. {
  19. *to++ = *buffer++;
  20. }
  21. return RESULT_OK;
  22. }
  23. uint32_t FlashErase(void *block_start, uint32_t block_size)
  24. {
  25. char *p = (char*)block_start;
  26. while (block_size--)
  27. {
  28. *p++ = 0;
  29. }
  30. return RESULT_OK;
  31. }
  32. The parameters to FlashWrite and FlashErase, in combination with the flash memory base
  33. address given in FlashInit, fully specify the addresses of the portions of the flash memory to
  34. be programmed. Thus, a given flash loader can be used for any number of different flash
  35. devices, with different total size, page size, or block layout, provided that they all employ the
  36. same flash programming algorithm. The flash memory configuration file (.flash) is used for
  37. specifying such variations between flash memories.
  38. The reference section at the end of this document describes all framework functions in detail.
复制代码

从上述flash loader 的示例程序中实现了FlashInit/FlashWrite/FlashErase 三个api 函数,我们可以objdump 下flash loader 程序看下内部是否是按照上述方式实现了对应的接口。

  1.                 FlashInit:
  2.   0x200000c4: 0xb510         PUSH   {R4, LR}
  3.   0x200000c6: 0x494a         LDR.N  R1, `.text_8`          ; flash_ie
  4.   0x200000c8: 0xf500 0x2200  ADD.W  R2, R0, #524288        ; 0x80000
  5.   0x200000cc: 0x604a         STR    R2, [R1, #0x4]
  6.   0x200000ce: 0x2300         MOVS   R3, #0
  7.   0x200000d0: 0x2200         MOVS   R2, #0
  8.   0x200000d2: 0x700a         STRB   R2, [R1]
  9.   0x200000d4: 0x9a02         LDR    R2, [SP, #0x8]
  10.   0x200000d6: 0xe000         B.N    @200000da
  11.                 @200000d8:
  12.   0x200000d8: 0x1c5b         ADDS   R3, R3, #1
  13.                 @200000da:
  14.   0x200000da: 0x4293         CMP    R3, R2
  15.   0x200000dc: 0xdbfc         BLT.N  @200000d8
  16.   0x200000de: 0x4a45         LDR.N  R2, `.text_9`          ; 0x40022008 (1073881096)
  17.   0x200000e0: 0x6993         LDR    R3, [R2, #0x18]
  18.   0x200000e2: 0x029b         LSLS   R3, R3, #10
  19.   0x200000e4: 0xd507         BPL.N  @200000f6
  20.   0x200000e6: 0x4b44         LDR.N  R3, `.text_10`         ; 0x1fff75e0 (536835552)
  21.   0x200000e8: 0x4c44         LDR.N  R4, `.text_11`         ; 0x3ffc00 (4193280)
  22.   0x200000ea: 0x881b         LDRH   R3, [R3]
  23.   0x200000ec: 0xea04 0x2383  AND.W  R3, R4, R3, LSL #10
  24.   0x200000f0: 0xeb00 0x0063  ADD.W  R0, R0, R3, ASR #1
  25.   0x200000f4: 0x6048         STR    R0, [R1, #0x4]
  26.                 @200000f6:
  27.   0x200000f6: 0x4842         LDR.N  R0, `.text_12`         ; 0xe000e100 (-536813312)
  28.   0x200000f8: 0x4b42         LDR.N  R3, `.text_13`         ; 0xe000e180 (-536813184)
  29.   0x200000fa: 0x6800         LDR    R0, [R0]
  30.   0x200000fc: 0x06c0         LSLS   R0, R0, #27
  31.   0x200000fe: 0xbf44         ITT    MI
  32.   0x20000100: 0x2001         MOVMI  R0, #1
  33.   0x20000102: 0x7008         STRBMI R0, [R1]
  34.   0x20000104: 0x2010         MOVS   R0, #16                ; 0x10
  35.   0x20000106: 0x6018         STR    R0, [R3]
  36.   0x20000108: 0x4b3f         LDR.N  R3, `.text_14`         ; 0xc7000ff8 (-956297224)
  37.   0x2000010a: 0x68d0         LDR    R0, [R2, #0xc]
  38.   0x2000010c: 0x4018         ANDS   R0, R0, R3
  39.   0x2000010e: 0x6088         STR    R0, [R1, #0x8]
  40.   0x20000110: 0x483e         LDR.N  R0, `.text_15`         ; 0x45670123 (1164378403)
  41.   0x20000112: 0x6010         STR    R0, [R2]
  42.   0x20000114: 0x483e         LDR.N  R0, `.text_16`         ; 0xcdef89ab (-839939669)
  43.   0x20000116: 0x6010         STR    R0, [R2]
  44.   0x20000118: 0x68d0         LDR    R0, [R2, #0xc]
  45.   0x2000011a: 0xf020 0x60c0  BIC.W  R0, R0, #100663296     ; 0x6000000
  46.   0x2000011e: 0x60d0         STR    R0, [R2, #0xc]
  47.   0x20000120: 0x68d0         LDR    R0, [R2, #0xc]
  48.   0x20000122: 0xf040 0x7080  ORR.W  R0, R0, #16777216      ; 0x1000000
  49.   0x20000126: 0x60d0         STR    R0, [R2, #0xc]
  50.                 @20000128:
  51.   0x20000128: 0x6890         LDR    R0, [R2, #0x8]
  52.   0x2000012a: 0x03c0         LSLS   R0, R0, #15
  53.   0x2000012c: 0xd4fc         BMI.N  @20000128
  54.   0x2000012e: 0x2000         MOVS   R0, #0
  55.   0x20000130: 0xbd10         POP    {R4, PC}
  56.                 `.text_5`:
  57.                 FlashWrite:
  58.   0x20000132: 0xb5f0         PUSH   {R4-R7, LR}
  59.   0x20000134: 0xf240 0x15ff  MOVW   R5, #511               ; 0x1ff
  60.   0x20000138: 0x1844         ADDS   R4, R0, R1
  61.   0x2000013a: 0x4936         LDR.N  R1, `.text_17`         ; 0x40022010 (1073881104)
  62.   0x2000013c: 0x600d         STR    R5, [R1]
  63.   0x2000013e: 0x2000         MOVS   R0, #0
  64.   0x20000140: 0x684d         LDR    R5, [R1, #0x4]
  65.   0x20000142: 0xf045 0x0501  ORR.W  R5, R5, #1
  66.   0x20000146: 0x604d         STR    R5, [R1, #0x4]
  67.   0x20000148: 0xe000         B.N    @2000014c
  68.                 @2000014a:
  69.   0x2000014a: 0x3a08         SUBS   R2, R2, #8
  70.                 @2000014c:
  71.   0x2000014c: 0xb162         CBZ    R2, @20000168
  72.   0x2000014e: 0xe8f3 0x6702  LDRD   R6, R7, [R3], #0x8
  73.   0x20000152: 0xe8e4 0x6702  STRD   R6, R7, [R4], #0x8
  74.   0x20000156: 0xbf00         NOP
  75.   0x20000158: 0xbf00         NOP
  76.                 @2000015a:
  77.   0x2000015a: 0x680d         LDR    R5, [R1]
  78.   0x2000015c: 0x03ed         LSLS   R5, R5, #15
  79.   0x2000015e: 0xd4fc         BMI.N  @2000015a
  80.   0x20000160: 0x680d         LDR    R5, [R1]
  81.   0x20000162: 0x07ed         LSLS   R5, R5, #31
  82.   0x20000164: 0xd4f1         BMI.N  @2000014a
  83.   0x20000166: 0x2001         MOVS   R0, #1
  84.                 @20000168:
  85.   0x20000168: 0x684a         LDR    R2, [R1, #0x4]
  86.   0x2000016a: 0x0852         LSRS   R2, R2, #1
  87.   0x2000016c: 0x0052         LSLS   R2, R2, #1
  88.   0x2000016e: 0x604a         STR    R2, [R1, #0x4]
  89.   0x20000170: 0xbdf0         POP    {R4-R7, PC}
  90.                 `.text_6`:
  91.                 FlashErase:
  92.   0x20000172: 0x4a28         LDR.N  R2, `.text_17`         ; 0x40022010 (1073881104)
  93.   0x20000174: 0xf240 0x13ff  MOVW   R3, #511               ; 0x1ff
  94.   0x20000178: 0x6013         STR    R3, [R2]
  95.   0x2000017a: 0x4601         MOV    R1, R0
  96.   0x2000017c: 0x6853         LDR    R3, [R2, #0x4]
  97.   0x2000017e: 0xf36f 0x03cb  BFC    R3, #3, #9
  98.   0x20000182: 0x6053         STR    R3, [R2, #0x4]
  99.   0x20000184: 0x2000         MOVS   R0, #0
  100.   0x20000186: 0x4b1a         LDR.N  R3, `.text_8`          ; flash_ie
  101.   0x20000188: 0x685b         LDR    R3, [R3, #0x4]
  102.   0x2000018a: 0x4299         CMP    R1, R3
  103.   0x2000018c: 0xd203         BCS.N  @20000196
  104.   0x2000018e: 0x0a09         LSRS   R1, R1, #8
  105.   0x20000190: 0xf401 0x61ff  AND.W  R1, R1, #2040          ; 0x7f8
  106.   0x20000194: 0xe007         B.N    @200001a6
  107.                 @20000196:
  108.   0x20000196: 0x1ac9         SUBS   R1, R1, R3
  109.   0x20000198: 0x6853         LDR    R3, [R2, #0x4]
  110.   0x2000019a: 0x0a09         LSRS   R1, R1, #8
  111.   0x2000019c: 0xf443 0x6300  ORR.W  R3, R3, #2048          ; 0x800
  112.   0x200001a0: 0xf401 0x61ff  AND.W  R1, R1, #2040          ; 0x7f8
  113.   0x200001a4: 0x6053         STR    R3, [R2, #0x4]
  114.                 @200001a6:
  115.   0x200001a6: 0xf041 0x0102  ORR.W  R1, R1, #2
  116.   0x200001aa: 0x6853         LDR    R3, [R2, #0x4]
  117.   0x200001ac: 0x4319         ORRS   R1, R1, R3
  118.   0x200001ae: 0x6051         STR    R1, [R2, #0x4]
  119.   0x200001b0: 0x6851         LDR    R1, [R2, #0x4]
  120.   0x200001b2: 0xf441 0x3180  ORR.W  R1, R1, #65536         ; 0x10000
  121.   0x200001b6: 0x6051         STR    R1, [R2, #0x4]
  122.   0x200001b8: 0xbf00         NOP
  123.   0x200001ba: 0xbf00         NOP
  124.                 @200001bc:
  125.   0x200001bc: 0x6811         LDR    R1, [R2]
  126.   0x200001be: 0x03c9         LSLS   R1, R1, #15
  127.   0x200001c0: 0xd4fc         BMI.N  @200001bc
  128.   0x200001c2: 0x6811         LDR    R1, [R2]
  129.   0x200001c4: 0x07c9         LSLS   R1, R1, #31
  130.   0x200001c6: 0x6851         LDR    R1, [R2, #0x4]
  131.   0x200001c8: 0xf021 0x0102  BIC.W  R1, R1, #2
  132.   0x200001cc: 0xbf58         IT     PL
  133.   0x200001ce: 0x2001         MOVPL  R0, #1
  134.   0x200001d0: 0x6051         STR    R1, [R2, #0x4]
  135.   0x200001d2: 0x4770         BX     LR
复制代码

上述通过  
ielfdumparm.exe  FlashSTM32L4xxxRAM48K_DUALBANK.out  -o FlashSTM32L4xxxRAM48K_DUALBANK.ASM --code
命令dump 出来的flash loader 程序,跟预期的保持一致实现了FlashInit/FlashWrite/FlashErase 这组API函数,而且通过反汇编的函数地址信息也可以看出对应的函数的link 地址并不是falsh 区域而是内部RAM 的地址,跟C-SPY 调用flash loader 程序的流程是一致的。


资料分割线
FlashLoaderGuide.ENU.pdf (233.17 KB, 下载次数: 4)
收藏 评论0 发布时间:2022-12-31 12:51

举报

0个回答

所属标签

相似分享

官网相关资源

关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
STM32N6 AI生态系统
STM32MCU,MPU高性能GUI
ST ACEPACK电源模块
意法半导体生物传感器
STM32Cube扩展软件包
关注我们
st-img 微信公众号
st-img 手机版