The IAP Upgrade Program tested and written over the past few days is really bad. It can be downloaded but cannot run.
After a variety of tests, I finally found the cause of the problem. Now I will summarize the reasons when I write the IAP program.
Problems and Solutions. First, we need to implement the IAP Upgrade Program for single-chip microcomputer. We need to know how our IDE can
Fix the compilation address of the function or variable of the program, because we need to fix the address of the bootload program,
The address of the program to jump to from bootload.
For the MSP430, when the program is reset during the test, it jumps to rts430x. Lib: boot. OBJ (. Text: _ ISR:
_ C_int00_noexit) and then execute _ syatem_pre_int-> _ auto_init-> main,
In the _ auto_init process, the program will execute the memcpy function (assign the. cinit segment to ram), that is, initialize the RAM
. My program is mainly wrong in this process, resulting in continuous problems after the update, as well as for. cinit segments and
. Const segment, we also need to fix the address, because the address of the memcpy function to initialize Ram is fixed, and the bootload
It cannot be updated, so after the. cinit segment is fixed, the memcopy operation address will be fixed. Otherwise, the program will be re-compiled when the program changes.
Later, the address of the. cinit segment may change, causing a ram initialization error.
After this modification, the program will be able to upgrade itself. The program will only upgrade some programs running, but will not upgrade the bootload program.