Skip to content

Conversation

Tejasgarg
Copy link
Contributor

@Tejasgarg Tejasgarg commented Oct 15, 2025

This PR changes the files to work on the prototype.

I have changed the FLASH.ld file from STM32ZIT6 to STM32RIT6, both in the bootloader and firmware.
Also changed this in the cmake files.

I have also changed the user LED pin from
PB0 -> PB12, as used on the prototype board.

Summary by Sourcery

Configure project for prototype board by switching target MCU variant and updating LED pin assignment

Enhancements:

  • Update linker scripts to target STM32H563RITx devices and adjust memory regions and stack size
  • Update CMake configuration to use STM32H563RI package and reference new linker scripts
  • Change user LED pin assignment from PB0 to PB12 across bootloader and firmware

Summary by Sourcery

Configure project for the prototype board by switching the MCU variant, updating linker scripts and build settings, consolidating to a single green LED on PB12, and adjusting blink behavior

Enhancements:

  • Switch target MCU variant from STM32H563ZITx to STM32H563RITx in bootloader and firmware
  • Update linker scripts with new memory origins, lengths, and READONLY section attributes
  • Modify LED driver and system modules to use a single green LED on PB12
  • Adjust application blink logic to toggle the green LED at a 2 s interval

Build:

  • Update CMake configurations to reference the STM32H563RITx linker scripts and CMSIS package

@sourcery-ai
Copy link

sourcery-ai bot commented Oct 15, 2025

Reviewer's Guide

This PR reconfigures the build and hardware abstraction for the prototype by switching the target MCU variant to STM32H563RITx (updating linker scripts and CMake settings), simplifying the LED subsystem to a single user LED on PB12, and adjusting the blink logic in application code.

Class diagram for updated LED subsystem

classDiagram
    class LED_LL_ID {
        <<enum>>
        LED_LL_GREEN = 0
        LED_LL_COUNT
    }
    class LEDConfig {
        GPIO_TypeDef *gpio_group
        uint16_t gpio_pin
    }
    class LED_LL {
        +void LED_LL_init()
        +void LED_LL_on(LED_LL_ID led_id)
        +void LED_LL_off(LED_LL_ID led_id)
        +void LED_LL_toggle(LED_LL_ID led_id)
    }
    LED_LL_ID <.. LED_LL
    LEDConfig <.. LED_LL

    class LED_ID {
        <<enum>>
        LED_GREEN
        LED_COUNT
    }
    class LED {
        +void LED_init()
        +void LED_on(LED_ID led_id)
        +void LED_off(LED_ID led_id)
        +void LED_toggle(LED_ID led_id)
    }
    LED_ID <.. LED
Loading

File-Level Changes

Change Details Files
Update target MCU variant and linker scripts
  • Switch FLASH.ld device identifiers from STM32H563ZITx to STM32H563RITx
  • Adjust RAM and FLASH origin and length definitions
  • Add READONLY qualifiers to section declarations
  • Bump copyright year from 2024 to 2025
boot/STM32H563ZITX_FLASH.ld
src/platform/h563xx/STM32H563ZITX_FLASH.ld
src/platform/h563xx/STM32H563RITX_FLASH.ld
Align CMake configuration with new MCU variant
  • Point bootloader CMake to use STM32H563RITX_FLASH.ld
  • Update CMSIS package lookup from STM32H563ZI to STM32H563RI
boot/CMakeLists.txt
cmake/target.cmake
Simplify LED subsystem to single LED on PB12
  • Change LED_GREEN pin from PB0 to PB12 and remove LED_YELLOW/LED_RED definitions
  • Enable/disable only GPIOB clock and update init/deinit flows
  • Remove LED loop initialization and mapping for unused LEDs
  • Update LED headers and HAL abstraction to reflect single LED
src/platform/h563xx/led_ll.c
src/platform/led_ll.h
src/system/led.h
src/system/led.c
boot/main.c
boot/led.c
Adjust application blink logic
  • Double blink period from 1000ms to 2000ms
  • Use only LED_GREEN for toggle instead of LED_YELLOW
src/application/main.c

Possibly linked issues


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. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

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 there - I've reviewed your changes and they look great!


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.

@Tejasgarg Tejasgarg marked this pull request as draft October 15, 2025 21:50
@Tejasgarg Tejasgarg marked this pull request as ready for review October 21, 2025 14:28
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 there - I've reviewed your changes - here's some feedback:

  • Now that only one LED is supported, consider refactoring led_ll.c, led_ll.h, and related abstractions to remove the array indirection and unused enum entries to simplify the API.
  • The linker script changes are duplicated under both boot/ and src/platform; consolidating them into a shared template or including a single source file could reduce duplication and maintenance overhead.
  • The blink_period magic number in application/main.c could be extracted into a named constant or configuration macro to improve readability and make future tuning easier.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Now that only one LED is supported, consider refactoring led_ll.c, led_ll.h, and related abstractions to remove the array indirection and unused enum entries to simplify the API.
- The linker script changes are duplicated under both boot/ and src/platform; consolidating them into a shared template or including a single source file could reduce duplication and maintenance overhead.
- The blink_period magic number in application/main.c could be extracted into a named constant or configuration macro to improve readability and make future tuning easier.

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.

@Tejasgarg Tejasgarg requested a review from bessman October 21, 2025 14:30
@bessman bessman merged commit 1026517 into fossasia:feat/crystal Oct 22, 2025
1 check 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.

2 participants