summaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2025-10-03 22:04:29 +0700
committerGitHub <[email protected]>2025-10-03 22:04:29 +0700
commit6ce46da042eb9ab243e4127ddcac57519c0a226f (patch)
treecd7d2bf2894d85dbdd5d633747a1c328e75ecbb6 /.github
parentc1bf19ed6cf1eaa791f221c1bc5ce4b3d069f76d (diff)
parentf3f6046e0bbcf9b3b926ca5f0e1882d1ceb9652d (diff)
Merge pull request #3277 from hathach/remove-claude-code
remove claude code workflow
Diffstat (limited to '.github')
-rw-r--r--.github/copilot-instructions.md67
-rw-r--r--.github/workflows/build.yml28
-rw-r--r--.github/workflows/claude.yml49
3 files changed, 73 insertions, 71 deletions
diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md
index 572b8d6f5..9982583cd 100644
--- a/.github/copilot-instructions.md
+++ b/.github/copilot-instructions.md
@@ -18,15 +18,23 @@ Choose ONE of these approaches:
```bash
cd examples/device/cdc_msc
mkdir -p build && cd build
-cmake -DBOARD=stm32f407disco -DCMAKE_BUILD_TYPE=MinSizeRel ..
+cmake -DBOARD=raspberry_pi_pico -DCMAKE_BUILD_TYPE=MinSizeRel ..
cmake --build . -j4
```
-- takes 1-2 seconds. NEVER CANCEL. Set timeout to 5+ minutes.
+**CMake with Ninja (Alternative)**
+```bash
+cd examples/device/cdc_msc
+mkdir build && cd build
+cmake -G Ninja -DBOARD=raspberry_pi_pico ..
+ninja
+```
+
**Option 2: Individual Example with Make**
```bash
cd examples/device/cdc_msc
-make BOARD=stm32f407disco all
+make BOARD=raspberry_pi_pico all
```
-- takes 2-3 seconds. NEVER CANCEL. Set timeout to 5+ minutes.
@@ -36,9 +44,39 @@ python3 tools/build.py -b BOARD_NAME
```
-- takes 15-20 seconds, may have some objcopy failures that are non-critical. NEVER CANCEL. Set timeout to 30+ minutes.
+### Build Options
+- **Debug build**:
+ - CMake: `-DCMAKE_BUILD_TYPE=Debug`
+ - Make: `DEBUG=1`
+- **With logging**:
+ - CMake: `-DLOG=2`
+ - Make: `LOG=2`
+- **With RTT logger**:
+ - CMake: `-DLOG=2 -DLOGGER=rtt`
+ - Make: `LOG=2 LOGGER=rtt`
+- **RootHub port selection**:
+ - CMake: `-DRHPORT_DEVICE=1`
+ - Make: `RHPORT_DEVICE=1`
+- **Port speed**:
+ - CMake: `-DRHPORT_DEVICE_SPEED=OPT_MODE_FULL_SPEED`
+ - Make: `RHPORT_DEVICE_SPEED=OPT_MODE_FULL_SPEED`
+
+### Flashing and Deploymen
+- **Flash with JLink**:1
+ - CMake: `ninja cdc_msc-jlink`
+ - Make: `make BOARD=raspberry_pi_pico flash-jlink`
+- **Flash with OpenOCD**:
+ - CMake: `ninja cdc_msc-openocd`
+ - Make: `make BOARD=raspberry_pi_pico flash-openocd`
+- **Generate UF2**:
+ - CMake: `ninja cdc_msc-uf2`
+ - Make: `make BOARD=raspberry_pi_pico all uf2`
+- **List all targets** (CMake/Ninja): `ninja -t targets`
+
### Unit Testing
- Install Ceedling: `sudo gem install ceedling`
-- Run all unit tests: `cd test/unit-test && ceedling` -- takes 4 seconds. NEVER CANCEL. Set timeout to 10+ minutes.
+- Run all unit tests: `cd test/unit-test && ceedling` or `cd test/unit-test && ceedling test:all` -- takes 4 seconds. NEVER CANCEL. Set timeout to 10+ minutes.
+- Run specific test: `cd test/unit-test && ceedling test:test_fifo`
- Tests use Unity framework with CMock for mocking
### Documentation
@@ -60,7 +98,7 @@ python3 tools/build.py -b BOARD_NAME
2. **Build validation**: Build at least one example that exercises your changes
```bash
cd examples/device/cdc_msc
- make BOARD=stm32f407disco all
+ make BOARD=raspberry_pi_pico all
```
### Manual Testing Scenarios
@@ -70,7 +108,7 @@ python3 tools/build.py -b BOARD_NAME
### Board Selection for Testing
- **STM32F4**: `stm32f407disco` - no external SDK required, good for testing
-- **RP2040**: `pico_sdk` - requires Pico SDK, commonly used
+- **RP2040**: `raspberry_pi_pico` - requires Pico SDK, commonly used
- **Other families**: Check `hw/bsp/FAMILY/boards/` for available boards
## Common Tasks and Time Expectations
@@ -130,4 +168,23 @@ python3 tools/build.py -b BOARD_NAME
- **Microchip**: SAM D/E/G/L families
- Check `hw/bsp/` for complete list and `docs/reference/boards.rst` for details
+## Code Style Guidelines
+
+### General Coding Standards
+- Use C99 standard
+- Memory-safe: no dynamic allocation
+- Thread-safe: defer all interrupt events to non-ISR task functions
+- 2-space indentation, no tabs
+- Use snake_case for variables/functions
+- Use UPPER_CASE for macros and constants
+- Follow existing variable naming patterns in files you're modifying
+- Include proper header comments with MIT license
+- Add descriptive comments for non-obvious functions
+
+### Best Practices
+- When including headers, group in order: C stdlib, tusb common, drivers, classes
+- Always check return values from functions that can fail
+- Use TU_ASSERT() for error checking with return statements
+- Follow the existing code patterns in the files you're modifying
+
Remember: TinyUSB is designed for embedded systems - builds are fast, tests are focused, and the codebase is optimized for resource-constrained environments.
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 9243c866d..16f906632 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -198,6 +198,17 @@ jobs:
needs: hil-build
runs-on: [self-hosted, X64, hathach, hardware-in-the-loop]
steps:
+ - name: Get Skip Boards from previous run
+ if: github.run_attempt != '1'
+ run: |
+ if [ -f "${{ env.HIL_JSON }}.skip" ]; then
+ SKIP_BOARDS=$(cat "${{ env.HIL_JSON }}.skip")
+ else
+ SKIP_BOARDS=""
+ fi
+ echo "SKIP_BOARDS=$SKIP_BOARDS"
+ echo "SKIP_BOARDS=$SKIP_BOARDS" >> $GITHUB_ENV
+
- name: Clean workspace
run: |
echo "Cleaning up for the first run"
@@ -213,25 +224,8 @@ jobs:
path: cmake-build
merge-multiple: true
- - name: Cache skip list
- uses: actions/cache@v4
- with:
- path: ${{ env.HIL_JSON }}.skip
- key: hil-skip-${{ github.run_id }}-${{ github.run_attempt }}
- restore-keys: |
- hil-skip-${{ github.run_id }}-
-
- name: Test on actual hardware
run: |
- ls cmake-build/
-
- # Skip boards that passed with previous run, file is generated by hil_test.py
- SKIP_BOARDS=""
- if [ -f ${{ env.HIL_JSON }}.skip ]; then
- SKIP_BOARDS=$(cat "${HIL_JSON}.skip")
- fi
- echo "SKIP_BOARDS=$SKIP_BOARDS"
-
python3 test/hil/hil_test.py ${{ env.HIL_JSON }} $SKIP_BOARDS
# ---------------------------------------
diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml
deleted file mode 100644
index a6ea7e396..000000000
--- a/.github/workflows/claude.yml
+++ /dev/null
@@ -1,49 +0,0 @@
-name: Claude Code
-
-on:
- issue_comment:
- types: [created]
- pull_request_review_comment:
- types: [created]
- issues:
- types: [opened, assigned]
- pull_request_review:
- types: [submitted]
-
-jobs:
- claude:
- if: |
- (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
- (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
- (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
- (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
- runs-on: ubuntu-latest
- permissions:
- contents: read
- pull-requests: read
- issues: read
- id-token: write
- actions: read # Required for Claude to read CI results on PRs
- steps:
- - name: Checkout repository
- uses: actions/checkout@v4
- with:
- fetch-depth: 1
-
- - name: Run Claude Code
- id: claude
- uses: anthropics/claude-code-action@v1
- with:
- anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
-
- # This is an optional setting that allows Claude to read CI results on PRs
- additional_permissions: |
- actions: read
-
- # Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
- # prompt: 'Update the pull request description to include a summary of changes.'
-
- # Optional: Add claude_args to customize behavior and configuration
- # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
- # or https://docs.claude.com/en/docs/claude-code/sdk#command-line for available options
- # claude_args: '--model claude-opus-4-1-20250805 --allowed-tools Bash(gh pr:*)'