mirror of https://github.com/wolfSSL/wolfBoot.git
Fix embedded images built with the clang compiler
parent
084431ba87
commit
ed15e3aee6
5
arch.mk
5
arch.mk
|
|
@ -1288,7 +1288,9 @@ ifeq ($(USE_CLANG),1)
|
|||
CLANG_NEWLIB_INCLUDE?=$(abspath $(dir $(CLANG_LIBC_A))/../include)
|
||||
|
||||
CC=$(CLANG_DRIVER)
|
||||
LD=$(CLANG_DRIVER)
|
||||
# Keep clang for compilation, but use the GNU linker driver so linker-script
|
||||
# LMAs for RAM sections are preserved and objcopy does not emit sparse images.
|
||||
LD=$(CLANG_GCC_NAME)
|
||||
AS=$(CLANG_DRIVER)
|
||||
AR=$(CROSS_COMPILE)ar
|
||||
OBJCOPY?=$(CROSS_COMPILE)objcopy
|
||||
|
|
@ -1296,6 +1298,7 @@ ifeq ($(USE_CLANG),1)
|
|||
|
||||
CFLAGS+=-isystem $(CLANG_NEWLIB_INCLUDE)
|
||||
CFLAGS+=-DWOLFSSL_NO_ATOMIC -DWOLFSSL_NO_ATOMICS
|
||||
CFLAGS+=-Wno-unknown-attributes -Wno-error=unknown-attributes
|
||||
LDFLAGS+=-nostdlib
|
||||
endif
|
||||
|
||||
|
|
|
|||
|
|
@ -102,6 +102,14 @@ LDFLAGS+=-T $(LSCRIPT) -Wl,-gc-sections -Wl,-Map=image.map -nostartfiles
|
|||
|
||||
# Setup default objcopy flags
|
||||
OBJCOPY_FLAGS+=--gap-fill $(FILL_BYTE)
|
||||
OBJCOPY_IMAGE_FLAGS:=
|
||||
|
||||
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+=-j .text -j .edidx
|
||||
endif
|
||||
|
||||
ifeq ($(DEBUG_UART),1)
|
||||
CFLAGS+=-DDEBUG_UART
|
||||
|
|
@ -913,15 +921,15 @@ delta-extra-data:LDFLAGS=-Wl,-Map=image.map
|
|||
|
||||
image.bin: image.elf
|
||||
@echo "\t[BIN] $@"
|
||||
$(Q)$(OBJCOPY) $(OBJCOPY_FLAGS) -O binary $^ $@
|
||||
$(Q)$(OBJCOPY) $(OBJCOPY_FLAGS) $(OBJCOPY_IMAGE_FLAGS) -O binary $^ $@
|
||||
|
||||
image.hex: image.elf
|
||||
@echo "\t[HEX] $@"
|
||||
$(Q)$(OBJCOPY) $(OBJCOPY_FLAGS) -O ihex $^ $@
|
||||
$(Q)$(OBJCOPY) $(OBJCOPY_FLAGS) $(OBJCOPY_IMAGE_FLAGS) -O ihex $^ $@
|
||||
|
||||
image.srec: image.elf
|
||||
@echo "\t[SREC] $@"
|
||||
$(Q)$(OBJCOPY) $(OBJCOPY_FLAGS) -O srec $^ $@
|
||||
$(Q)$(OBJCOPY) $(OBJCOPY_FLAGS) $(OBJCOPY_IMAGE_FLAGS) -O srec $^ $@
|
||||
|
||||
APP_OBJS := $(patsubst $(WOLFBOOT_LIB_WOLFSSL)/%, \
|
||||
$(WOLFSSL_LOCAL_OBJDIR)/%, $(APP_OBJS))
|
||||
|
|
|
|||
Loading…
Reference in New Issue