Merge pull request #2966 from cesanta/ota-h7-dual-core
Some checks failed
Build and test - essentials / linux ${{ matrix.target }} CC=${{ matrix.cc }} SSL=${{ matrix.ssl }} (clang++, , mip_test) (push) Has been cancelled
Build and test - essentials / linux ${{ matrix.target }} CC=${{ matrix.cc }} SSL=${{ matrix.ssl }} (clang++, , test) (push) Has been cancelled
Build and test - essentials / linux ${{ matrix.target }} CC=${{ matrix.cc }} SSL=${{ matrix.ssl }} (clang++, BUILTIN, mip_test) (push) Has been cancelled
Build and test - essentials / linux ${{ matrix.target }} CC=${{ matrix.cc }} SSL=${{ matrix.ssl }} (clang++, BUILTIN, test) (push) Has been cancelled
Build and test - essentials / linux ${{ matrix.target }} CC=${{ matrix.cc }} SSL=${{ matrix.ssl }} (gcc, , mip_test) (push) Has been cancelled
Build and test - essentials / linux ${{ matrix.target }} CC=${{ matrix.cc }} SSL=${{ matrix.ssl }} (gcc, , test) (push) Has been cancelled
Build and test - essentials / linux ${{ matrix.target }} CC=${{ matrix.cc }} SSL=${{ matrix.ssl }} (gcc, BUILTIN, mip_test) (push) Has been cancelled
Build and test - essentials / linux ${{ matrix.target }} CC=${{ matrix.cc }} SSL=${{ matrix.ssl }} (gcc, BUILTIN, test) (push) Has been cancelled
Build and test - essentials / s390 (push) Has been cancelled
Build and test - essentials / armhf (push) Has been cancelled
Build and test - essentials / unamalgamated-mg_prefix (push) Has been cancelled
Build and test - essentials / macos SSL=${{ matrix.ssl }} () (push) Has been cancelled
Build and test - essentials / macos SSL=${{ matrix.ssl }} (BUILTIN) (push) Has been cancelled
Build and test - essentials / windows ${{ matrix.target }} (mingw++) (push) Has been cancelled
Build and test - essentials / windows ${{ matrix.target }} (vc22) (push) Has been cancelled
Build and test - essentials / windows ${{ matrix.target }} (vc98) (push) Has been cancelled
Build and test - essentials / arm (push) Has been cancelled
Build and test - essentials / riscv (push) Has been cancelled
Build and test - essentials / examples (push) Has been cancelled
Build and test - essentials / examples_win (push) Has been cancelled
Build and test - essentials / examples_mac (push) Has been cancelled
Build and test - essentials / refprojs (push) Has been cancelled
Build and test - essentials / refprojs_win (push) Has been cancelled
Build and test - essentials / refprojs_mac (push) Has been cancelled
Build and test - essentials / tutorials (push) Has been cancelled
Build and test - essentials / tutorials_win (push) Has been cancelled
Build and test - essentials / tutorials_mac (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:nxp/frdm-mcxn947-make-baremetal-builtin]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:nxp/frdm-mcxn947-make-freertos-builtin]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:nxp/rt1020-evk-make-baremetal-builtin]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:nxp/rt1060-evk-make-baremetal-builtin]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:nxp/rt1170-evk-make-baremetal-builtin]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:stm32/nucleo-f429zi-make-baremetal-builtin]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:stm32/nucleo-f429zi-make-freertos-builtin]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:stm32/nucleo-f746zg-make-baremetal-builtin]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:stm32/nucleo-f746zg-make-freertos-builtin]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:stm32/nucleo-h563zi-make-baremetal-builtin]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:stm32/nucleo-h563zi-make-freertos-builtin]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:stm32/nucleo-h723zg-make-baremetal-builtin]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:stm32/nucleo-h723zg-make-freertos-builtin]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:stm32/nucleo-h743zi-make-baremetal-builtin]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:stm32/nucleo-h743zi-make-freertos-builtin]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:stm32/stm32h573i-dk-make-baremetal-builtin]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:stm32/stm32h573i-dk-make-freertos-builtin]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:ti/ek-tm4c1294xl-make-baremetal-builtin]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:ti/ek-tm4c1294xl-make-freertos-builtin]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:esp32/uart-bridge]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:esp8266/http-client-server]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:infineon/infineon-xmc4700_4800-lwip-rtx-rtos]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:stm32/nucleo-g031-make-baremetal-builtin]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:esp32/device-dashboard]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:infineon/infineon-xmc7200]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:microchip/same54-xpro/device-dashboard]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:nxp/rt1020-evk-make-freertos-builtin]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:nxp/rt1060-evk-make-freertos-builtin]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:nxp/rt1170-evk-make-freertos-builtin]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:pico-sdk/pico-rndis-dashboard]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:pico-sdk/pico-w]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:pico-sdk/w5500-evb-pico-picosdk-baremetal-builtin]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:pico-sdk/w5500-evb-pico2-picosdk-baremetal-builtin]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:renesas/ek-ra6m4-make-baremetal-builtin]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:stm32/nucleo-f746zg-make-baremetal-builtin-cmsis_driver]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:stm32/nucleo-f746zg-make-freertos-tcp]) (push) Has been cancelled
Build and test - essentials / ${{ matrix.example.path }} (map[path:pico-sdk/pico-rndis-device]) (push) Has been cancelled
Build and test - essentials / cube_examples (push) Has been cancelled
Build and test - essentials / test_f7 (push) Has been cancelled
Build and test - essentials / test_f4 (push) Has been cancelled
Build and test - essentials / test_h743 (push) Has been cancelled
Build and test - essentials / test_h723 (push) Has been cancelled
Build and test - essentials / test_h5 (push) Has been cancelled
Build and test - essentials / test_rt1020 (push) Has been cancelled
Build and test - essentials / test_rt1060 (push) Has been cancelled
Build and test - essentials / test_rt1170 (push) Has been cancelled
Build and test - essentials / test_ra6m4 (push) Has been cancelled
Build and test - essentials / test_tm4c (push) Has been cancelled
Build and test - essentials / test_same54 (push) Has been cancelled
Build and test - essentials / test_pico_w5500 (push) Has been cancelled

H7 dual core OTA fix
This commit is contained in:
Sergio R. Caprile 2024-11-14 14:23:17 -03:00 committed by GitHub
commit 8b95a22e75
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 30 additions and 4 deletions

View File

@ -6654,7 +6654,7 @@ bool mg_ota_end(void) {
#if MG_OTA == MG_OTA_STM32H7
#if MG_OTA == MG_OTA_STM32H7 || MG_OTA == MG_OTA_STM32H7_DUAL_CORE
// - H723/735 RM 4.3.3: Note: The application can simultaneously request a read
// and a write operation through the AXI interface.
@ -6687,7 +6687,15 @@ static struct mg_flash s_mg_flash_stm32h7 = {
#define FLASH_OPTSR_PRG 0x20
#define FLASH_SIZE_REG 0x1ff1e880
#define IS_DUALCORE() (MG_OTA == MG_OTA_STM32H7_DUAL_CORE)
MG_IRAM static bool is_dualbank(void) {
if (IS_DUALCORE()) {
// H745/H755 and H747/H757 are running on dual core.
// Using only the 1st bank (mapped to CM7), in order not to interfere
// with the 2nd bank (CM4), possibly causing CM4 to boot unexpectedly.
return false;
}
return (s_mg_flash_stm32h7.size < 2 * 1024 * 1024) ? false : true;
}
@ -6824,6 +6832,10 @@ MG_IRAM static void single_bank_swap(char *p1, char *p2, size_t s, size_t ss) {
bool mg_ota_begin(size_t new_firmware_size) {
s_mg_flash_stm32h7.size = MG_REG(FLASH_SIZE_REG) * 1024;
if (IS_DUALCORE()) {
// Using only the 1st bank (mapped to CM7)
s_mg_flash_stm32h7.size /= 2;
}
return mg_ota_flash_begin(new_firmware_size, &s_mg_flash_stm32h7);
}

View File

@ -2651,7 +2651,8 @@ void mg_rpc_list(struct mg_rpc_req *r);
#define MG_OTA_NONE 0 // No OTA support
#define MG_OTA_STM32H5 1 // STM32 H5
#define MG_OTA_STM32H7 2 // STM32 H7
#define MG_OTA_STM32F 3 // STM32 F7/F4/F2
#define MG_OTA_STM32H7_DUAL_CORE 3 // STM32 H7 dual core
#define MG_OTA_STM32F 4 // STM32 F7/F4/F2
#define MG_OTA_CH32V307 100 // WCH CH32V307
#define MG_OTA_U2A 200 // Renesas U2A16, U2A8, U2A6
#define MG_OTA_RT1020 300 // IMXRT1020

View File

@ -8,7 +8,8 @@
#define MG_OTA_NONE 0 // No OTA support
#define MG_OTA_STM32H5 1 // STM32 H5
#define MG_OTA_STM32H7 2 // STM32 H7
#define MG_OTA_STM32F 3 // STM32 F7/F4/F2
#define MG_OTA_STM32H7_DUAL_CORE 3 // STM32 H7 dual core
#define MG_OTA_STM32F 4 // STM32 F7/F4/F2
#define MG_OTA_CH32V307 100 // WCH CH32V307
#define MG_OTA_U2A 200 // Renesas U2A16, U2A8, U2A6
#define MG_OTA_RT1020 300 // IMXRT1020

View File

@ -2,7 +2,7 @@
#include "log.h"
#include "ota.h"
#if MG_OTA == MG_OTA_STM32H7
#if MG_OTA == MG_OTA_STM32H7 || MG_OTA == MG_OTA_STM32H7_DUAL_CORE
// - H723/735 RM 4.3.3: Note: The application can simultaneously request a read
// and a write operation through the AXI interface.
@ -35,7 +35,15 @@ static struct mg_flash s_mg_flash_stm32h7 = {
#define FLASH_OPTSR_PRG 0x20
#define FLASH_SIZE_REG 0x1ff1e880
#define IS_DUALCORE() (MG_OTA == MG_OTA_STM32H7_DUAL_CORE)
MG_IRAM static bool is_dualbank(void) {
if (IS_DUALCORE()) {
// H745/H755 and H747/H757 are running on dual core.
// Using only the 1st bank (mapped to CM7), in order not to interfere
// with the 2nd bank (CM4), possibly causing CM4 to boot unexpectedly.
return false;
}
return (s_mg_flash_stm32h7.size < 2 * 1024 * 1024) ? false : true;
}
@ -172,6 +180,10 @@ MG_IRAM static void single_bank_swap(char *p1, char *p2, size_t s, size_t ss) {
bool mg_ota_begin(size_t new_firmware_size) {
s_mg_flash_stm32h7.size = MG_REG(FLASH_SIZE_REG) * 1024;
if (IS_DUALCORE()) {
// Using only the 1st bank (mapped to CM7)
s_mg_flash_stm32h7.size /= 2;
}
return mg_ota_flash_begin(new_firmware_size, &s_mg_flash_stm32h7);
}