mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/5] ARM: stm32mp: fix some misnomers/typos
@ 2019-07-12 10:24 Ahmad Fatoum
  2019-07-12 10:24 ` [PATCH 2/5] images: add support for generating STM32MP images Ahmad Fatoum
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Ahmad Fatoum @ 2019-07-12 10:24 UTC (permalink / raw)
  To: barebox; +Cc: mfe

The arch was renamed to stm32mp, so it doesn't look out of place when
the stm32mp2 is released. Fix spotted comments/labels with the old
name. While at it, fix a typo about the SoC name on the DK2 board.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/Kconfig              | 2 +-
 arch/arm/mach-stm32mp/Kconfig | 4 ++--
 images/Makefile.stm32mp       | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 1d4b6e09ce79..915a06cd7639 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -208,7 +208,7 @@ config ARCH_S3C64xx
 	select GENERIC_GPIO
 
 config ARCH_STM32MP
-	bool "ST stm32mp1xx"
+	bool "STMicroelectronics STM32MP"
 	select CPU_V7
 	select HAVE_PBL_MULTI_IMAGES
 	select CLKDEV_LOOKUP
diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig
index be16294f5ad7..af0bf6a74ba3 100644
--- a/arch/arm/mach-stm32mp/Kconfig
+++ b/arch/arm/mach-stm32mp/Kconfig
@@ -1,10 +1,10 @@
 if ARCH_STM32MP
 
-config ARCH_STM32MP1157
+config ARCH_STM32MP157
 	bool
 
 config MACH_STM32MP157C_DK2
-	select ARCH_STM32MP1157
+	select ARCH_STM32MP157
 	select ARM_USE_COMPRESSED_DTB
 	bool "STM32MP157C-DK2 board"
 
diff --git a/images/Makefile.stm32mp b/images/Makefile.stm32mp
index c49b1d72b788..bc3e7394d729 100644
--- a/images/Makefile.stm32mp
+++ b/images/Makefile.stm32mp
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0-or-later
 #
-# barebox image generation Makefile for STMicroelectronics MP1
+# barebox image generation Makefile for STMicroelectronics MP
 #
 
 pblb-$(CONFIG_MACH_STM32MP157C_DK2) += start_stm32mp157c_dk2
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 2/5] images: add support for generating STM32MP images
  2019-07-12 10:24 [PATCH 1/5] ARM: stm32mp: fix some misnomers/typos Ahmad Fatoum
@ 2019-07-12 10:24 ` Ahmad Fatoum
  2019-07-12 10:24 ` [PATCH 3/5] filetype: add STM32 image type Ahmad Fatoum
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Ahmad Fatoum @ 2019-07-12 10:24 UTC (permalink / raw)
  To: barebox; +Cc: Marco Felsch, mfe

From: Marco Felsch <marco.felsch@gmail.com>

Both STM32MP BootROM and TF-A first stage expect subsequent bootloader
stages to feature a specific STM32 file header. Add a stm32image
utility to address this.

Signed-off-by: Marco Felsch <marco.felsch@gmail.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 images/Makefile.stm32mp |   8 ++
 scripts/Makefile        |   1 +
 scripts/Makefile.lib    |   3 +
 scripts/stm32image.c    | 281 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 293 insertions(+)
 create mode 100644 scripts/stm32image.c

diff --git a/images/Makefile.stm32mp b/images/Makefile.stm32mp
index bc3e7394d729..a0baad30c3ad 100644
--- a/images/Makefile.stm32mp
+++ b/images/Makefile.stm32mp
@@ -3,6 +3,14 @@
 # barebox image generation Makefile for STMicroelectronics MP
 #
 
+# %.stm32 - convert into STM32MP image
+# --------------------------------------
+
+$(obj)/%.stm32: $(obj)/% FORCE
+	$(call if_changed,stm32_image)
+
+# --------------------------------------
+
 pblb-$(CONFIG_MACH_STM32MP157C_DK2) += start_stm32mp157c_dk2
 FILE_barebox-stm32mp157c-dk2.img = start_stm32mp157c_dk2.pblb
 image-$(CONFIG_MACH_STM32MP157C_DK2) += barebox-stm32mp157c-dk2.img
diff --git a/scripts/Makefile b/scripts/Makefile
index 1af5f9fc985b..178313b1e244 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -22,6 +22,7 @@ hostprogs-$(CONFIG_ARCH_ZYNQ)	 += zynq_mkimage
 hostprogs-$(CONFIG_ARCH_SOCFPGA) += socfpga_mkimage
 hostprogs-$(CONFIG_MXS_HOSTTOOLS)+= mxsimage mxsboot
 hostprogs-$(CONFIG_ARCH_LAYERSCAPE) += pblimage
+hostprogs-$(CONFIG_ARCH_STM32MP) += stm32image
 HOSTCFLAGS += -I$(srctree)/scripts/include/
 HOSTLDLIBS_mxsimage  = `pkg-config --libs openssl`
 HOSTCFLAGS_omap3-usb-loader.o = `pkg-config --cflags libusb-1.0`
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 87bff2d296e3..ae49ca31e8f5 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -509,6 +509,9 @@ quiet_cmd_cboot_bct = BCT     $@
 $(obj)/%.bct: $(obj)/%.bct.cfg
 	$(call cmd,cboot_bct)
 
+quiet_cmd_stm32_image = STM32-IMG $@
+      cmd_stm32_image = $(objtree)/scripts/stm32image $(OPTS_$(@F)) -i $< -o $@
+
 quiet_cmd_b64dec = B64DEC  $@
       cmd_b64dec = base64 -d $< > $@
 
diff --git a/scripts/stm32image.c b/scripts/stm32image.c
new file mode 100644
index 000000000000..c33bcca0d80a
--- /dev/null
+++ b/scripts/stm32image.c
@@ -0,0 +1,281 @@
+// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
+/*
+ * Copyright (C) 2018, STMicroelectronics - All Rights Reserved
+ * Copyright (C) 2019, Pengutronix
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+#include <stdint.h>
+#include <getopt.h>
+#include "compiler.h"
+
+#ifndef MAP_POPULATE
+#define MAP_POPULATE 0
+#endif
+
+/* magic ='S' 'T' 'M' 0x32 */
+#define HEADER_MAGIC htobe32(0x53544D32)
+#define VER_MAJOR_IDX	2
+#define VER_MINOR_IDX	1
+#define VER_VARIANT_IDX	0
+/* default option : bit0 => no signature */
+#define HEADER_DEFAULT_OPTION	htole32(0x00000001)
+/* default binary type for barebox */
+#define HEADER_TYPE_BAREBOX	htole32(0x00000000)
+#define HEADER_LENGTH	0x100
+
+#define FSBL_LOADADDR		0x2ffc2400
+#define FSBL_ENTRYPOINT		(FSBL_LOADADDR + HEADER_LENGTH)
+#define MAX_FSBL_PAYLOAD_SIZE	(247 * 1024)
+
+struct __attribute((packed)) stm32_header {
+	uint32_t magic_number;
+	uint32_t image_signature[64 / 4];
+	uint32_t image_checksum;
+	uint8_t  header_version[4];
+	uint32_t image_length;
+	uint32_t image_entry_point;
+	uint32_t reserved1;
+	uint32_t load_address;
+	uint32_t reserved2;
+	uint32_t version_number;
+	uint32_t option_flags;
+	uint32_t ecdsa_algorithm;
+	uint32_t ecdsa_public_key[64 / 4];
+	uint32_t padding[83 / 4];
+	uint32_t binary_type;
+};
+
+static struct stm32_header stm32image_header;
+
+static const char *infile;
+static const char *outfile;
+static int in_fd;
+static int out_fd;
+static uint32_t loadaddr;
+static uint32_t entrypoint;
+static uint32_t pbl_size;
+static uint32_t version = 0x01;
+
+static void stm32image_print_header(void)
+{
+	printf("Image Type   : STMicroelectronics STM32 V%d.%d\n",
+	       stm32image_header.header_version[VER_MAJOR_IDX],
+	       stm32image_header.header_version[VER_MINOR_IDX]);
+	printf("Image Size   : %u bytes\n",
+	       le32toh(stm32image_header.image_length));
+	printf("Image Load   : 0x%08x\n",
+	       le32toh(stm32image_header.load_address));
+	printf("Entry Point  : 0x%08x\n",
+	       le32toh(stm32image_header.image_entry_point));
+	printf("Checksum     : 0x%08x\n",
+	       le32toh(stm32image_header.image_checksum));
+	printf("Option     : 0x%08x\n",
+	       le32toh(stm32image_header.option_flags));
+	printf("BinaryType : 0x%08x\n",
+	       le32toh(stm32image_header.binary_type));
+}
+
+static uint32_t stm32image_checksum(void)
+{
+	uint32_t csum = 0;
+	uint32_t len = pbl_size;
+	uint8_t *p;
+
+	p = mmap(NULL, len, PROT_READ, MAP_PRIVATE | MAP_POPULATE, in_fd, 0);
+	if (p == MAP_FAILED) {
+		perror("mmap");
+		exit(EXIT_FAILURE);
+	}
+
+	for (; len > 0; len--)
+		csum += *p++;
+
+	munmap(p, len);
+
+	return csum;
+}
+
+static void stm32image_set_header(void)
+{
+
+	memset(&stm32image_header, 0, sizeof(struct stm32_header));
+
+	/* set default values */
+	stm32image_header.magic_number = HEADER_MAGIC;
+	stm32image_header.header_version[VER_MAJOR_IDX] = version;
+	stm32image_header.option_flags = HEADER_DEFAULT_OPTION;
+	stm32image_header.ecdsa_algorithm = 1;
+	/* used to specify the 2nd-stage barebox address within dram */
+	stm32image_header.load_address = loadaddr;
+	stm32image_header.binary_type = HEADER_TYPE_BAREBOX;
+
+	stm32image_header.image_entry_point = htole32(entrypoint);
+	stm32image_header.image_length = htole32(pbl_size);
+	stm32image_header.image_checksum = stm32image_checksum();
+}
+
+static void stm32image_check_params(void)
+{
+	off_t ret;
+
+	in_fd = open(infile, O_RDONLY);
+	if (in_fd < 0) {
+		fprintf(stderr, "Error: Cannot open %s for reading: %s\n", infile,
+			strerror(errno));
+		exit(EXIT_FAILURE);
+	}
+
+	if (!pbl_size) {
+		pbl_size = lseek(in_fd, 0, SEEK_END);
+		if (pbl_size == (uint32_t)-1) {
+			fprintf(stderr, "Cannot seek to end\n");
+			exit(EXIT_FAILURE);
+		}
+
+		ret = lseek(in_fd, 0, SEEK_SET);
+		if (ret == (off_t)-1) {
+			fprintf(stderr, "Cannot seek to start\n");
+			exit(EXIT_FAILURE);
+		}
+	}
+
+	out_fd = creat(outfile, 0644);
+	if (out_fd < 0) {
+		fprintf(stderr, "Cannot open %s for writing: %s\n",
+			outfile, strerror(errno));
+		exit(EXIT_FAILURE);
+	}
+
+	if (loadaddr < 0xc0000000) {
+		fprintf(stderr, "Error: loadaddr must be within the DDR memory space\n");
+		exit(EXIT_FAILURE);
+	}
+}
+
+static void copy_fd(int in, int out)
+{
+	int bs = 4096;
+	void *buf = malloc(bs);
+
+	if (!buf)
+		exit(EXIT_FAILURE);
+
+	while (1) {
+		int now, wr;
+
+		now = read(in, buf, bs);
+		if (now < 0) {
+			fprintf(stderr, "read failed with %s\n", strerror(errno));
+			exit(EXIT_FAILURE);
+		}
+
+		if (!now)
+			break;
+
+		wr = write(out, buf, now);
+		if (wr < 0) {
+			fprintf(stderr, "write failed with %s\n", strerror(errno));
+			exit(EXIT_FAILURE);
+		}
+
+		if (wr != now) {
+			fprintf(stderr, "short write\n");
+			exit(EXIT_FAILURE);
+		}
+	}
+
+	free(buf);
+}
+
+int main(int argc, char *argv[])
+{
+	const char *verbose;
+	int opt, ret;
+	off_t pos;
+	entrypoint = FSBL_ENTRYPOINT;
+
+	while ((opt = getopt(argc, argv, "i:o:a:e:s:v:h")) != -1) {
+		switch (opt) {
+		case 'i':
+			infile = optarg;
+			break;
+		case 'o':
+			outfile = optarg;
+			break;
+		case 'a':
+			loadaddr = strtol(optarg, NULL, 16);
+			break;
+		case 'e':
+			entrypoint = strtol(optarg, NULL, 16);
+			break;
+		case 's':
+			pbl_size = strtol(optarg, NULL, 16);
+			break;
+		case 'v':
+			version = strtol(optarg, NULL, 16);
+			break;
+		case 'h':
+			printf("%s [-i inputfile] [-o outputfile] [-a loadaddr] [-s pblimage size in byte]\n", argv[0]);
+			exit(EXIT_SUCCESS);
+		default:
+			fprintf(stderr, "Unknown option: -%c\n", opt);
+			exit(EXIT_FAILURE);
+		}
+	}
+
+	if (!infile) {
+		fprintf(stderr, "No infile given\n");
+		exit(EXIT_FAILURE);
+	}
+
+	if (!outfile) {
+		fprintf(stderr, "No outfile given\n");
+		exit(EXIT_FAILURE);
+	}
+
+	stm32image_check_params();
+	stm32image_set_header();
+
+	ret = write(out_fd, (const void *)&stm32image_header, sizeof(struct stm32_header));
+	if (ret != 0x100) {
+		fprintf(stderr, "Error: write on %s: %s\n", outfile,
+			strerror(errno));
+		exit(EXIT_FAILURE);
+	}
+
+	verbose = getenv("V");
+	if (verbose && !strcmp(verbose, "1"))
+		stm32image_print_header();
+
+	ret = ftruncate(out_fd, HEADER_LENGTH);
+	if (ret) {
+		fprintf(stderr, "Cannot truncate\n");
+		exit(EXIT_FAILURE);
+	}
+
+	pos = lseek(out_fd, HEADER_LENGTH, SEEK_SET);
+	if (pos == (off_t)-1) {
+		fprintf(stderr, "Cannot lseek 1\n");
+		exit(EXIT_FAILURE);
+	}
+
+	pos = lseek(in_fd, 0, SEEK_SET);
+	if (pos == (off_t)-1) {
+		fprintf(stderr, "Cannot lseek 2\n");
+		exit(EXIT_FAILURE);
+	}
+
+	copy_fd(in_fd, out_fd);
+
+	close(in_fd);
+	close(out_fd);
+
+	exit(EXIT_SUCCESS);
+}
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 3/5] filetype: add STM32 image type
  2019-07-12 10:24 [PATCH 1/5] ARM: stm32mp: fix some misnomers/typos Ahmad Fatoum
  2019-07-12 10:24 ` [PATCH 2/5] images: add support for generating STM32MP images Ahmad Fatoum
