Skip to content

Commit

Permalink
Adds a make rule to produce disassembly files for kernel source files
Browse files Browse the repository at this point in the history
  • Loading branch information
HAKarlsson committed Nov 29, 2024
1 parent 6ca735a commit e2fe1b7
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ CFLAGS:=-march=${ARCH} -mabi=${ABI} -mcmodel=${CMODEL} \
-DPLATFORM_${PLATFORM} \
-std=c11 \
-O2 -g3 \
-flto -ffat-lto-objects \
-Wall -Wextra -Werror \
-Wno-unused-parameter \
-Wshadow -fno-common \
-fno-stack-protector \
-flto \
-include ${S3K_CONF_H} \
-Iinc -I${COMMON_INC} \

# LD flags
LDFLAGS:=-march=${ARCH} -mabi=${ABI} -mcmodel=${CMODEL} \
-Tlinker.ld \
-nostartfiles -ffreestanding \
-flto \
-Wl,--no-warn-rwx-segment \
-Wl,--gc-sections \
-flto \
--specs=nosys.specs \
-ffunction-sections -fdata-sections \
-L${COMMON_LIB} \
Expand All @@ -52,7 +52,8 @@ DEPS:=${OBJS:.o=.d}
ELF:=${BUILD}/${PROGRAM}.elf
BIN:=${ELF:.elf=.bin}
HEX:=${ELF:.elf=.hex}
DA :=${ELF:.elf=.da}
DA :=${ELF:.elf=.da} ${patsubst %.o, %.da, ${OBJS}}


all: ${ELF} ${BIN} ${HEX} ${DA}

Expand Down Expand Up @@ -82,8 +83,16 @@ ${BUILD}/${PROGRAM}/%.c.o: src/%.c
@${OBJCOPY} -O ihex $< $@
@printf "OBJCOPY\t$@\n"

%.c.da: %.c.o
@${OBJDUMP} -d $< > $@
@printf "OBJDUMP\t$@\n"

%.S.da: %.S.o
@${OBJDUMP} -d $< > $@
@printf "OBJDUMP\t$@\n"

%.da: %.elf
@${OBJDUMP} -D $< > $@
@${OBJDUMP} -d $< > $@
@printf "OBJDUMP\t$@\n"

.PHONY: all da format clean
Expand Down

0 comments on commit e2fe1b7

Please sign in to comment.