Foreword
The user program is relatively simple, but plays a vital role
The user program and is cooperating BootLoader program
Copy the files to your project
stmflash.c stmflash.h APP user program and on one of BootLoader is the same.
IAP is only a little difference
User application needs to do two things
A. Obtain updated information (version number, the update status)
Second, think later write the user program is running without problems APP
Now to complete the processing of APP user program.
Now I will explain why doing so
There are many state determination procedure in the previous BootLoader inside,
APP which the user can obtain the program state
You can come to know through the last update IAPStructValue.UpdateStatusValue value in the user program inside state
For more intuitive, we can directly call printf ( "% s", IAPStructValue.UpdateStatusStr); string corresponding to printing
The state can also be considered when the program is not the problem, these states sent to the host computer, so that you know intuitively updated
then
BootLoader download a good program after it, write status is: 0x01 then restart
After the restart of course, to run BootLoader
BootLoader is then determined after writing 0xFF 0x01
Then run the new user program
Which only the user program
If you perform a new user program, but we do not call that function to do the above process
Then the microcontroller will be executed after the restart BootLoader
BootLoader a judge or 0xFF will be that the new program does not run correctly
Then it will switch to a running program
So I will let you feel the user program is running is no problem then call
IAPUpdateDispose () function
Because the source code I provide reference or direct application to do the project for everyone
How should I say! I want to ensure foolproof !!
Generating first user program
Remember not to print on a BootLoader
所以第一份用户程序的配置
生成第二份用户程序
如果想升级怎么办?
我的原则还是交由BootLoader处理
APP用户程序里面只需要 IAPSetUpdateFlage();