@ 2019-07-12 10:24 ` Ahmad Fatoum
  2019-07-12 10:24 ` [PATCH 4/5] ARM: stm32mp: generate STM32 images Ahmad Fatoum
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Ahmad Fatoum @ 2019-07-12 10:24 UTC (permalink / raw)
  To: barebox; +Cc: mfe

Both STM32MP BootROM and TF-A first stage expect subsequent bootloader
stages to feature a specific 256-byte long STM32 file header.
Add detection of the header to file_detect_type().

While there's only one version of the header so far, identify the new
header as v1 anyway, so new versions can be unambiguously added.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/filetype.c  | 9 +++++++++
 include/filetype.h | 1 +
 2 files changed, 10 insertions(+)

diff --git a/common/filetype.c b/common/filetype.c
index 329f5144bfed..825bf25ad107 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -79,6 +79,7 @@ static const struct filetype_str filetype_str[] = {
 	[filetype_layerscape_qspi_image] = { "Layerscape QSPI image", "layerscape-qspi-PBL" },
 	[filetype_ubootvar] = { "U-Boot environmemnt variable data",
 				"ubootvar" },
+	[filetype_stm32_image_v1] = { "STM32 image (v1)", "stm32-image-v1" },
 };
 
 const char *file_type_to_string(enum filetype f)
