The present invention provides a data lossless remote code updating method and apparatus. The method comprises: S1, a
server side sends a ProcessAppInfoMsg frame, the frame transmits a total
byte number and a total packet number of a code to a controller, the controller writes the total
byte number and the total packet number of the code into a designated position of an SD card for a checking frame to check, and the controller returns the ProcessAppInfoMsg frame; S2, the
server side sends the ProcessAppInfoMsg frame, a controller side checks the frame according to a check code of the frame and if the frame is correct, the codes are written into corresponding addresses of the SD card according to a
record format of the SD card; S3, the
server side sends the ProcessAppInfoMsg frame, the frame is sent after code frames are sent, a 32-bit total checksums of all the codes is recorded in the frame, checking is successfully carried out if a 32-bit total
checksum of all the code frames read from the SD card is equal to that of all the codes, or error information is carried by a return frame of the frame and a server is requested to resend the frame; and S4, the
server side sends the ProcessAppInfoMsg frame, a user application skips to the position of a bootloader after receiving the frame, and the bootloader completes the code updating operation. The data lossless remote code updating method and apparatus have the advantages of
short code updating time and lossless data.