Merge pull request #55 from kienvo/usbc-ver

feat: Add a build option for USB-C version
This commit is contained in:
François Cartegnie
2024-09-30 16:20:06 +07:00
committed by GitHub
3 changed files with 19 additions and 7 deletions

View File

@@ -7,7 +7,8 @@ on:
env: env:
MRS_TOOLCHAIN: MRS_Toolchain_Linux_x64_V1.91 MRS_TOOLCHAIN: MRS_Toolchain_Linux_x64_V1.91
BUILD_DIR: build USBC_BUILD_DIR: usb-c
MICROB_BUILD_DIR: micro-b
BIN_TYPES: '{.bin,.elf}' BIN_TYPES: '{.bin,.elf}'
jobs: jobs:
@@ -32,13 +33,15 @@ jobs:
- name: Build firmware - name: Build firmware
run: | run: |
export PREFIX=${{ env.MRS_TOOLCHAIN }}/RISC-V_Embedded_GCC/bin/riscv-none-embed- export PREFIX=${{ env.MRS_TOOLCHAIN }}/RISC-V_Embedded_GCC/bin/riscv-none-embed-
export BUILD_DIR=${{ env.BUILD_DIR }} BUILD_DIR=${{ env.USBC_BUILD_DIR }} USBC_VERSION=1 make -j$(nproc)
make -j$(nproc) BUILD_DIR=${{ env.MICROB_BUILD_DIR }} make -j$(nproc)
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
with: with:
name: badgemagic-firmware name: badgemagic-firmware
path: ${{ env.BUILD_DIR }}/badgemagic-* path: |
${{ env.USBC_BUILD_DIR }}/badgemagic-*
${{ env.MICROB_BUILD_DIR }}/badgemagic-*
# Skip upload APK for pull requests & only allow binaries build from master # Skip upload APK for pull requests & only allow binaries build from master
- if: ${{ github.event_name != 'pull_request' && github.ref_name == 'master' }} - if: ${{ github.event_name != 'pull_request' && github.ref_name == 'master' }}
@@ -47,10 +50,9 @@ jobs:
git config --global user.name "${{ github.workflow }}" git config --global user.name "${{ github.workflow }}"
git config --global user.email "gh-actions@${{ github.repository_owner }}" git config --global user.email "gh-actions@${{ github.repository_owner }}"
mv ${{ env.BUILD_DIR }}/badgemagic-*${{ env.BIN_TYPES }} ./
git checkout --orphan bin git checkout --orphan bin
git reset git reset
git add badgemagic-*${{ env.BIN_TYPES }} git add ${{ env.USBC_BUILD_DIR }}/badgemagic-*${{ env.BIN_TYPES }}
git add ${{ env.MICROB_BUILD_DIR }}/badgemagic-*${{ env.BIN_TYPES }}
git commit -am "[Auto] Update firmware binaries from ${{ github.ref_name }} ($(date +%Y-%m-%d.%H:%M:%S))" git commit -am "[Auto] Update firmware binaries from ${{ github.ref_name }} ($(date +%Y-%m-%d.%H:%M:%S))"
git push --force origin bin git push --force origin bin

View File

@@ -9,6 +9,8 @@ TARGET = badgemagic-ch582
###################################### ######################################
# Uncomment below line to enable debugging # Uncomment below line to enable debugging
# DEBUG = 1 # DEBUG = 1
# Uncomment below to build for USB-C version
# USBC_VERSION = 1
# optimization for size # optimization for size
OPT = -Os OPT = -Os
@@ -120,6 +122,10 @@ ifeq ($(DEBUG), 1)
CFLAGS += -g -gdwarf-2 -DDEBUG=$(DEBUG) CFLAGS += -g -gdwarf-2 -DDEBUG=$(DEBUG)
endif endif
ifeq ($(USBC_VERSION), 1)
CFLAGS += -DUSBC_VERSION=$(USBC_VERSION)
endif
# Generate dependency information # Generate dependency information
CFLAGS += -MMD -MP CFLAGS += -MMD -MP

View File

@@ -88,7 +88,11 @@ static const pinctrl_t led_pins[LED_PINCOUNT] = {
PINCTRL(B, 4), // Q PINCTRL(B, 4), // Q
PINCTRL(B, 2), // R PINCTRL(B, 2), // R
PINCTRL(B, 1), // S PINCTRL(B, 1), // S
#ifdef USBC_VERSION
PINCTRL(B, 6), // T
#else
PINCTRL(B, 23), // T PINCTRL(B, 23), // T
#endif
PINCTRL(B, 21), // U PINCTRL(B, 21), // U
PINCTRL(B, 20), // V PINCTRL(B, 20), // V
PINCTRL(B, 19), // W PINCTRL(B, 19), // W