How to generate DCT(16k) for Photon?

I want to generate DCT for Photon so that I can flash whole firmware (bootloader dct system-firmware…) by st-link or j-link.
1.I have read DCT layout part in datasheet.


2.Read whole stm32 flash data out by st-link.
3.But It seems that It is not simple write application_dct_t struct to flash 0x8004000 or 0x800800.
4.I can not find src of function “dct_write_app_data” from system-firmware.

particle and dfu-util always fail and we pay works in minutes.

Please Please help!Thanks!