# CLAUDE.md This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## Build System and Common Commands ### Primary Build Commands - `python3 build.py -c ws63-liteos-hilink` - Build HiLink firmware - `python3 build.py -c ws63-liteos-app-iot` - Build App-IoT firmware - `python3 build.py -j` - Build with specified thread count (defaults to max threads) - `python3 build.py -clean` - Clean before building ### Independent Upgrade Build System - `python3 indie_build.py sdk` - Build HiLink SDK only with packaging - `python3 indie_build.py all` - Full build including HiLink + App-IoT + upgrade packages - `python3 package.py` - Generate upgrade package from existing binaries ### Pre-build Tools - `bash prebuild.sh` - Run pre-build tools (BLE name, product config, code generation) ### Build Configuration - Uses CMake build system with target-specific configurations - Configuration files located in `build/config/target_config/ws63/` - Supports both Unix Makefiles and Ninja generators (`-ninja` flag) ## Project Architecture ### Core Structure This is an embedded IoT firmware project for the WS63 chip platform with HiLink connectivity: - **Target Platform**: WS63 RISC-V chip with LiteOS kernel - **Primary Function**: Smart lighting device with HiLink cloud connectivity - **Architecture**: Dual-firmware system supporting independent upgrades ### Key Directories - `application/ws63/user_main/` - Main application code including spotlight control - `drivers/` - Hardware abstraction layer and device drivers - `kernel/liteos/` - Huawei LiteOS v208.5.0 real-time operating system - `middleware/` - System services, utilities, and chip-specific adaptations - `protocol/` - Communication protocols (WiFi, Bluetooth, Radar) - `open_source/` - Third-party libraries (mbedTLS, GmSSL, libcoap, etc.) - `bootloader/` - Boot sequence and update mechanisms ### Firmware Components 1. **HiLink Firmware**: Handles cloud connectivity and OTA updates 2. **App-IoT Firmware**: Contains device-specific application logic 3. **Independent Upgrade**: Allows updating HiLink without touching App-IoT ### Hardware Features - PWM-controlled lighting with color temperature support - GPIO-based controls and indicators - WiFi connectivity for cloud services - Bluetooth Low Energy support - Factory test and calibration modes ## Development Workflow ### Independent Upgrade Development When developing with independent upgrade enabled: 1. Build HiLink firmware first: `python3 build.py -c ws63-liteos-hilink` 2. Build App-IoT firmware: `python3 build.py -c ws63-liteos-app-iot` 3. Generate upgrade packages: `python3 build/config/target_config/ws63/build_ws63_update.py --pkt=app_iot` Or use the simplified workflow: - `python3 indie_build.py all` for complete build and packaging ### Configuration Management - Kconfig system for feature selection - Target-specific configurations in `build/config/target_config/ws63/config.py` - Hardware pin mappings in application code ### Output Artifacts - Complete firmware packages: `output/ws63/fwpkg/` - Upgrade packages: `output/ws63/upgrade/` - Build artifacts: `output/ws63/acore/` ## Key Technologies - **OS**: Huawei LiteOS (real-time embedded OS) - **Connectivity**: HiLink cloud protocol, WiFi, BLE - **Security**: GmSSL3.0, mbedTLS for cryptographic functions - **Build**: CMake with Python automation scripts - **Architecture**: RISC-V 32-bit processor