Bootloader learning experience

Source: Internet
Author: User

Recently I want to do something that can be updated remotely, so I have to use bootloader to split flash into multiple regional programs.

The next step is to do the test to prove the feasibility. The stm32f103 discover board used in this test, the flash size is 512 K, enough for simple demo development.

Firstly:

Create two project files, each of which only provides one serial output for detection. (Printf ("test! \ N ");).

Second:

Set the flash burning address.

Project 1 starts from 0x0800000, sets the burning write size to 0x10000, and allocates 64 K memory as the bootloader area.

 

Project 2 follows project 1 from 0x08010000 and sets the size to 0x6ffff (the size after the bootloader area is subtracted) (the total size is 0x80000 ).

Third:

In Project 1, set the specified jump address. This is only a demo. In actual applications, the application should be stored in the off-chip memory (such as the SD card), and the bootloader should be read. the binfile is then burned and written into the program itself to achieve automatic updates. After the update is complete, the command is redirected (this demo directly skips the process of burning and writing the local machine ), after the jump is complete, run the application.

The redirection command on stm32 is:

(* (Void (*) (void) (* (vu32 *) (0x08010000 + 4) (); // (0x08010000 is the address to jump, as for why I want to add 4, I don't really understand it. The explanation is as follows: "What is saved here is the reset interrupt address of the interrupt vector table ").


Bootloader learning experience

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.