Skip to content

Update dependencies rebased #10409

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

Closed

Conversation

calamity10110
Copy link

CircuitPython Board Configuration System

This system allows board configurations to be defined using a single board_setting.toml file,
which is then automatically converted into the required C and Makefile configurations.

File Structure

  • board_setting.toml - Main configuration file
  • generate_board_config.py - Generator script
  • test_board_config.py - Test script
  • board_template.toml - Template with all available options

Usage

  1. Create a board_setting.toml in your board directory following the template
  2. Run the generator:
    python tools/generate_board_config.py ports/<port>/boards/<board_name>
  3. The following files will be generated/updated:
    • mpconfigboard.h
    • mpconfigboard.mk
    • pins.c
    • board.c

GitHub Integration

The .github/workflows/board_builder.yml workflow will automatically:

  • Detect changes to board_setting.toml files
  • Generate the configuration files
  • Build the firmware
  • Run tests
  • Upload artifacts

Testing

To test the configuration generator:

python tools/test_board_config.py

CXX coveragecpp.cpp
LINK build-coverage/micropython
   text    data     bss     dec     hex filename
1501735  319984  199040 2020759  1ed597 build-coverage/micropython

Adding a New Board

  1. Copy board_template.toml to ports/<port>/boards/<new_board>/board_setting.toml
  2. Fill in the configuration values
  3. Run the generator script
  4. Commit both the TOML and generated files

Best Practices

  • Keep the TOML file well-commented
  • Test configurations locally before committing
  • Verify all pin definitions match the board schematic
  • Update the configuration when making hardware changes

calamity10110 and others added 10 commits May 10, 2025 07:08
- Added TOML-based board configuration
- Created generator scripts and tests
- Implemented GitHub Actions workflow
- Added documentation
- Added comprehensive settings.md with detailed examples
- Organized pin definitions and peripheral configurations
- Included test cases for frozen modules
- Restructured board config files into board_config directory
Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

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

This is an interesting idea: a single config file that is a board definition.

However, there are many cases in current board definitions that are not covered in the board definitions or the script to generate the board definition. As an example, there are no provisions for pin aliases, special naming conventions, etc. For example, all GPIO pins are named GPIO<n> which is not always the case at all. Also, for example, board.I2C() is always included, even if there are no I2C pins.

The .mpy files in shared-module should not be there.

I don't think TOML is a good choice for a single board definition file. Using Python or some more powerful language that could do conditionals would make more sense.

It appears that this code was generated by AI, without good review.

We would not be able to accept this PR in its current form.

@dhalbert
Copy link
Collaborator

Closing for now.

@dhalbert dhalbert closed this Jun 16, 2025
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