### Install QEMU and Libvirt Packages Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/quickstart/ia32-generic-qemu.md Installs necessary packages for QEMU and libvirt on an Ubuntu host. Ensures libvirtd service is enabled and started. ```shell sudo apt update sudo apt install qemu-system-common libvirt-clients libvirt-daemon systemctl enable libvirtd.service systemctl start libvirtd.service ``` -------------------------------- ### QEMU Version Output Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/quickstart/ia32-generic-qemu.md Example output showing the installed QEMU version. This confirms the emulator is ready for use. ```shell qemu-system-i386 --version QEMU emulator version 4.2.1 (Debian 1:4.2-3ubuntu6.24) Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers ~$ ``` -------------------------------- ### Start Barometer Simsensor Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/devices/simsensors.md Example command to start a simulated barometer sensor using a specific mock measurements file. ```shell ./sbin/sensors -s baro_sim:./etc/mock_measurements.csv ``` -------------------------------- ### Install QEMU on Ubuntu Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/quickstart/riscv64-generic-qemu.md Installs QEMU and related virtualization tools on Ubuntu systems. Ensure your system is up-to-date before installation. ```shell sudo apt update && \ sudo apt install -y \ qemu-system \ virt-manager \ virt-viewer \ libvirt-clients \ libvirt-daemon-system \ bridge-utils \ virtinst \ libvirt-daemon ``` -------------------------------- ### QEMU Version Output Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/quickstart/riscv64-generic-qemu.md Example output showing the installed QEMU emulator version for RISC-V 64. ```text ~$ qemu-system-riscv64 --version QEMU emulator version 4.2.1 (Debian 1:4.2-3ubuntu6.24) Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers ~$ ``` -------------------------------- ### Example ioctl Usage Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/libc/functions/ioctl/ioctl.part-impl.md An example demonstrating how to open a device and send a custom ioctl request with data. ```c #include #include #include #include #define REQUEST _IOC(IOC_IN, 'A', 0x01, int) int main() { int fd; int data = 4; if (fd = open(PATH, O_WRONLY) < 0) { fprintf(stderr, "Cannot open special device file\n"); exit(EXIT_FAILURE); } /* * Send request with additional data to device server, * assuming device server successfully created and accept our request. */ if (ioctl(fd, REQUEST, &data) < 0) { fprintf(stderr, "Something went wrong\n"); } } ``` -------------------------------- ### Start and Autostart Default Network Bridge Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/quickstart/ia32-generic-qemu.md Configures the default libvirt network bridge to start automatically on boot and starts it immediately. ```shell sudo virsh net-autostart --network default sudo virsh net-start --network default ``` -------------------------------- ### Start WSL Subsystem Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/building/windows.md Initiates the Windows Subsystem for Linux environment after installation. This may take some time on the first run and will prompt for sudo credentials. ```powershell wsl ``` -------------------------------- ### Check QEMU Installation Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/quickstart/armv8r52-mps3an536-qemu.md Verify that QEMU is installed and check its version. This command confirms the successful installation of the QEMU emulator. ```shell qemu-system-arm --version ``` -------------------------------- ### Install Device Tree Compiler Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/quickstart/riscv64-generic-spike.md Install the device-tree-compiler utility, which is a dependency for building the Spike simulator. ```shell sudo apt-get update && \ sudo apt-get install device-tree-compiler ``` -------------------------------- ### Start Execution in GRMON Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/quickstart/sparcv8leon-gr740-mini.md Initiate the execution of the loaded system image from the GRMON monitor. This command sets the entry point and starts the processor. ```shell ep 0xc0000000 run ``` -------------------------------- ### Example Phoenix-RTOS File Header Implementation Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/coding/index.md Provides a concrete example of a file header for an operating system kernel file, demonstrating the correct placement of project details, copyright, authors, and license. ```c /* * Phoenix-RTOS * * Operating system kernel * * pmap - machine dependent part of VM subsystem (ARM) * * Copyright 2014-2015 Phoenix Systems * Copyright 2005-2006 Pawel Pisarczyk * Author: Pawel Pisarczyk, Radoslaw F. Wawrzusiak, Jacek Popko * * SPDX-License-Identifier: BSD-3-Clause */ ``` -------------------------------- ### Build and Install Spike Simulator Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/quickstart/riscv64-generic-spike.md Configure, build, and install the Spike RISC-V ISA Simulator. Ensure the RISC-V environment variable is set. ```shell mkdir build && \ cd build && \ ../configure --prefix=$RISCV && \ make && \ sudo make install ``` -------------------------------- ### Start Default Network with Updated Configuration Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/quickstart/ia32-generic-qemu.md Starts the default libvirt network using the configuration that has been edited, potentially including IPv6 settings. ```shell sudo virsh net-start default ``` -------------------------------- ### psu Example with Timeout Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/hostutils/psu.md Example of using the psu tool with a custom timeout for the wait command. The timeout is set to 15 seconds. ```shell psu -t 15 script.sdp ``` -------------------------------- ### Install picocom on Ubuntu Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/quickstart/armv7a7-imx6ull-evk.md Install the picocom utility on Ubuntu 20.04 systems. This is a prerequisite for establishing serial communication with the board. ```shell sudo apt-get update && \ sudo apt-get install picocom ``` -------------------------------- ### General Simsensor Start Command Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/devices/simsensors.md This is the general command structure for starting a simsensor. It requires the sensor type and the path to the scenario file. ```shell ./sbin/sensors -s _sim: ``` -------------------------------- ### Install Docker Prerequisites on Ubuntu Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/building/linux.md Installs essential packages required for setting up Docker on an Ubuntu system, including curl, certificates, GPG, and LSB release utilities. ```shell sudo apt-get update && sudo apt-get install -y \ curl \ ca-certificates \ gnupg \ lsb-release ``` -------------------------------- ### Install LwIP Binary Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/lwip/lwip-pppou.md For some targets, it's necessary to install the LwIP binary to the system's sbin directory. ```shell b_install "$PREFIX_PROG_STRIPPED/lwip" /sbin ``` -------------------------------- ### Install WSL using winget Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/building/windows.md Use this command in PowerShell (as administrator) to install the Windows Subsystem for Linux if winget is available. ```powershell winget install wsl ``` -------------------------------- ### Install Docker Engine (Ubuntu 22.04) Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/quickstart/armv7a9-zynq7000/armv7a9-zynq7000-qemu.md Installs the Docker CE, CLI, and containerd.io packages. This command should be run after configuring the Docker repository. ```shell sudo apt-get update && \ sudo apt-get install docker-ce docker-ce-cli containerd.io ``` -------------------------------- ### Install Git and Update Packages Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/building/linux.md Ensures your system has the latest package information and installs the Git version control system, which is necessary for cloning repositories. ```shell sudo apt-get update && \ sudo apt-get install -y git ``` -------------------------------- ### Static ports.yaml example Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/ports/ports_yaml.md This example shows a static configuration for including 'busybox' and 'lua' ports, with 'lua' having specific test and use flags. The 'heatshrink' port is included using shorthand notation. ```yaml tests: true # Optional. Default: false ports: - name: busybox # Required. String. Must match port.def.sh 'name' of port - name: lua tests: true # Optional. Boolean. Default: false. AND-ed with global 'tests' use: ["safe"] # Optional. List of strings. Default: [] - heatshrink # Shorthand notation for `name: heatshrink` ``` -------------------------------- ### Create Cleanmarkers and Start System Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/quickstart/sparcv8leon-gr712rc-board.md Execute the 'jffs2' command to create cleanmarkers in flash memory, then use 'go!' to start the Phoenix-RTOS system. ```shell jffs2 go! ``` -------------------------------- ### Install Host Executables Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/ports/port_def.md Installs executable files to the host-specific build directory (e.g., `${PREFIX_BUILD}/host-prog/`). Used for build-time tools executed on the host during cross-compilation. ```bash b_install_host(*filelist) ``` -------------------------------- ### Install Files to Target Filesystem Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/ports/port_def.md Installs one or more files to a destination directory within the target filesystem, relative to `${PREFIX_FS}/root/`. Creates destination directories and sets executable permissions (755). ```bash # Install lua, luac to /usr/bin b_install "${PREFIX_PROG_TO_INSTALL}/lua" /usr/bin # Install multiple lua tests to /usr/share/lua/tests b_install "${lua_test_dir}"/*.lua /usr/share/lua/tests ``` -------------------------------- ### Starting LwIP PPP via Sysexec Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/lwip/lwip-pppou.md Start the LwIP PPP server on non-MMU targets using the 'sysexec' command with specified memory and UART configuration. ```shell sysexec ocram2 lwip pppou:/dev/uart3:115200:up ``` -------------------------------- ### Simulated Sensor CSV File Example Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/devices/simsensors.md This example demonstrates the structure of a CSV file for simulated sensors, including SensorID, Timestamp, and measurement data. ```text SensorID,Timestamp,Field1,Field2,Field3 1,2282607175,748,-419,-9780,0 8,2282607175,-2,-64,0,0 1,2282610344,740,-484,-9776,0 8,2282610344,-6,-71,-2,0 1,2282612689,740,-484,-9776,0 8,2282612689,-6,-73,-3,0 1,2282614538,742,-510,-9788,0 8,2282614538,-1,-68,-2,0 1,2282617192,723,-517,-9783,0 ``` -------------------------------- ### Build Toolchain for i386 Architecture Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/building/linux.md Builds the toolchain for the i386 architecture and installs it in the specified directory. ```shell ./build-toolchain.sh i386-pc-phoenix ~/toolchains/i386-pc-phoenix ``` -------------------------------- ### Get Dependency Installation Directory Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/ports/port_def.md Retrieves the installation directory of a required dependency. Aborts the build if the dependency is not installed. ```bash b_dependency_dir(dep_name) ``` -------------------------------- ### Get Optional Dependency Installation Directory Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/ports/port_def.md Retrieves the installation directory of an optional dependency. Returns an empty string if the dependency is not installed. ```bash b_optional_dir(dep_name) ``` -------------------------------- ### Set Entry Point and Run System with GRMON Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/quickstart/sparcv8leon-gr712rc-board.md Configure the system's entry point and start the CPU using these GRMON commands. ```shell ep 0x0 run ``` -------------------------------- ### Create /etc/qemu Directory and Set Permissions Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/quickstart/ia32-generic-qemu.md Creates the /etc/qemu directory if it doesn't exist and sets appropriate permissions for it. ```shell sudo mkdir /etc/qemu sudo chmod 755 /etc/qemu ``` -------------------------------- ### Launch QEMU Instance Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/quickstart/ia32-generic-qemu.md Executes the QEMU virtual machine using a specific script designed for network configuration. ```shell ./scripts/ia32-generic-qemu-net.sh ``` -------------------------------- ### Run Hello World Test Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/tests/index.md Executes the defined tests using the test runner script, targeting 'ia32-generic-qemu' and using the 'hello/test_config.yaml' configuration file. ```shell ./phoenix-rtos-tests/runner.py --target ia32-generic-qemu -t phoenix-rtos-tests/hello/test_config.yaml ``` -------------------------------- ### Print system date with custom format Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/utils/psh/psh-applets/date.md Use a FORMAT string starting with '+' to specify how the date and time should be displayed. This example shows how to print only the hour, minute, and second. ```shell (psh)% date +%H:%M:%S 00:02:34 (psh)% ``` -------------------------------- ### Run IoTHub Client Sample Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/ports/azure_sdk.md Execute the IoTHub client telemetry sample. Ensure internet connectivity and the correct system date are set before running. ```shell /bin/iothub_ll_telemetry_sample ``` -------------------------------- ### Enable PPPoU Driver and Interface Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/lwip/lwip-pppou.md Configure the 'plo' script to enable the PPPoU driver and bring up the interface immediately after the Phoenix RTOS kernel starts. This example uses UART3 at 115200 baud. ```shell app flash0 -x @lwip;/dev/uart3:115200:up xip1 ocram2 ``` -------------------------------- ### Install picocom (Ubuntu) Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/quickstart/aarch64a53-zynqmp-zcu104.md Install the picocom utility on Ubuntu 22.04. This command updates package lists and installs picocom. ```sh sudo apt-get update && \ sudo apt-get install picocom ``` -------------------------------- ### Main Azure IoT Hub Example Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/ports/azure_sdk.md Demonstrates the basic lifecycle of an Azure IoT Hub device client: initialization, opening a connection, sending a message, closing the connection, and deinitialization. ```c int main(void) { IOTHUB_DEVICE_CLIENT_LL_HANDLE devhandle; azure_init(); azure_open(AZURE_CONNECTION_STRING, cert, &devhandle); azure_sendMsg(&devhandle, "test message"); azure_close(&devhandle); azure_deinit(); return 0; } ``` -------------------------------- ### Launch ia32-generic QEMU Image Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/quickstart/ia32-generic-qemu.md Starts the ia32-generic Phoenix-RTOS system image using the provided script. This command should be run from the root of the phoenix-rtos-project directory. ```shell ./scripts/ia32-generic-qemu.sh ``` -------------------------------- ### Install openocd from source Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/quickstart/armv7m4-stm32l4x6-nucleo.md Manually install openocd version 0.12.0 from source if the repository version is not suitable. This involves downloading, configuring, building, and installing. ```shell wget -O- https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/openocd/0.12.0-1build2/openocd_0.12.0.orig.tar.bz2 | \ sudo tar xjvf - -C /usr/local/src && cd /usr/local/src/openocd-0.12.0 && sudo apt install -y pkg-config \ libusb-1.0-0-dev && ./configure --enable-stlink && make && sudo make install ``` -------------------------------- ### Start bootloader in GRMON Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/quickstart/sparcv8leon-gr716-mini.md Execute the loaded bootloader in GRMON to begin the system startup process. This command initiates the bootloader's execution. ```shell go ``` -------------------------------- ### Install Docker Packages (Ubuntu 22.04) Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/quickstart/armv7a9-zynq7000/armv7a9-zynq7000-qemu.md Installs necessary packages for Docker on Ubuntu 22.04. Ensure you have curl, ca-certificates, gnupg, and lsb-release installed. ```shell sudo apt-get update && \ sudo apt-get install curl \ ca-certificates \ gnupg \ lsb-release ``` -------------------------------- ### Install Ubuntu-22.04 on WSL Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/building/windows.md Installs the Ubuntu-22.04 distribution for use within the Windows Subsystem for Linux. ```powershell wsl --install -d Ubuntu-22.04 ``` -------------------------------- ### Install Python Testing Dependencies Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/tests/index.md Installs the necessary Python packages for the testing script using pip. ```shell pip3 install -r requirements.txt ``` -------------------------------- ### Build QEMU on Ubuntu Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/quickstart/sparcv8leon-generic-qemu.md Install necessary build tools and compile QEMU from source for the sparc-softmmu target. Ensure you have QEMU version 9.0.0 or later. ```shell sudo apt update && sudo apt install -y ninja-build \ libglib2.0-dev && \ git clone https://gitlab.com/qemu-project/qemu.git -b v9.0.2 && \ cd qemu && \ git submodule update --init --recursive && \ ./configure --target-list=sparc-softmmu && \ make && \ sudo make install ``` -------------------------------- ### Example Usage of ioctl Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/libc/functions/ioctl/ioctl.part-impl.md An example demonstrating how to use the ioctl function to send a request with data to a device. ```APIDOC ## Example Usage ### Description This example shows how to open a special device file and send a request with an integer argument using `ioctl()`. ### Code ```C #include #include #include #include #define REQUEST _IOC(IOC_IN, 'A', 0x01, int) int main() { int fd; int data = 4; if ((fd = open(PATH, O_WRONLY)) < 0) { fprintf(stderr, "Cannot open special device file\n"); exit(EXIT_FAILURE); } /* * Send request with additional data to device server, * assuming device server successfully created and accept our request. */ if (ioctl(fd, REQUEST, &data) < 0) { fprintf(stderr, "Something went wrong\n"); } // Close the file descriptor when done (not shown in original example but good practice) // close(fd); return 0; } ``` ``` -------------------------------- ### Launch QEMU with Multiple Cores Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/quickstart/ia32-generic-qemu.md Starts the ia32-generic Phoenix-RTOS image in QEMU and configures it to use multiple processor cores. Specify the desired number of cores using the '-smp' option. ```shell qemu-system-i386 -hda _boot/phoenix-ia32-generic.disk -smp 4 ``` -------------------------------- ### Create a Directory with mkdir Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/utils/psh/psh-applets/mkdir.md Use the mkdir utility to create a new directory. Provide the desired directory path as an argument. ```shell mkdir ... ``` -------------------------------- ### Install picocom on Ubuntu Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/quickstart/armv7a9-zynq7000/armv7a9-zynq7000-zedboard.md Install the picocom terminal emulator on Ubuntu systems. This is required for serial communication with the board. ```shell sudo apt-get update && \ sudo apt-get install picocom ``` -------------------------------- ### Install openocd on Ubuntu Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/quickstart/armv7m4-stm32l4x6-nucleo.md Install openocd from the default Ubuntu repositories. Ensure the version is compatible (0.11 or 0.12). ```shell sudo apt install -y openocd ``` -------------------------------- ### Makefile for Hello World Program Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/tests/index.md Makefile to build the 'hello' executable from the 'hello.c' source file. It uses the standard binary build include. ```makefile NAME := hello LOCAL_SRCS := hello.c include $(binary.mk) ``` -------------------------------- ### Install picocom on Ubuntu Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/quickstart/armv7m4-stm32l4x6-nucleo.md Install the picocom utility on Ubuntu systems. This is required for serial communication with the development board. ```shell sudo apt update && sudo apt install -y picocom ``` -------------------------------- ### C opendir() and fdopendir() Synopsis Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/libc/functions/dirent/opendir.part-impl.md Includes the necessary header and shows the function signatures for opendir() and fdopendir(). ```c #include DIR *fdopendir(int fd); DIR *opendir(const char *dirname); ``` -------------------------------- ### Install Toolchain Build Dependencies Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/building/linux.md Installs essential packages required for building the toolchain from source on Debian-based systems. ```shell sudo apt-get update # toolchain build dependencies sudo apt-get install -y --no-install-recommends \ autoconf \ automake \ bzip2 \ ca-certificates \ g++ \ git \ gcc \ libc6-dev \ libglib2.0-dev \ libmaxminddb-dev \ libtool \ make \ patch \ texinfo \ unzip \ wget \ xz-utils # phoenix-rtos-build runtime dependencies sudo apt-get install -y --no-install-recommends \ cpio \ genext2fs \ libhidapi-dev \ vim \ mtd-utils \ xxd \ cmake \ python3 \ python3-yaml \ python3-jinja2 \ python3-pycryptodome \ python3-packaging \ python3-resolvelib \ python3-pyparsing \ python3-rich \ jq ``` -------------------------------- ### RISC-V 64 Secondary Core Startup and Interrupts Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/kernel/hal/riscv64.md Sets up a dummy page fault handler, enables IPI interrupts, calls `hal_started`, and finally enables all interrupts for secondary cores. ```assembly /* Add dummy page fault trap handler */ la a0, .Lsecondary_park csrw stvec, a0 /* s0 = hartId, s3 = bootHartId * Boot hart will continue to main */ beq s0, s3, main call hal_cpuInitCore /* Enable IPI irq */ csrs sie, (1 << 1) csrs sstatus, 2 2: call hal_started fence rw, rw beqz a0, 2b /* Enable interrupts */ li a0, -1 csrw sie, a0 .Lsecondary_park: wfi j .Lsecondary_park ``` -------------------------------- ### Start Performance Monitoring Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/kernel/syscalls/perf.md Starts performance monitoring for a process. Requires the process ID (pid) to be available on the stack. ```C GETFROMSTACK(ustack, unsigned, pid, 0); ``` -------------------------------- ### Start PHFS Daemon Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/quickstart/armv7a9-zynq7000/armv7a9-zynq7000-zturn.md Launch the `phoenixd` daemon to share the disk image with the bootloader. Ensure you use the correct ttyACM device and baud rate. ```shell cd _boot/armv7a9-zynq7000-zturn ``` ```shell sudo ./phoenixd -p /dev/ttyACM0 -b 115200 -s . ``` -------------------------------- ### gets() Function Signature Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/libc/functions/stdio/gets.part-impl.md This is the function signature for gets(). It takes a character pointer to a buffer and returns a character pointer. ```c #include char *gets(char *s); ``` -------------------------------- ### Get arguments for syscalls_meminfo Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/kernel/syscalls/mem.md Retrieves arguments for the `syscalls_meminfo` function from the stack. Used to get memory map entries. ```C GETFROMSTACK(ustack, meminfo_t *, info, 0); ``` -------------------------------- ### Verify Docker Installation Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/building/linux.md Checks if Docker has been installed correctly by displaying its version information. Note that the version number may differ. ```shell sudo docker --version ``` -------------------------------- ### Phoenix-RTOS Shell Commands Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/quickstart/armv7a9-zynq7000/armv7a9-zynq7000-qemu.md Provides examples of basic commands to interact with the Phoenix-RTOS shell. Use 'help' to see available commands, 'ps' for processes, and 'top' for a process table. ```shell help ``` ```shell ps ``` ```shell top ``` -------------------------------- ### wget Basic Usage Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/utils/psh/psh-applets/wget.md Demonstrates the basic syntax for using the wget utility to download a file from a URL. Specify options and the target URL. ```shell wget [options] ... URL ``` -------------------------------- ### Initialize VirtIO Library Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/corelibs/libvirtio.md Initializes the entire VirtIO library. This must be called before using any other libvirtio functions. ```c int virtio_init(void) ``` -------------------------------- ### top Applet Command-line Arguments Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/utils/psh/psh-applets/top.md Displays help message for the 'top' applet. Use -h for help, -H to start in threads mode, -d to set refresh rate, and -n to set the number of iterations. ```shell Command-line arguments -h: prints help -H: starts with threads mode -d: sets refresh rate (integer greater than 0) -n: sets number of iterations (by default its infinity) ``` -------------------------------- ### Get Pending Signals Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/libc/functions/signal/sigpending.part-impl.md Call sigpending() to get the set of signals that are pending delivery. The result is stored in the sigset_t structure pointed to by 'set'. ```c #include int sigpending(sigset_t *set); ``` -------------------------------- ### C Preprocessor Conditional Example Source: https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/coding/index.md Preprocessor conditionals should be minimized and formatted as shown. This example demonstrates conditional code execution based on the NOMMU macro. ```c #ifndef NOMMU process->mapp = &process->map; process->amap = NULL; vm_mapCreate(process->mapp, (void *)VADDR_MIN, process_common.kmap->start); /* Create pmap */ p = vm_pageAlloc(SIZE_PAGE, PAGE_OWNER_KERNEL | PAGE_KERNEL_PTABLE); vaddr = vm_mmap(process_common.kmap, process_common.kmap->start, p, 1 << p->idx, NULL, 0, 0); pmap_create(&process->mapp->pmap, &process_common.kmap->pmap, p, vaddr); #else process->mapp = process_common.kmap; process->amap = NULL; process->lazy = 1; #endif ```