The ATF (arm trusted firmware, BL1, BL2) command line loop supports ymodem protocol. Under windows, I am using TeraTerm and can use its menu to manually send files to the device, using ymodem protocol, after inputting the command ymodem <address>
and seeing the C
character:
NOTICE: Booting Trusted Firmware
NOTICE: BL1: v1.4(release):58e7395
NOTICE: BL1: Built : 17:39:25, Jan 2 2018
# ymodem 0x45103000
NOTICE: ## Ready for binary (ymodem) download to 0x451030000 at 115200 bps...
C
Tera Term also support Macro to automate the process, which works fine. Now I want to use screen
+expect
+sz
under Linux to do the same...But so far I am not successful.
I am currently testing with the following code:
85 spawn screen /dev/ttyUSB0 115200
86 set screen $spawn_id
93 send "ymodem 0x45103000\r"
94 set timeout 3
95 expect {
96 timeout {
97 puts "timeout..."
98 exit 1
99 }
100 "115200 bps...\r\nC"
101 }
102 #stty -echo raw
103 spawn sz --ymodem $bl2_burn_path
104 interact -u $screen
105 expect "Bytes" # can expect see this?
106 stty echo -raw
107
108 send "\r\r\r"
109 send "exit\r"
It seems sz
repeately sending the file, but there is no feedback from the remote side:
expect: does "ymodem 0x45103000\r\n\u001b)0\u001b[?1049h\u001b[4l\u001b[?1h\u001b=\u001b[0m\u001b(B\u001b[1;24r\u001b[H\u001b[J\u001b[H\u001b[Jymodem 0x45103000\r\nNOTICE: ## Ready for binary (ymodem) download to 0x45103000 at 115200 bps...\r\nC" (spawn_id exp7) match glob pattern "115200 bps...\r\nC"? yes
expect: set expect_out(0,string) "115200 bps...\r\nC"
expect: set expect_out(spawn_id) "exp7"
expect: set expect_out(buffer) "ymodem 0x45103000\r\n\u001b)0\u001b[?1049h\u001b[4l\u001b[?1h\u001b=\u001b[0m\u001b(B\u001b[1;24r\u001b[H\u001b[J\u001b[H\u001b[Jymodem 0x45103000\r\nNOTICE: ## Ready for binary (ymodem) download to 0x45103000 at 115200 bps...\r\nC"
spawn sz --ymodem /home/bruin/work/f5/bsp/bl2-burn.bin
parent: waiting for sync byte
parent: telling child to go ahead
parent: now unsynchronized from child
spawn: returns {31117}
spawn id exp7 sent <C>
spawn id exp8 sent <\u0001\u0000\u00ffbl2-burn.bin\u000045352 13335245531 100700 0 1 45352\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001c\u0013\u00a4>
spawn id exp8 sent <\u0001\u0000\u00ffbl2-burn.bin\u000045352 13335245531 100700 0 1 45352\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001c\u0013\u00a4>
What's missing from the script above?
I have another question about how to determine the file transfer is complete. Normally (on windows as I observed), once the file tranfer completes, among other things, ATF will print the size of the data transfered, such as 45123 Bytes
. How expect
watch this msg now? My understanding is that these two spawned processes (screen
and sz
) talks directly, bypassing expect
, no?