Initial Commit
- initial default booting image
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
From 9901603e18524c4c52fd1dd47bda4ab4016628fc Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
Date: Thu, 10 Sep 2020 11:37:33 +0200
|
||||
Subject: [PATCH] Pass -fno-builtin to fix build with gcc 10
|
||||
|
||||
gcc 10, if it recognizes some hand-written code that looks like
|
||||
memcpy, will generate a call to memcpy().
|
||||
|
||||
For example:
|
||||
|
||||
while (dst < &_end_data) {
|
||||
*dst++ = *src++;
|
||||
}
|
||||
|
||||
gets recognized as such. However, in the context of bare-metal code,
|
||||
having a call to memcpy() in the C library doesn't work. So we fix
|
||||
that by disabling builtins.
|
||||
|
||||
Fixes:
|
||||
|
||||
/home/thomas/projets/buildroot/output/host/opt/ext-toolchain/bin/../arm-buildroot-uclinux-uclibcgnueabi/bin/ld.real: stm32f429i-disco.o: in function `reset':
|
||||
stm32f429i-disco.c:(.text.reset+0x1a): undefined reference to `memcpy'
|
||||
/home/thomas/projets/buildroot/output/host/opt/ext-toolchain/bin/../arm-buildroot-uclinux-uclibcgnueabi/bin/ld.real: stm32f429i-disco.c:(.text.reset+0x34): undefined reference to `memset'
|
||||
make[1]: *** [Makefile:26: stm32f429i-disco] Error 1
|
||||
|
||||
Upstream: https://github.com/mcoquelin-stm32/afboot-stm32/pull/11
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
---
|
||||
Makefile | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index f699176..1e8557d 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -13,6 +13,7 @@ DTB_ADDR?=0x08004000
|
||||
CFLAGS := -mthumb -mcpu=cortex-m4
|
||||
CFLAGS += -ffunction-sections -fdata-sections
|
||||
CFLAGS += -Os -std=gnu99 -Wall
|
||||
+CFLAGS += -fno-builtin
|
||||
LINKERFLAGS := -nostartfiles --gc-sections
|
||||
|
||||
obj-y += gpio.o mpu.o qspi.o start_kernel.o
|
||||
--
|
||||
2.35.1
|
||||
|
||||
40
boot/afboot-stm32/0002-Makefile-drop-nostartfiles.patch
Normal file
40
boot/afboot-stm32/0002-Makefile-drop-nostartfiles.patch
Normal file
@@ -0,0 +1,40 @@
|
||||
From be760c062c5d05bd2223f3916afafd37120d3318 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
Date: Thu, 28 Apr 2022 22:47:09 +0200
|
||||
Subject: [PATCH] Makefile: drop -nostartfiles
|
||||
|
||||
In commit 0f3e61c9dd48fd8b4248ce4672c044c2562e4de1 ("Use ld instead of
|
||||
gcc for linking "), we started using ld instead of gcc for the link
|
||||
step. This worked fine for a while, but recent versions of ld no
|
||||
longer accept the -nostartfiles option, causing the build to break:
|
||||
|
||||
Error: unable to disambiguate: -nostartfiles (did you mean --nostartfiles ?)
|
||||
|
||||
In fact, -nostartfiles was passed to gcc prior to
|
||||
0f3e61c9dd48fd8b4248ce4672c044c2562e4de1, but it is not a ld
|
||||
option. It is only by luck that it was accepted and ignored by older
|
||||
ld versions. Since this option is useless when calling ld directly, we
|
||||
can simply drop it.
|
||||
|
||||
Upstream: https://github.com/mcoquelin-stm32/afboot-stm32/pull/11
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
---
|
||||
Makefile | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 1e8557d..8f42be1 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -14,7 +14,7 @@ CFLAGS := -mthumb -mcpu=cortex-m4
|
||||
CFLAGS += -ffunction-sections -fdata-sections
|
||||
CFLAGS += -Os -std=gnu99 -Wall
|
||||
CFLAGS += -fno-builtin
|
||||
-LINKERFLAGS := -nostartfiles --gc-sections
|
||||
+LINKERFLAGS := --gc-sections
|
||||
|
||||
obj-y += gpio.o mpu.o qspi.o start_kernel.o
|
||||
obj-f4 += $(obj-y) usart-f4.o
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
From d65b07d6fe438e760fdbc33a8e42650a27d5b417 Mon Sep 17 00:00:00 2001
|
||||
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
||||
Date: Sat, 31 Dec 2022 11:09:38 +0100
|
||||
Subject: [PATCH] Makefile: disable stack-protector
|
||||
|
||||
Disable stack-protector to avoid the following build failure:
|
||||
|
||||
/home/autobuild/autobuild/instance-14/output-1/host/bin/arm-buildroot-linux-gnueabi-ld -T stm32f429.lds --gc-sections -o stm32f469i-disco.elf stm32f469i-disco.o gpio.o mpu.o qspi.o start_kernel.o usart-f4.o
|
||||
/home/autobuild/autobuild/instance-14/output-1/host/bin/arm-buildroot-linux-gnueabi-ld: stm32f469i-disco.o: in function `main':
|
||||
stm32f469i-disco.c:(.text.startup.main+0x3b0): undefined reference to `__stack_chk_guard'
|
||||
/home/autobuild/autobuild/instance-14/output-1/host/bin/arm-buildroot-linux-gnueabi-ld: stm32f469i-disco.c:(.text.startup.main+0x4c0): undefined reference to `__stack_chk_fail'
|
||||
/home/autobuild/autobuild/instance-14/output-1/host/bin/arm-buildroot-linux-gnueabi-ld: stm32f469i-disco.c:(.text.startup.main+0x4ec): undefined reference to `__stack_chk_guard'
|
||||
|
||||
Fixes:
|
||||
- http://autobuild.buildroot.org/results/fa6ffab24c3998f21034ab24e8d2852cacde08c1
|
||||
|
||||
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
||||
---
|
||||
Makefile | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 8f42be1..8da7a25 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -14,6 +14,7 @@ CFLAGS := -mthumb -mcpu=cortex-m4
|
||||
CFLAGS += -ffunction-sections -fdata-sections
|
||||
CFLAGS += -Os -std=gnu99 -Wall
|
||||
CFLAGS += -fno-builtin
|
||||
+CFLAGS += -fno-stack-protector
|
||||
LINKERFLAGS := --gc-sections
|
||||
|
||||
obj-y += gpio.o mpu.o qspi.o start_kernel.o
|
||||
--
|
||||
2.35.1
|
||||
|
||||
27
boot/afboot-stm32/Config.in
Normal file
27
boot/afboot-stm32/Config.in
Normal file
@@ -0,0 +1,27 @@
|
||||
menuconfig BR2_TARGET_AFBOOT_STM32
|
||||
bool "afboot-stm32"
|
||||
depends on BR2_arm
|
||||
help
|
||||
afboot-stm32 is a very small bootloader for STM32 platforms
|
||||
|
||||
https://github.com/mcoquelin-stm32/afboot-stm32
|
||||
|
||||
if BR2_TARGET_AFBOOT_STM32
|
||||
|
||||
config BR2_TARGET_AFBOOT_STM32_KERNEL_ADDR
|
||||
hex "Kernel load address"
|
||||
default "0x08008000"
|
||||
help
|
||||
This is the physical address in your flash memory the kernel
|
||||
will be linked for and stored to. This address is dependent on
|
||||
your own flash usage.
|
||||
|
||||
config BR2_TARGET_AFBOOT_STM32_DTB_ADDR
|
||||
hex "Device-tree load address"
|
||||
default "0x08004000"
|
||||
help
|
||||
This is the physical address in your flash memory the
|
||||
device-tree will be stored to. This address is dependent on
|
||||
your own flash usage.
|
||||
|
||||
endif
|
||||
2
boot/afboot-stm32/afboot-stm32.hash
Normal file
2
boot/afboot-stm32/afboot-stm32.hash
Normal file
@@ -0,0 +1,2 @@
|
||||
# Locally calculated
|
||||
sha256 2caacd302ab3ed5b70b3b93a6aef04162abf779c758a5be547be3ab01b68ca10 afboot-stm32-3566acd582e5536fb60864281788a30f5527df2d.tar.gz
|
||||
22
boot/afboot-stm32/afboot-stm32.mk
Normal file
22
boot/afboot-stm32/afboot-stm32.mk
Normal file
@@ -0,0 +1,22 @@
|
||||
################################################################################
|
||||
#
|
||||
# afboot-stm32
|
||||
#
|
||||
################################################################################
|
||||
|
||||
AFBOOT_STM32_VERSION = 3566acd582e5536fb60864281788a30f5527df2d
|
||||
AFBOOT_STM32_SITE = $(call github,mcoquelin-stm32,afboot-stm32,$(AFBOOT_STM32_VERSION))
|
||||
AFBOOT_STM32_INSTALL_IMAGES = YES
|
||||
AFBOOT_STM32_INSTALL_TARGET = NO
|
||||
|
||||
define AFBOOT_STM32_BUILD_CMDS
|
||||
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) CROSS_COMPILE=$(TARGET_CROSS) all \
|
||||
KERNEL_ADDR=$(BR2_TARGET_AFBOOT_STM32_KERNEL_ADDR) \
|
||||
DTB_ADDR=$(BR2_TARGET_AFBOOT_STM32_DTB_ADDR)
|
||||
endef
|
||||
|
||||
define AFBOOT_STM32_INSTALL_IMAGES_CMDS
|
||||
$(INSTALL) -m 0755 -t $(BINARIES_DIR) -D $(@D)/stm32*.bin
|
||||
endef
|
||||
|
||||
$(eval $(generic-package))
|
||||
Reference in New Issue
Block a user