@@ -355,6 +356,14 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)
 	if (buf8[0] == 'M' && buf8[1] == 'Z')
 		return filetype_exe;
 
+	if (bufsize < 256)
+		return filetype_unknown;
+
+	if (strncmp(buf8, "STM\x32", 4) == 0) {
+		if (buf8[74] == 0x01)
+			return filetype_stm32_image_v1;
+	}
+
 	if (bufsize < 512)
 		return filetype_unknown;
 
diff --git a/include/filetype.h b/include/filetype.h
index f1be04e81632..90a03de58105 100644
--- a/include/filetype.h
+++ b/include/filetype.h
@@ -48,6 +48,7 @@ enum filetype {
 	filetype_layerscape_image,
 	filetype_layerscape_qspi_image,
 	filetype_ubootvar,
+	filetype_stm32_image_v1,
 	filetype_max,
 };
 
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 4/5] ARM: stm32mp: generate STM32 images
  2019-07-12 10:24 [PATCH 1/5] ARM: stm32mp: fix some misnomers/typos Ahmad Fatoum
  2019-07-12 10:24 ` [PATCH 2/5] images: add support for generating STM32MP images Ahmad Fatoum
  2019-07-12 10:24 ` [PATCH 3/5] filetype: add STM32 image type Ahmad Fatoum
