Commit dc4dd6d1 authored by Sami Nurmenniemi's avatar Sami Nurmenniemi

Enable booting directly to QSPI with "go" command

- Supports booting image without u-boot headers on stm32
parent 50f9aed4
......@@ -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
......@@ -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
*/
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment