From 31cf1a660f636644d7848325c9cf8db64fb98d49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Artur=20N=C3=B3brega?= Date: Sat, 30 Aug 2025 03:08:24 +0100 Subject: [PATCH 1/8] docs(README): Add ethernet information to README --- README.md | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index c6f64df..3d32acd 100644 --- a/README.md +++ b/README.md @@ -51,13 +51,15 @@ The bootloader in SoCLinux differs from that in IOb-SoC. In SoCLinux, the bootlo The boot control unit in SoCLinux, unlike IOb-SoC, is a distinct module and exclusively manages the boot process state. On the software side, the SoCLinux bootloader initially loads a file named soc_linux_mem.config, which specifies the files and their respective memory addresses to be copied into external memory. - ## Ethernet simulation -The ethernet simulation requires setting up dummy interfaces with -`eth-[SIMULATOR]` that require `sudo`: -Setup the following interfaces with the commands: +The ethernet simulation requires dummy interfaces, named `eth-[SIMULATOR]`. + +The SoCLinux template automatically creates Makefiles in the build directory to create these interfaces during the build process for simulation. +These interfaces require root privileges to be created, so the Makefile may request for sudo/root password during the build process for simulation. + +Alternatively, to setup these dummy interfaces manually, run the following commands: ```bash sudo modprobe dummy sudo ip link add eth-icarus type dummy @@ -102,12 +104,32 @@ sudo ip link set [interface] promisc on The system's Python scripts need RAW frame access for Ethernet communication. To achieve this, the Python interpreter must have the CAP_NET_RAW capability. -The 'ETHERNET' submodule already includes a Python wrapper that provides RAW frame access. -To build the python wrapper, run: +The [iob-eth](https://github.com/IObundle/iob-eth/tree/master/scripts/pyRawWrapper) repository includes a wrapper for the Python binary that provides RAW frame access. +The iob-eth's scripts will copy this wrapper's Makefile and source files to the build directory under the folder `path/to/build/dir/scripts/pyRawWrapper/`. + +The SoCLinux template will generate a Makefile in the build directory to automatically create the Python wrapper during the build process for simulation and FPGA. + +Alternatively, to build the python wrapper manually, run: ```bash -make -C submodules/ETHERNET/scripts/pyRawWrapper +make -C ../soc_linux_V*/scripts/pyRawWrapper +``` + +It is also possible to use a custom python wrapper located in a different path by setting the `IOB_CONSOLE_PYTHON_ENV` environment variable: +```bash +export IOB_CONSOLE_PYTHON_ENV=/path/to/custom/pyRawWrapper +``` + +## Common issues: + +```bash +unable to set iab: Operation not permitted +``` + +This error usually appears when the pyRawWrapper does not have the linux 'CAP_NET_RAW' capability set. +Running the following command with root privileges will set the capability: +```bash +setcap cap_net_raw,cap_setpcap=p path/to/pyRawWrapperBinary ``` ---> # Tutorial: Add New Device Driver Checkout [this tutorial](document/device_driver_tutorial.md) for more details on From 173447eeb74970ec0793ea8f6f8af42c6fd91996 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Artur=20N=C3=B3brega?= Date: Sun, 31 Aug 2025 13:23:24 +0100 Subject: [PATCH 2/8] refactor(makefile): Refactor python paremters; Update README. --- Makefile | 19 ++++++++++++++++++- README.md | 9 +++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 05434c5..0cf951d 100644 --- a/Makefile +++ b/Makefile @@ -24,8 +24,25 @@ ifneq ($(DEBUG),) EXTRA_ARGS +=--debug_level $(DEBUG) endif +# System parameters +ifneq ($(INIT_MEM),) +PY_PARAMS:=$(PY_PARAMS):init_mem=$(INIT_MEM) +endif +ifneq ($(USE_INTMEM),) +PY_PARAMS:=$(PY_PARAMS):use_intmem=$(USE_INTMEM) +endif +ifneq ($(USE_EXTMEM),) +PY_PARAMS:=$(PY_PARAMS):use_extmem=$(USE_EXTMEM) +endif +ifneq ($(USE_ETHERNET),) +PY_PARAMS:=$(PY_PARAMS):use_ethernet=$(USE_ETHERNET) +endif +# Remove first char (:) from PY_PARAMS +PY_PARAMS:=$(shell echo $(PY_PARAMS) | cut -c2-) + + setup: - nix-shell --run "py2hwsw $(CORE) setup --no_verilog_lint --py_params 'use_intmem=$(USE_INTMEM):use_extmem=$(USE_EXTMEM):init_mem=$(INIT_MEM)' $(EXTRA_ARGS)" + nix-shell --run "py2hwsw $(CORE) setup --no_verilog_lint --py_params '$(PY_PARAMS)' $(EXTRA_ARGS)" pc-emul-run: nix-shell --run "make clean setup && make -C ../$(CORE)_V$(VERSION)/ pc-emul-run" diff --git a/README.md b/README.md index 3d32acd..30b3ea1 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,15 @@ The bootloader in SoCLinux differs from that in IOb-SoC. In SoCLinux, the bootlo The boot control unit in SoCLinux, unlike IOb-SoC, is a distinct module and exclusively manages the boot process state. On the software side, the SoCLinux bootloader initially loads a file named soc_linux_mem.config, which specifies the files and their respective memory addresses to be copied into external memory. --> +## Ethernet + +The SoCLinux template supports ethernet communication by default. +The bootloader and firmware provided use ethernet to speed up file transfers. + +However, to setup the ethernet interfaces on the host machine, root privileges are required. +As an alternative, ethernet can be disable by passing `USE_ETHERNET=0` to the make command. +This will cause SocLinux to generate a system without ethernet support, and make all file transfers via serial communication. + ## Ethernet simulation The ethernet simulation requires dummy interfaces, named `eth-[SIMULATOR]`. From b93c951f1539f1e6518e40727c20965c46b3654f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Artur=20N=C3=B3brega?= Date: Sun, 31 Aug 2025 13:25:27 +0100 Subject: [PATCH 3/8] feat(py2hwsw): Update py2hwsw version --- default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/default.nix b/default.nix index 9c75005..73bc34e 100644 --- a/default.nix +++ b/default.nix @@ -5,8 +5,8 @@ { pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/24.05.tar.gz") {} }: let - py2hwsw_commit = "c4ea097573a8e399b3ee0814004ea46e18d3d4f6"; # Replace with the desired commit. - py2hwsw_sha256 = "ZXfn5J9mLLxh/o46ik9syKuDhoFY9NMzdQ/SDDkjXPg="; # Replace with the actual SHA256 hash. + py2hwsw_commit = "88aa0751afe697e5be1254b2fb7b7c007bf1eaa1"; # Replace with the desired commit. + py2hwsw_sha256 = "7FzKUAjqYn79G6lX7CWMGAs34PeULTamjV1UChf6EDw="; # Replace with the actual SHA256 hash. # Get local py2hwsw root from `PY2HWSW_ROOT` env variable py2hwswRoot = builtins.getEnv "PY2HWSW_ROOT"; From 205c586cf10987888531e9846a18f6046ef6d38e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Artur=20N=C3=B3brega?= Date: Sun, 31 Aug 2025 13:42:28 +0100 Subject: [PATCH 4/8] feat(py2hwsw): Update py2hwsw version --- default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/default.nix b/default.nix index 73bc34e..274dd8b 100644 --- a/default.nix +++ b/default.nix @@ -5,8 +5,8 @@ { pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/24.05.tar.gz") {} }: let - py2hwsw_commit = "88aa0751afe697e5be1254b2fb7b7c007bf1eaa1"; # Replace with the desired commit. - py2hwsw_sha256 = "7FzKUAjqYn79G6lX7CWMGAs34PeULTamjV1UChf6EDw="; # Replace with the actual SHA256 hash. + py2hwsw_commit = "0ccdf12d197e5746b807a3eaed6922b4209eba37"; # Replace with the desired commit. + py2hwsw_sha256 = "khRmu67kRlTqC34Td5LcaiyPXZ5tNzZoLMGpe88beC0="; # Replace with the actual SHA256 hash. # Get local py2hwsw root from `PY2HWSW_ROOT` env variable py2hwswRoot = builtins.getEnv "PY2HWSW_ROOT"; From 792b55eb3bd8abedef1ece55ef35058e8e76c9dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Artur=20N=C3=B3brega?= Date: Mon, 1 Sep 2025 06:15:08 +0100 Subject: [PATCH 5/8] re-run ci.yml I changed the environment on IObundle machines that should fix the ethernet python RAW frame access. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 30b3ea1..b2d1336 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,7 @@ The bootloader in SoCLinux differs from that in IOb-SoC. In SoCLinux, the bootlo The boot control unit in SoCLinux, unlike IOb-SoC, is a distinct module and exclusively manages the boot process state. On the software side, the SoCLinux bootloader initially loads a file named soc_linux_mem.config, which specifies the files and their respective memory addresses to be copied into external memory. --> + ## Ethernet The SoCLinux template supports ethernet communication by default. From b706ed2fe0dbeb69d5eed23782deecd2e20b5fb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Artur=20N=C3=B3brega?= Date: Mon, 1 Sep 2025 07:01:23 +0100 Subject: [PATCH 6/8] feat(py2hwsw): Update py2hwsw version --- default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/default.nix b/default.nix index 274dd8b..03f1747 100644 --- a/default.nix +++ b/default.nix @@ -5,8 +5,8 @@ { pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/24.05.tar.gz") {} }: let - py2hwsw_commit = "0ccdf12d197e5746b807a3eaed6922b4209eba37"; # Replace with the desired commit. - py2hwsw_sha256 = "khRmu67kRlTqC34Td5LcaiyPXZ5tNzZoLMGpe88beC0="; # Replace with the actual SHA256 hash. + py2hwsw_commit = "6393cb57d49a4529e22ff3fd400fd879b8ffbcb2"; # Replace with the desired commit. + py2hwsw_sha256 = "Ud2aZo0YsKGNvODtByf25P/PIpan+3voUO7aP5ODu6c="; # Replace with the actual SHA256 hash. # Get local py2hwsw root from `PY2HWSW_ROOT` env variable py2hwswRoot = builtins.getEnv "PY2HWSW_ROOT"; From a52973de8395ab20f1a045af90817952d8065d56 Mon Sep 17 00:00:00 2001 From: arturum1 <34355224+arturum1@users.noreply.github.com> Date: Mon, 1 Sep 2025 22:01:25 +0100 Subject: [PATCH 7/8] Update README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b2d1336..83b41bf 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ The bootloader and firmware provided use ethernet to speed up file transfers. However, to setup the ethernet interfaces on the host machine, root privileges are required. As an alternative, ethernet can be disable by passing `USE_ETHERNET=0` to the make command. -This will cause SocLinux to generate a system without ethernet support, and make all file transfers via serial communication. +This will cause SoCLinux to generate a system without ethernet support, and make all file transfers via serial communication. ## Ethernet simulation From 2bbd2c839afa8a8213fd26ae9b0c27475c377048 Mon Sep 17 00:00:00 2001 From: arturum1 <34355224+arturum1@users.noreply.github.com> Date: Mon, 1 Sep 2025 22:06:17 +0100 Subject: [PATCH 8/8] Fix typo in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 83b41bf..9d2529f 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ The SoCLinux template supports ethernet communication by default. The bootloader and firmware provided use ethernet to speed up file transfers. However, to setup the ethernet interfaces on the host machine, root privileges are required. -As an alternative, ethernet can be disable by passing `USE_ETHERNET=0` to the make command. +As an alternative, ethernet can be disabled by passing `USE_ETHERNET=0` to the make command. This will cause SoCLinux to generate a system without ethernet support, and make all file transfers via serial communication. ## Ethernet simulation