STM32三种启动模式对应的存储介质均是芯片内置的,它们是:
1)用户闪存 = 芯片内置的Flash。
2)SRAM = 芯片内置的RAM区,就是内存啦。
3)系统存储器 = 芯片内部一块特定的区域,芯片出厂时在这个区域预置了一段Bootloader,就是通常说的ISP程序。这个区域的内容在芯片出厂后没有人能够修改或擦除,即它是一个ROM区。
在每个STM32的芯片上都有两个管脚BOOT0和BOOT1,这两个管脚在芯片复位时的电平状态决定了芯片复位后从哪个区域开始执行程序。
BOOT1=x BOOT0=0 从用户闪存启动,这是正常的工作模式。
BOOT1=0 BOOT0=1 从系统存储器启动,这种模式启动的程序功能由厂家设置。
BOOT1=1 BOOT0=1 从内置SRAM启动,这种模式可以用于调试。
要注意的是,一般不使用内置SRAM启动(BOOT1=1 BOOT0=1),因为SRAM掉电后数据就丢失。多数情况下SRAM只是在调试时使用,也可以做其他一些用途。如做故障的局部诊断,写一段小程序加载到SRAM中诊断板上的其他电路,或用此方法读写板上的Flash或EEPROM等。还可以通过这种方法解除内部Flash的读写保护,当然解除读写保护的同时Flash的内容也被自动清除,以防止恶意的软件拷贝。
一般BOOT0和BOOT1跳线都跳到0(地)。只是在ISP下载的情况下,BOOT0=1,BOOT1=0 ,下载完成后,把BOOT0的跳线接回0,也即BOOT0=0,BOOT1=0 。
相关文章









