Skip to content

Commit

Permalink
Merge pull request #144 from sifive/stdout-path-no-baud
Browse files Browse the repository at this point in the history
Set default stdout-path baud rate to 115200
  • Loading branch information
nategraff-sifive committed Aug 28, 2019
2 parents 571a7ea + c9a5eef commit 96886cd
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions metal_header/stdout_path.c++
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@ stdout_path::stdout_path(std::ostream &os, const fdt &dtb)

void stdout_path::create_handles() {
dtb.chosen("stdout-path", tuple_t<std::string>(), [&](std::string info) {
if (info.find(":") == decltype(info)::npos) {
return;
}
if (info.find(":") != decltype(info)::npos) {
auto path = info.substr(0, info.find(":"));
auto target = dtb.node_by_path(path);
auto baud = info.substr(info.find(":") + 1);

auto path = info.substr(0, info.find(":"));
auto target = dtb.node_by_path(path);
emit_def_handle("__METAL_DT_STDOUT_UART_HANDLE", target, ".uart");
emit_def_handle("__METAL_DT_STDOUT_UART_HANDLE", target, ".uart");
emit_def("__METAL_DT_STDOUT_UART_BAUD", baud);
} else {
auto target = dtb.node_by_path(info);

auto baud = info.substr(info.find(":") + 1);
emit_def("__METAL_DT_STDOUT_UART_BAUD", baud);
emit_def_handle("__METAL_DT_STDOUT_UART_HANDLE", target, ".uart");
/* If no baud rate is specified, default to 115200 */
emit_def("__METAL_DT_STDOUT_UART_BAUD", "115200");
}
});
}

0 comments on commit 96886cd

Please sign in to comment.