bootloader somehow working
Signed-off-by: Eduard Iten <eduard@iten.pro>
This commit is contained in:
9
software/apps/bl_test/sysbuild/bl_test.overlay
Normal file
9
software/apps/bl_test/sysbuild/bl_test.overlay
Normal file
@@ -0,0 +1,9 @@
|
||||
#include "common.dtsi"
|
||||
|
||||
/* Application Configuration - Firmware wird in slot0_partition geschrieben */
|
||||
/ {
|
||||
chosen {
|
||||
zephyr,code-partition = &slot0_partition;
|
||||
zephyr,uart-mcumgr = &cdc_acm_uart0;
|
||||
};
|
||||
};
|
||||
94
software/apps/bl_test/sysbuild/common.dtsi
Normal file
94
software/apps/bl_test/sysbuild/common.dtsi
Normal file
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Common Devicetree Configuration für weact_stm32g431_core
|
||||
* - Konfiguriert einen W25Q128 Flash-Speicher auf SPI2
|
||||
* - Konfiguriert USB-CDC für MCUMGR
|
||||
* - Setzt den Chip Select (CS) Pin auf PA5
|
||||
* - Weist das Label "flash1" zu
|
||||
*/
|
||||
|
||||
/* Partitions für internes Flash (STM32G431) */
|
||||
&flash0 {
|
||||
/delete-node/ partitions; /* Entferne die Standard-Partitionen */
|
||||
partitions {
|
||||
compatible = "fixed-partitions";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
/* MCUboot bootloader - 48 KB */
|
||||
boot_partition: partition@0 {
|
||||
label = "mcuboot";
|
||||
reg = <0x00000000 0x0000C000>;
|
||||
};
|
||||
|
||||
/* Slot0 partition für primäres Application Image - 80 KB (20 sectors @ 4KB) */
|
||||
slot0_partition: partition@C000 {
|
||||
label = "image-0";
|
||||
reg = <0x0000C000 0x00014000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
/* USB-CDC Konfiguration für MCUMGR */
|
||||
&usb {
|
||||
status = "okay";
|
||||
cdc_acm_uart0: cdc_acm_uart0 {
|
||||
compatible = "zephyr,cdc-acm-uart";
|
||||
};
|
||||
};
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
zephyr,uart-mcumgr = &cdc_acm_uart0;
|
||||
};
|
||||
};
|
||||
|
||||
&spi2 {
|
||||
/* Definiere die Pins für SCK, MISO, MOSI auf Port B */
|
||||
pinctrl-0 = <&spi2_sck_pb13 &spi2_miso_pb14 &spi2_mosi_pb15>;
|
||||
pinctrl-names = "default";
|
||||
status = "okay";
|
||||
|
||||
/* === Chip Select (CS) auf PA5 gesetzt === */
|
||||
cs-gpios = <&gpioa 5 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
|
||||
|
||||
/* Definiere den Flash-Chip als SPI NOR Gerät */
|
||||
flash1: flash@0 {
|
||||
compatible = "jedec,spi-nor";
|
||||
reg = <0>;
|
||||
label = "flash1";
|
||||
|
||||
/* JEDEC ID für einen Winbond W25Q128 (16 MBytes) */
|
||||
jedec-id = [ef 40 18];
|
||||
|
||||
/* Speichergröße in Bytes (16 MBytes) */
|
||||
size = <DT_SIZE_M(16)>;
|
||||
|
||||
/* Maximale Taktfrequenz - angepasst an STM32G431 Limits */
|
||||
spi-max-frequency = <1000000>;
|
||||
|
||||
/* Partitions für externes Flash */
|
||||
partitions {
|
||||
compatible = "fixed-partitions";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
/* Slot1 partition für MCUboot (sekundäres Image) - 80 KB (20 sectors @ 4KB) */
|
||||
slot1_partition: partition@0 {
|
||||
label = "image-1";
|
||||
reg = <0x00000000 0x00014000>;
|
||||
};
|
||||
|
||||
/* Scratch partition für MCUboot - 80 KB (20 sectors @ 4KB) */
|
||||
scratch_partition: partition@14000 {
|
||||
label = "scratch";
|
||||
reg = <0x00014000 0x00014000>;
|
||||
};
|
||||
|
||||
/* Speicher partition für LittleFS - ~15.83 MB */
|
||||
storage_partition: partition@28000 {
|
||||
label = "storage";
|
||||
reg = <0x00028000 0x00FD8000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
23
software/apps/bl_test/sysbuild/mcuboot.conf
Normal file
23
software/apps/bl_test/sysbuild/mcuboot.conf
Normal file
@@ -0,0 +1,23 @@
|
||||
CONFIG_LOG=y
|
||||
CONFIG_MCUBOOT_LOG_LEVEL_INF=y
|
||||
|
||||
# Enable UART console for MCUboot debug output
|
||||
CONFIG_UART_CONSOLE=y
|
||||
CONFIG_CONSOLE=y
|
||||
CONFIG_MCUBOOT_INDICATION_LED=y
|
||||
|
||||
# Enable external SPI flash support
|
||||
CONFIG_SPI=y
|
||||
CONFIG_SPI_NOR=y
|
||||
CONFIG_SPI_NOR_SFDP_DEVICETREE=n
|
||||
CONFIG_FLASH=y
|
||||
CONFIG_FLASH_MAP=y
|
||||
CONFIG_GPIO=y
|
||||
|
||||
# Add SPI NOR specific configurations - use 4KB page size (required by driver)
|
||||
CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
|
||||
CONFIG_SPI_NOR_INIT_PRIORITY=80
|
||||
|
||||
# Set maximum image sectors manually since auto doesn't work with external flash
|
||||
CONFIG_BOOT_MAX_IMG_SECTORS_AUTO=n
|
||||
CONFIG_BOOT_MAX_IMG_SECTORS=80
|
||||
8
software/apps/bl_test/sysbuild/mcuboot.overlay
Normal file
8
software/apps/bl_test/sysbuild/mcuboot.overlay
Normal file
@@ -0,0 +1,8 @@
|
||||
#include "common.dtsi"
|
||||
|
||||
/* MCUboot Configuration - Bootloader wird in boot_partition geschrieben */
|
||||
/ {
|
||||
chosen {
|
||||
zephyr,code-partition = &boot_partition;
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user