diff --git a/Caddyfile b/Caddyfile new file mode 100644 index 0000000..ab91177 --- /dev/null +++ b/Caddyfile @@ -0,0 +1,25 @@ +:80 { + root * /srv + + # Enable gzip compression + encode gzip + + # Handle client-side routing - try file, then index.html + try_files {path} /index.html + + # Serve static files + file_server + + # Cache static assets + @static { + path *.js *.css *.png *.jpg *.jpeg *.gif *.ico *.svg *.woff *.woff2 *.ttf *.eot + } + header @static Cache-Control "public, max-age=31536000, immutable" + + # Security headers + header { + X-Frame-Options "SAMEORIGIN" + X-Content-Type-Options "nosniff" + X-XSS-Protection "1; mode=block" + } +} diff --git a/Dockerfile b/Dockerfile index 7cb0a04..a2faf7d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,17 +16,17 @@ COPY . . # Build the application RUN npm run build -# Production stage -FROM nginx:alpine AS production - -# Copy custom nginx config -COPY nginx.conf /etc/nginx/conf.d/default.conf +# Production stage - Using Caddy +FROM caddy:2-alpine AS production # Copy built assets from builder stage -COPY --from=builder /app/dist /usr/share/nginx/html +COPY --from=builder /app/dist /srv + +# Copy Caddyfile +COPY Caddyfile /etc/caddy/Caddyfile # Expose port 80 EXPOSE 80 -# Start nginx -CMD ["nginx", "-g", "daemon off;"] +# Start Caddy +CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile"] diff --git a/deploy.sh b/deploy.sh index 3bf9c58..3a60244 100644 --- a/deploy.sh +++ b/deploy.sh @@ -76,26 +76,24 @@ else print_status "Caddy network exists" fi -# Step 4: Update Caddy configuration +# Step 4: Show Caddy configuration to add echo "" -echo -e "${BLUE}Step 4: Updating Caddy configuration...${NC}" +echo -e "${BLUE}Step 4: Caddy configuration...${NC}" # Check if Traceability entry already exists in Caddyfile if grep -q "Traceability.nabd-co.com" "$CADDY_DIR/Caddyfile" 2>/dev/null; then - print_status "Caddy configuration already exists" + print_status "Caddy configuration already exists in Caddyfile" else - # Append Traceability configuration to Caddyfile - cat >> "$CADDY_DIR/Caddyfile" << 'EOF' - -# ------------------------- -# Traceability Matrix Proxy -# ------------------------- -Traceability.nabd-co.com { - reverse_proxy traceability_web:80 - encode gzip -} -EOF - print_status "Added Traceability configuration to Caddyfile" + print_warning "Add this entry to your Caddyfile at $CADDY_DIR/Caddyfile:" + echo "" + echo -e "${YELLOW}# -------------------------" + echo "# Traceability Matrix Proxy" + echo "# -------------------------" + echo "Traceability.nabd-co.com {" + echo " reverse_proxy traceability_web:80" + echo " encode gzip" + echo -e "}${NC}" + echo "" fi # Step 5: Build and start the application diff --git a/docker-compose.yml b/docker-compose.yml index 1e77b3c..1ee7895 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,11 +8,8 @@ services: container_name: traceability_web restart: always networks: - - caddy_network - labels: - - "traefik.enable=false" + - caddy_default networks: - caddy_network: + caddy_default: external: true - name: caddy_default diff --git a/src/App.tsx b/src/App.tsx index d7d8232..009ea58 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -8,6 +8,7 @@ import DocumentationPage from "./pages/DocumentationPage"; import AnalysisPage from "./pages/AnalysisPage"; import ALMTypePage from "./pages/ALMTypePage"; import TraceabilityMatrixPage from "./pages/TraceabilityMatrixPage"; +import ESPIDFHelperPage from "./pages/ESPIDFHelperPage"; import NotFound from "./pages/NotFound"; const queryClient = new QueryClient(); @@ -23,6 +24,7 @@ const App = () => ( } /> } /> } /> + } /> } /> {/* ADD ALL CUSTOM ROUTES ABOVE THE CATCH-ALL "*" ROUTE */} } /> diff --git a/src/components/layout/AppSidebar.tsx b/src/components/layout/AppSidebar.tsx index 10cca0d..734adc8 100644 --- a/src/components/layout/AppSidebar.tsx +++ b/src/components/layout/AppSidebar.tsx @@ -16,6 +16,7 @@ import { LayoutDashboard, ChevronDown, ChevronRight, + Cpu, } from "lucide-react"; import { NavLink } from "@/components/NavLink"; import { useLocation } from "react-router-dom"; @@ -37,6 +38,7 @@ const mainItems = [ { title: "Traceability Matrix", url: "/matrix", icon: GitBranch }, { title: "Documentation", url: "/documentation", icon: BookOpen }, { title: "Gap Analysis", url: "/analysis", icon: Search }, + { title: "ESP-IDF Helper", url: "/esp-idf", icon: Cpu }, ]; const almItems = [ diff --git a/src/pages/ESPIDFHelperPage.tsx b/src/pages/ESPIDFHelperPage.tsx new file mode 100644 index 0000000..e5aaa92 --- /dev/null +++ b/src/pages/ESPIDFHelperPage.tsx @@ -0,0 +1,726 @@ +import { useState } from "react"; +import { AppLayout } from "@/components/layout/AppLayout"; +import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; +import { Badge } from "@/components/ui/badge"; +import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; +import { ScrollArea } from "@/components/ui/scroll-area"; +import { Input } from "@/components/ui/input"; +import { + Cpu, + Wifi, + Bluetooth, + Shield, + Zap, + HardDrive, + Code, + Terminal, + Search, + ExternalLink, + Layers, + Radio, + Database, + Lock, + RefreshCw, + Settings, + Clock, + Thermometer, + CircuitBoard, + Cable, + Gauge, + Monitor +} from "lucide-react"; +import { cn } from "@/lib/utils"; + +// ESP-IDF V5.4 Data +const supportedChips = [ + { name: "ESP32", cores: "Dual-core Xtensa LX6", flash: "Up to 16MB", ram: "520KB SRAM", wifi: true, bt: "Classic + BLE", status: "Stable" }, + { name: "ESP32-S2", cores: "Single-core Xtensa LX7", flash: "Up to 16MB", ram: "320KB SRAM", wifi: true, bt: null, status: "Stable" }, + { name: "ESP32-S3", cores: "Dual-core Xtensa LX7", flash: "Up to 16MB", ram: "512KB SRAM + 8MB PSRAM", wifi: true, bt: "BLE 5.0", status: "Stable" }, + { name: "ESP32-C2", cores: "Single-core RISC-V", flash: "Up to 4MB", ram: "272KB SRAM", wifi: true, bt: "BLE 5.0", status: "Stable" }, + { name: "ESP32-C3", cores: "Single-core RISC-V", flash: "Up to 16MB", ram: "400KB SRAM", wifi: true, bt: "BLE 5.0", status: "Stable" }, + { name: "ESP32-C6", cores: "Single-core RISC-V", flash: "Up to 16MB", ram: "512KB SRAM", wifi: "WiFi 6", bt: "BLE 5.0 + 802.15.4", status: "Stable" }, + { name: "ESP32-H2", cores: "Single-core RISC-V", flash: "Up to 4MB", ram: "320KB SRAM", wifi: false, bt: "BLE 5.0 + 802.15.4", status: "Stable" }, + { name: "ESP32-P4", cores: "Dual-core RISC-V HP + LP", flash: "External", ram: "768KB + 8KB LP", wifi: false, bt: false, status: "Preview" }, +]; + +const peripherals = [ + { + name: "GPIO", + icon: CircuitBoard, + description: "General Purpose Input/Output pins with interrupt support", + apis: ["gpio_config()", "gpio_set_level()", "gpio_get_level()", "gpio_install_isr_service()", "gpio_isr_handler_add()"], + features: ["Pull-up/Pull-down resistors", "Interrupt on edge/level", "RTC GPIO support", "Sleep retention (v5.4)"] + }, + { + name: "SPI", + icon: Cable, + description: "Serial Peripheral Interface for high-speed communication", + apis: ["spi_bus_initialize()", "spi_bus_add_device()", "spi_device_transmit()", "spi_device_queue_trans()"], + features: ["Master/Slave modes", "DMA support", "Up to 80MHz", "Multiple devices per bus", "Sleep retention (v5.4)"] + }, + { + name: "I2C", + icon: Cable, + description: "Inter-Integrated Circuit for sensor communication", + apis: ["i2c_param_config()", "i2c_driver_install()", "i2c_master_write_read_device()", "i2c_master_cmd_begin()"], + features: ["Master/Slave modes", "Standard (100kHz) and Fast (400kHz)", "Clock stretching", "LP-I2C on C6/P4"] + }, + { + name: "UART", + icon: Terminal, + description: "Universal Asynchronous Receiver/Transmitter", + apis: ["uart_driver_install()", "uart_param_config()", "uart_write_bytes()", "uart_read_bytes()"], + features: ["Hardware flow control", "Ring buffer", "Pattern detection", "RS-485 support"] + }, + { + name: "ADC", + icon: Gauge, + description: "Analog to Digital Converter (12-bit resolution)", + apis: ["adc_oneshot_new_unit()", "adc_oneshot_read()", "adc_cali_create_scheme_curve_fitting()", "adc_continuous_start()"], + features: ["Oneshot & Continuous modes", "Hardware calibration", "Attenuation settings", "LP-ADC on C6/P4"] + }, + { + name: "LEDC (PWM)", + icon: Zap, + description: "LED Controller for PWM signal generation", + apis: ["ledc_timer_config()", "ledc_channel_config()", "ledc_set_duty()", "ledc_update_duty()", "ledc_fade_start()"], + features: ["High-speed & low-speed modes", "Hardware fade", "Multiple channels", "Up to 40MHz"] + }, + { + name: "Timer", + icon: Clock, + description: "Hardware timers for precise timing operations", + apis: ["gptimer_new_timer()", "gptimer_set_alarm_action()", "gptimer_start()", "esp_timer_create()"], + features: ["64-bit general purpose timers", "Alarm on match", "Auto-reload", "High-resolution esp_timer"] + }, + { + name: "Temperature Sensor", + icon: Thermometer, + description: "Built-in temperature sensor", + apis: ["temperature_sensor_install()", "temperature_sensor_enable()", "temperature_sensor_get_celsius()"], + features: ["On-chip temperature", "-10°C to 80°C range", "Low power consumption"] + }, +]; + +const networkingFeatures = [ + { + name: "WiFi", + icon: Wifi, + description: "802.11 b/g/n wireless connectivity", + apis: ["esp_wifi_init()", "esp_wifi_set_mode()", "esp_wifi_set_config()", "esp_wifi_connect()", "esp_wifi_scan_start()"], + modes: ["Station (STA)", "SoftAP", "STA+AP", "Promiscuous", "WiFi 6 (C6 only)"], + features: ["WPA3 security", "FTM calibration (v5.4)", "Improved coex power (v5.4)", "ESP-NOW protocol"] + }, + { + name: "Bluetooth", + icon: Bluetooth, + description: "Bluetooth Classic and BLE support", + apis: ["esp_bt_controller_init()", "esp_bluedroid_init()", "esp_ble_gap_start_advertising()", "nimble_port_init()"], + modes: ["Classic BR/EDR (ESP32/S3)", "BLE 5.0", "Mesh", "HID", "A2DP/AVRCP"], + features: ["Dual-mode", "Cover Art AVRCP (v5.4)", "NimBLE 1.7.0 (v5.4)", "Device ID Profile"] + }, + { + name: "Thread / Zigbee", + icon: Radio, + description: "802.15.4 mesh networking protocols", + apis: ["esp_openthread_init()", "esp_zb_init()", "esp_zb_start()"], + modes: ["Thread Border Router", "Zigbee Coordinator/Router/End Device"], + features: ["Matter support", "TREL (v5.4)", "Zigbee 1.6.x", "RCP over USB (v5.4)"] + }, + { + name: "ESP-NETIF", + icon: Layers, + description: "Network interface abstraction layer", + apis: ["esp_netif_init()", "esp_netif_create_default_wifi_sta()", "esp_netif_get_ip_info()"], + modes: ["WiFi", "Ethernet", "PPP", "SLIP"], + features: ["DHCP client/server", "Static IP", "IPv4/IPv6", "DNS"] + }, +]; + +const protocolsLibraries = [ + { + category: "HTTP/HTTPS", + items: [ + { name: "esp_http_client", description: "HTTP client for REST APIs", apis: ["esp_http_client_init()", "esp_http_client_perform()"] }, + { name: "esp_http_server", description: "HTTP server for web dashboards", apis: ["httpd_start()", "httpd_register_uri_handler()"] }, + ] + }, + { + category: "MQTT", + items: [ + { name: "esp_mqtt", description: "MQTT v3.1.1/v5.0 client", apis: ["esp_mqtt_client_init()", "esp_mqtt_client_subscribe()", "esp_mqtt_client_publish()"] }, + ] + }, + { + category: "WebSocket", + items: [ + { name: "esp_websocket_client", description: "WebSocket client", apis: ["esp_websocket_client_init()", "esp_websocket_client_send_text()"] }, + ] + }, + { + category: "mDNS/DNS", + items: [ + { name: "mdns", description: "Multicast DNS service discovery", apis: ["mdns_init()", "mdns_hostname_set()", "mdns_service_add()"] }, + ] + }, + { + category: "TLS/SSL", + items: [ + { name: "esp_tls", description: "TLS/SSL wrapper (mbedTLS 3.6.0)", apis: ["esp_tls_conn_new()", "esp_tls_conn_read()", "esp_tls_conn_write()"] }, + { name: "esp_crt_bundle", description: "Certificate bundle for HTTPS", apis: ["esp_crt_bundle_attach()"] }, + ] + }, +]; + +const storageOptions = [ + { + name: "NVS (Non-Volatile Storage)", + icon: Database, + description: "Key-value storage for configuration and small data", + apis: ["nvs_flash_init()", "nvs_open()", "nvs_set_str()", "nvs_get_i32()", "nvs_commit()"], + useCase: "WiFi credentials, device settings, calibration data" + }, + { + name: "SPIFFS", + icon: HardDrive, + description: "SPI Flash File System for read-heavy workloads", + apis: ["esp_vfs_spiffs_register()", "fopen()", "fread()", "fwrite()"], + useCase: "Web assets, configuration files, logs" + }, + { + name: "FATFS", + icon: HardDrive, + description: "FAT file system with SD card support", + apis: ["esp_vfs_fat_mount()", "esp_vfs_fat_sdmmc_mount()"], + useCase: "SD card data logging, removable storage" + }, + { + name: "LittleFS", + icon: HardDrive, + description: "Power-loss resilient file system", + apis: ["esp_vfs_littlefs_register()"], + useCase: "Frequent writes, power-unstable environments" + }, + { + name: "Wear Leveling", + icon: RefreshCw, + description: "Flash wear leveling layer", + apis: ["wl_mount()", "wl_read()", "wl_write()"], + useCase: "Extend flash lifespan for heavy write workloads" + }, +]; + +const securityFeatures = [ + { + name: "Secure Boot V2", + icon: Shield, + description: "Cryptographic verification of boot chain", + details: ["RSA-3072 or ECDSA signatures", "Anti-rollback protection", "Hardware root of trust"] + }, + { + name: "Flash Encryption", + icon: Lock, + description: "AES-256 encryption of flash contents", + details: ["Hardware encryption engine", "Transparent to application", "Development & Release modes"] + }, + { + name: "Hardware Crypto", + icon: Cpu, + description: "Hardware-accelerated cryptographic operations", + details: ["AES, SHA, RSA, ECDSA", "Random number generator", "Digital signature peripheral"] + }, + { + name: "mbedTLS 3.6.0", + icon: Lock, + description: "TLS/SSL library (updated in v5.4)", + details: ["TLS 1.2/1.3 support", "Certificate management", "Optimized RAM usage (v5.4)"] + }, +]; + +const v54Highlights = [ + { title: "ESP32-P4 Support", description: "Initial support for the high-performance non-wireless SoC with dual RISC-V cores" }, + { title: "Sleep Retention", description: "GPIO, SPI, I2C peripherals maintain state during light sleep on C6/H2" }, + { title: "PSRAM Retention", description: "External PSRAM data preserved during light sleep on supported chips" }, + { title: "mbedTLS 3.6.0", description: "Updated TLS library with reduced RAM usage for Certificate Bundle" }, + { title: "LP Core Expansion", description: "LP-ADC, LP-SPI, LP-I2C support on C6/P4 for ultra-low power operation" }, + { title: "NimBLE 1.7.0", description: "Updated BLE stack with improved stability and features" }, + { title: "WiFi FTM", description: "Fine Timing Measurement calibration support for C6" }, + { title: "Thread TREL", description: "Thread Radio Encapsulation Link support for improved mesh networking" }, + { title: "Bootloader Mocks", description: "New mocking framework for improved unit testing capabilities" }, + { title: "AVRCP Cover Art", description: "Bluedroid now supports album artwork transfer over Bluetooth" }, +]; + +const ESPIDFHelperPage = () => { + const [searchTerm, setSearchTerm] = useState(""); + + const filteredPeripherals = peripherals.filter(p => + p.name.toLowerCase().includes(searchTerm.toLowerCase()) || + p.description.toLowerCase().includes(searchTerm.toLowerCase()) + ); + + return ( + +
+ {/* Header */} +
+
+
+
+ +
+
+

ESP-IDF V5.4 Helper

+

Comprehensive reference for Espressif IoT Development Framework

+
+
+
+
+ + Version 5.4.3 (Latest) + + + GitHub + + + Docs + +
+
+ + {/* V5.4 Highlights */} + + + + + What's New in ESP-IDF V5.4 + + + +
+ {v54Highlights.map((item, idx) => ( +
+

{item.title}

+

{item.description}

+
+ ))} +
+
+
+ + {/* Search */} +
+ + setSearchTerm(e.target.value)} + className="pl-10" + /> +
+ + + + Supported Chips + Peripherals + Networking + Protocols & Libraries + Storage + Security + Development Tools + + + {/* Supported Chips */} + + + + Supported Microcontrollers + ESP-IDF V5.4 supports the following ESP32 series chips + + +
+ + + + + + + + + + + + + + {supportedChips.map((chip) => ( + + + + + + + + + + ))} + +
ChipProcessorFlashRAMWiFiBluetoothStatus
{chip.name}{chip.cores}{chip.flash}{chip.ram} + {chip.wifi ? ( + + {typeof chip.wifi === 'string' ? chip.wifi : 'Yes'} + + ) : ( + No + )} + + {chip.bt ? ( + + {chip.bt} + + ) : ( + No + )} + + + {chip.status} + +
+
+
+
+
+ + {/* Peripherals */} + +
+ {filteredPeripherals.map((peripheral) => ( + + + + + {peripheral.name} + + {peripheral.description} + + +
+

KEY APIs

+
+ {peripheral.apis.map((api) => ( + + {api} + + ))} +
+
+
+

FEATURES

+
    + {peripheral.features.map((feature) => ( +
  • +
    + {feature} +
  • + ))} +
+
+
+
+ ))} +
+
+ + {/* Networking */} + +
+ {networkingFeatures.map((feature) => ( + + + + + {feature.name} + + {feature.description} + + +
+

MODES

+
+ {feature.modes.map((mode) => ( + + {mode} + + ))} +
+
+
+

KEY APIs

+
+ {feature.apis.map((api) => ( + + {api} + + ))} +
+
+
+

FEATURES

+
    + {feature.features.map((f) => ( +
  • +
    + {f} +
  • + ))} +
+
+
+
+ ))} +
+
+ + {/* Protocols & Libraries */} + + {protocolsLibraries.map((category) => ( + + + {category.category} + + +
+ {category.items.map((item) => ( +
+

{item.name}

+

{item.description}

+
+ {item.apis.map((api) => ( + + {api} + + ))} +
+
+ ))} +
+
+
+ ))} +
+ + {/* Storage */} + +
+ {storageOptions.map((storage) => ( + + + + + {storage.name} + + {storage.description} + + +
+

KEY APIs

+
+ {storage.apis.map((api) => ( + + {api} + + ))} +
+
+
+

USE CASE

+

{storage.useCase}

+
+
+
+ ))} +
+
+ + {/* Security */} + +
+ {securityFeatures.map((feature) => ( + + + + + {feature.name} + + {feature.description} + + +
    + {feature.details.map((detail) => ( +
  • +
    + {detail} +
  • + ))} +
+
+
+ ))} +
+
+ + {/* Development Tools */} + +
+ + + + + idf.py - Build System + + Primary command-line tool for ESP-IDF projects + + +
+
+ $ idf.py set-target esp32s3 +
+
+ $ idf.py menuconfig +
+
+ $ idf.py build +
+
+ $ idf.py -p /dev/ttyUSB0 flash monitor +
+
+
+
+ + + + + + menuconfig - Configuration + + Interactive configuration system for project settings + + +
    +
  • +
    + Component configuration (WiFi, Bluetooth, etc.) +
  • +
  • +
    + Compiler and optimization settings +
  • +
  • +
    + Partition table configuration +
  • +
  • +
    + Security settings (Secure Boot, Flash Encryption) +
  • +
  • +
    + FreeRTOS and system configuration +
  • +
+
+
+ + + + + + Debugging Tools + + Tools for debugging and profiling + + +
    +
  • +
    + idf.py monitor - Serial console output +
  • +
  • +
    + GDB - Hardware debugging via JTAG +
  • +
  • +
    + Core Dump - Post-mortem analysis +
  • +
  • +
    + Application Tracing - Real-time tracing +
  • +
  • +
    + Heap Analysis - Memory debugging +
  • +
+
+
+ + + + + + FreeRTOS APIs + + Real-time operating system primitives + + +
+

TASK MANAGEMENT

+
+ {["xTaskCreate()", "vTaskDelete()", "vTaskDelay()", "xTaskNotify()"].map((api) => ( + + {api} + + ))} +
+
+
+

SYNCHRONIZATION

+
+ {["xSemaphoreCreateMutex()", "xQueueCreate()", "xEventGroupCreate()"].map((api) => ( + + {api} + + ))} +
+
+
+

ESP EVENT LOOP

+
+ {["esp_event_loop_create_default()", "esp_event_handler_register()", "esp_event_post()"].map((api) => ( + + {api} + + ))} +
+
+
+
+
+
+
+
+
+ ); +}; + +export default ESPIDFHelperPage;