# # Makefile for hello world example # MAIN=hello include $(RTEMS_MAKEFILE_PATH)/Makefile.inc include $(RTEMS_CUSTOM) include $(PROJECT_ROOT)/make/leaf.cfg # Constants for relocating HEADERADDR=0x00097E00 START16FILE=$(rtemsdir)/lib/start16.bin START16ADDR=0x00097C00 RELOCADDR=0x00100000 # Tool helpers rtemsdir=${RTEMS_MAKEFILE_PATH} GNATMAKE=$(AS:as=gnatmake) CARGS=-B${rtemsdir}/lib/ -specs bsp_specs -qrtems $(CPU_CFLAGS) \ -Wl,-Ttext,$(RELOCADDR) CARGS+=-DGNAT_MAIN_STACKSPACE=100 all: init.o $(MAIN) $(MAIN): $(MAIN).exe ln $(MAIN).exe $(MAIN) $(MAIN).exe: init.o $(GNATMAKE) -v -O -gnata -gnatE -gnato $(MAIN) -g -o $(MAIN).obj \ -bargs -Mgnat_main \ -cargs $(CARGS) \ -largs $(CARGS) init.o $(SIZE) $(MAIN).obj $(NM) -g -n $(MAIN).obj >$(MAIN).num $(OBJCOPY) -O elf32-i386 \ --remove-section=.rodata \ --remove-section=.comment \ --remove-section=.note \ --strip-unneeded $(MAIN).obj $@ $(OBJCOPY) -O binary $(MAIN).obj $(MAIN).bin $(rtemsdir)/build-tools/bin2boot -v $(MAIN).bt $(HEADERADDR) \ $(START16FILE) $(START16ADDR) 0 $(MAIN).bin $(RELOCADDR) 0 init.o: init.c $(CC) $(CFLAGS) -c init.c clean: rm -f b_$(MAIN).c b_$(MAIN).o *.o *.ali $(MAIN) rm -f *.num *.exe *.obj *.bin *.bt