Skip to content

Commit 4d64679

Browse files
authored
Merge pull request #55 from kbumsik/master
run_arduino_sh: Add log command, some improvements
2 parents 86c5136 + 34e1baf commit 4d64679

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

run_arduino_gen.sh

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ generate_packaged_script() {
111111
fi
112112
echo "'" >> $output_script
113113
tail -n +$(grep -n "%}" "$this_script" | cut -d: -f1 | head -n 1) $this_script >> $output_script
114-
dos2unix $output_script
114+
dos2unix $output_script 2> /dev/null
115115
}
116116

117117

@@ -167,7 +167,7 @@ try_send() {
167167
# Linux host must send any dummy data first to finish initialization of rpmsg
168168
# on the coprocessor side. This message should be discarded.
169169
# See: https://github.com/OpenAMP/open-amp/issues/182
170-
echo "DUMMY" >$RPMSG_DIR
170+
echo -n "DUMMY" >$RPMSG_DIR
171171
echo "Virtual serial $RPMSG_DIR connection established."
172172
}
173173

@@ -204,7 +204,7 @@ case "$1" in
204204
;;
205205
monitor)
206206
autodetect_board
207-
stty igncr onlcr -echo -F $RPMSG_DIR
207+
stty raw -echo -echoe -echok -F $RPMSG_DIR
208208
cat $RPMSG_DIR
209209
;;
210210
send-msg)
@@ -213,7 +213,13 @@ case "$1" in
213213
;;
214214
send-file)
215215
autodetect_board
216-
dd if="$2" of=$RPMSG_DIR
216+
# Maximum buffer size at a time: 512 - 16 bytes
217+
# Otherwise, it used to return error in earlier version of OpenSTLinux
218+
# Reference: https://elixir.bootlin.com/linux/v5.5.6/source/drivers/rpmsg/virtio_rpmsg_bus.c#L581
219+
dd if="$2" bs=496 of=$RPMSG_DIR
220+
;;
221+
log)
222+
cat /sys/kernel/debug/remoteproc/remoteproc0/trace0
217223
;;
218224
minicom)
219225
autodetect_board
@@ -231,7 +237,8 @@ case "$1" in
231237
*)
232238
echo "Usage: $0 [start|stop|restart]"
233239
echo " $0 [install|uninstall]"
234-
echo " $0 [monitor|send-msg|send-file|minicom]"
240+
echo " $0 [monitor|minicom|log]"
241+
echo " $0 [send-msg|send-file] ..."
235242
echo " $0 [generate]"
236243
echo ""
237244
echo "$0 is a helper script that helps managing an Arduino binary"
@@ -266,6 +273,9 @@ case "$1" in
266273
echo "$0 minicom"
267274
echo " Launch minicom interactive serial communication program."
268275
echo ""
276+
echo "$0 log"
277+
echo " Print debugging log in OpenAMP trace buffer."
278+
echo ""
269279
echo "$0 stop"
270280
echo " Stop the coprocessor."
271281
echo ""

0 commit comments

Comments
 (0)