Skip to content

Commit

Permalink
Fix order of operations for compiling compiled linker script.
Browse files Browse the repository at this point in the history
  • Loading branch information
cnlohr committed Feb 12, 2024
1 parent fca0738 commit bddf3b9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ch32v003fun/ch32v003fun.mk
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ LDFLAGS+=-T $(LINKER_SCRIPT) -Wl,--gc-sections -L$(CH32V003FUN)/../misc -lgcc

ifeq ($(TARGET_MCU), CH32V003)

$(TARGET).elf : $(SYSTEM_C) $(TARGET).$(TARGET_EXT) $(ADDITIONAL_C_FILES)
$(PREFIX)-gcc -o $@ $^ $(CFLAGS) $(LDFLAGS)
COMPILED_FILES:=$(SYSTEM_C) $(TARGET).$(TARGET_EXT) $(ADDITIONAL_C_FILES)

$(TARGET).elf : $(COMPILED_FILES) $(LINKER_SCRIPT)
$(PREFIX)-gcc -o $@ $(COMPILED_FILES) $(CFLAGS) $(LDFLAGS)

endif

Expand Down Expand Up @@ -102,7 +104,6 @@ FLASH_COMMAND?=$(MINICHLINK)/minichlink -w $< $(WRITE_SECTION) -b
$(GENERATED_LD_FILE) :
$(PREFIX)-gcc -E -P -x c -DTARGET_MCU=CH32V003 $(CH32V003FUN)/ch32v003fun.ld > $(GENERATED_LD_FILE)


cv_flash : $(TARGET).bin
make -C $(MINICHLINK) all
$(FLASH_COMMAND)
Expand Down

0 comments on commit bddf3b9

Please sign in to comment.