Skip to content

Commit

Permalink
Make the linker make the map file instead of it being a separate step…
Browse files Browse the repository at this point in the history
… becuase it tells you which libraries are actually being linked that way.
  • Loading branch information
cnlohr committed Dec 5, 2024
1 parent f10fda0 commit 8125a65
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions ch32v003fun/ch32v003fun.mk
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Default prefix for Windows
ifeq ($(OS),Windows_NT)
PREFIX?=riscv64-unknown-elf
PREFIX?=riscv64-unknown-elf
# Check if riscv64-linux-gnu-gcc exists
else ifneq ($(shell which riscv64-linux-gnu-gcc),)
PREFIX?=riscv64-linux-gnu
PREFIX?=riscv64-linux-gnu
# Check if riscv64-unknown-elf-gcc exists
else ifneq ($(shell which riscv64-unknown-elf-gcc),)
PREFIX?=riscv64-unknown-elf
PREFIX?=riscv64-unknown-elf
# Default prefix
else
PREFIX?=riscv64-elf
PREFIX?=riscv64-elf
endif

# Fedora places newlib in a different location
Expand All @@ -34,7 +34,7 @@ ifeq ($(DEBUG),1)
endif

CFLAGS?=-g -Os -flto -ffunction-sections -fdata-sections -fmessage-length=0 -msmall-data-limit=8
LDFLAGS+=-Wl,--print-memory-usage
LDFLAGS+=-Wl,--print-memory-usage -Wl,-Map=$(TARGET).map

ifeq ($(TARGET_MCU),CH32V003)
CFLAGS_ARCH+=-march=rv32ec -mabi=ilp32e -DCH32V003=1
Expand Down Expand Up @@ -189,7 +189,6 @@ FILES_TO_COMPILE:=$(SYSTEM_C) $(TARGET).$(TARGET_EXT) $(ADDITIONAL_C_FILES)

$(TARGET).bin : $(TARGET).elf
$(PREFIX)-objdump -S $^ > $(TARGET).lst
$(PREFIX)-objdump -t $^ > $(TARGET).map
$(PREFIX)-objcopy -O binary $< $(TARGET).bin
$(PREFIX)-objcopy -O ihex $< $(TARGET).hex

Expand Down

0 comments on commit 8125a65

Please sign in to comment.