mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-23 16:29:34 +00:00
4cdb7ba9b6
This patch extends the protection domain framework with an additional plugin to use Task-State Segment (TSS) structures to offload much of the work of switching protection domains to the CPU. This can save space compared to paging, since paging requires two 4KiB page tables and one 32-byte page table plus one whole-system TSS and an additional 32-byte data structure for each protection domain, whereas the approach implemented by this patch just requires a 128-byte data structure for each protection domain. Only a small number of protection domains will typically be used, so n * 128 < 8328 + (n * 32). For additional information, please refer to cpu/x86/mm/README.md. GCC 6 is introducing named address spaces for the FS and GS segments [1]. LLVM Clang also provides address spaces for the FS and GS segments [2]. This patch also adds support to the multi-segment X86 memory management subsystem for using these features instead of inline assembly blocks, which enables type checking to detect some address space mismatches. [1] https://gcc.gnu.org/onlinedocs/gcc/Named-Address-Spaces.html [2] http://llvm.org/releases/3.3/tools/clang/docs/LanguageExtensions.html#target-specific-extensions
60 lines
2.3 KiB
Makefile
60 lines
2.3 KiB
Makefile
GDB ?= gdb
|
|
OPENOCD_SCRIPTS = $(CONTIKI)/platform/galileo/bsp/openocd-scripts
|
|
|
|
.PHONY: debug $(CONTIKI_PROJECT)
|
|
|
|
# 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
|
|
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 $@
|
|
|
|
%.$(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))
|