The invention belongs to the technical field of single-
chip microcomputers. The invention provides a single-
chip microcomputer partitioning method. The storage space of a single-
chip microcomputer is divided into a guide area, a main program area and a
backup program area. Compiling bin files respectively used for upgrading the main program area and the
backup program area, and adding header information of 1 *
Block Size bytes at the beginning of each bin file; secondly, the sizes of bin files of the main program area and the
backup program area are checked, it is guaranteed that the bin files are integer multiples of the
Block Size, and the bin files with the sizes smaller than the integer multiples are supplemented with 0; combining the supplemented bin files to serve as an upgrading file; and finally, the single-chip
microcomputer receives an upgrading instruction, and the main program detects the current running program area and receives an upgrading file to
upgrade the non-running program area. According to the method, the problem that different bin files are generated by the same program due to different partition addresses is effectively solved, so that the upgrading process is simplified, and the safety and the reliability are improved.