Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add a build option for USB-C version #55

Merged
merged 2 commits into from
Sep 30, 2024

Conversation

kienvo
Copy link
Member

@kienvo kienvo commented Sep 29, 2024

Resolve #43.

Summary by Sourcery

Add a build option for the USB-C version of the firmware, updating the Makefile and CI workflow to support separate configurations and build directories for USB-C and Micro-B versions.

New Features:

  • Introduce a build option for the USB-C version of the firmware, allowing for separate build directories and configurations.

Enhancements:

  • Modify the Makefile to include a conditional compilation flag for the USB-C version, enabling specific code paths for USB-C hardware.

CI:

  • Update the GitHub Actions workflow to support building and uploading artifacts for both USB-C and Micro-B versions, with separate build directories.

Copy link

sourcery-ai bot commented Sep 29, 2024

Reviewer's Guide by Sourcery

This pull request adds a build option for a USB-C version of the firmware. It modifies the build process to generate two versions of the firmware: one for USB-C and one for Micro-B. The changes include updates to the GitHub Actions workflow, Makefile, and LED driver code to support this new build option.

Sequence Diagram

sequenceDiagram
    participant GH as GitHub Actions
    participant M as Make
    participant A as Artifacts
    participant B as Bin Branch
    GH->>M: Build USB-C version
    M-->>GH: USB-C firmware
    GH->>M: Build Micro-B version
    M-->>GH: Micro-B firmware
    GH->>A: Upload both versions
    GH->>B: Commit both versions
Loading

File-Level Changes

Change Details Files
Modify GitHub Actions workflow to build both USB-C and Micro-B versions
  • Update environment variables to define separate build directories for USB-C and Micro-B versions
  • Modify the build command to create both versions of the firmware
  • Update artifact upload step to include both versions
  • Adjust the binary commit step to add both versions to the bin branch
.github/workflows/build.yaml
Add USB-C version build option to Makefile
  • Introduce USBC_VERSION flag to enable USB-C specific build
  • Add conditional compilation flag for USB-C version
Makefile
Update LED driver code to support USB-C version
  • Add conditional compilation for USB-C version to use a different pin (B6) instead of B23 for LED 'T'
src/leddrv.c

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @kienvo - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@@ -32,13 +33,15 @@ jobs:
- name: Build firmware
run: |
export PREFIX=${{ env.MRS_TOOLCHAIN }}/RISC-V_Embedded_GCC/bin/riscv-none-embed-
export BUILD_DIR=${{ env.BUILD_DIR }}
make -j$(nproc)
BUILD_DIR=${{ env.USBC_BUILD_DIR }} USBC_VERSION=1 make -j$(nproc)
Copy link

Choose a reason for hiding this comment

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

suggestion: Consider using separate make targets for USB-C and Micro-B builds

This would make the build process more explicit and easier to maintain. It could also simplify adding more variants in the future.

      - name: Build USB-C version
        run: make usb-c -j$(nproc)
      - name: Build Micro-B version
        run: make micro-b -j$(nproc)

@@ -88,7 +88,11 @@ static const pinctrl_t led_pins[LED_PINCOUNT] = {
PINCTRL(B, 4), // Q
PINCTRL(B, 2), // R
PINCTRL(B, 1), // S
#ifdef USBC_VERSION
Copy link

Choose a reason for hiding this comment

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

suggestion: Consider using a more descriptive macro name for hardware version

A name like HARDWARE_VERSION_USBC might be clearer and more self-documenting.

#ifdef HARDWARE_VERSION_USBC

@fcartegnie fcartegnie merged commit c2fbdd3 into fossasia:master Sep 30, 2024
2 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.

USB-C version support
2 participants