Skip to content

Commit 3c108b2

Browse files
committed
add CLAUDE.md and fix pre-commit build
1 parent 9da1113 commit 3c108b2

File tree

4 files changed

+76
-11
lines changed

4 files changed

+76
-11
lines changed

.github/workflows/claude-code-review.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ jobs:
1717
# github.event.pull_request.user.login == 'external-contributor' ||
1818
# github.event.pull_request.user.login == 'new-developer' ||
1919
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
20-
20+
2121
runs-on: ubuntu-latest
2222
permissions:
2323
contents: read
2424
pull-requests: read
2525
issues: read
2626
id-token: write
27-
27+
2828
steps:
2929
- name: Checkout repository
3030
uses: actions/checkout@v4
@@ -46,12 +46,11 @@ jobs:
4646
- Performance considerations
4747
- Security concerns
4848
- Test coverage
49-
49+
5050
Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback.
5151
5252
Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.
53-
53+
5454
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
5555
# or https://docs.claude.com/en/docs/claude-code/sdk#command-line for available options
5656
claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'
57-

.github/workflows/claude.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
uses: anthropics/claude-code-action@v1
3636
with:
3737
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
38-
38+
3939
# This is an optional setting that allows Claude to read CI results on PRs
4040
additional_permissions: |
4141
actions: read
@@ -47,4 +47,3 @@ jobs:
4747
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
4848
# or https://docs.claude.com/en/docs/claude-code/sdk#command-line for available options
4949
# claude_args: '--model claude-opus-4-1-20250805 --allowed-tools Bash(gh pr:*)'
50-

CLAUDE.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# TinyUSB Development Guide
2+
3+
## Build Commands
4+
5+
### CMake Build System (Preferred)
6+
CMake with Ninja is the preferred build method for TinyUSB development.
7+
8+
- Build example with Ninja:
9+
```bash
10+
cd examples/device/cdc_msc
11+
mkdir build && cd build
12+
cmake -G Ninja -DBOARD=raspberry_pi_pico ..
13+
ninja
14+
```
15+
- Debug build: `cmake -G Ninja -DBOARD=raspberry_pi_pico -DCMAKE_BUILD_TYPE=Debug ..`
16+
- With logging: `cmake -G Ninja -DBOARD=raspberry_pi_pico -DLOG=2 ..`
17+
- With RTT logger: `cmake -G Ninja -DBOARD=raspberry_pi_pico -DLOG=2 -DLOGGER=rtt ..`
18+
- Flash with JLink: `ninja cdc_msc-jlink`
19+
- Flash with OpenOCD: `ninja cdc_msc-openocd`
20+
- Generate UF2: `ninja cdc_msc-uf2`
21+
- List all targets: `ninja -t targets`
22+
23+
### Make Build System (Alternative)
24+
- Build example: `cd examples/device/cdc_msc && make BOARD=raspberry_pi_pico all`
25+
- For specific example: `cd examples/{device|host|dual}/{example_name} && make BOARD=raspberry_pi_pico all`
26+
- Flash with JLink: `make BOARD=raspberry_pi_pico flash-jlink`
27+
- Flash with OpenOCD: `make BOARD=raspberry_pi_pico flash-openocd`
28+
- Debug build: `make BOARD=raspberry_pi_pico DEBUG=1 all`
29+
- With logging: `make BOARD=raspberry_pi_pico LOG=2 all`
30+
- With RTT logger: `make BOARD=raspberry_pi_pico LOG=2 LOGGER=rtt all`
31+
- Generate UF2: `make BOARD=raspberry_pi_pico all uf2`
32+
33+
### Additional Options
34+
- Select RootHub port: `RHPORT_DEVICE=1` (make) or `-DRHPORT_DEVICE=1` (cmake)
35+
- Set port speed: `RHPORT_DEVICE_SPEED=OPT_MODE_FULL_SPEED` (make) or `-DRHPORT_DEVICE_SPEED=OPT_MODE_FULL_SPEED` (cmake)
36+
37+
### Dependencies
38+
- Get dependencies: `python tools/get_deps.py rp2040`
39+
- Or from example: `cd examples/device/cdc_msc && make BOARD=raspberry_pi_pico get-deps`
40+
41+
### Testing
42+
- Run unit tests: `cd test/unit-test && ceedling test:all`
43+
- Run specific test: `cd test/unit-test && ceedling test:test_fifo`
44+
45+
### Pre-commit Hooks
46+
Before building, it's recommended to run pre-commit to ensure code quality:
47+
- Run pre-commit on all files: `pre-commit run --all-files`
48+
- Run pre-commit on staged files: `pre-commit run`
49+
- Install pre-commit hook: `pre-commit install`
50+
51+
## Code Style Guidelines
52+
- Use C99 standard
53+
- Memory-safe: no dynamic allocation
54+
- Thread-safe: defer all interrupt events to non-ISR task functions
55+
- 2-space indentation, no tabs
56+
- Use snake_case for variables/functions
57+
- Use UPPER_CASE for macros and constants
58+
- Follow existing variable naming patterns in files you're modifying
59+
- Include proper header comments with MIT license
60+
- Add descriptive comments for non-obvious functions
61+
- When including headers, group in order: C stdlib, tusb common, drivers, classes
62+
- Always check return values from functions that can fail
63+
- Use TU_ASSERT() for error checking with return statements
64+
65+
## Project Structure
66+
- src/: Core TinyUSB stack code
67+
- hw/: Board support packages and MCU drivers
68+
- examples/: Reference examples for device/host/dual
69+
- test/: Unit tests and hardware integration tests

