write spe-fw failed

I added some code in the l4t-rt. The size of the compiled spe.bin is 99660 bytes.

Flash the spe-fw as followed:
sudo ./flash.sh -k spe-fw jetson-xavier mmcblk0p1

The programming process cannot be completed:
[ 10.5014 ] Writing partition
[ 10.5035 ] tegradevflash_v2 --write spe-fw 1_spe_t194_sigheader.bin.encrypt
[ 10.5057 ] Bootloader version 01.00.0000
[ 10.6886 ] Writing partition spe-fw with 1_spe_t194_sigheader.bin.encrypt

I have modified the size of spe-fw and spe-fw_b of flash_t194_sdmmc.xml from 131072 to 262144. But the same error occurred during programming.

Hello, yinghua:
The possible reason is described in “doc/faq.md”:

# Why does my customized SPE firmware fail to flash?

I successfully flashed the default firmware. But then flashing failed with when I tried to flash
SPI firmware that I modified  to test my own code. I used the same flash command and the same
device.

@b Answer: Flashing customized SPE firmware can fail for several reasons:

- The custom SPE firmware has a problem, which causes the SPE firmware to crash and the device to
  hang. When that happens, the PC cannot communicate with the
  device and the flash command cannot proceed.

  To resolve this issue, carefully check the code you modified and ensure its logic and
  settings are correct.

- SPE firmware size exceeds limitation. To workaround this limitation, follow [Known Issues](rt-knownissues.html).

If the firmware size does not exceed the limit, most probable reason is that the firmware is not correct.
Please check the firmware code carefully.
Another suggestion is that you can postpone your private code running, after triggered by some commands from Linux side through IVC. That may help to debug.

br
Chenjian

Hi jachen,
You are right. My code has some error. I want to send some datas from spe to linux through ivc_echo_task_write_msg. After calling this function 32 times, the spe crash.