osd-contiki/cpu/x86/Makefile.x86_common

21 lines
385 B
Makefile
Raw Normal View History

CONTIKI_CPU_DIRS += . init/common
CONTIKI_SOURCEFILES += gdt.c helpers.S idt.c cpu.c
CC = gcc
LD = gcc
AS = as
OBJCOPY = objcopy
SIZE = size
STRIP = strip
x86: Improve debugging experience This patch appends some gcc options to CFLAGS when building the default image in order to improve the debugging experience on GDB. We use the '-ggdb' option which produces debugging information used by GDB (including GDB extensions) with level 3 which includes preprocessor macros information. We also use '-Og' which enables optimizations that do not interfere with debugging. According to gcc manpage, it should be the optimization level of choice for the standard edit-compile-debug cycle, offering a reasonable level of optimization while maintaining fast compilation and a good debugging experience. Also, this patch removes the '-g' option from the default CFLAGS because there is no point in using it when BUILD_RELEASE=1. As expected, the overall ELF image increases (due to -ggdb3 option) while the .text section is reduced (due to -Og). For the sake of comparison, below follows the output of 'size'. Before patch: $ size -A hello-world.galileo hello-world.galileo : section size addr .text 13766 1048576 .rodata 241 1064960 .eh_frame 5160 1065204 .eh_frame_hdr 1212 1070364 .data 1188 1073152 .bss 12808 1077248 .debug_info 14351 0 .debug_abbrev 6281 0 .debug_aranges 768 0 .debug_line 6443 0 .debug_str 4805 0 .comment 17 0 .note 40 0 .debug_ranges 24 0 Total 67104 After patch: $ size -A hello-world.galileo hello-world.galileo : section size addr .text 11718 1048576 .rodata 249 1060864 .eh_frame 5496 1061116 .eh_frame_hdr 1204 1066612 .data 1156 1069056 .bss 12808 1073152 .debug_info 16727 0 .debug_abbrev 7254 0 .debug_loc 2083 0 .debug_aranges 768 0 .debug_macro 17273 0 .debug_line 13433 0 .debug_str 42192 0 .comment 17 0 .note 40 0 Total 132418
2015-07-10 16:44:28 +02:00
CFLAGS += -Wall
LDFLAGS += -Wl,-Map=contiki-$(TARGET).map,--build-id=none
ifeq ($(BUILD_RELEASE),1)
CFLAGS += -Os -fno-strict-aliasing
LDFLAGS += -Wl,--strip-all
x86: Improve debugging experience This patch appends some gcc options to CFLAGS when building the default image in order to improve the debugging experience on GDB. We use the '-ggdb' option which produces debugging information used by GDB (including GDB extensions) with level 3 which includes preprocessor macros information. We also use '-Og' which enables optimizations that do not interfere with debugging. According to gcc manpage, it should be the optimization level of choice for the standard edit-compile-debug cycle, offering a reasonable level of optimization while maintaining fast compilation and a good debugging experience. Also, this patch removes the '-g' option from the default CFLAGS because there is no point in using it when BUILD_RELEASE=1. As expected, the overall ELF image increases (due to -ggdb3 option) while the .text section is reduced (due to -Og). For the sake of comparison, below follows the output of 'size'. Before patch: $ size -A hello-world.galileo hello-world.galileo : section size addr .text 13766 1048576 .rodata 241 1064960 .eh_frame 5160 1065204 .eh_frame_hdr 1212 1070364 .data 1188 1073152 .bss 12808 1077248 .debug_info 14351 0 .debug_abbrev 6281 0 .debug_aranges 768 0 .debug_line 6443 0 .debug_str 4805 0 .comment 17 0 .note 40 0 .debug_ranges 24 0 Total 67104 After patch: $ size -A hello-world.galileo hello-world.galileo : section size addr .text 11718 1048576 .rodata 249 1060864 .eh_frame 5496 1061116 .eh_frame_hdr 1204 1066612 .data 1156 1069056 .bss 12808 1073152 .debug_info 16727 0 .debug_abbrev 7254 0 .debug_loc 2083 0 .debug_aranges 768 0 .debug_macro 17273 0 .debug_line 13433 0 .debug_str 42192 0 .comment 17 0 .note 40 0 Total 132418
2015-07-10 16:44:28 +02:00
else
CFLAGS += -Og -ggdb3
endif