====== Mini-Pix STM32F405VG ====== L'objectif est d'utiliser la carte Mini-Pix comme terrain de jeu et d'expérimentation sur la plateforme STM32. Les données se trouvent [[https://nuage.beafrancois.fr/nextcloud/index.php/f/211397|ici]]. ===== Zephyrproject ===== [[https://zephyrproject.org|Site du projet]]. L'installation de l'environnement est simple. Je l'ai faite dans ''~/Projets/zephyr'' ==== Création de la board mini_pix ==== - Création du répertoire ''zephyr/zephyr/boards/radiolink/mini_pix''. - Copie d'un projet similaire (ici ''zephyr/boards/weact/stm32f405_core''). - Adaptation des noms (weact_stm32f405_core --> radiolink_mini_pix) ==== Adaptation de l'image pour MCUboot ==== L'objectif est de pouvoir remplacer le bootloader qui se trouve sur la carte. Histoire de pouvoir mettre à jour l'appli comme on veut. Il faut rajouter les paramètres suivants dans le fichier ''zephyr/boards/radiolink/mini_pix/radiolink_mini_pix_defconfig'' CONFIG_CLOCK_STM32_HSE_CLOCK=24000000 # enable MCUBoot CONFIG_BOOTLOADER_MCUBOOT=y CONFIG_MCUBOOT_GENERATE_UNSIGNED_IMAGE=y CONFIG_MCUBOOT_BOOTLOADER_MODE_OVERWRITE_ONLY=y Il faut modifier le device tree ''zephyr/boards/radiolink/mini_pix/radiolink_mini_pix.dts'' Changement de l'include du µC [...] #include [...] Les partitions [...] soc { flash-controller@40023c00 { flash0: flash@8000000 { partitions { compatible = "fixed-partitions"; #address-cells = <0x1>; #size-cells = <0x1>; boot_partition: partition@0 { reg = <0x0 0x10000>; read-only; }; storage_partition: partition@1e000 { reg = <0x1e000 0x2000>; }; slot0_partition: partition@20000 { reg = <0x20000 0x60000>; }; slot1_partition: partition@80000 { reg = <0x80000 0x60000>; }; scratch_partition: partition@e0000 { reg = <0xe0000 0x20000>; }; }; }; }; }; [...] Dire sur quelle partition le code sera et quelle sera la console [...] chosen { zephyr,console = &usart2; zephyr,shell-uart = &usart2; zephyr,sram = &sram0; zephyr,flash = &flash0; zephyr,code-partition = &slot0_partition; zephyr,ccm = &ccm0; }; [...] Changement de la fréquence [...] &clk_hse { clock-frequency = ; status = "okay"; }; &pll { div-m = <24>; mul-n = <336>; div-p = <2>; div-q = <7>; clocks = <&clk_hse>; status = "okay"; }; &rcc { clocks = <&pll>; clock-frequency = ; ahb-prescaler = <1>; apb1-prescaler = <4>; apb2-prescaler = <2>; }; [...] les leds [...] leds: leds { compatible = "gpio-leds"; led: led_0 { gpios = <&gpioc 5 GPIO_ACTIVE_HIGH>; label = "User LED"; }; boot_led: led_1 { gpios = <&gpiob 1 GPIO_ACTIVE_HIGH>; label = "Bootloader LED"; }; }; [...] le port série [...] &usart2 { pinctrl-0 = <&usart2_tx_pd5 &usart2_rx_pd6>; pinctrl-names = "default"; current-speed = <115200>; status = "okay"; }; [...] ===== MCUboot ===== MCUboot est le bootloader officiel du projet Zephyr. il faut aller dans le réperoire ''zephyr/bootloader/mcuboot/boot/zephyr'' Pour faire une config jolie: west build -t menuconfig Il faut configurer les trucs suivants: # Configured to only overwrite slot 0 CONFIG_SINGLE_APPLICATION_SLOT=y CONFIG_BOOT_USB_DFU_WAIT=y # CONFIG_BOOT_USB_DFU_GPIO is not set CONFIG_BOOT_USB_DFU_WAIT_DELAY_MS=12000 CONFIG_BOOT_USB_DFU_NO_APPLICATION=y CONFIG_MCUBOOT_INDICATION_LED=y CONFIG_USB_DEVICE_DRIVER=y CONFIG_USB_DEVICE_VID=0x0483 CONFIG_USB_DEVICE_PID=0xdf11 CONFIG_USB_DEVICE_MANUFACTURER="FOUE" ==== Flasher MCUboot ==== Il faut passer en mode DFU sur la Mini-Pix en mettant la pin 94 (BOOT0) à 3.3V. Ensuite, dans ''zephyr/bootloader/mcuboot/boot/zephyr/build/zephyr'' dfu-util -a 0 -s 0x08000000:leave -D zephyr.bin