Skip to contentSkip to conversation

Add a config for AM335x High Security EVM

PATCH Superseded Andrew F. Davis 3 participants 8 messages Jan 22, 2017 – Jan 23, 2017

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover Add a config for AM335x High Security EVM

Hello all,

This series is [0] and [1] together due to a dependency. Both are modified as suggested in the comments.

Thanks,
Andrew

[0]: https://patchwork.ozlabs.org/patch/713945/
[1]: https://patchwork.ozlabs.org/patch/715820/

Andrew F. Davis (3):
malloc_simple: Add debug statements to memalign_simple
spl: Remove overwrite of relocated malloc limit
defconfig: Add a config for AM335x High Security EVM

 MAINTAINERS                     |  1 +
 common/malloc_simple.c          |  6 +++-
 common/spl/spl.c                |  2 ++
 configs/am335x_hs_evm_defconfig | 62 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 70 insertions(+), 1 deletion(-)
 create mode 100644 configs/am335x_hs_evm_defconfig
Signature · 1 line
2.11.0
#1 lore raw

PATCH v3 1/3 malloc_simple: Add debug statements to memalign_simple

Add debug statements to memalign_simple to match malloc_simple.

---
 common/malloc_simple.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
common/malloc_simple.c +5 -1
index 0f6bcbcc71..611400265b 100644
@@ -39,10 +39,14 @@ void *memalign_simple(size_t align, size_t bytes)
 
 	addr = ALIGN(gd->malloc_base + gd->malloc_ptr, align);
 	new_ptr = addr + bytes - gd->malloc_base;
-	if (new_ptr > gd->malloc_limit)
+	if (new_ptr > gd->malloc_limit) {
+		debug("space exhausted\n");
 		return NULL;
+	}
+
 	ptr = map_sysmem(addr, bytes);
 	gd->malloc_ptr = ALIGN(new_ptr, sizeof(new_ptr));
+	debug("%lx\n", (ulong)ptr);
 
 	return ptr;
 }
Signature · 1 line
2.11.0
#2 lore raw

PATCH v3 1/3 malloc_simple: Add debug statements to memalign_simple

Quoted 3 lines · Andrew F. Davis

Add debug statements to memalign_simple to match malloc_simple.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170122/2d7be1e0/attachment.sig>
#4 lore raw

PATCH v3 2/3 spl: Remove overwrite of relocated malloc limit

In reply to Andrew F. Davis

spl_init on some boards is called after stack and heap relocation, on some platforms spl_relocate_stack_gd is called to handle setting the limit to its value CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN when simple SPL malloc is enabled during relocation. spl_init should then not re-assign the old pre-relocation limit when this is defined.

---
 common/spl/spl.c | 2 ++
 1 file changed, 2 insertions(+)
common/spl/spl.c +2 -0
index 462c3a2b97..abff85a725 100644
@@ -187,7 +187,9 @@ int spl_init(void)
 #ifdef CONFIG_MALLOC_F_ADDR
 	gd->malloc_base = CONFIG_MALLOC_F_ADDR;
 #endif
+#ifndef CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN
 	gd->malloc_limit = CONFIG_SYS_MALLOC_F_LEN;
+#endif
 	gd->malloc_ptr = 0;
 #endif
 	if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) {
Signature · 1 line
2.11.0
#5 lore raw

PATCH v3 2/3 spl: Remove overwrite of relocated malloc limit

Quoted 16 lines · Andrew F. Davis

spl_init on some boards is called after stack and heap relocation, on some platforms spl_relocate_stack_gd is called to handle setting the limit to its value CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN when simple SPL malloc is enabled during relocation. spl_init should then not re-assign the old pre-relocation limit when this is defined.

---
 common/spl/spl.c | 2 ++
 1 file changed, 2 insertions(+)
common/spl/spl.c +0 -0
index 462c3a2b97..abff85a725 100644

common/spl/spl.c int spl_init(void) · line 194

Quoted 8 lines
common/spl/spl.c +2 -0
@@ -187,7 +187,9 @@ int spl_init(void)
 #ifdef CONFIG_MALLOC_F_ADDR
 	gd->malloc_base = CONFIG_MALLOC_F_ADDR;
 #endif
+#ifndef CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN
 	gd->malloc_limit = CONFIG_SYS_MALLOC_F_LEN;
+#endif
 	gd->malloc_ptr = 0;
 #endif

With fuller context of the function, I don't like this solution. When we do have CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN we are setting both malloc_limit and malloc_base down in spl_relocate_stack_gd() and would not want to overwrite either of them, yes? So what's happening (I think) is that CONFIG_SYS_MALLOC_F_LEN set for U-Boot proper but are in the case where it's also not the valid size for SPL. Yes?

So I think, in sum, we should change the just-above-context line:
#if defined(CONFIG_SYS_MALLOC_F_LEN)
into:
#if defined(CONFIG_SYS_MALLOC_F_LEN) && \
!defined(CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN)

And comment above it what is going on.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170122/40a11782/attachment.sig>
#6 lore raw

PATCH v3 3/3 defconfig: Add a config for AM335x High Security EVM

In reply to Andrew F. Davis

Add a new defconfig file for the AM335x High Security EVM. This config is specific for the case of memory device booting. Memory device booting is handled separatly from peripheral booting on HS devices as the load address changes.

This defconfig is the same as for the non-secure part, except for:
CONFIG_TI_SECURE_DEVICE option set to 'y' CONFIG_ISW_ENTRY_ADDR updated for secure images. CONFIG_FIT_IMAGE_POST_PROCESS option set to 'y' CONFIG_SPL_FIT_IMAGE_POST_PROCESS option set to 'y' CONFIG_USE_TINY_PRINTF option set to 'y' to reduce SPL size CONFIG_SPL_SYS_MALLOC_SIMPLE set to 'y' to reduce SPL size

---
 MAINTAINERS                     |  1 +
 configs/am335x_hs_evm_defconfig | 62 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+)
 create mode 100644 configs/am335x_hs_evm_defconfig
