Skip to content

Commit

Permalink
Update code for GCC version 12
Browse files Browse the repository at this point in the history
The only change necessary to update from GCC 10 to GCC 12 is that
the option `-g3` needs to be `-g` instead.

Why do we have to update to GCC 12? The main motivation is to have
the toolchain available for macOS Apple Silicon hosts that want to
build the Microkit SDK from source. The toolchain for Apple Silicon
hosts is only available from GCC 12 and above.

Signed-off-by: Ivan Velickovic <[email protected]>
  • Loading branch information
Ivan-Velickovic committed Jan 29, 2024
1 parent 0ff9c19 commit 7522184
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions example/imx8mm_evk/passive_server/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ CLIENT_OBJS := client.o
BOARD_DIR := $(MICROKIT_SDK)/board/$(MICROKIT_BOARD)/$(MICROKIT_CONFIG)

IMAGES := server.elf client.elf
CFLAGS := -mcpu=$(CPU) -mstrict-align -nostdlib -ffreestanding -g3 -O3 -Wall -Wno-unused-function -Werror -I$(BOARD_DIR)/include
CFLAGS := -mcpu=$(CPU) -mstrict-align -nostdlib -ffreestanding -g -O3 -Wall -Wno-unused-function -Werror -I$(BOARD_DIR)/include
LDFLAGS := -L$(BOARD_DIR)/lib
LIBS := -lmicrokit -Tmicrokit.ld

Expand All @@ -47,7 +47,7 @@ $(BUILD_DIR)/%.o: %.c Makefile
$(CC) -c $(CFLAGS) $< -o $@

$(BUILD_DIR)/%.o: %.s Makefile
$(AS) -g3 -mcpu=$(CPU) $< -o $@
$(AS) -g -mcpu=$(CPU) $< -o $@

$(BUILD_DIR)/server.elf: $(addprefix $(BUILD_DIR)/, $(SERVER_OBJS))
$(LD) $(LDFLAGS) $^ $(LIBS) -o $@
Expand Down
4 changes: 2 additions & 2 deletions example/maaxboard/hello/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ HELLO_OBJS := hello.o
BOARD_DIR := $(MICROKIT_SDK)/board/$(MICROKIT_BOARD)/$(MICROKIT_CONFIG)

IMAGES := hello.elf
CFLAGS := -mcpu=$(CPU) -mstrict-align -nostdlib -ffreestanding -g3 -O3 -Wall -Wno-unused-function -Werror -I$(BOARD_DIR)/include
CFLAGS := -mcpu=$(CPU) -mstrict-align -nostdlib -ffreestanding -g -O3 -Wall -Wno-unused-function -Werror -I$(BOARD_DIR)/include
LDFLAGS := -L$(BOARD_DIR)/lib
LIBS := -lmicrokit -Tmicrokit.ld

Expand All @@ -46,7 +46,7 @@ $(BUILD_DIR)/%.o: %.c Makefile
$(CC) -c $(CFLAGS) $< -o $@

$(BUILD_DIR)/%.o: %.s Makefile
$(AS) -g3 -mcpu=$(CPU) $< -o $@
$(AS) -g -mcpu=$(CPU) $< -o $@

$(BUILD_DIR)/hello.elf: $(addprefix $(BUILD_DIR)/, $(HELLO_OBJS))
$(LD) $(LDFLAGS) $^ $(LIBS) -o $@
Expand Down
4 changes: 2 additions & 2 deletions example/tqma8xqp1gb/ethernet/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ GPT_OBJS := gpt.o
BOARD_DIR := $(MICROKIT_SDK)/board/$(MICROKIT_BOARD)/$(MICROKIT_CONFIG)

IMAGES := eth.elf pass.elf gpt.elf
CFLAGS := -mcpu=$(CPU) -mstrict-align -nostdlib -ffreestanding -g3 -O3 -Wall -Wno-unused-function -Werror -I$(BOARD_DIR)/include
CFLAGS := -mcpu=$(CPU) -mstrict-align -nostdlib -ffreestanding -g -O3 -Wall -Wno-unused-function -Werror -I$(BOARD_DIR)/include
LDFLAGS := -L$(BOARD_DIR)/lib
LIBS := -lmicrokit -Tmicrokit.ld

Expand All @@ -48,7 +48,7 @@ $(BUILD_DIR)/%.o: %.c Makefile
$(CC) -c $(CFLAGS) $< -o $@

$(BUILD_DIR)/%.o: %.s Makefile
$(AS) -g3 -mcpu=$(CPU) $< -o $@
$(AS) -g -mcpu=$(CPU) $< -o $@

$(BUILD_DIR)/eth.elf: $(addprefix $(BUILD_DIR)/, $(ETH_OBJS))
$(LD) $(LDFLAGS) $^ $(LIBS) -o $@
Expand Down
4 changes: 2 additions & 2 deletions example/zcu102/hello/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ HELLO_OBJS := hello.o
BOARD_DIR := $(MICROKIT_SDK)/board/$(MICROKIT_BOARD)/$(MICROKIT_CONFIG)

IMAGES := hello.elf
CFLAGS := -mcpu=$(CPU) -mstrict-align -nostdlib -ffreestanding -g3 -O3 -Wall -Wno-unused-function -Werror -I$(BOARD_DIR)/include
CFLAGS := -mcpu=$(CPU) -mstrict-align -nostdlib -ffreestanding -g -O3 -Wall -Wno-unused-function -Werror -I$(BOARD_DIR)/include
LDFLAGS := -L$(BOARD_DIR)/lib
LIBS := -lmicrokit -Tmicrokit.ld

Expand All @@ -46,7 +46,7 @@ $(BUILD_DIR)/%.o: %.c Makefile
$(CC) -c $(CFLAGS) $< -o $@

$(BUILD_DIR)/%.o: %.s Makefile
$(AS) -g3 -mcpu=$(CPU) $< -o $@
$(AS) -g -mcpu=$(CPU) $< -o $@

$(BUILD_DIR)/hello.elf: $(addprefix $(BUILD_DIR)/, $(HELLO_OBJS))
$(LD) $(LDFLAGS) $^ $(LIBS) -o $@
Expand Down
4 changes: 2 additions & 2 deletions libmicrokit/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ $(error GCC_CPU must be specified)
endif

TOOLCHAIN := aarch64-none-elf-
CFLAGS := -std=gnu11 -g3 -O3 -nostdlib -ffreestanding -mcpu=$(GCC_CPU) -Wall -Wno-maybe-uninitialized -Wno-unused-function -Werror -Iinclude -I$(SEL4_SDK)/include
CFLAGS := -std=gnu11 -g -O3 -nostdlib -ffreestanding -mcpu=$(GCC_CPU) -Wall -Wno-maybe-uninitialized -Wno-unused-function -Werror -Iinclude -I$(SEL4_SDK)/include

LIBS := libmicrokit.a
OBJS := main.o crt0.o dbg.o

$(BUILD_DIR)/%.o : src/%.S
$(TOOLCHAIN)gcc -x assembler-with-cpp -c -g3 -mcpu=$(GCC_CPU) $< -o $@
$(TOOLCHAIN)gcc -x assembler-with-cpp -c -g -mcpu=$(GCC_CPU) $< -o $@

$(BUILD_DIR)/%.o : src/%.s
$(TOOLCHAIN)as -g -mcpu=$(GCC_CPU) $< -o $@
Expand Down
4 changes: 2 additions & 2 deletions loader/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ endif


TOOLCHAIN := aarch64-none-elf-
CFLAGS := -std=gnu11 -g3 -O3 -nostdlib -ffreestanding -mcpu=$(GCC_CPU) -DBOARD_$(BOARD) -Wall -Werror
CFLAGS := -std=gnu11 -g -O3 -nostdlib -ffreestanding -mcpu=$(GCC_CPU) -DBOARD_$(BOARD) -Wall -Werror

PROGS := loader.elf
OBJECTS := loader.o crt0.o util64.o
LINKSCRIPT_INPUT := loader.ld
LINKSCRIPT := $(BUILD_DIR)/link.ld

$(BUILD_DIR)/%.o : src/%.S
$(TOOLCHAIN)gcc -x assembler-with-cpp -c -g3 -mcpu=$(GCC_CPU) $< -o $@
$(TOOLCHAIN)gcc -x assembler-with-cpp -c -g -mcpu=$(GCC_CPU) $< -o $@

$(BUILD_DIR)/%.o : src/%.s
$(TOOLCHAIN)as -g -mcpu=$(GCC_CPU) $< -o $@
Expand Down
4 changes: 2 additions & 2 deletions monitor/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ $(error GCC_CPU must be specified)
endif

TOOLCHAIN := aarch64-none-elf-
CFLAGS := -std=gnu11 -g3 -O3 -nostdlib -ffreestanding -mcpu=$(GCC_CPU) -Wall -Wno-maybe-uninitialized -Werror -I$(SEL4_SDK)/include
CFLAGS := -std=gnu11 -g -O3 -nostdlib -ffreestanding -mcpu=$(GCC_CPU) -Wall -Wno-maybe-uninitialized -Werror -I$(SEL4_SDK)/include