@ 2019-07-12 10:24 ` Ahmad Fatoum
  2019-07-12 10:24 ` [PATCH 5/5] Documentation: boards: add initial STM32MP documentation Ahmad Fatoum
  2019-07-15  6:46 ` [PATCH 1/5] ARM: stm32mp: fix some misnomers/typos Sascha Hauer
  4 siblings, 0 replies; 10+ messages in thread
From: Ahmad Fatoum @ 2019-07-12 10:24 UTC (permalink / raw)
  To: barebox; +Cc: mfe

Both STM32MP BootROM and TF-A first stage expect subsequent bootloader
stages to feature a specific STM32 file header. Generate this image
type by default.

If for some reason, the image without stm32 header is required, the
start_stm32mp157c_dk2.pblb can be used.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 images/Makefile.stm32mp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/images/Makefile.stm32mp b/images/Makefile.stm32mp
index a0baad30c3ad..910e029a5b66 100644
--- a/images/Makefile.stm32mp
+++ b/images/Makefile.stm32mp
@@ -9,8 +9,11 @@
 $(obj)/%.stm32: $(obj)/% FORCE
 	$(call if_changed,stm32_image)
 
+STM32MP1_OPTS = -a 0xc0100000 -e 0xc0100000 -v1
+
 # --------------------------------------
 
 pblb-$(CONFIG_MACH_STM32MP157C_DK2) += start_stm32mp157c_dk2
-FILE_barebox-stm32mp157c-dk2.img = start_stm32mp157c_dk2.pblb
+FILE_barebox-stm32mp157c-dk2.img = start_stm32mp157c_dk2.pblb.stm32
+OPTS_start_stm32mp157c_dk2.pblb.stm32 = $(STM32MP1_OPTS)
 image-$(CONFIG_MACH_STM32MP157C_DK2) += barebox-stm32mp157c-dk2.img
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 5/5] Documentation: boards: add initial STM32MP documentation
  2019-07-12 10:24 [PATCH 1/5] ARM: stm32mp: fix some misnomers/typos Ahmad Fatoum
                   ` (2 preceding siblings ...)
  2019-07-12 10:24 ` [PATCH 4/5] ARM: stm32mp: generate STM32 images Ahmad Fatoum
@ 2019-07-12 10:24 ` Ahmad Fatoum
  2019-07-12 11:49   ` [PATCH] fixup! " Ahmad Fatoum
  2019-07-16  8:48   ` [PATCH 5/5] " Roland Hieber
  2019-07-15  6:46 ` [PATCH 1/5] ARM: stm32mp: fix some misnomers/typos Sascha Hauer
  4 siblings, 2 replies; 10+ messages in thread
From: Ahmad Fatoum @ 2019-07-12 10:24 UTC (permalink / raw)
  To: barebox; +Cc: mfe

Support for the SoC is still in progress, but lets document
what we have now.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 Documentation/boards/stm32mp.rst | 73 ++++++++++++++++++++++++++++++++
 1 file changed, 73 insertions(+)
 create mode 100644 Documentation/boards/stm32mp.rst

diff --git a/Documentation/boards/stm32mp.rst b/Documentation/boards/stm32mp.rst
new file mode 100644
index 000000000000..7f787bac203e
--- /dev/null
+++ b/Documentation/boards/stm32mp.rst
@@ -0,0 +1,73 @@
+STMicroelectronics STM32MP
+==========================
+
+.. note::
+
+  Support for the STM32MP architecure in barebox is still in progress.
+  Bootstrapping an OS from mainline barebox is not yet supported.
+
+The STM32MP is a line of 32-bit ARM SoCs. They reuse peripherals of the
+STM32 line of microcontrollers and can have a STM32 MCU embedded as co-processor
+as well.
+
+The boot process of the STM32MP SoC is a two step process.
+The first stage boot loader (FSBL) is loaded by the ROM code into the built-in
+SYSRAM and executed. The FSBL sets up the SDRAM, install a secure monitor and
+then the second stage boot loader (SSBL) is loaded into DRAM.
+
+When building barebox, the resulting ``barebox-${board}.img`` file has the STM32
+header preprended, so it can be loaded directly as FSBL by the ARM TF-A
+(https://github.com/ARM-software/arm-trusted-firmware). Each entry point has a
+header-less image ending in ``*.pblb`` as well.
+
+Use of barebox as FSBL is not supported.
+
+Following boards are currently supported in barebox:
+
+Building barebox
+----------------
+
+With multi-image and device trees, it's expected to have ``stm32mp_defconfig``
+as sole defconfig for all STM32MP boards::
+
+  make ARCH=arm stm32mp_defconfig
+
+The resulting images will be placed under ``images/``:
+
+::
+
+  barebox-stm32mp157c-dk2.img
+
+
+Flashing barebox
+----------------
+
+An appropriate image for the boot media can be generated with following
+``genimage(1)`` config::
+
+  image @STM32MP_BOARD@.img {
+      hdimage {
+          align = 1M
+          gpt = "true"
+      }
+      partition fsbl1 {
+          image = "tf-a-@STM32MP_BOARD@.stm32"
+          size = 256K
+      }
+      partition fsbl2 {
+          image = "tf-a-@STM32MP_BOARD@.stm32"
+          size = 256K
+      }
+      partition ssbl {
+          image = "barebox-@STM32MP_BOARD@.img"
+          size = 1M
+      }
+  }
+
+Image can then be flashed on e.g. a SD-Card.
+
+TODO
+----
+
+* Extend barebox MMCI support to support the SDMMC2
+* Extend barebox DesignWare MAC support to support the stmmac
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] fixup! Documentation: boards: add initial STM32MP documentation
  2019-07-12 10:24 ` [PATCH 5/5] Documentation: boards: add initial STM32MP documentation Ahmad Fatoum
