osd-contiki/platform/galileo/Makefile.customrules-galileo

60 lines
2.3 KiB
Makefile
Raw Normal View History

GDB ?= gdb
OPENOCD_SCRIPTS = $(CONTIKI)/platform/galileo/bsp/openocd-scripts
x86, galileo: Add UEFI support This patch adds support for optionally building EFI binaries in addition to Multiboot ELF binaries. It includes a script, build_uefi.sh, that downloads tool and library sources from the EDK II project, builds the GenFw tool that is used to create UEFI binaries, and creates a makefile that is included from the main x86 common makefile and enables UEFI support in the Contiki build system. If the script is not run prior to building Contiki, then an informational message will be displayed with instructions for running build_uefi.sh if UEFI support is desired. This patch also adds the path to the auto-generated makefile to .gitignore. This patch modifies the linker script for the Intel Quark X1000 to account for the output file section offsets and alignment expectations of the EDK II GenFw project. This patch also adds a newlib patch to remove the weak symbol attribute from floating point stdio support routines. See <newlib>/newlib/README for an explanation of how the newlib developers intended for _printf_float and _scanf_float to be linked. Newlib declares them as weak symbols with the intention that developers would force them to be linked only when needed using a linker command line option. However, some but not all Contiki programs require them, so we cannot simply always include or exclude them. Instead, we remove the weak symbol attributes and rely on the linker to automatically determine whether or not they should be linked. This avoids an issue in which weak symbols were undefined in the intermediate DLL generated as part of the UEFI build process. That resulted in the GenFw program emitting "ERROR 3000" messages when it encountered relocations referencing such an undefined symbol. Finally, this patch updates README.md to both make some revisions to account for the UART support introduced in previous patches as well as to provide instructions for using the UEFI support.
2015-07-10 20:21:00 +02:00
.PHONY: debug $(CONTIKI_PROJECT)
x86, galileo: Add UEFI support This patch adds support for optionally building EFI binaries in addition to Multiboot ELF binaries. It includes a script, build_uefi.sh, that downloads tool and library sources from the EDK II project, builds the GenFw tool that is used to create UEFI binaries, and creates a makefile that is included from the main x86 common makefile and enables UEFI support in the Contiki build system. If the script is not run prior to building Contiki, then an informational message will be displayed with instructions for running build_uefi.sh if UEFI support is desired. This patch also adds the path to the auto-generated makefile to .gitignore. This patch modifies the linker script for the Intel Quark X1000 to account for the output file section offsets and alignment expectations of the EDK II GenFw project. This patch also adds a newlib patch to remove the weak symbol attribute from floating point stdio support routines. See <newlib>/newlib/README for an explanation of how the newlib developers intended for _printf_float and _scanf_float to be linked. Newlib declares them as weak symbols with the intention that developers would force them to be linked only when needed using a linker command line option. However, some but not all Contiki programs require them, so we cannot simply always include or exclude them. Instead, we remove the weak symbol attributes and rely on the linker to automatically determine whether or not they should be linked. This avoids an issue in which weak symbols were undefined in the intermediate DLL generated as part of the UEFI build process. That resulted in the GenFw program emitting "ERROR 3000" messages when it encountered relocations referencing such an undefined symbol. Finally, this patch updates README.md to both make some revisions to account for the UART support introduced in previous patches as well as to provide instructions for using the UEFI support.
2015-07-10 20:21:00 +02:00
# Multiboot ELF binary
MULTIBOOT_SFX = $(TARGET)
MULTIBOOT = $(CONTIKI_PROJECT).$(MULTIBOOT_SFX)
# UEFI binary
UEFI_DLL_SFX = $(TARGET).dll
UEFI_DLL = $(CONTIKI_PROJECT).$(UEFI_SFX)
# The GenFw program is unable to process absolute symbols like _stext_addr,
# etc., that are defined in quarkX1000_dma.ld and quarkX1000_multi_seg.ld
# and used to configure segments in multi-segment.c, etc. Furthermore,
# relocating the UEFI image during load would result in those symbols not
# pointing to the expected image locations. So, relocation data is omitted
# from the intermediate UEFI DLL. This will only result in a
# correctly-functioning build if the UEFI firmware does not attempt to
# relocate the UEFI image, so it may be desirable in the future to revisit
# this design. To emit relocation data, '-Xlinker --emit-relocs' should be
# appended to the following line.
UEFI_LDFLAGS = -Xlinker --entry=uefi_start
x86, galileo: Add UEFI support This patch adds support for optionally building EFI binaries in addition to Multiboot ELF binaries. It includes a script, build_uefi.sh, that downloads tool and library sources from the EDK II project, builds the GenFw tool that is used to create UEFI binaries, and creates a makefile that is included from the main x86 common makefile and enables UEFI support in the Contiki build system. If the script is not run prior to building Contiki, then an informational message will be displayed with instructions for running build_uefi.sh if UEFI support is desired. This patch also adds the path to the auto-generated makefile to .gitignore. This patch modifies the linker script for the Intel Quark X1000 to account for the output file section offsets and alignment expectations of the EDK II GenFw project. This patch also adds a newlib patch to remove the weak symbol attribute from floating point stdio support routines. See <newlib>/newlib/README for an explanation of how the newlib developers intended for _printf_float and _scanf_float to be linked. Newlib declares them as weak symbols with the intention that developers would force them to be linked only when needed using a linker command line option. However, some but not all Contiki programs require them, so we cannot simply always include or exclude them. Instead, we remove the weak symbol attributes and rely on the linker to automatically determine whether or not they should be linked. This avoids an issue in which weak symbols were undefined in the intermediate DLL generated as part of the UEFI build process. That resulted in the GenFw program emitting "ERROR 3000" messages when it encountered relocations referencing such an undefined symbol. Finally, this patch updates README.md to both make some revisions to account for the UART support introduced in previous patches as well as to provide instructions for using the UEFI support.
2015-07-10 20:21:00 +02:00
UEFI_SFX = $(TARGET).efi
UEFI = $(CONTIKI_PROJECT).$(UEFI_SFX)
# Suffixes for final (non-intermediate) files to be built
FINAL_SFXS = $(MULTIBOOT_SFX)
ifeq ($(EN_UEFI),1)
FINAL_SFXS += $(UEFI_SFX)
endif
debug: $(MULTIBOOT)
@openocd -s $(OPENOCD_SCRIPTS) -f debug.cfg &> $(shell pwd)/LOG_OPENOCD &
@$(GDB) $< -ex "target remote :3333"
CUSTOM_RULE_LINK=1
%.$(MULTIBOOT_SFX): %.co $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a
$(TRACE_LD)
$(Q)$(LD) $(LDFLAGS) $(MULTIBOOT_LDFLAGS) $(TARGET_STARTFILES) ${filter-out %.a,$^} \
${filter %.a,$^} $(TARGET_LIBFILES) -o $@
%.$(UEFI_DLL_SFX): %.co $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a
$(TRACE_LD)
$(Q)$(LD) $(LDFLAGS) $(UEFI_LDFLAGS) $(TARGET_STARTFILES) ${filter-out %.a,$^} \
${filter %.a,$^} $(TARGET_LIBFILES) -o $@
x86, galileo: Add UEFI support This patch adds support for optionally building EFI binaries in addition to Multiboot ELF binaries. It includes a script, build_uefi.sh, that downloads tool and library sources from the EDK II project, builds the GenFw tool that is used to create UEFI binaries, and creates a makefile that is included from the main x86 common makefile and enables UEFI support in the Contiki build system. If the script is not run prior to building Contiki, then an informational message will be displayed with instructions for running build_uefi.sh if UEFI support is desired. This patch also adds the path to the auto-generated makefile to .gitignore. This patch modifies the linker script for the Intel Quark X1000 to account for the output file section offsets and alignment expectations of the EDK II GenFw project. This patch also adds a newlib patch to remove the weak symbol attribute from floating point stdio support routines. See <newlib>/newlib/README for an explanation of how the newlib developers intended for _printf_float and _scanf_float to be linked. Newlib declares them as weak symbols with the intention that developers would force them to be linked only when needed using a linker command line option. However, some but not all Contiki programs require them, so we cannot simply always include or exclude them. Instead, we remove the weak symbol attributes and rely on the linker to automatically determine whether or not they should be linked. This avoids an issue in which weak symbols were undefined in the intermediate DLL generated as part of the UEFI build process. That resulted in the GenFw program emitting "ERROR 3000" messages when it encountered relocations referencing such an undefined symbol. Finally, this patch updates README.md to both make some revisions to account for the UART support introduced in previous patches as well as to provide instructions for using the UEFI support.
2015-07-10 20:21:00 +02:00
%.$(UEFI_SFX): %.$(UEFI_DLL_SFX)
$(Q)$(GEN_FW) -o $@ -e UEFI_APPLICATION $^
# The Intel Galileo firmware has been observed to not relocate the image
# if its base is set to the 1M boundary. This makes debugging easier,
# since the symbols in the intermediate DLL then correspond to the load
# addresses.
$(Q)$(GEN_FW) -o $@ --rebase 0x100000 $@
$(CONTIKI_PROJECT): $(addprefix $(CONTIKI_PROJECT).,$(FINAL_SFXS))
@$(SIZE) $^
CLEAN += $(addprefix $(CONTIKI_PROJECT).,$(FINAL_SFXS))