summaryrefslogtreecommitdiff
path: root/tools/binman/test
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2021-11-13 21:14:51 -0500
committerTom Rini <[email protected]>2021-11-13 21:14:51 -0500
commite035ce4b3ba116016385e8d93ef448c710810286 (patch)
tree89cf25fb1c1cb99e18ca3ab1da98d70b9da0554f /tools/binman/test
parentb8a156f54ecd1e9a74f48a09a0735b4a41c90eba (diff)
parent89cc0520d7962358ca85464836112217c5b8eca2 (diff)
Merge tag 'dm-pull-13nov21' of https://source.denx.de/u-boot/custodians/u-boot-dm
env tidy-ups test fixes binman fixes and ELF enhancements
Diffstat (limited to 'tools/binman/test')
-rw-r--r--tools/binman/test/Makefile13
-rw-r--r--tools/binman/test/bss_data.c2
-rw-r--r--tools/binman/test/embed_data.c16
-rw-r--r--tools/binman/test/embed_data.lds23
-rw-r--r--tools/binman/test/u_boot_binman_embed.c13
-rw-r--r--tools/binman/test/u_boot_binman_embed.lds29
-rw-r--r--tools/binman/test/u_boot_binman_embed_sm.c13
7 files changed, 107 insertions, 2 deletions
diff --git a/tools/binman/test/Makefile b/tools/binman/test/Makefile
index 0b19b7d9935..387ba163353 100644
--- a/tools/binman/test/Makefile
+++ b/tools/binman/test/Makefile
@@ -28,10 +28,12 @@ LDS_UCODE := -T $(SRC)u_boot_ucode_ptr.lds
LDS_BINMAN := -T $(SRC)u_boot_binman_syms.lds
LDS_BINMAN_BAD := -T $(SRC)u_boot_binman_syms_bad.lds
LDS_BINMAN_X86 := -T $(SRC)u_boot_binman_syms_x86.lds
+LDS_BINMAN_EMBED := -T $(SRC)u_boot_binman_embed.lds
TARGETS = u_boot_ucode_ptr u_boot_no_ucode_ptr bss_data \
u_boot_binman_syms u_boot_binman_syms.bin u_boot_binman_syms_bad \
- u_boot_binman_syms_size u_boot_binman_syms_x86
+ u_boot_binman_syms_size u_boot_binman_syms_x86 embed_data \
+ u_boot_binman_embed u_boot_binman_embed_sm
all: $(TARGETS)
@@ -44,6 +46,9 @@ u_boot_ucode_ptr: u_boot_ucode_ptr.c
bss_data: CFLAGS += $(SRC)bss_data.lds
bss_data: bss_data.c
+embed_data: CFLAGS += $(SRC)embed_data.lds
+embed_data: embed_data.c
+
u_boot_binman_syms.bin: u_boot_binman_syms
$(OBJCOPY) -O binary $< -R .note.gnu.build-id $@
@@ -59,6 +64,12 @@ u_boot_binman_syms_bad: u_boot_binman_syms_bad.c
u_boot_binman_syms_size: CFLAGS += $(LDS_BINMAN)
u_boot_binman_syms_size: u_boot_binman_syms_size.c
+u_boot_binman_embed: CFLAGS += $(LDS_BINMAN_EMBED)
+u_boot_binman_embed: u_boot_binman_embed.c
+
+u_boot_binman_embed_sm: CFLAGS += $(LDS_BINMAN_EMBED)
+u_boot_binman_embed_sm: u_boot_binman_embed_sm.c
+
clean:
rm -f $(TARGETS)
diff --git a/tools/binman/test/bss_data.c b/tools/binman/test/bss_data.c
index 79537c31b65..4f9b64cef9e 100644
--- a/tools/binman/test/bss_data.c
+++ b/tools/binman/test/bss_data.c
@@ -2,7 +2,7 @@
/*
* Copyright (c) 2016 Google, Inc
*
- * Simple program to create a _dt_ucode_base_size symbol which can be read
+ * Simple program to create a bss_data region so the symbol can be read
* by binutils. This is used by binman tests.
*/
diff --git a/tools/binman/test/embed_data.c b/tools/binman/test/embed_data.c
new file mode 100644
index 00000000000..47d8c38248c
--- /dev/null
+++ b/tools/binman/test/embed_data.c
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2021 Google LLC
+ *
+ * Simple program including some embedded data that can be accessed by binman.
+ * This is used by binman tests.
+ */
+
+int first[10] = {1};
+int embed[3] __attribute__((section(".embed"))) = {0x1234, 0x5678};
+int second[10] = {1};
+
+int main(void)
+{
+ return 0;
+}
diff --git a/tools/binman/test/embed_data.lds b/tools/binman/test/embed_data.lds
new file mode 100644
index 00000000000..908bf66c294
--- /dev/null
+++ b/tools/binman/test/embed_data.lds
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2021 Google LLC
+ */
+
+OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
+OUTPUT_ARCH(i386)
+ENTRY(_start)
+
+SECTIONS
+{
+ _start = .;
+ __data_start = .;
+ .data :
+ {
+ . = ALIGN(32);
+ embed_start = .;
+ *(.embed*)
+ embed_end = .;
+ . = ALIGN(32);
+ *(.data*)
+ }
+}
diff --git a/tools/binman/test/u_boot_binman_embed.c b/tools/binman/test/u_boot_binman_embed.c
new file mode 100644
index 00000000000..75874bb6e23
--- /dev/null
+++ b/tools/binman/test/u_boot_binman_embed.c
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2021 Google LLC
+ *
+ * Simple program to embed a devicetree. This is used by binman tests.
+ */
+
+int __attribute__((section(".mydtb"))) dtb_data[4096];
+
+int main(void)
+{
+ return 0;
+}
diff --git a/tools/binman/test/u_boot_binman_embed.lds b/tools/binman/test/u_boot_binman_embed.lds
new file mode 100644
index 00000000000..e213fa8a84c
--- /dev/null
+++ b/tools/binman/test/u_boot_binman_embed.lds
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (c) 2016 Google, Inc
+ */
+
+OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
+OUTPUT_ARCH(i386)
+ENTRY(_start)
+
+SECTIONS
+{
+ . = 0x00000000;
+ _start = .;
+
+ . = ALIGN(4);
+ .text :
+ {
+ *(.text*)
+ }
+
+ . = ALIGN(4);
+ .data : {
+ dtb_embed_begin = .;
+ KEEP(*(.mydtb));
+ dtb_embed_end = .;
+ }
+ .interp : { *(.interp*) }
+
+}
diff --git a/tools/binman/test/u_boot_binman_embed_sm.c b/tools/binman/test/u_boot_binman_embed_sm.c
new file mode 100644
index 00000000000..ae245d78a6a
--- /dev/null
+++ b/tools/binman/test/u_boot_binman_embed_sm.c
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2021 Google LLC
+ *
+ * Simple program to embed a devicetree. This is used by binman tests.
+ */
+
+int __attribute__((section(".mydtb"))) dtb_data[16];
+
+int main(void)
+{
+ return 0;
+}