mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
fix throwing an error in villas-fpga-cat leading to abort, because of wrong deconstructor order
Signed-off-by: Niklas Eiling <niklas.eiling@eonerc.rwth-aachen.de>
This commit is contained in:
parent
f26656a90d
commit
404bc9c8be
2 changed files with 14 additions and 5 deletions
|
@ -1 +1 @@
|
|||
Subproject commit b7e176fdb69025a2bdb9fa27efa7d3b524a905cd
|
||||
Subproject commit 8dcf83bf0fbc258bb54db2434df796255119213f
|
|
@ -72,6 +72,13 @@ int main(int argc, char* argv[])
|
|||
return 1;
|
||||
}
|
||||
|
||||
//FIXME: This must be called before card is intialized, because the card descructor
|
||||
// still accesses the allocated memory. This order ensures that the allocator
|
||||
// is destroyed AFTER the card.
|
||||
auto &alloc = villas::HostRam::getAllocator();
|
||||
villas::MemoryAccessor<int32_t> mem[] = {alloc.allocate<int32_t>(0x200), alloc.allocate<int32_t>(0x200)};
|
||||
const villas::MemoryBlock block[] = {mem[0].getMemoryBlock(), mem[1].getMemoryBlock()};
|
||||
|
||||
auto card = fpga::setupFpgaCard(configFile, fpgaName);
|
||||
|
||||
std::vector<fpga::ip::AuroraXilinx::Ptr> aurora_channels;
|
||||
|
@ -104,10 +111,6 @@ int main(int argc, char* argv[])
|
|||
#else
|
||||
dma->connectLoopback();
|
||||
#endif
|
||||
auto &alloc = villas::HostRam::getAllocator();
|
||||
villas::MemoryAccessor<int32_t> mem[] = {alloc.allocate<int32_t>(0x200), alloc.allocate<int32_t>(0x200)};
|
||||
const villas::MemoryBlock block[] = {mem[0].getMemoryBlock(), mem[1].getMemoryBlock()};
|
||||
|
||||
for (auto b : block) {
|
||||
dma->makeAccesibleFromVA(b);
|
||||
}
|
||||
|
@ -152,6 +155,12 @@ int main(int argc, char* argv[])
|
|||
return -1;
|
||||
} catch (const CLI::ParseError &e) {
|
||||
return app.exit(e);
|
||||
} catch (const std::exception &e) {
|
||||
logger->error("Error: {}", e.what());
|
||||
return -1;
|
||||
} catch (...) {
|
||||
logger->error("Unknown error");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue