PhiOS is a minimal operating system kernel that can be used on the smallest RISCV core that exists at present.
- Context Switch: process of saving and restoring the state of a running process or thread by the operating system scheduler to enable multitasking and efficient resource utilization.
-
Task Scheduler: A lightweight task scheduler to manage and switch between tasks efficiently, typically using a cooperative or simple preemptive scheduling approach.
-
Interrupt Handling: Support for handling hardware interrupts efficiently and effectively, as embedded devices often rely heavily on interrupt-driven mechanisms.
-
Memory Management: Basic memory management, including support for memory allocation and deallocation, especially in resource-constrained environments.
-
Device Drivers: Minimal device drivers to handle communication with essential peripherals like UART, SPI, I2C, GPIO, timers, and possibly some specialized hardware unique to the embedded device.
-
Low-Power Modes: Support for low-power modes to optimize power consumption when the device is idle or not actively processing tasks.
-
Clock and Timer Management: Basic clock and timer management for scheduling tasks and handling time-related operations.
-
Communication Protocols: Support for relevant communication protocols, such as UART, SPI, I2C, or USB, depending on the device's connectivity requirements.
-
File System (Optional): If the device requires persistent data storage, a minimal file system with read/write capabilities may be included. However, in some cases, it might be sufficient to have just a simple flash memory interface.
-
Error Handling: Basic error handling and reporting mechanisms for debugging and diagnostics.
-
Startup and Initialization: Code to initialize hardware and set up the initial state of the system during boot-up.
-
Debugging Support: Basic debugging support, such as logging and tracing mechanisms.
-
Configurability: Some level of configurability to allow users to enable/disable certain features based on their specific needs, as embedded devices can have various use cases.
cd test
#compile hardware
iverilog -s testbench -o ice.vvp hw/icebreaker_tb.v hw/icebreaker.v hw/ice40up5k_spram.v hw/spimemio.v hw/simpleuart.v hw/picosoc.v hw/picorv32.v hw/spiflash.v -DNO_ICE40_DEFAULT_ASSIGNMENTS `yosys-config --datdir/ice40/cells_sim.v`
#simulate hardware with kernel
vvp -N ice.vvp ../src/bootapp.hex +firmware=../src/bootapp.hex