From 6298b984b904c1238b59ab836ae55d9707504036 Mon Sep 17 00:00:00 2001 From: "@baamiis" Date: Mon, 1 Dec 2025 19:13:29 +0000 Subject: [PATCH 1/2] Create CODE_OF_CONDUCT.md added CODE_OF_CONDUCT.md file --- CODE_OF_CONDUCT.md | 295 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 295 insertions(+) create mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..f6318e3 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,295 @@ +# Contributing to KDOS + +Thank you for your interest in contributing to KDOS (formerly KTOS)! This document provides guidelines and instructions for contributing to our tiny cooperative RTOS. + +## Table of Contents +- [Code of Conduct](#code-of-conduct) +- [Getting Started](#getting-started) +- [Development Workflow](#development-workflow) +- [Coding Standards](#coding-standards) +- [Commit Guidelines](#commit-guidelines) +- [Pull Request Process](#pull-request-process) +- [Testing](#testing) +- [Documentation](#documentation) + +## Code of Conduct + +This project adheres to a Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to [your-email]@[domain]. + +## Getting Started + +### Prerequisites +- Git +- Appropriate toolchain for your target platform (e.g., gcc-arm-none-eabi for ARM) +- Basic understanding of embedded systems and C programming + +### Setting Up Your Development Environment + +1. **Fork the repository** + - Click the "Fork" button on GitHub + - Clone your fork locally: + ```bash + git clone https://github.com/YOUR-USERNAME/ktos.git + cd ktos + ``` + +2. **Add upstream remote** + ```bash + git remote add upstream https://github.com/ORIGINAL-OWNER/ktos.git + ``` + +3. **Build the project** + ```bash + make all + ``` + +4. **Run tests** + ```bash + make test + ``` + +## Development Workflow + +1. **Create a branch** for your work + ```bash + git checkout -b feature/your-feature-name + ``` + + Branch naming conventions: + - `feature/description` - for new features + - `fix/description` - for bug fixes + - `docs/description` - for documentation + - `refactor/description` - for code refactoring + - `test/description` - for test improvements + +2. **Make your changes** + - Write clean, well-documented code + - Follow the coding standards below + - Add tests for new functionality + +3. **Keep your branch updated** + ```bash + git fetch upstream + git rebase upstream/main + ``` + +4. **Test your changes** + - Build the project + - Run all tests + - Test on actual hardware if possible + +5. **Commit your changes** + - Follow the commit message guidelines below + - Keep commits focused and atomic + +6. **Push to your fork** + ```bash + git push origin feature/your-feature-name + ``` + +7. **Open a Pull Request** + - Go to the original repository on GitHub + - Click "New Pull Request" + - Select your branch + - Fill out the PR template completely + +## Coding Standards + +### C Code Style + +- **Indentation**: 4 spaces (no tabs) +- **Line length**: Maximum 100 characters +- **Braces**: K&R style + ```c + if (condition) { + do_something(); + } + ``` + +- **Naming conventions**: + - Functions: `k_function_name` or `KFunction` (follow existing style in KDOS) + - Task functions: descriptive names like `task_timer`, `task_serial` + - Types: `snake_case_t` (e.g., `task_handle_t`) + - Macros/Constants: `UPPER_CASE` (e.g., `KDOS_MAX_TASKS`, `MSG_TYPE_INIT`) + - Keep consistency with existing KDOS code style + +- **Comments**: + - Use `/* */` for multi-line comments + - Use `//` for single-line comments + - Document all public APIs with descriptive comments + - Explain "why" not "what" in comments + +### Code Organization + +- Keep functions small and focused (ideally < 50 lines) +- One function should do one thing +- Minimize global state +- Use static functions for internal implementation details +- Group related functions together + +### Memory Management + +- **No dynamic allocation** in core KTOS code +- All memory should be statically allocated or stack-based +- Document memory requirements clearly +- Avoid recursion to prevent stack overflow + +### Platform-Specific Code + +- Keep platform-specific code isolated in separate files +- Use clear abstractions for hardware access +- Document platform requirements + +## Commit Guidelines + +### Commit Message Format + +``` +: + + + +