Skip to content

Commit

Permalink
Set default PMR
Browse files Browse the repository at this point in the history
  • Loading branch information
serges147 committed Nov 5, 2024
1 parent 19d09cb commit 09704c1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

- name: get nunavut
run: >
pip install git+https://github.com/OpenCyphal/nunavut.git@7f62204ddec9e5d4fbe4a969f9fcdfd5d045d35b
pip install git+https://github.com/OpenCyphal/nunavut.git@3.0.preview
- name: Configure CMake
run: cmake -B ${{github.workspace}}/libcyphal_demo/build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} ${{github.workspace}}/libcyphal_demo
Expand Down
7 changes: 6 additions & 1 deletion libcyphal_demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ This document will walk you through the process of building, running, and evalua
on a GNU/Linux-based OS.
It can be easily ported to another platform, such as a baremetal MCU,
by replacing the POSIX socket API and stdio with suitable alternatives;
for details, please consult with `udp.h` and `storage.h`. **FIXME**
for details, please consult with:
- `platform/posix/udp/*` files regarding UDP transport
- `platform/linux/can/*` files regarding CAN transport
- `platform/linux/epoll_single_threaded_executor.hpp` file regarding the executor
- `platform/storage.hpp` file regarding the non-volatile storage
- `platform/o1_heap_memory_resource.hpp` file regarding the memory resource

## Preparation

Expand Down
4 changes: 4 additions & 0 deletions libcyphal_demo/src/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Application::Application()
, registry_{o1_heap_mr_}
, regs_{registry_}
{
cetl::pmr::set_default_resource(&o1_heap_mr_);

load(storage_, registry_);

// Maybe override some of the registry values with environment variables.
Expand Down Expand Up @@ -67,6 +69,8 @@ Application::~Application()
<< " peak_allocated=" << mr_diag.peak_allocated << "\n"
<< " peak_request_size=" << mr_diag.peak_request_size << "\n"
<< " oom_count=" << mr_diag.oom_count << "\n";

cetl::pmr::set_default_resource(cetl::pmr::new_delete_resource());
}

/// Returns the 128-bit unique-ID of the local node. This value is used in `uavcan.node.GetInfo.Response`.
Expand Down

0 comments on commit 09704c1

Please sign in to comment.