Skip to content

Added FreeRTOS example + test for STM32H5#79

Merged
dgarske merged 5 commits intowolfSSL:masterfrom
danielinux:freeRTOS-test
Mar 13, 2026
Merged

Added FreeRTOS example + test for STM32H5#79
dgarske merged 5 commits intowolfSSL:masterfrom
danielinux:freeRTOS-test

Conversation

@danielinux
Copy link
Member

  • added ssh test

Copilot AI review requested due to automatic review settings March 13, 2026 10:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a FreeRTOS-based STM32H563 m33mu CI path (echo + HTTPS via a BSD-socket wrapper) and introduces new local/CI workflow wiring to build/run those targets in the emulator.

Changes:

  • Add FREERTOS=1 build mode for the STM32H563 port, including FreeRTOS kernel sources + BSD socket wrapper + new FreeRTOS echo/HTTPS servers.
  • Extend container CI runner script and local workflow runner to support a new stm32h563-m33mu-freertos workflow/jobs.
  • Add new GitHub Actions workflows for FreeRTOS and SSH testing.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 15 comments.

Show a summary per file
File Description
tools/scripts/run-m33mu-workflow.sh Adds FreeRTOS workflow/job names to the local podman runner interface.
tools/scripts/run-m33mu-ci-in-container.sh Adds FreeRTOS build/run jobs (echo/HTTPS) and resolves m33mu binary path.
src/port/stm32h563/Makefile Introduces FREERTOS build mode and FreeRTOS source integration.
src/port/stm32h563/main.c Adds FreeRTOS scheduler path, BSD socket init, and starts FreeRTOS echo/HTTPS tasks.
src/port/stm32h563/ivt.c Adjusts vector table handler references for FreeRTOS builds.
src/port/stm32h563/FreeRTOSConfig.h Adds a FreeRTOS configuration header for the STM32H563 port.
src/port/stm32h563/echo_server_freertos.[ch] New FreeRTOS task-based TCP echo server using BSD socket wrappers.
src/port/stm32h563/https_server_freertos.[ch] New FreeRTOS task-based HTTPS server using wolfSSL + BSD socket wrappers.
src/port/freeRTOS/bsd_socket.c Tweaks error-handling loops to treat -1 similarly to -WOLFIP_EAGAIN.
.github/workflows/stm32h563-m33mu-freertos.yml New CI workflow to run the FreeRTOS echo test in the container.
.github/workflows/stm32h563-m33mu-ssh-tzen.yml New CI workflow to build/run SSH test and check server banner.
Comments suppressed due to low confidence (2)

src/port/freeRTOS/bsd_socket.c:321

  • wolfIP_sock_accept() uses -1 for real error cases (e.g., invalid state, allocation failure, filter rejection). Treating ret == -1 like EAGAIN here will cause accept() to wait/retry indefinitely and hide the underlying failure. Consider mapping -1 to a concrete errno and returning immediately (or change the core API to return -WOLFIP_E... codes consistently).
            }
            return public_fd;
        }
        if (ret != -WOLFIP_EAGAIN && ret != -1) {
            xSemaphoreGive(g_lock);
            wolfip_bsd_set_error(ret);
            return -1;
        }

src/port/freeRTOS/bsd_socket.c:353

  • wolfIP_sock_connect() can return -1 for real errors (e.g., filter rejection / invalid state), not just "would block". Treating ret == -1 like EAGAIN here can turn hard failures into infinite waits and makes diagnosing connection issues difficult. Prefer returning an error and setting socket_last_error() when ret == -1.
        ret = wolfIP_sock_connect(g_ipstack, entry->internal_fd, addr, addrlen);
        if (ret == 0) {
            xSemaphoreGive(g_lock);
            return 0;
        }
        if (ret != -WOLFIP_EAGAIN && ret != -1) {
            xSemaphoreGive(g_lock);
            wolfip_bsd_set_error(ret);
            return -1;
        }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Copilot AI review requested due to automatic review settings March 13, 2026 12:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a FreeRTOS-based runtime option for the STM32H563 port (echo + HTTPS via a blocking BSD-socket wrapper layer) and wires it into the local/CI m33mu workflow tooling.

Changes:

  • Add FreeRTOS echo/HTTPS servers and FreeRTOS hooks/integration in the STM32H563 firmware.
  • Extend STM32H563 build system/linker script to support FREERTOS=1 builds and associated sources.
  • Add/update m33mu runner scripts and GitHub Actions workflows to exercise the new FreeRTOS echo job (and expose an HTTPS FreeRTOS job).

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tools/scripts/run-m33mu-workflow.sh Accepts/normalizes the new stm32h563-m33mu-freertos workflow name and jobs.
tools/scripts/run-m33mu-ci-in-container.sh Adds FreeRTOS build/run jobs, resolves m33mu binary path, and tweaks CI checks.
src/port/stm32h563/target_tzen.ld Aligns/defines heap+stack reservations similar to non-TZEN linker script and reserves space.
src/port/stm32h563/Makefile Introduces FREERTOS build mode, pulls in FreeRTOS + BSD socket wrapper sources, and adjusts wolfSSL source selection.
src/port/stm32h563/main.c Boots either bare-metal or FreeRTOS server tasks; tightens SAU config for TZEN; adds FreeRTOS failure hooks.
src/port/stm32h563/ivt.c Adjusts vector table handler references to support FreeRTOS SVC/PendSV/SysTick handlers.
src/port/stm32h563/FreeRTOSConfig.h Adds a FreeRTOS configuration for STM32H563 builds.
src/port/stm32h563/https_server_freertos.h Declares FreeRTOS HTTPS server start API.
src/port/stm32h563/https_server_freertos.c Implements a simple TLS1.3 HTTPS server running in a FreeRTOS task via BSD-socket wrappers.
src/port/stm32h563/echo_server_freertos.h Declares FreeRTOS echo server start API.
src/port/stm32h563/echo_server_freertos.c Implements a TCP echo server running in a FreeRTOS task via BSD-socket wrappers.
.github/workflows/stm32h563-m33mu-freertos.yml Adds a CI workflow that runs the FreeRTOS echo job inside the m33mu container.
.github/workflows/stm32h563-m33mu-ssh-tzen.yml Adds a CI workflow for TZEN SSH testing (currently validating via SSH banner).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@danielinux danielinux requested review from Copilot and removed request for Copilot March 13, 2026 14:23
(replaced xorshift-based unsecure RNG in STM32H5 demo with TRNG)
Copy link
Contributor

@dgarske dgarske left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — all CI checks passing.

@dgarske dgarske merged commit 930034f into wolfSSL:master Mar 13, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants