Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion boot/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ target_compile_options(pslab-mini-bootloader
$<$<CONFIG:Debug>:-Og> # -O0 doesn't fit in 48K
)

stm32_add_linker_script(pslab-mini-bootloader PRIVATE STM32H563ZITX_FLASH.ld)
stm32_add_linker_script(pslab-mini-bootloader PRIVATE STM32H563RITX_FLASH.ld)
stm32_print_size_of_target(pslab-mini-bootloader)
stm32_generate_srec_file(pslab-mini-bootloader)
22 changes: 9 additions & 13 deletions boot/STM32H563ZITX_FLASH.ld → boot/STM32H563RITX_FLASH.ld
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
**
** @author : Auto-generated by STM32CubeIDE
**
** Abstract : Linker script for NUCLEO-H563ZI Board embedding STM32H563ZITx Device from stm32h5 series
** @brief : Linker script for STM32H563RITx Device from STM32H5 series
** 2048KBytes FLASH
** 640KBytes RAM
**
Expand All @@ -22,7 +22,7 @@
******************************************************************************
** @attention
**
** Copyright (c) 2024 STMicroelectronics.
** Copyright (c) 2025 STMicroelectronics.
** All rights reserved.
**
** This software is licensed under terms that can be found in the LICENSE file
Expand All @@ -44,12 +44,8 @@ _Min_Stack_Size = 0x1000; /* required amount of stack */
/* Memories definition */
MEMORY
{
RAM (xrw) :
ORIGIN = 0x20000000,
LENGTH = 640K
FLASH (rx) :
ORIGIN = 0x08000000,
LENGTH = 48K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 640K
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 48K
}

/* Sections */
Expand Down Expand Up @@ -89,14 +85,14 @@ SECTIONS
. = ALIGN(4);
} >FLASH

.ARM.extab :
.ARM.extab (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
{
. = ALIGN(4);
*(.ARM.extab* .gnu.linkonce.armextab.*)
. = ALIGN(4);
} >FLASH

.ARM :
.ARM (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
{
. = ALIGN(4);
__exidx_start = .;
Expand All @@ -105,7 +101,7 @@ SECTIONS
. = ALIGN(4);
} >FLASH

.preinit_array :
.preinit_array (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
{
. = ALIGN(4);
PROVIDE_HIDDEN (__preinit_array_start = .);
Expand All @@ -114,7 +110,7 @@ SECTIONS
. = ALIGN(4);
} >FLASH

.init_array :
.init_array (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
{
. = ALIGN(4);
PROVIDE_HIDDEN (__init_array_start = .);
Expand All @@ -124,7 +120,7 @@ SECTIONS
. = ALIGN(4);
} >FLASH

.fini_array :
.fini_array (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
{
. = ALIGN(4);
PROVIDE_HIDDEN (__fini_array_start = .);
Expand Down
6 changes: 3 additions & 3 deletions boot/led.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ void LedBlinkTask(void)
if (ledOn == BLT_FALSE)
{
ledOn = BLT_TRUE;
LL_GPIO_SetOutputPin(GPIOB, LL_GPIO_PIN_0);
LL_GPIO_SetOutputPin(GPIOB, LL_GPIO_PIN_12);
}
else
{
ledOn = BLT_FALSE;
LL_GPIO_ResetOutputPin(GPIOB, LL_GPIO_PIN_0);
LL_GPIO_ResetOutputPin(GPIOB, LL_GPIO_PIN_12);
}
/* schedule the next blink event */
nextBlinkEvent = TimerGet() + ledBlinkIntervalMs;
Expand All @@ -94,7 +94,7 @@ void LedBlinkTask(void)
void LedBlinkExit(void)
{
/* turn the LED off */
LL_GPIO_ResetOutputPin(GPIOB, LL_GPIO_PIN_0);
LL_GPIO_ResetOutputPin(GPIOB, LL_GPIO_PIN_12);
} /*** end of LedBlinkExit ***/


Expand Down
13 changes: 3 additions & 10 deletions boot/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,6 @@ void HAL_MspInit(void)
LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOB);
LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOC);
LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOD);
LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOE);
LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOF);
LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOG);
LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOH);

#if (BOOT_COM_RS232_ENABLE > 0)
Expand All @@ -253,13 +250,13 @@ void HAL_MspInit(void)
#endif

/* Configure GPIO pin for the LED. */
GPIO_InitStruct.Pin = LL_GPIO_PIN_0;
GPIO_InitStruct.Pin = LL_GPIO_PIN_12;
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
LL_GPIO_ResetOutputPin(GPIOB, LL_GPIO_PIN_0);
LL_GPIO_ResetOutputPin(GPIOB, LL_GPIO_PIN_12);

/* Configure GPIO pin for (optional) backdoor entry input. */
GPIO_InitStruct.Pin = LL_GPIO_PIN_13;
Expand Down Expand Up @@ -309,12 +306,10 @@ void HAL_MspDeInit(void)
LL_RCC_DeInit();

/* Reset GPIO pin for the LED to turn it off. */
LL_GPIO_ResetOutputPin(GPIOB, LL_GPIO_PIN_0);
LL_GPIO_ResetOutputPin(GPIOB, LL_GPIO_PIN_12);

/* Deinit used GPIOs. */
LL_GPIO_DeInit(GPIOH);
LL_GPIO_DeInit(GPIOG);
LL_GPIO_DeInit(GPIOE);
LL_GPIO_DeInit(GPIOD);
LL_GPIO_DeInit(GPIOC);
LL_GPIO_DeInit(GPIOB);
Expand All @@ -337,8 +332,6 @@ void HAL_MspDeInit(void)

/* GPIO ports clock disable. */
LL_AHB2_GRP1_DisableClock(LL_AHB2_GRP1_PERIPH_GPIOH);
LL_AHB2_GRP1_DisableClock(LL_AHB2_GRP1_PERIPH_GPIOG);
LL_AHB2_GRP1_DisableClock(LL_AHB2_GRP1_PERIPH_GPIOE);
LL_AHB2_GRP1_DisableClock(LL_AHB2_GRP1_PERIPH_GPIOD);
LL_AHB2_GRP1_DisableClock(LL_AHB2_GRP1_PERIPH_GPIOC);
LL_AHB2_GRP1_DisableClock(LL_AHB2_GRP1_PERIPH_GPIOB);
Expand Down
2 changes: 1 addition & 1 deletion cmake/target.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set(PLATFORM "h563xx" CACHE STRING "Target platform")
set_property(CACHE PLATFORM PROPERTY STRINGS "h563xx")

# Find required packages for target
find_package(CMSIS COMPONENTS STM32H563ZI REQUIRED)
find_package(CMSIS COMPONENTS STM32H563RI REQUIRED)
find_package(HAL COMPONENTS STM32H5 REQUIRED)

# Add subdirectories
Expand Down
2 changes: 1 addition & 1 deletion src/application/CMakeLists.target.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ target_link_libraries(pslab-mini-firmware

# Add platform-specific linker script
if(PLATFORM STREQUAL "h563xx")
stm32_add_linker_script(pslab-mini-firmware PRIVATE ../platform/h563xx/STM32H563ZITX_FLASH.ld)
stm32_add_linker_script(pslab-mini-firmware PRIVATE ../platform/h563xx/STM32H563RITX_FLASH.ld)
stm32_print_size_of_target(pslab-mini-firmware)
stm32_generate_srec_file(pslab-mini-firmware)
endif()
4 changes: 2 additions & 2 deletions src/application/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ int main(void)
LOG_task(0xF);

static uint32_t last_toggle = 0;
uint32_t const blink_period = 1000; // 1 second
uint32_t const blink_period = 2000; // 2 second
if (SYSTEM_get_tick() - last_toggle >= blink_period) {
LED_toggle(LED_YELLOW);
LED_toggle(LED_GREEN);
last_toggle = SYSTEM_get_tick();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
**
** @author : Auto-generated by STM32CubeIDE
**
** Abstract : Linker script for NUCLEO-H563ZI Board embedding STM32H563ZITx Device from stm32h5 series
** @brief : Linker script for STM32H563RITx Device from STM32H5 series
** 2048KBytes FLASH
** 640KBytes RAM
**
Expand All @@ -22,7 +22,7 @@
******************************************************************************
** @attention
**
** Copyright (c) 2024 STMicroelectronics.
** Copyright (c) 2025 STMicroelectronics.
** All rights reserved.
**
** This software is licensed under terms that can be found in the LICENSE file
Expand All @@ -44,12 +44,8 @@ _Min_Stack_Size = 0x1000; /* required amount of stack */
/* Memories definition */
MEMORY
{
RAM (xrw) :
ORIGIN = 0x20000000,
LENGTH = 640K
FLASH (rx) :
ORIGIN = 0x0800C000,
LENGTH = 2048K - 48K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 640K
FLASH (rx) : ORIGIN = 0x800C000, LENGTH = 2048K - 48K
}

/* Sections */
Expand Down Expand Up @@ -89,14 +85,14 @@ SECTIONS
. = ALIGN(4);
} >FLASH

.ARM.extab :
.ARM.extab (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
{
. = ALIGN(4);
*(.ARM.extab* .gnu.linkonce.armextab.*)
. = ALIGN(4);
} >FLASH

.ARM :
.ARM (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
{
. = ALIGN(4);
__exidx_start = .;
Expand All @@ -105,7 +101,7 @@ SECTIONS
. = ALIGN(4);
} >FLASH

.preinit_array :
.preinit_array (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
{
. = ALIGN(4);
PROVIDE_HIDDEN (__preinit_array_start = .);
Expand All @@ -114,7 +110,7 @@ SECTIONS
. = ALIGN(4);
} >FLASH

.init_array :
.init_array (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
{
. = ALIGN(4);
PROVIDE_HIDDEN (__init_array_start = .);
Expand All @@ -124,7 +120,7 @@ SECTIONS
. = ALIGN(4);
} >FLASH

.fini_array :
.fini_array (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
{
. = ALIGN(4);
PROVIDE_HIDDEN (__fini_array_start = .);
Expand Down
26 changes: 5 additions & 21 deletions src/platform/h563xx/led_ll.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@
*
* Hardware Implementation Details:
* - Uses STM32H5xx HAL library for GPIO operations
* - LED_GREEN (LED1) is connected to GPIOB Pin 0 (PB0)
* - LED_YELLOW (LED2) is connected to GPIOF Pin 4 (PF4)
* - LED_RED (LED3) is connected to GPIOG Pin 4 (PG4)
* - LED_GREEN (LED1) is connected to GPIOB Pin 12 (PB12)
* - Configured as push-pull output with no pull-up/pull-down resistors
* - Low frequency GPIO speed setting for power efficiency
* - Requires GPIOB, GPIOF, and GPIOG clocks to be enabled
* - Requires GPIOB clock to be enabled
*
* @author PSLab Team
* @date 2025
Expand All @@ -23,13 +21,7 @@
#include "led_ll.h"

#define LED_GREEN_GPIO_GROUP GPIOB
#define LED_GREEN_GPIO_PIN GPIO_PIN_0

#define LED_YELLOW_GPIO_GROUP GPIOF
#define LED_YELLOW_GPIO_PIN GPIO_PIN_4

#define LED_RED_GPIO_GROUP GPIOG
#define LED_RED_GPIO_PIN GPIO_PIN_4
#define LED_GREEN_GPIO_PIN GPIO_PIN_12

typedef struct {
GPIO_TypeDef *gpio_group;
Expand All @@ -38,8 +30,6 @@ typedef struct {

static LEDConfig const g_LED_CONFIGS[LED_LL_COUNT] = {
[LED_LL_GREEN] = { LED_GREEN_GPIO_GROUP, LED_GREEN_GPIO_PIN },
[LED_LL_YELLOW] = { LED_YELLOW_GPIO_GROUP, LED_YELLOW_GPIO_PIN },
[LED_LL_RED] = { LED_RED_GPIO_GROUP, LED_RED_GPIO_PIN },
};

/**
Expand All @@ -55,19 +45,13 @@ void LED_LL_init(void)

/* Enable GPIO port clocks */
__HAL_RCC_GPIOB_CLK_ENABLE();
__HAL_RCC_GPIOF_CLK_ENABLE();
__HAL_RCC_GPIOG_CLK_ENABLE();

/* Configure common GPIO settings */
gpio_init.Mode = GPIO_MODE_OUTPUT_PP;
gpio_init.Pull = GPIO_NOPULL;
gpio_init.Speed = GPIO_SPEED_FREQ_LOW;

/* Configure each LED pin */
for (int i = 0; i < LED_LL_COUNT; ++i) {
gpio_init.Pin = g_LED_CONFIGS[i].gpio_pin;
HAL_GPIO_Init(g_LED_CONFIGS[i].gpio_group, &gpio_init);
}
gpio_init.Pin = g_LED_CONFIGS[0].gpio_pin;
HAL_GPIO_Init(g_LED_CONFIGS[0].gpio_group, &gpio_init);
}

void LED_LL_on(LED_LL_ID led_id)
Expand Down
12 changes: 4 additions & 8 deletions src/platform/led_ll.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
* @brief LED identifiers for the Nucleo-H563ZI board
*/
typedef enum {
LED_LL_GREEN = 0, /**< Green LED on PB0 */
LED_LL_YELLOW, /**< Yellow LED on PF4 */
LED_LL_RED, /**< Red LED on PG4 */
LED_LL_GREEN = 0, /**< Green LED on PB12 */
LED_LL_COUNT /**< Total number of LEDs */
} LED_LL_ID;

Expand All @@ -36,8 +34,7 @@ void LED_LL_init(void);
*
* @pre LED_LL_init() must be called before using this function.
*
* @param led_id The ID of the LED to turn on (LED_LL_GREEN, LED_LL_YELLOW, or
* LED_LL_RED).
* @param led_id The ID of the LED to turn on (LED_LL_GREEN).
*/
void LED_LL_on(LED_LL_ID led_id);

Expand All @@ -46,8 +43,7 @@ void LED_LL_on(LED_LL_ID led_id);
*
* @pre LED_LL_init() must be called before using this function.
*
* @param led_id The ID of the LED to turn off (LED_LL_GREEN, LED_LL_YELLOW, or
* LED_LL_RED).
* @param led_id The ID of the LED to turn off (LED_LL_GREEN).
*/
void LED_LL_off(LED_LL_ID led_id);

Expand All @@ -56,7 +52,7 @@ void LED_LL_off(LED_LL_ID led_id);
*
* @pre LED_LL_init() must be called before using this function.
*
* @param led_id The LED to toggle (LED_LL_GREEN, LED_LL_YELLOW, or LED_LL_RED)
* @param led_id The LED to toggle (LED_LL_GREEN).
*/
void LED_LL_toggle(LED_LL_ID led_id);

Expand Down
2 changes: 0 additions & 2 deletions src/system/led.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

static LED_LL_ID const g_LED_MAPPING[LED_COUNT] = {
[LED_GREEN] = LED_LL_GREEN,
[LED_YELLOW] = LED_LL_YELLOW,
[LED_RED] = LED_LL_RED,
};

static char const *const g_LED_INVALID_WARN_MSG =
Expand Down
Loading