Specifications

36 A Minimal PowerPCÂȘ Boot Sequence for
Executing Compiled C Programs
Source Files
LDFLAGS += -Wl,--defsym,DATA_START=$(DATA_START) \
-Wl,--defsym,IMAGE_DATA_START=$(IMAGE_DATA_START)
endif
# define options for the objdump
DUMPFLAGS = --syms --disassemble-all
# list C modules to link with the init code here
C_SRC = test.c
C_OBJS = $(C_SRC:.c=.o)
# use variables to refer to init code in case it changes
PPCINIT = ppcinit.o
PPCINIT_DEP = reg_defs.h ppcinit.h ppcinit.S
#
# define build targets
#
all: go.srec
clean:
rm *.o *.elf *.srec *.dump *.i
# build s-record with init code and c files linked together
go.srec: $(C_OBJS) $(PPCINIT)
$(LD) $(LDFLAGS) -o go.elf $(PPCINIT) $(C_OBJS)
$(OBJDUMP) $(DUMPFLAGS) go.elf > go.dump
$(OBJCOPY) -O srec -R .comment go.elf go.srec
# compile init code
$(PPCINIT): $(PPCINIT_DEP)
$(CC) $(CFLAGS) -c -x assembler-with-cpp $*.S
# handle compilation of C files
%.o:%.c
$(CC) $(CFLAGS) -c $<