Here I want describe inserting a program to do auto update for applications running on DSP.
The platform is a bare DSP board which have no OS running on it, and programming language is C in CCS, which would compile C and assemble into binaries for the target. The binaries resides in Nor Flash, and they will be executed inplace(XIP). By default,
the binaries could be downloaded to flash by JTAG in CCS or external programmer, what I need to do, is update the flash program by serial port. The user would only take the binaries need to be updated and plug in the serial port to change the binaries, which
will allow non-developer to do software update when the product is installed at field.
This is quite like what uboot does. It need some basic functions to communicate with host device such, to write the binaries to specified flash sector, and to jump to specified address starting the kernel or the main application binaries, and these functions should be stored in a protected zone always being executed first when system boot up.
graph 1. software components
As graph 1 shows, there are several sections of NOR FLASH which have a size of 512KB. If the hardware was configured to boot from flash, it will jump to an address on FLASH A, where I burned my program--"updater". In updater it will listen on the serial port for several seconds to see if host request an update operation. If yes, then it will ask host to transfer binaries and related target address, then write it to the place. I used time slot based protocol to simplify the communication, and each binaries it received would have a strict check about the correctness. Also I wrote the program running on the host provide UI, load binary files, answer the request. The binary files comes from the output of CCS, which contain code with address, but CCS is not need on the host.
After the "updater" procedure is done, it will execute a "long jump" to the application address, which holds the real application codes. The Flash A served only in booting stage, like a shadow which the really application can't see.