diff --git a/board/emcraft/stm32f7-som/board.c b/board/emcraft/stm32f7-som/board.c index 1980c23018d90f4d35d53c2dece8326e17025d55..96ac587e352fff69a1b53d10b7b8d85c7b632a8f 100644 --- a/board/emcraft/stm32f7-som/board.c +++ b/board/emcraft/stm32f7-som/board.c @@ -847,3 +847,32 @@ int board_late_init(void) return rv; } #endif /* BOARD_LATE_INIT */ + +#ifdef CONFIG_CMD_GO_DIRECT_JUMP +/* Code for overriding default "go" functionality for directly + jumping to a memory location without return. This is needed + since: + - We are executing from QSPI + - RTEMS image for stm32f769i places executable code in + in the beginning of QSPI address range + - Command bootm requires u-boot header before the executable code +*/ + +typedef void (*jump_t)(void); + +static inline void __set_MSP(uint32_t topOfMainStack) +{ + asm volatile ("MSR msp, %0\n" : : "r" (topOfMainStack) : "sp"); +} + +unsigned long do_go_exec (ulong (*entry)(int, char *[]), int argc, char *argv[]) +{ + jump_t jump; + jump = (jump_t) (*(uint32_t *)(entry + 4)); + __set_MSP(*(uint32_t*) entry); + STM32_SYSCFG->memrmp |= SYSCFG_MEMRMP_SWP_FMC_0; + CM3_SCB_REGS->vtor = (uint32_t)entry; + jump(); + return 0; +} +#endif // CONFIG_CMD_GO_DIRECT_JUMP diff --git a/drivers/net/stm32_eth.c b/drivers/net/stm32_eth.c index 77b3241cbb036ff22396b5dd21b136d376bdb1b6..5bbdf2c38f78e71af4099e4783ccbdb6303fa490 100644 --- a/drivers/net/stm32_eth.c +++ b/drivers/net/stm32_eth.c @@ -138,11 +138,6 @@ #define STM32_DMA_RBD_RCH (1 << 14) /* 2nd address chained*/ -/* - * STM32 SYSCFG definitions - */ -#define STM32_SYSCFG_BASE (STM32_APB2PERIPH_BASE + 0x3800) - /* * PMC reg fields */ @@ -250,19 +245,6 @@ struct stm32_mac_regs { #define STM32_MAC ((volatile struct stm32_mac_regs *) \ STM32_MAC_BASE) -/* - * SYSCFG register map - */ -struct stm32_syscfg_regs { - u32 memrmp; /* Memory remap */ - u32 pmc; /* Peripheral mode configuration */ - u32 exticr[4]; /* External interrupt configuration */ - u32 rsv0[2]; - u32 cmpcr; /* Compensation cell control */ -}; -#define STM32_SYSCFG ((volatile struct stm32_syscfg_regs *) \ - STM32_SYSCFG_BASE) - /* * STM32 ETH Normal DMA buffer descriptors */ diff --git a/include/asm-arm/arch-stm32/stm32.h b/include/asm-arm/arch-stm32/stm32.h index b4057622a8f90377bf5758e79fb968dc1afb369d..0e0244dd3fa39bbb14f183a8709bca59db86be3b 100644 --- a/include/asm-arm/arch-stm32/stm32.h +++ b/include/asm-arm/arch-stm32/stm32.h @@ -121,6 +121,24 @@ struct stm32_pwr_regs { */ #define STM32F4_LTDC_BASE (STM32_APB2PERIPH_BASE + 0x6800) +/* + * STM32 SYSCFG definitions + */ +#define STM32_SYSCFG_BASE (STM32_APB2PERIPH_BASE + 0x3800) + +/* + * SYSCFG register map + */ +struct stm32_syscfg_regs { + u32 memrmp; /* Memory remap */ + u32 pmc; /* Peripheral mode configuration */ + u32 exticr[4]; /* External interrupt configuration */ + u32 rsv0[2]; + u32 cmpcr; /* Compensation cell control */ +}; +#define STM32_SYSCFG ((volatile struct stm32_syscfg_regs *) \ + STM32_SYSCFG_BASE) +#define SYSCFG_MEMRMP_SWP_FMC_0 (1U << 10U); /****************************************************************************** * FIXME: get rid of this diff --git a/include/configs/stm32f769i-discovery.h b/include/configs/stm32f769i-discovery.h index 1170ca7eb138b856a35d1d352dca866177ec71ea..7caf1f31f7a4f3551e03c4e759beb0c44a136376 100644 --- a/include/configs/stm32f769i-discovery.h +++ b/include/configs/stm32f769i-discovery.h @@ -311,6 +311,9 @@ /* Enable DHCP */ #define CONFIG_CMD_DHCP +/* Directly jump with "go" */ +#define CONFIG_CMD_GO_DIRECT_JUMP + /* * To save memory disable long help */ @@ -326,7 +329,12 @@ */ #define CONFIG_BOOTDELAY 1 #define CONFIG_ZERO_BOOTDELAY_CHECK + +#ifdef CONFIG_CMD_GO_DIRECT_JUMP +#define CONFIG_BOOTCOMMAND "go " stringify(STM32_QSPI_BANK) +#else #define CONFIG_BOOTCOMMAND "run qspiboot || echo 'Boot from QSPI failed, run the update command'" +#endif /* boot args and env */ #define CONFIG_HOSTNAME stm32f769i-disco