MAINTAINERS +1 -0
index 0e05c0ecff..eaa2c3bbb8 100644
@@ -441,6 +441,7 @@ F:	arch/arm/mach-omap2/omap5/sec_entry_cpu1.S
 F:	arch/arm/mach-omap2/omap5/sec-fxns.c
 F:	arch/arm/mach-omap2/sec-common.c
 F:	arch/arm/mach-omap2/config_secure.mk
+F:	configs/am335x_hs_evm_defconfig
 F:	configs/am43xx_hs_evm_defconfig
 F:	configs/am57xx_hs_evm_defconfig
 F:	configs/dra7xx_hs_evm_defconfig
configs/am335x_hs_evm_defconfig new file +62 -0

62 lines not on this page · raw message

Signature · 1 line
2.11.0
#7 lore raw

PATCH v3 3/3 defconfig: Add a config for AM335x High Security EVM

Quoted 13 lines · Andrew F. Davis

Add a new defconfig file for the AM335x High Security EVM. This config is specific for the case of memory device booting. Memory device booting is handled separatly from peripheral booting on HS devices as the load address changes.

This defconfig is the same as for the non-secure part, except for:
CONFIG_TI_SECURE_DEVICE option set to 'y' CONFIG_ISW_ENTRY_ADDR updated for secure images. CONFIG_FIT_IMAGE_POST_PROCESS option set to 'y' CONFIG_SPL_FIT_IMAGE_POST_PROCESS option set to 'y' CONFIG_USE_TINY_PRINTF option set to 'y' to reduce SPL size CONFIG_SPL_SYS_MALLOC_SIMPLE set to 'y' to reduce SPL size

Quoted 2 lines

Thanks and regards,
Lokesh

Quoted 87 lines
---
 MAINTAINERS                     |  1 +
 configs/am335x_hs_evm_defconfig | 62 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+)
 create mode 100644 configs/am335x_hs_evm_defconfig
MAINTAINERS +1 -0
index 0e05c0ecff..eaa2c3bbb8 100644
@@ -441,6 +441,7 @@ F:	arch/arm/mach-omap2/omap5/sec_entry_cpu1.S
 F:	arch/arm/mach-omap2/omap5/sec-fxns.c
 F:	arch/arm/mach-omap2/sec-common.c
 F:	arch/arm/mach-omap2/config_secure.mk
+F:	configs/am335x_hs_evm_defconfig
 F:	configs/am43xx_hs_evm_defconfig
 F:	configs/am57xx_hs_evm_defconfig
 F:	configs/dra7xx_hs_evm_defconfig
configs/am335x_hs_evm_defconfig new file +62 -0
new file mode 100644
index 0000000000..d6224bcdfb
@@ -0,0 +1,62 @@
+CONFIG_ARM=y
+CONFIG_AM33XX=y
+CONFIG_TI_SECURE_DEVICE=y
+# CONFIG_SPL_EXT_SUPPORT is not set
+# CONFIG_SPL_NAND_SUPPORT is not set
+CONFIG_TARGET_AM335X_EVM=y
+CONFIG_ISW_ENTRY_ADDR=0x40300350
+CONFIG_SPL_STACK_R_ADDR=0x82000000
+# CONFIG_SPL_YMODEM_SUPPORT is not set
+CONFIG_DEFAULT_DEVICE_TREE="am335x-evm"
+CONFIG_DISTRO_DEFAULTS=y
+CONFIG_FIT=y
+CONFIG_SYS_EXTRA_OPTIONS="NAND"
+CONFIG_SPL_LOAD_FIT=y
+CONFIG_SPL_FIT_IMAGE_POST_PROCESS=y
+CONFIG_FIT_IMAGE_POST_PROCESS=y
+CONFIG_SYS_CONSOLE_INFO_QUIET=y
+CONFIG_VERSION_VARIABLE=y
+CONFIG_SPL=y
+CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_STACK_R=y
+CONFIG_SPL_MTD_SUPPORT=y
+# CONFIG_CMD_IMLS is not set
+CONFIG_CMD_ASKENV=y
+# CONFIG_CMD_FLASH is not set
+CONFIG_CMD_MMC=y
+CONFIG_CMD_SF=y
+CONFIG_CMD_SPI=y
+CONFIG_CMD_I2C=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_DFU=y
+CONFIG_CMD_GPIO=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_OF_CONTROL=y
+CONFIG_OF_LIST="am335x-evm"
+# CONFIG_BLK is not set
+CONFIG_DFU_MMC=y
+CONFIG_DFU_NAND=y
+CONFIG_DFU_RAM=y
+CONFIG_DM_I2C=y
+CONFIG_DM_MMC=y
+# CONFIG_DM_MMC_OPS is not set
+CONFIG_MMC_OMAP_HS=y
+CONFIG_SPI_FLASH=y
+CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_DM_ETH=y
+CONFIG_SYS_NS16550=y
+CONFIG_TIMER=y
+CONFIG_OMAP_TIMER=y
+CONFIG_USB=y
+CONFIG_USB_MUSB_HOST=y
+CONFIG_USB_MUSB_GADGET=y
+CONFIG_USB_STORAGE=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_G_DNL_MANUFACTURER="Texas Instruments"
+CONFIG_G_DNL_VENDOR_NUM=0x0451
+CONFIG_G_DNL_PRODUCT_NUM=0xd022
+CONFIG_USE_TINY_PRINTF=y
+CONFIG_RSA=y
+CONFIG_SPL_OF_LIBFDT=y