@ 2019-07-12 11:49   ` Ahmad Fatoum
  2019-07-16  8:48   ` [PATCH 5/5] " Roland Hieber
  1 sibling, 0 replies; 10+ messages in thread
From: Ahmad Fatoum @ 2019-07-12 11:49 UTC (permalink / raw)
  To: barebox

Fix typo: TF-A is FSBL, barebox is SSBL
---
 Documentation/boards/stm32mp.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/boards/stm32mp.rst b/Documentation/boards/stm32mp.rst
index 7f787bac203e..8cbf36c3961e 100644
--- a/Documentation/boards/stm32mp.rst
+++ b/Documentation/boards/stm32mp.rst
@@ -16,7 +16,7 @@ SYSRAM and executed. The FSBL sets up the SDRAM, install a secure monitor and
 then the second stage boot loader (SSBL) is loaded into DRAM.
 
 When building barebox, the resulting ``barebox-${board}.img`` file has the STM32
-header preprended, so it can be loaded directly as FSBL by the ARM TF-A
+header preprended, so it can be loaded directly as SSBL by the ARM TF-A
 (https://github.com/ARM-software/arm-trusted-firmware). Each entry point has a
 header-less image ending in ``*.pblb`` as well.
 
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/5] ARM: stm32mp: fix some misnomers/typos
  2019-07-12 10:24 [PATCH 1/5] ARM: stm32mp: fix some misnomers/typos Ahmad Fatoum
                   ` (3 preceding siblings ...)
  2019-07-12 10:24 ` [PATCH 5/5] Documentation: boards: add initial STM32MP documentation Ahmad Fatoum