PROGS := monitor.elf
OBJECTS := main.o crt0.o debug.o util.o
LINKSCRIPT := monitor.ld

$(BUILD_DIR)/%.o : src/%.S
$(TOOLCHAIN)gcc -x assembler-with-cpp -c -g3 -mcpu=$(GCC_CPU) $< -o $@
$(TOOLCHAIN)gcc -x assembler-with-cpp -c -g -mcpu=$(GCC_CPU) $< -o $@

$(BUILD_DIR)/%.o : src/%.s
$(TOOLCHAIN)as -g -mcpu=$(GCC_CPU) $< -o $@
Expand Down
4 changes: 2 additions & 2 deletions tests/capfault/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ AS := $(TOOLCHAIN)-as
CAPFAULT_OBJS := capfault.o

IMAGES := capfault.elf
CFLAGS := -mcpu=$(CPU) -mstrict-align -nostdlib -ffreestanding -g3 -O3 -Wall -Wno-unused-function -Werror -I$(SEL4_SDK)/include -I$(LIBMICROKIT)/include
CFLAGS := -mcpu=$(CPU) -mstrict-align -nostdlib -ffreestanding -g -O3 -Wall -Wno-unused-function -Werror -I$(SEL4_SDK)/include -I$(LIBMICROKIT)/include
LDFLAGS := -L$(LIBMICROKIT) -Tmicrokit.ld
LIBS := -lmicrokit

Expand All @@ -27,7 +27,7 @@ all: $(IMAGES)
$(CC) -c $(CFLAGS) $< -o $@

%.o: %.s Makefile
$(AS) -g3 -mcpu=$(CPU) $< -o $@
$(AS) -g -mcpu=$(CPU) $< -o $@

capfault.elf: $(CAPFAULT_OBJS)
$(LD) $(LDFLAGS) $(CAPFAULT_OBJS) $(LIBS) -o $@
4 changes: 2 additions & 2 deletions tests/overlapping_pages/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ AS := $(TOOLCHAIN)-as
OVERLAPPING_PAGES_OBJS := overlapping_pages.o

IMAGES := overlapping_pages.elf
CFLAGS := -mcpu=$(CPU) -mstrict-align -nostdlib -ffreestanding -g3 -O3 -Wall -Wno-unused-function -Werror -I$(SEL4_SDK)/include -I$(LIBMICROKIT)/include
CFLAGS := -mcpu=$(CPU) -mstrict-align -nostdlib -ffreestanding -g -O3 -Wall -Wno-unused-function -Werror -I$(SEL4_SDK)/include -I$(LIBMICROKIT)/include
LDFLAGS := -L$(LIBMICROKIT) -Tmicrokit.ld
LIBS := -lmicrokit

Expand All @@ -27,7 +27,7 @@ all: $(IMAGES)
$(CC) -c $(CFLAGS) $< -o $@

%.o: %.s Makefile
$(AS) -g3 -mcpu=$(CPU) $< -o $@
$(AS) -g -mcpu=$(CPU) $< -o $@

overlapping_pages.elf: $(OVERLAPPING_PAGES_OBJS)
$(LD) $(LDFLAGS) $(OVERLAPPING_PAGES_OBJS) $(LIBS) -o $@
4 changes: 2 additions & 2 deletions tests/simplemrs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ AS := $(TOOLCHAIN)-as
SIMPLEMRS_OBJS := simplemrs.o

IMAGES := simplemrs.elf
CFLAGS := -mcpu=$(CPU) -mstrict-align -nostdlib -ffreestanding -g3 -O3 -Wall -Wno-unused-function -Werror -I$(SEL4_SDK)/include -I$(LIBMICROKIT)/include
CFLAGS := -mcpu=$(CPU) -mstrict-align -nostdlib -ffreestanding -g -O3 -Wall -Wno-unused-function -Werror -I$(SEL4_SDK)/include -I$(LIBMICROKIT)/include
LDFLAGS := -L$(LIBMICROKIT) -Tmicrokit.ld
LIBS := -lmicrokit

Expand All @@ -27,7 +27,7 @@ all: $(IMAGES)
$(CC) -c $(CFLAGS) $< -o $@

%.o: %.s Makefile
$(AS) -g3 -mcpu=$(CPU) $< -o $@
$(AS) -g -mcpu=$(CPU) $< -o $@

simplemrs.elf: $(SIMPLEMRS_OBJS)
$(LD) $(LDFLAGS) $(SIMPLEMRS_OBJS) $(LIBS) -o $@

0 comments on commit 7522184

Please sign in to comment.