README.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ Supported CPUs
115115
| +-----------------------------+--------+------+-----------+------------------------+-------------------+
116116
| | F402_F405 |||| dwc2 | F405 is HS |
117117
+--------------+-----------------------------+--------+------+-----------+------------------------+-------------------+
118-
| Brigetek | FT90x || || ft9xx | 1-dir ep |
118+
| Bridgetek | FT90x || || ft9xx | 1-dir ep |
119119
+--------------+-----------------------------+--------+------+-----------+------------------------+-------------------+
120120
| Broadcom | BCM2711, BCM2837 || || dwc2 | |
121121
+--------------+-----------------------------+--------+------+-----------+------------------------+-------------------+
@@ -147,7 +147,7 @@ Supported CPUs
147147
| | +-----------------------+--------+------+-----------+------------------------+-------------------+
148148
| | | 32mz || | | pic32mz | musb variant |
149149
+--------------+-----+-----------------------+--------+------+-----------+------------------------+-------------------+
150-
| Mind Montion | mm32 || || mm32f327x_otg | ci_fs variant |
150+
| MindMotion | mm32 || || mm32f327x_otg | ci_fs variant |
151151
+--------------+-----+-----------------------+--------+------+-----------+------------------------+-------------------+
152152
| NordicSemi | nRF 52833, 52840, 5340 |||| nrf5x | only ep8 is ISO |
153153
+--------------+-----------------------------+--------+------+-----------+------------------------+-------------------+
@@ -202,8 +202,6 @@ Supported CPUs
202202
| | C0, G0, H5 || || stm32_fsdev | |
203203
| +-----------------------------+--------+------+-----------+------------------------+-------------------+
204204
| | G4 |||| stm32_fsdev | |
205-
| +-----------------------------+--------+------+-----------+------------------------+-------------------+
206-
| | L0, L1 |||| stm32_fsdev | |
207205
| +----+------------------------+--------+------+-----------+------------------------+-------------------+
208206
| | L4 | 4x2, 4x3 |||| stm32_fsdev | |
209207
| | +------------------------+--------+------+-----------+------------------------+-------------------+

0 commit comments

Comments
 (0)