1From fe5f3a86d07e378baeeddc1dfecd0686d83aa42f Mon Sep 17 00:00:00 2001
2From: Yauheni Saldatsenka <eugentoo@gmail.com>
3Date: Sat, 14 Aug 2021 18:54:51 +0300
4Subject: [PATCH] stm32f469-i: Update kernel start address
5
6As of GNU/Linux v5.12 kernel device tree binary grows above 0x08008000
7and overwrites kernel binary
8Therefore this commit moves kernel to the next flash bank
9
10Signed-off-by: Yauheni Saldatsenka <eugentoo@gmail.com>
11---
12 stm32f469i-disco.c | 7 +++----
13 1 file changed, 3 insertions(+), 4 deletions(-)
14
15diff --git a/stm32f469i-disco.c b/stm32f469i-disco.c
16index 2da1f4b..46fc06a 100644
17--- a/stm32f469i-disco.c
18+++ b/stm32f469i-disco.c
19@@ -6,6 +6,7 @@
20 #include "gpio.h"
21 #include "mpu.h"
22
23+#define KERNEL_ADDR     0x08010000
24 #define CONFIG_HSE_HZ	8000000
25 #define CONFIG_PLL_M	8
26 #define CONFIG_PLL_N	360
27@@ -85,7 +86,7 @@ static void fmc_wait_busy(void)
28
29 void start_kernel(void)
30 {
31-	void (*kernel)(uint32_t reserved, uint32_t mach, uint32_t dt) = (void (*)(uint32_t, uint32_t, uint32_t))(0x08008000 | 1);
32+	void (*kernel)(uint32_t reserved, uint32_t mach, uint32_t dt) = (void (*)(uint32_t, uint32_t, uint32_t))(KERNEL_ADDR | 1);
33
34 	kernel(0, ~0UL, 0x08004000);
35 }
36@@ -102,7 +103,7 @@ int main(void)
37 	volatile uint32_t *SYSCFG_MEMRMP = (void *)(SYSCFG_BASE + 0x00);
38 	int i;
39
40-	mpu_config(0x0);
41+	mpu_config(0xc0000000);
42
43 	if (*FLASH_CR & FLASH_CR_LOCK) {
44 		*FLASH_KEYR = 0x45670123;
45@@ -195,8 +196,6 @@ int main(void)
46 	usart_setup(usart_base, 45000000);
47 	usart_putch(usart_base, '.');
48
49-	*SYSCFG_MEMRMP = 0x4;
50-
51 	start_kernel();
52
53 	return 0;
54--
552.32.0
56
57