Flash programming is similar on both 521x and 5223x. You might want to look for 521x bootloaders as a starting point.
I'm writing a bootloader for the 5223x in my spare time; it will have serial download and bootp/tftp to both internal RAM and Flash, limited scripting. So far I expect it will require less than 32KB. I should have an alpha by the end of the month; I might GPL-it if there's any interest.