mirror of https://github.com/wolfSSL/wolfBoot.git
Fixed Clang sections in TZEN images
parent
8583a87c96
commit
bcd4d8b9e6
22
Makefile
22
Makefile
|
|
@ -199,9 +199,11 @@ ifeq ($(USE_GCC_HEADLESS),1)
|
|||
OBJCOPY_FLAGS+=--gap-fill $(FILL_BYTE)
|
||||
endif
|
||||
|
||||
ifeq ($(USE_CLANG),1)
|
||||
ifeq ($(ARCH),ARM)
|
||||
OBJCOPY_BIN_FLAGS+=$(CLANG_ARM_OBJCOPY_FLASH_FLAGS_BOOT)
|
||||
ifeq ($(ARCH),ARM)
|
||||
ifeq ($(USE_CLANG),1)
|
||||
ifneq ($(TZEN),1)
|
||||
OBJCOPY_BIN_FLAGS+=$(CLANG_ARM_OBJCOPY_FLASH_FLAGS_BOOT)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
ifeq ($(TARGET),ti_hercules)
|
||||
|
|
@ -333,7 +335,21 @@ wolfboot.efi: wolfboot.elf
|
|||
|
||||
wolfboot.bin: wolfboot.elf
|
||||
@echo "\t[BIN] $@"
|
||||
ifeq ($(USE_CLANG),1)
|
||||
ifeq ($(TZEN),1)
|
||||
$(Q)last_load="$$($(CROSS_COMPILE)readelf -Wl $< | awk '/ LOAD / { line = $$0 } END { print line }')"; \
|
||||
set -- $$last_load; \
|
||||
last_phys=$$(printf '%d' $$4); \
|
||||
last_filesz=$$(printf '%d' $$5); \
|
||||
padded_filesz=$$((($$last_filesz + 0xff) & ~0xff)); \
|
||||
pad_to=$$((last_phys + padded_filesz)); \
|
||||
$(OBJCOPY) $(OBJCOPY_FLAGS) $(OBJCOPY_BIN_FLAGS) --pad-to=$$(printf '0x%x' $$pad_to) -O binary $< $@
|
||||
else
|
||||
$(Q)$(OBJCOPY) $(OBJCOPY_FLAGS) $(OBJCOPY_BIN_FLAGS) -O binary $^ $@
|
||||
endif
|
||||
else
|
||||
$(Q)$(OBJCOPY) $(OBJCOPY_FLAGS) $(OBJCOPY_BIN_FLAGS) -O binary $^ $@
|
||||
endif
|
||||
@echo
|
||||
@echo "\t[SIZE]"
|
||||
$(Q)$(SIZE) wolfboot.elf
|
||||
|
|
|
|||
6
arch.mk
6
arch.mk
|
|
@ -1301,9 +1301,9 @@ ifeq ($(USE_CLANG),1)
|
|||
CFLAGS+=-Wno-unknown-attributes -Wno-error=unknown-attributes
|
||||
CFLAGS+=-fno-unwind-tables -fno-asynchronous-unwind-tables
|
||||
LSCRIPT_FLAGS+=-T $(abspath $(WOLFBOOT_ROOT)/hal/clang-discard.ld)
|
||||
# Keep Clang-specific raw-image section selection in one place. Both the
|
||||
# bootloader and test-app need flash-backed sections only, but the bootloader
|
||||
# has a few extra output sections that must be preserved.
|
||||
# Clang-built ARM raw images may otherwise expand ELF loadable gaps into
|
||||
# oversized binaries on some targets. Keep the section selection scoped to
|
||||
# the Clang workaround paths only.
|
||||
CLANG_ARM_OBJCOPY_FLASH_FLAGS_BASE:=-j .text -j .edidx
|
||||
CLANG_ARM_OBJCOPY_FLASH_FLAGS_BOOT:=$(CLANG_ARM_OBJCOPY_FLASH_FLAGS_BASE) -j .ramcode -j .keystore -j .gnu.sgstubs
|
||||
CLANG_ARM_OBJCOPY_FLASH_FLAGS_APP:=$(CLANG_ARM_OBJCOPY_FLASH_FLAGS_BASE)
|
||||
|
|
|
|||
|
|
@ -108,7 +108,9 @@ ifeq ($(USE_CLANG),1)
|
|||
# Clang-built ARM ELFs can keep RAM sections as loadable segments, and raw
|
||||
# objcopy output then expands the flash-to-RAM gap into a huge sparse image.
|
||||
# The app image only needs the flash-backed output sections.
|
||||
OBJCOPY_IMAGE_FLAGS+=$(CLANG_ARM_OBJCOPY_FLASH_FLAGS_APP)
|
||||
ifneq ($(TZEN),1)
|
||||
OBJCOPY_IMAGE_FLAGS+=$(CLANG_ARM_OBJCOPY_FLASH_FLAGS_APP)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(DEBUG_UART),1)
|
||||
|
|
|
|||
Loading…
Reference in New Issue