@ 2019-07-15  6:46 ` Sascha Hauer
  4 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2019-07-15  6:46 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox, mfe

On Fri, Jul 12, 2019 at 12:24:53PM +0200, Ahmad Fatoum wrote:
> The arch was renamed to stm32mp, so it doesn't look out of place when
> the stm32mp2 is released. Fix spotted comments/labels with the old
> name. While at it, fix a typo about the SoC name on the DK2 board.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  arch/arm/Kconfig              | 2 +-
>  arch/arm/mach-stm32mp/Kconfig | 4 ++--
>  images/Makefile.stm32mp       | 2 +-
>  3 files changed, 4 insertions(+), 4 deletions(-)

Applied, thanks

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 5/5] Documentation: boards: add initial STM32MP documentation
  2019-07-12 10:24 ` [PATCH 5/5] Documentation: boards: add initial STM32MP documentation Ahmad Fatoum
  2019-07-12 11:49   ` [PATCH] fixup! " Ahmad Fatoum
@ 2019-07-16  8:48   ` Roland Hieber
  1 sibling, 0 replies; 10+ messages in thread
From: Roland Hieber @ 2019-07-16  8:48 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox, mfe

On Fri, Jul 12, 2019 at 12:24:57PM +0200, Ahmad Fatoum wrote:
> Support for the SoC is still in progress, but lets document
> what we have now.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  Documentation/boards/stm32mp.rst | 73 ++++++++++++++++++++++++++++++++
>  1 file changed, 73 insertions(+)
>  create mode 100644 Documentation/boards/stm32mp.rst
> 
> diff --git a/Documentation/boards/stm32mp.rst b/Documentation/boards/stm32mp.rst
> new file mode 100644
> index 000000000000..7f787bac203e
> --- /dev/null
> +++ b/Documentation/boards/stm32mp.rst
> @@ -0,0 +1,73 @@
> +STMicroelectronics STM32MP
> +==========================
> +
> +.. note::
> +
> +  Support for the STM32MP architecure in barebox is still in progress.
> +  Bootstrapping an OS from mainline barebox is not yet supported.
> +
> +The STM32MP is a line of 32-bit ARM SoCs. They reuse peripherals of the
> +STM32 line of microcontrollers and can have a STM32 MCU embedded as co-processor
> +as well.
> +
> +The boot process of the STM32MP SoC is a two step process.
> +The first stage boot loader (FSBL) is loaded by the ROM code into the built-in
> +SYSRAM and executed. The FSBL sets up the SDRAM, install a secure monitor and

