Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
app-notes:ai-features [2026/10/14 15:19] – [The next thing you'll need is the DX-RT runtime software] grayapp-notes:ai-features [2026/11/01 19:15] (current) – [Adjust the LXC config so that the USB port can be used in the container] gray
Line 21: Line 21:
     * Not available for legacy products NB1600, NB2700, NB3700, NB3710     * Not available for legacy products NB1600, NB2700, NB3700, NB3710
  
-**+
 <WRAP center round important 90%> <WRAP center round important 90%>
 The wiki was tested with router software nrsw-image-2800-0.0.0.0.img and the LXC container with debina 13 armhf (trixie) The wiki was tested with router software nrsw-image-2800-0.0.0.0.img and the LXC container with debina 13 armhf (trixie)
 </WRAP> </WRAP>
-**+
  
 ---- ----
Line 227: Line 227:
 With this information, we can adjust the LXC configuration so that we have access to the device from within the container. With this information, we can adjust the LXC configuration so that we have access to the device from within the container.
  
-** 
 <WRAP center round important 90%> <WRAP center round important 90%>
 This change is made directly in the router software. When updating the router software, this entry must be made again because it is not part of the official software. This change is made directly in the router software. When updating the router software, this entry must be made again because it is not part of the official software.
 </WRAP> </WRAP>
-** 
  
 Add these entries to the end of the ''config'' file. Add these entries to the end of the ''config'' file.
Line 380: Line 378:
 root@LXCNAME:~# apt install libncurses-dev root@LXCNAME:~# apt install libncurses-dev
 root@LXCNAME:~# apt install libonnxruntime-dev root@LXCNAME:~# apt install libonnxruntime-dev
 +root@LXCNAME:~# apt install nano
 </konsole> </konsole>
  
 You can then proceed with the installation of the DX-RT (runtime software). You can then proceed with the installation of the DX-RT (runtime software).
 +
 +Open the file `safe_cast.h` using the `nano` tool.
 +
 +<code>
 +nano /mnt/home/data/dx-all-suite/dx-runtime/dx_rt/lib/include/dxrt/safe_cast.h
 +</code>
 +
 +Delete the code block
 +
 +<code>
 +// For consistency with FromAddr, specify destination type as is (e.g., FromAddr<int*>)
 +
 +. . .
 +
 +}
 +</code>
 +
 +and replace it with this code.
 +
 +<code>
 +// For consistency with FromAddr, specify destination type as is (e.g., FromAddr<int*>)
 +    template <typename T_Dest, typename T_Src>
 +    static inline T_Dest IntegerToPointer(T_Src addr) noexcept {
 +        static_assert(std::is_pointer<T_Dest>::value, "Error: Destination must be a pointer type");
 +        static_assert(std::is_integral<T_Src>::value && std::is_unsigned<T_Src>::value,
 +                      "Error: Source must be an unsigned integral type");
 +
 +        // On platforms where uintptr_t is narrower than T_Src (e.g. 32-bit targets
 +        // receiving 64-bit addresses from a protocol/driver struct), make sure no
 +        // address bits are silently dropped.
 +        assert(static_cast<T_Src>(static_cast<uintptr_t>(addr)) == addr &&
 +               "Error: address value does not fit in uintptr_t on this platform");
 +
 +        return reinterpret_cast<T_Dest>(static_cast<uintptr_t>(addr));  // NOSONAR: S3630
 +    }
 +</code>
 +
  
 <konsole> <konsole>
 root@LXCNAME:~# cd /mnt/home/data/dx-all-suite/dx-runtime/dx_rt root@LXCNAME:~# cd /mnt/home/data/dx-all-suite/dx-runtime/dx_rt
- 
-root@LXCNAME:~# cmake -S . -B build -DPython_EXECUTABLE=/usr/bin/python3 -Donnxruntime_INCLUDE_DIRS=/mnt/home/data/dx-all-suite/dx-runtime/dx_rt/extern/onnxruntime-win-x64-1.20.1/include -Donnxruntime_LIB_DIRS=/mnt/home/data/dx-all-suite/dx-runtime/dx_rt/extern/onnxruntime-win-x64-1.20.1/lib 
  
 root@LXCNAME:~# sed -i 's/uint64_t addr;/uintptr_t addr;/' /mnt/home/data/dx-all-suite/dx-runtime/dx_rt/lib/buffer.cpp root@LXCNAME:~# sed -i 's/uint64_t addr;/uintptr_t addr;/' /mnt/home/data/dx-all-suite/dx-runtime/dx_rt/lib/buffer.cpp
 +
 +root@LXCNAME:~# cmake -S . -B build -DPython_EXECUTABLE=/usr/bin/python3 -Donnxruntime_INCLUDE_DIRS=/mnt/home/data/dx-all-suite/dx-runtime/dx_rt/extern/onnxruntime-win-x64-1.20.1/include -Donnxruntime_LIB_DIRS=/mnt/home/data/dx-all-suite/dx-runtime/dx_rt/extern/onnxruntime-win-x64-1.20.1/lib
  
 root@LXCNAME:~# cmake --build build -j1 root@LXCNAME:~# cmake --build build -j1
 </konsole> </konsole>
 +and replace it with this code.
 <code> <code>
-cmake -S . -B build -DPython_EXECUTABLE=/usr/bin/python3 -Donnxruntime_INCLUDE_DIRS=/mnt/home/data/dx-all-suite/dx-runtime/dx_rt/extern/onnxruntime-win-x64-1.20.1/include -Donnxruntime_LIB_DIRS=/mnt/home/data/dx-all-suite/dx-runtime/dx_rt/extern/onnxruntime-win-x64-1.20.1/lib 
- 
 sed -i 's/uint64_t addr;/uintptr_t addr;/' \ sed -i 's/uint64_t addr;/uintptr_t addr;/' \
   /mnt/home/data/dx-all-suite/dx-runtime/dx_rt/lib/buffer.cpp   /mnt/home/data/dx-all-suite/dx-runtime/dx_rt/lib/buffer.cpp
 +
 +cmake -S . -B build -DPython_EXECUTABLE=/usr/bin/python3 -Donnxruntime_INCLUDE_DIRS=/mnt/home/data/dx-all-suite/dx-nano /mnt/home/data/dx-all-suite/dx-runtime/dx_rt/lib/include/dxrt/safe_cast.hruntime/dx_rt/extern/onnxruntime-win-x64-1.20.1/include -Donnxruntime_LIB_DIRS=/mnt/home/data/dx-all-suite/dx-runtime/dx_rt/extern/onnxruntime-win-x64-1.20.1/lib
  
 cmake --build build -j1 cmake --build build -j1