Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

Commit

Permalink
Merge pull request #346 from sifive/trace-encoder
Browse files Browse the repository at this point in the history
DTS Fixup: Use sifive,trace as stdout-path
  • Loading branch information
nategraff-sifive authored Sep 9, 2019
2 parents 12f6e96 + eb7a76c commit 60eee28
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion scripts/fixup-dts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ if [ `grep -c 'stdout-path' ${dts}` -eq 0 ]; then
if [ `grep -c 'sifive,uart0' ${dts}` -ne 0 ]; then
echo "$0: stdout-path property not given, but a UART device exists."

serial_node=`grep -oP "serial@\d+" ${dts} | sort | uniq | head -n 1`
serial_node=`grep -oP "serial@[[:xdigit:]]+" ${dts} | sort | uniq | head -n 1`
serial_path="/soc/${serial_node}:115200"

if [ `grep -c 'chosen' ${dts}` -eq 0 ]; then
Expand All @@ -81,6 +81,21 @@ if [ `grep -c 'stdout-path' ${dts}` -eq 0 ]; then
${SED} -i "/chosen/a stdout-path=\"${serial_path}\";" ${dts}

echo -e "$0: \tAdded stdout-path ${serial_path}"

# If no UART exists, use the trace encoder
elif [ `grep -c 'sifive,trace' ${dts}` -ne 0 ]; then
echo "$0: stdout-path property not given, but a trace encoder exists."

trace_node=`grep -oP "trace@[[:xdigit:]]+" ${dts} | sort | uniq | head -n 1`
trace_path="/soc/${trace_node}:115200"

if [ `grep -c 'chosen' ${dts}` -eq 0 ]; then
${SED} -i "/cpus/i chosen {\n};" ${dts}
fi

${SED} -i "/chosen/a stdout-path=\"${trace_path}\";" ${dts}

echo -e "$0: \tAdded stdout-path ${trace_path}"
fi
fi

Expand Down

0 comments on commit 60eee28

Please sign in to comment.