Small typo here, s/install/installs/.

> +then the second stage boot loader (SSBL) is loaded into DRAM.
> +
> +When building barebox, the resulting ``barebox-${board}.img`` file has the STM32
> +header preprended, so it can be loaded directly as FSBL by the ARM TF-A
> +(https://github.com/ARM-software/arm-trusted-firmware). Each entry point has a
> +header-less image ending in ``*.pblb`` as well.
> +
> +Use of barebox as FSBL is not supported.
> +
> +Following boards are currently supported in barebox:
> +

None? :-)

 - Roland

> +Building barebox
> +----------------
> +
> +With multi-image and device trees, it's expected to have ``stm32mp_defconfig``
> +as sole defconfig for all STM32MP boards::
> +
> +  make ARCH=arm stm32mp_defconfig
> +
> +The resulting images will be placed under ``images/``:
> +
> +::
> +
> +  barebox-stm32mp157c-dk2.img
> +
> +
> +Flashing barebox
> +----------------
> +
> +An appropriate image for the boot media can be generated with following
> +``genimage(1)`` config::
> +
> +  image @STM32MP_BOARD@.img {
> +      hdimage {
> +          align = 1M
> +          gpt = "true"
> +      }
> +      partition fsbl1 {
> +          image = "tf-a-@STM32MP_BOARD@.stm32"
> +          size = 256K
> +      }
> +      partition fsbl2 {
> +          image = "tf-a-@STM32MP_BOARD@.stm32"
> +          size = 256K
> +      }
> +      partition ssbl {
> +          image = "barebox-@STM32MP_BOARD@.img"
> +          size = 1M
> +      }
> +  }
> +
> +Image can then be flashed on e.g. a SD-Card.
> +
> +TODO
> +----
> +
> +* Extend barebox MMCI support to support the SDMMC2
> +* Extend barebox DesignWare MAC support to support the stmmac
> -- 
> 2.20.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Roland Hieber                     | r.hieber@pengutronix.de     |
Pengutronix e.K.                  | https://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim | Phone: +49-5121-206917-5086 |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] fixup! Documentation: boards: add initial STM32MP documentation
  2019-08-03 17:33 [PATCH] fixup! Documentation: boards: add initial STM32MP documentation Ahmad Fatoum
@ 2019-08-05 12:04 ` Sascha Hauer
  0 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2019-08-05 12:04 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox, afa, rhi

On Sat, Aug 03, 2019 at 07:33:58PM +0200, Ahmad Fatoum wrote:
> Left-over line spotted by Roland. The boards are listed in the section
> following this.
> ---
>  Documentation/boards/stm32mp.rst | 2 --
>  1 file changed, 2 deletions(-)

Applied, thanks

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] fixup! Documentation: boards: add initial STM32MP documentation
@ 2019-08-03 17:33 Ahmad Fatoum
  2019-08-05 12:04 ` Sascha Hauer
  0 siblings, 1 reply; 10+ messages in thread
From: Ahmad Fatoum @ 2019-08-03 17:33 UTC (permalink / raw)
  To: barebox; +Cc: afa, rhi

Left-over line spotted by Roland. The boards are listed in the section
following this.
---
 Documentation/boards/stm32mp.rst | 2 --
 1 file changed, 2 deletions(-)

diff --git a/Documentation/boards/stm32mp.rst b/Documentation/boards/stm32mp.rst
index 8cbf36c3961e..24cf8859db8d 100644
--- a/Documentation/boards/stm32mp.rst
+++ b/Documentation/boards/stm32mp.rst
@@ -22,8 +22,6 @@ header-less image ending in ``*.pblb`` as well.
 
 Use of barebox as FSBL is not supported.
 
-Following boards are currently supported in barebox:
-
 Building barebox
 ----------------
 
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-08-05 12:04 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-12 10:24 [PATCH 1/5] ARM: stm32mp: fix some misnomers/typos Ahmad Fatoum
2019-07-12 10:24 ` [PATCH 2/5] images: add support for generating STM32MP images Ahmad Fatoum
2019-07-12 10:24 ` [PATCH 3/5] filetype: add STM32 image type Ahmad Fatoum
2019-07-12 10:24 ` [PATCH 4/5] ARM: stm32mp: generate STM32 images Ahmad Fatoum
2019-07-12 10:24 ` [PATCH 5/5] Documentation: boards: add initial STM32MP documentation Ahmad Fatoum
2019-07-12 11:49   ` [PATCH] fixup! " Ahmad Fatoum
2019-07-16  8:48   ` [PATCH 5/5] " Roland Hieber
2019-07-15  6:46 ` [PATCH 1/5] ARM: stm32mp: fix some misnomers/typos Sascha Hauer
2019-08-03 17:33 [PATCH] fixup! Documentation: boards: add initial STM32MP documentation Ahmad Fatoum
2019-08-05 12:04 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox