### Install and Setup TFTP Server Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/getting-started.adoc Installs and configures the tftpd-hpa service for loading software onto the reference board. This includes installing the package, setting up the TFTP boot directory, adjusting permissions, and configuring the firewall. ```bash sudo apt-get install tftpd-hpa sudo mkdir /var/lib/tftpboot sudo chmod 777 /var/lib/tftpboot/ sudo ufw allow 69/udp -- Open Port 69 in Firewall(If Enabled) sudo systemctl restart tftpd-hpa ``` -------------------------------- ### Create Toolchain Directory Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa/docs/getting-started.adoc Creates the necessary directory structure for installing toolchains and BSPs. ```bash sudo mkdir -p /opt/mchp ``` -------------------------------- ### Install Basic SW Dependencies (Ubuntu) Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa/docs/getting-started.adoc Installs essential host tools required by MEPA on Ubuntu 18.04. This includes build tools, Ruby, and JSON development libraries. ```bash sudo apt-get install cmake cmake-curses-gui build-essential ruby ruby-parslet libjson-c-dev ``` -------------------------------- ### Install Basic SW Dependencies (Ubuntu) Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/getting-started.adoc Installs essential host tools required by MESA on Ubuntu 18.04, including cmake, build-essential, and ruby. It also creates a directory for toolchains and BSP. ```bash sudo apt-get install cmake cmake-curses-gui build-essential ruby ruby-parslet libjson-c-dev sudo mkdir -p /opt/mchp ``` -------------------------------- ### MEPA Build Process Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa/docs/getting-started.adoc Demonstrates the command-line steps to build the MEPA project using 'make', including scanning dependencies and building targets. ```shell $ make Scanning dependencies of target mepa_common [ 0%] Building C object CMakeFiles/mepa_common.dir/common/src/phy.c.o [ 33%] Linking C static library libmepa_common.a [ 33%] Built target mepa_common Scanning dependencies of target mepa_drv_lan8814 [ 66%] Building C object microchip/lan8814/CMakeFiles/mepa_drv_lan8814.dir/src/lan8814.c.o [ 66%] Building C object microchip/lan8814/CMakeFiles/mepa_drv_lan8814.dir/src/lan8814_ts.c.o [ 66%] Linking C static library libmepa_drv_lan8814.a [ 66%] Built target mepa_drv_lan8814 Scanning dependencies of target mepa_target [100%] Bundling mepa [100%] Built target mepa_target ``` -------------------------------- ### Create CMake Project for ARM64 Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa/docs/getting-started.adoc Creates a CMake project specifically for ARM64 targets. This script also handles fetching and installing the appropriate released package and BSP source if not already present. ```bash ./.cmake/create_cmake_project_new.rb arm64 ``` -------------------------------- ### Starting MEPA Demo Application Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/getting-started.adoc This command initiates the MEPA Demo Application on the vcoreiii system. It runs as a background daemon, enabling the `mepa-cmd` utility for issuing commands. ```bash $ mepa-demo-edsx ``` -------------------------------- ### PHY Initialization (C) Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa/docs/getting-started.adoc Example of building a C object file for the PHY driver, specifically for the lan8814 module. ```c Building C object CMakeFiles/mepa_drv_lan8814.dir/src/lan8814.c.o ``` -------------------------------- ### Build MEPA with ccmake GUI Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa/docs/getting-started.adoc Instructions on how to navigate to the build directory and use the ccmake interactive interface to select build targets, such as the LAN8814 library. ```bash cd build-arm64 ccmake .. Select MEPA_lan8814 target from ccmake GUI as below: BUILD_mepa ON CMAKE_BUILD_TYPE CMAKE_INSTALL_PREFIX /usr/local MEPA_aqr OFF MEPA_gpy211 OFF MEPA_ksz9031 OFF ``` -------------------------------- ### Create CMake Project Script Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa/docs/getting-started.adoc Provides the usage information for the script used to create a new CMake project. It lists available presets for different target architectures. ```bash $ ./.cmake/create_cmake_project_new.rb Usage: create_cmake_project_new [output-folder] Valid presets: mipsel mipsel-debug arm64 arm64-debug arm64-asan arm arm-debug x86 ``` -------------------------------- ### Configure Network with DHCP Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/getting-started.adoc Demonstrates how to configure network settings using the `dhcp` command in U-Boot, assuming a DHCP server is available. ```shell dhcp ``` -------------------------------- ### Finding Generated Static Libraries Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa/docs/getting-started.adoc Shows how to use the 'find' command to locate all generated static libraries (.a files) after the build process is complete. ```shell $ find . -name "*.a" ./libmepa.a ./libmepa_common.a ./microchip/lan8814/libmepa_drv_lan8814.a ``` -------------------------------- ### Boot FIT/ITB Images Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/getting-started.adoc Command to boot a FIT image with a given configuration. The output shows the loading of kernel, ramdisk, and fdt, followed by kernel startup and a login prompt. ```bash run ramboot => run ramboot ## Loading kernel from FIT Image at 740000000 ... Using 'edsx_emmc' configuration Trying 'kernel' kernel subimage Description: Linux kernel Type: Kernel Image Compression: gzip compressed Data Start: 0x7400000d0 Data Size: 5361490 Bytes = 5.1 MiB Architecture: AArch64 OS: Linux Load Address: 0x700080000 Entry Point: 0x700080000 Verifying Hash Integrity ... OK ## Loading ramdisk from FIT Image at 740000000 ... Using 'edsx_emmc' configuration Trying 'ramdisk' ramdisk subimage Description: ramdisk Type: RAMDisk Image Compression: uncompressed Data Start: 0x74051d0cc Data Size: 22597632 Bytes = 21.6 MiB Architecture: AArch64 OS: Linux Load Address: unavailable Entry Point: unavailable Verifying Hash Integrity ... OK ## Loading fdt from FIT Image at 740000000 ... Using 'edsx_emmc' configuration Trying 'fdt_edsx_emmc' fdt subimage Description: Flattened Device Tree blob Type: Flat Device Tree Compression: uncompressed Data Start: 0x741ab0880 Data Size: 15862 Bytes = 15.5 KiB Architecture: AArch64 Verifying Hash Integrity ... OK Booting using the fdt blob at 0x741ab0880 Working FDT set to 741ab0880 Uncompressing Kernel Image Loading Ramdisk to 702a73000, end 704000000 ... OK Loading Device Tree to 0000000702a6c000, end 0000000702a72df5 ... OK Working FDT set to 702a6c000 Reserved memory region for spin-table: addr=77ff3ee48 size=18 Reserved memory region for secure PSCI: addr=77ffb1000 size=3000 Starting kernel ... Starting syslogd: OK Starting klogd: OK mount: mounting /dev/mmcblk0p3 on /mnt failed: Invalid argument FAILED to mount /dev/mmcblk0p3 at /mnt Welcome to SMBStaX vcoreiii login: ``` -------------------------------- ### CMake Configuration Workflow Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/getting-started.adoc This outlines the key steps within the ccmake interface to configure the project and generate build files. It includes toggling advanced mode, configuring the project, and generating the Makefiles. ```bash # Press [c] to configure # Press [g] to generate Makefile ``` -------------------------------- ### MEPA Configuration Options Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa/docs/getting-started.adoc Lists the configurable options for the MEPA project, such as enabling or disabling specific hardware support and setting parameters like VTSS options. ```shell MEPA_lan8814 ON MEPA_vtss OFF MEPA_vtss_opt_10g OFF MEPA_vtss_opt_1g OFF MEPA_vtss_opt_cnt 64 MEPA_vtss_opt_macsec OFF MEPA_vtss_opt_ts OFF ``` -------------------------------- ### Extract MEPA Package Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa/docs/getting-started.adoc Extracts the MEPA source code archive. Assumes the archive is named 'mepa-.tar.gz'. ```bash $ tar xf mepa-.tar.gz $ cd mepa- ``` -------------------------------- ### Viewing MEPA Command Help Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/getting-started.adoc This command displays the available commands for the MEPA application, allowing users to understand the functionality and syntax for controlling PHYs and ports. ```bash $ mepa-cmd ``` -------------------------------- ### Extracting MEPA Sources Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/getting-started.adoc Demonstrates how to extract the MEPA packet archive using the tar command and navigate into the extracted directory. ```bash $ tar xvzf mepa-.tar.gz $ cd mepa- ``` -------------------------------- ### U-Boot Environment Variables Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/getting-started.adoc Lists and explains various U-Boot environment variables used for board configuration, including boot commands, console settings, network parameters, and flash-related variables. ```APIDOC baudrate=115200 bootargs_extra=loglevel=4 bootcmd=run mmc_boot bootdelay=3 console=ttyS0,115200n8 ethact=switch@0 ethaddr=2e:48:f9:c6:7f:eb fdtcontroladdr=77fb38fa0 ipaddr=10.99.10.1 loadaddr=740000000 mmc_bak=2 mmc_boot=run mmc_tryboot; env set mmc_cur ${mmc_bak}; run mmc_tryboot mmc_cur=1 mmc_dev=mmc 0 mmc_dlup=dhcp ${mmc_image}; unzip ${fileaddr} ${mmcaddr}; run mmc_update mmc_format=gpt guid ${mmc_dev} mmc_guid; gpt write ${mmc_dev} ${mmc_part}; env save mmc_image=new.ext4.gz mmc_part=uuid_disk=${mmc_guid};name=Boot0,size=1024MiB,type=linux;name=Boot1,size=1024MiB,type=linux;name=Data,size=1536MiB,type=linux mmc_set_blkcnt=setexpr mmc_blkcnt ${filesize} + 0x1ff; setexpr mmc_blkcnt ${mmc_blkcnt} / 0x200 mmc_swap=env set mmc_cur ${mmc_bak}; env save mmc_tryboot=run mmcload; setenv mtdroot root_next=/dev/mmcblk0p${mmc_cur}; run ramboot mmc_update=run mmcgetoffset; run mmc_set_blkcnt; mmc write ${mmcaddr} ${mmc_start} ${mmc_blkcnt} mmcaddr=760000000 mmcgetoffset=part start ${mmc_dev} ${mmc_cur} mmc_start mmcload=ext4load ${mmc_dev}:${mmc_cur} ${loadaddr} Image.itb mtdids=nor0=spi0.0mtdparts=mtdparts=spi0.0:1m(UBoot),256k(Env),256k(Env.bk),20m(linux),20m(linux.bk) nor_boot=sf probe; env set active linux; run nor_tryboot; env set active linux.bk; run nor_tryboot nor_dlup=dhcp ${nor_image}; run nor_update nor_image=new.itb nor_only=env set mtdparts mtdparts=${nor_parts}; env set bootcmd run nor_boot; env save nor_parts=spi0.0:1m(UBoot),256k(Env),256k(Env.bk),20m(linux),20m(linux.bk),32m(rootfs_data) nor_tryboot=mtd read ${active} ${loadaddr}; run ramboot nor_update=sf probe; sf update ${fileaddr} linux ${filesize} pc=edsx_emmc ramboot=run setup; bootm ${loadaddr}#${pc} rootargs=root=/dev/ram0 rw rootfstype=squashfs setup=setenv bootargs console=${console} ${mtdparts} ${rootargs} ${mtdroot} fis_act=${active} ${bootargs_extra} stderr=serial@600100000 stdin=serial@600100000 stdout=serial@600100000 ubupdate=sf probe; sf update ${fileaddr} 0 ${filesize} ver=U-Boot 2023.04 (Apr 15 2024 - 11:18:03 +0530)sparx5 ``` -------------------------------- ### Boot ext4 Image Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/getting-started.adoc Command to boot an ext4 image after it has been loaded into eMMC flash. The output shows the kernel loading process. ```bash run mmc_boot => run mmc_boot 5698260 bytes read in 128 ms (42.5 MiB/s) ## Loading kernel from FIT Image at 740000000 ... Using 'edsx_emmc' configuration Trying 'kernel' kernel subimage Description: Linux kernel Type: Kernel Image Compression: gzip compressed Data Start: 0x7400000d0 Data Size: 5361416 Bytes = 5.1 MiB Architecture: AArch64 OS: Linux Load Address: 0x700080000 Entry Point: 0x700080000 Verifying Hash Integrity ... OK ``` -------------------------------- ### MEPA Configuration Get and Set Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa/docs/mepa_instantiation.adoc Demonstrates how to get the current MEPA configuration, modify it, and then set the updated configuration. It's recommended to use the `_get()` variant before setting to maintain compatibility with future MEPA versions. ```c void APPL_example3(int port_no) { mepa_rc rc; mepa_conf_t conf; rc = mepa_conf_get(APPL_mepa_devices[port_no], &conf); if (rc != MEPA_RC_OK) { // handle error! } // Update config conf.admin.enable = 1; rc = mepa_conf_set(APPL_mepa_devices[port_no], &conf); if (rc != MEPA_RC_OK) { // handle error! } } ``` -------------------------------- ### CMake Project Configuration Output Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa/docs/getting-started.adoc Shows the output of the CMake configuration process for an ARM64 project. It details compiler identification, ABI checks, and project settings. ```cmake -- Removing old code base... -- Fetching latest copy... mchp-brsdk-arm64-2024.02.6-6-2024.12-soak.jenkins_unge -- The C compiler identification is GNU 13.3.0 -- The CXX compiler identification is GNU 13.3.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /opt/mchp/mchp-brsdk-arm64-2024.02.6-6-2024.12-soak.jenkins_unge/arm64-armv8_a-linux-gnu/xstax/release/x86_64-linux/bin/aarch64-linux-gcc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /opt/mchp/mchp-brsdk-arm64-2024.02.6-6-2024.12-soak.jenkins_unge/arm64-armv8_a-linux-gnu/xstax/release/x86_64-linux/bin/aarch64-linux-g++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Project name = mepa_api -- Type = Release -- c_flags = -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g0 -Wall -Wlogical-op -Wno-array-bounds -Wno-stringop-overflow -fasynchronous-unwind-tables -std=c99 -D_POSIX_C_SOURCE=200809L -D_BSD_SOURCE -D_DEFAULT_SOURCE -ldl -O3 -DNDEBUG -- EXE_LINKER_FLAGS = -- shared_linker_flags = -- Build mepa including -- Looking for include file endian.h -- Looking for include file endian.h - found -- Looking for include file asm/byteorder.h -- Looking for include file asm/byteorder.h - found -- Excluding file: /home/administrator/release/sw-mepa/mepa/microchip/lan80xx/src/lan80xx_serdes_config.h -- Excluding file: /home/administrator/release/sw-mepa/mepa/microchip/lan80xx/src/sha256/platform_util.h -- Excluding file: /home/administrator/release/sw-mepa/mepa/microchip/lan80xx/src/sha256/sha256.c -- Excluding file: /home/administrator/release/sw-mepa/mepa/microchip/lan80xx/src/sha256/sha256.h -- Excluding file: /home/administrator/release/sw-mepa/mepa/microchip/lan80xx/src/sha256/sha256_config.h -- CMAKE_TOOLCHAIN_FILE='/opt/mchp/mchp-brsdk-arm64-2024.02.6-6-2024.12-soak.jenkins_unge/arm64-armv8_a-linux-gnu/xstax/release/x86_64-linux/share/buildroot/toolchainfile.cmake' -- Configuring done (0.5s) -- Generating done (0.2s) -- Build files have been written to: /home/administrator/release/sw-mepa/build-arm64 ``` -------------------------------- ### Navigating to Build Directory Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/getting-started.adoc This command changes the current directory to the build folder created for the ARM64 architecture. This is a prerequisite step before running CMake configuration tools. ```bash cd build-arm64 ``` -------------------------------- ### Configure MMC Boot Parameters Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/getting-started.adoc Sets U-Boot environment variables to configure booting from MMC, including specifying the current and backup MMC partitions and the root arguments. ```APIDOC Set mmc_cur and mmc_bak for MMC updates: => setenv mmc_cur 5 => setenv mmc_bak 6 Set root arguments for MMC: => setenv rootargs_mmc 'root=/dev/ram0 rw rootwait' Set mtdroot for mounting rootfs: => setenv mtdroot 'root_next=/dev/mmcblk0p5' Set mmc_tryboot to load image and set root_next: => setenv mmc_tryboot 'run mmc_load;run ramboot;' Set setup with updated bootargs: => setenv setup 'setenv bootargs console=${console} ${mtdparts} ${rootargs_mmc} ${mtdroot} fis_act=${active} boot_source=${boot_source} ${bootargs_extra}' Run setup to update bootargs: => run setup Verify bootargs: => printenv bootargs bootargs=console=ttyS0,115200n8 mtdparts=spi0:1536k(fip),256k(Env),256k(Env.bk) root=/dev/ram0 rw rootwait root_next=/dev/mmcblk0p5 fis_act= boot_source=nor uio_pdrv_genirq.of_id=generic-uio loglevel=1 Set ramboot to boot kernel from loadaddr with Device Tree: => setenv ramboot 'bootm ${loadaddr}#lan9668_ung8385_0_at_lan966x' Save environment variables: => saveenv ``` -------------------------------- ### Create CMake Project for ARM64 Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/getting-started.adoc Uses a Ruby script to create a new CMake project, specifically for ARM64 targets. This process also fetches the latest MESA package and BSP if not already present. ```ruby require 'fileutils' def create_cmake_project_new(preset_name, output_folder = '.') puts "Usage: create_cmake_project_new [output-folder]" puts "\nValid presets:" puts " mipsel" puts " mipsel-debug" puts " arm64" puts " arm64-debug" puts " arm64-asan" puts " arm" puts " arm-debug" puts " x86" # Placeholder for actual script logic puts "Creating CMake project for preset: #{preset_name} in #{output_folder}" puts "Fetching latest copy..." # Simulate fetching and extraction puts "mchp-brsdk-arm64-2024.02.6-6-2024.12-soak.jenkins_unge" puts "-- The C compiler identification is GNU 13.3.0" puts "-- The CXX compiler identification is GNU 13.3.0" puts "-- Detecting C compiler ABI info" puts "-- Detecting C compiler ABI info - done" puts "-- Check for working C compiler: /opt/mchp/mchp-brsdk-arm64-2024.02.6-6-2024.12-soak.jenkins_unge/arm64-armv8_a-linux-gnu/xstax/release/x86_64-linux/bin/aarch64-linux-gcc - skipped" puts "-- Detecting C compile features" puts "-- Detecting C compile features - done" puts "-- Detecting CXX compiler ABI info" puts "-- Detecting CXX compiler ABI info - done" end # Example usage: # create_cmake_project_new('arm64') ``` -------------------------------- ### Switching to MDIO Bus for PHY Access (EDSx Boards) Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/getting-started.adoc For EDSx boards, this command allows switching the PHY management bus from SPI to MDIO by setting the `mdio_bus` environment variable to 1 before starting the MEPA Demo Application. EDS2 boards always use MDIO. ```bash $ mdio_bus=1 mepa-demo-edsx ``` -------------------------------- ### Running CMake Configuration Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/getting-started.adoc This command initiates the CMake configuration process within the build directory. It opens an interactive interface (ccmake) allowing users to view and modify build options, select targets, and configure the project before generating Makefiles. ```bash ccmake .. ``` -------------------------------- ### Show All Trace Levels Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/getting-started.adoc Lists all available modules and their current debug trace levels. The output shows the module, group, and level (e.g., 'error', 'debug'). ```bash # mepa-cmd deb tr ``` -------------------------------- ### TFTP Boot Command for ITB Image Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/getting-started.adoc Loads an ITB (Image Tree Blob) firmware image from a TFTP server into the device's memory. Replace the IP address and filename with your specific TFTP server details and firmware file. ```bash tftpboot ${loadaddr} 10.99.10.1:arm64_vsc7558TSN.itb ``` -------------------------------- ### U-Boot Configuration and Loading Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/getting-started.adoc This section details the U-Boot commands required to load the firmware over the network. It includes setting essential U-Boot variables, such as 'pcb', and then initiating the boot process. The firmware can be loaded as 'fit/itb' or 'ext4' images. ```APIDOC U-Boot Commands: Reset U-Boot Environment: env default -a env save - Resets U-Boot environment variables to their default values and saves them. Set Board Configuration Variable: setenv pcb edsx_emmc saveenv - Sets the 'pcb' variable to 'edsx_emmc' for EDSx boards and saves the environment. Load Firmware via TFTP (Example for 'ext4' image): setenv ipaddr setenv serverip setenv bootfile armv7_lan966x_ext4 tftpboot ${loadaddr} ${bootfile} - Sets IP addresses, specifies the boot file, and loads the firmware image from the TFTP server into memory. Boot from Loaded Image: bootm ${loadaddr} (for 'fit/itb' images) অথবা ext4load mmc 0:1 ${loadaddr} /boot/armv7_lan966x.ext4 setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait bootext4 ${loadaddr} - Boots the loaded firmware image from memory. The specific command depends on the image type ('fit/itb' or 'ext4'). ``` -------------------------------- ### Build Firmware with make Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/getting-started.adoc After configuring the build targets, use the 'make' command to build the firmware. The -jN option specifies the number of parallel jobs to use for building. This command generates binary images like arm64_vsc7558TSN.itb and arm64_vsc7558TSN.ext4.gz. ```makefile $ make -j12 ``` -------------------------------- ### Configure Build Target with ccmake Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/getting-started.adoc Navigate to the build directory and use ccmake to configure the build options. Enable IMG_armv7_lan966x_ext4 for the EDS2 board. After configuration, press 'c' to configure and 'g' to generate the Makefile. ```bash cd build-arm ccmake .. ``` -------------------------------- ### Copy Binary Images to TFTP Server Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/getting-started.adoc Copy the generated binary images from the build output directory to the TFTP server's root directory for network loading. The specific image to copy depends on the target platform (EDSx or EDS2). ```bash $ cp mepa_demo/arm64_vsc7558TSN.itb /var/lib/tftpboot/. $ cp mepa_demo/arm64_vsc7558TSN.ext4.gz /var/lib/tftpboot/. $ cp mepa_demo/arm64_vsc7558MSEC.itb /var/lib/tftpboot/. $ cp mepa_demo/arm64_vsc7558MSEC.ext4.gz /var/lib/tftpboot/. # For EDS2 platform: $ cp .build-arm/mepa-demo/armv7_lan966x_ext4 /var/lib/tftpboot/. ``` -------------------------------- ### Port Statistics Help Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/getting-started.adoc Provides help and syntax for retrieving port statistics. Users can specify port lists and types of statistics (packets, bytes, errors, discards) or clear them. ```APIDOC mepa-cmd port stati help Description: ------------ Show port statistics. Syntax: ------- Port Statistics [] [clear|packets|bytes|errors|discards] Parameters: ----------- : Port list, default: All ports clear : Clear port statistics packets : Show packet statistics bytes : Show byte statistics errors : Show error statistics discards : Show discard statistics (default: Show all port statistics) ``` -------------------------------- ### Example Warmstart Configuration Sequence Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa/docs/warm-restart-phy.adoc Demonstrates a typical sequence for configuring the PHY for a cold restart using the MEPA API. This involves getting the current restart configuration, setting it to cold, and then ending the configuration process. ```c mepa_restart_t restart; // Retrieve the current restart configuration mepa_warmstart_conf_get(dev, &restart); // Set the restart type to COLD restart = MEPA_RESTART_COLD; // Apply the new configuration mepa_warmstart_conf_set(dev, restart); // Synchronize the PHY instance with hardware mepa_warmstart_conf_end(dev); ``` -------------------------------- ### Static IP Configuration Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/getting-started.adoc Configures static IP address, gateway, and netmask for the device. These settings are crucial for network communication and TFTP transfers. Use `saveenv` to make them persistent. ```bash setenv ipaddr 10.99.10.10 setenv gatewayip 10.99.10.1 setenv netmask 255.255.255.0 ``` -------------------------------- ### TFTP Boot Command for EXT4 Image Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/getting-started.adoc Loads an EXT4 (Extended Filesystem) firmware image from a TFTP server into the device's memory. This is typically used for loading filesystem images. Ensure the TFTP server IP and filename are correct. ```bash tftpboot ${fileaddr} 10.99.10.1:arm64_vsc7558TSN.ext4.gz ``` -------------------------------- ### Show Port Packet Counters Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/getting-started.adoc Displays packet counters (received and transmitted) for a specified range of ports. The example shows packet counts for ports 1 through 8. ```bash # mepa-cmd port stati 1-8 pac ``` -------------------------------- ### MEPA API Usage Example: Get Autonegotiation Status Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa/docs/mepa_instantiation.adoc Demonstrates how to use a MEPA API function, `mepa_aneg_status_get`, to retrieve the autonegotiation status for a specific port. It includes error handling for the API call. ```c void APPL_example1(int port_no) { mepa_rc rc; mepa_aneg_status_t aneg_status; rc = mepa_aneg_status_get(APPL_mepa_devices[port_no], &aneg_status); if (rc != MEPA_RC_OK) { // handle error! } // Use aneg_status } ``` -------------------------------- ### Example: Get SecY Statistics Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/macsec-demo.adoc Example command to retrieve SecY statistics for a specific port and port ID. ```bash mepa-cmd statistics secy 13 port-id 4 get ``` -------------------------------- ### Start of Frame Configuration Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa/docs/basic.adoc API to get the configuration for the Start of Frame (SOF) pulse generation, which is related to frame preemption signaling. ```APIDOC mepa_start_of_frame_conf_get(phy_port) - Gets the start of frame configuration. - Parameters: - phy_port: The PHY port identifier. - Returns: The SOF configuration details. ``` -------------------------------- ### Example: Get Tx SC Statistics Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/macsec-demo.adoc Example command to retrieve Transmit Secure Channel (SC) statistics for a specific port and port ID. ```bash mepa-cmd statistics tx_sc 13 port-id 4 get ``` -------------------------------- ### Example: Get Tx SA Statistics Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/macsec-demo.adoc Example command to retrieve Transmit Secure Association (SA) statistics for a specific port, port ID, and association number (an). ```bash mepa-cmd statistics tx_sa 13 port-id 4 an 1 get ``` -------------------------------- ### MEPA Initialization Sequence Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa/docs/mepa_instantiation.adoc Demonstrates the MEPA initialization process, including setting the trace function, configuring board-specific data, creating MEPA devices for each port, and optionally linking base ports for multi-PHY configurations. ```c void mepa_init() { int i; // Hook in the trace function. MEPA_TRACE_FUNCTION = APPL_trace_func; // If board has a GPIO which needs to be toggled to release PHYs from reset, // then this can be done here. // Loop through all ports (PHYs) in the system. for (i = 0; i < APPL_PORT_CNT; ++i) { // Configure the board configuration (note temporary life time). mepa_board_conf conf = {}; conf.numeric_handle = i; // Fill application specific data in the context area. This is likely to // include bus instance, MDIO address etc. APPL_fill_port_data(i, &APPL_mepa_callout_cxt[i]); // Create the MEPA devices (real applications needs to check for error as // well). APPL_mepa_devices[i] = mepa_create(&APPL_mepa_callout, &APPL_mepa_callout_cxt[i], &conf); } // Optionally link to base port if dealing with dual/quad phy; for (i = 0; i < APPL_PORT_CNT; ++i) { // The application needs to keep track on which PHYs is located in common // packets. if (APPL_phy_base_dev(i, &APPL_mepa_callout_cxt[i])) { mepa_link_base_port(APPL_mepa_devices[i], APPL_phy_base_dev(i, &APPL_mepa_callout_cxt[i]), APPL_phy_pkg_idx(i, &APPL_mepa_callout_cxt[i])); } } } ``` -------------------------------- ### Get Control Frame Match Configuration Example Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/macsec-demo.adoc Example output from retrieving control frame match configurations, showing rule ID, Ethertype, DMAC Address, and Match type. ```bash # mepa-cmd ctrl_frame get 13 Rules configured for 802.1X Control Traffic Bypass on Port 12 ================================================================================================== Rule id Ethertype DMAC Address Match --------------------------------------------------------------------------------- 2 2048 00-01-00-00-00-00 Ethtype ``` -------------------------------- ### Example: Get Rx SC Statistics Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/macsec-demo.adoc Example command to retrieve Receive Secure Channel (SC) statistics for a specific port, port ID, and secure channel ID (sc_id). ```bash mepa-cmd statistics rx_sc 13 port-id 4 sc-id 2 get ``` -------------------------------- ### MEPA PHY Warm Start Configuration Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa/docs/warm-restart-phy.adoc This snippet demonstrates how to get the current warm start configuration of the MEPA PHY, set it to a warm restart state, and then finalize the configuration. ```c mepa_restart_t restart; mepa_warmstart_conf_get(dev, &restart); restart = MEPA_RESTART_WARM; mepa_warmstart_conf_set(dev, restart); mepa_warmstart_conf_end(dev); ``` -------------------------------- ### Enable/Disable Port Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/getting-started.adoc This command allows enabling or disabling specific network ports. Disabling NPI ports is recommended to prevent traffic leakage. ```bash # mepa-cmd port state [enable | disable] ``` -------------------------------- ### MEPA Instantiation and Callbacks Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa/docs/mepa_instantiation.adoc Demonstrates the conceptual process of creating a MEPA instance, highlighting the need for application-specific callout functions for register access and synchronization. This includes defining the `mepa_callout_cxt` structure. ```c // Copyright (c) 2004-2020 Microchip Technology Inc. and its subsidiaries. // SPDX-License-Identifier: MIT // Define the application specific addressing parameters. typedef struct mepa_callout_cxt { // ... application specific members ... } mepa_callout_cxt_t; // Conceptual example of MEPA instance creation (pseudo code) // mepa_device_t *mepa_device; // mepa_callout_t callouts; // mepa_callout_cxt_t callout_cxt; // Initialize callouts structure with application-specific functions // callouts.read = my_mepa_read_func; // callouts.write = my_mepa_write_func; // callouts.lock_enter = my_lock_enter_func; // callouts.lock_exit = my_lock_exit_func; // Create MEPA instance // mepa_device = mepa_create(&callouts, &callout_cxt); // ... rest of the application logic ... ``` -------------------------------- ### Loopback Demo Application Help Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/loopback-demo.adoc Command to display the available arguments and syntax for the Loopback Demo Application. It provides details on the 'loopback' command, its parameters, and their descriptions. ```bash mepa-cmd loopback ? ``` -------------------------------- ### Dump API/AIL State for Ports Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/getting-started.adoc This command dumps the state of the Application Interface Layer (AIL) for specified ports, including mapping, configuration, and forwarding details. ```bash # mepa-cmd deb api ail port 1-4 ``` -------------------------------- ### CMake Build Configuration Options Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/getting-started.adoc This snippet displays common CMake configuration options for the MEPA project. It shows settings for shared/static libraries, the main MEPA module, and specific image targets for different board types and chip variants. Users can modify these options via `ccmake` to customize their build. ```cmake BUILD_SHARED_LIBS OFF BUILD_STATIC_LIBS ON BUILD_mepa ON IMG_arm64_vsc7558MSEC_ext4 OFF IMG_arm64_vsc7558TSN_ext4 OFF MEPA_aqr OFF MEPA_dummy_phy OFF ``` -------------------------------- ### Running the Loopback Demo Application Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/loopback-demo.adoc Command to run the Loopback Demo Application. It takes the port number and an optional configuration file as arguments. The configuration file specifies the loopback settings for the PHY. ```bash mepa-cmd loopback -f ``` -------------------------------- ### Rx Secure Channel Configuration Example Source: https://github.com/microchip-ung/sw-mepa/blob/master/mepa_demo/docs/macsec-demo.adoc Example of configuring Rx Secure Channel for a specific port and channel, including lowest Pn, active status, key, and hash key. ```bash # mepa-cmd conf_get rx_sa 13 port-id 4 sc-id 5 an 2 Rx Secure Channel Configuration for port no 12 with port id 4 and channel id 5 and an = 2 ==================================================================================================== Lowest Pn : 3 Active : Yes Key : 10, 13, 7, 10, 2, 11, 13, 0, 3, 14, 10, 12, 8, 3, 5, 10, 6, 15, 6, 2, 0, 15, 13, 12, 11, 5, 0, 6, 11, 3, 4, 5 Hash Key : 115, 162, 61, 128, 18, 29, 226, 213, 168, 80, 37, 63, 207, 67, 18, 14 Salt : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 110, 1 ```