Skip to content

Commit

Permalink
Merge pull request #169 from sifive/pick-first-unnamed-reg
Browse files Browse the repository at this point in the history
Get first unnamed reg from a memory node
  • Loading branch information
nategraff-sifive committed Oct 23, 2019
2 parents eba4dcd + 8497af1 commit 5bb9f91
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions linker_script/freedom-ldscript-generator.c++
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <iostream>
#include <list>
#include <regex>
#include <tuple>

#include <fdt.h++>

Expand Down Expand Up @@ -123,11 +124,12 @@ int main(int argc, char *argv[]) {
m.size = ranges.front().size;
}
} else {
n.maybe_tuple("reg", tuple_t<target_addr, target_size>(), [&]() {},
[&](target_addr b, target_size s) {
m.base = b;
m.size = s;
});
auto regs = n.get_fields<std::tuple<target_addr, target_size>>("reg");

if (!regs.empty()) {
m.base = std::get<0>(regs.front());
m.size = std::get<1>(regs.front());
}
}
};

Expand Down

0 comments on commit 5bb9f91

Please sign in to comment.