-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# | ||
# Copyright 2024, UNSW | ||
# | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
|
||
CLK_DRIVER_DIR := $(dir $(lastword $(MAKEFILE_LIST))) | ||
CLK_DRIVER_OBJS := clk.o clk-operations.o clk-measure.o clk-meson.o sm1-clk.o | ||
|
||
clk_driver.elf: $(CLK_DRIVER_OBJS) libsddf_util_debug.a | ||
$(LD) $(LDFLAGS) $^ $(LIBS) -o $@ | ||
|
||
CLK_CONFIG_HEADER := $(BUILD_DIR)/clk_config.h | ||
CLK_DRIVER_CONF_INC := $(SDDF)/include/sddf/clk | ||
CLK_DRIVER_INC := $(CLK_DRIVER_DIR)/include | ||
CLK_DRIVER_COMMON_DIR := $(SDDF)/drivers/clk | ||
|
||
$(CLK_DRIVER_OBJS): ${CLK_DRIVER_COMMON_DIR}/*.c ${CLK_DRIVER_DIR}/*.c $(CLK_CONFIG_HEADER) | ||
$(CC) -c $(CFLAGS) \ | ||
-I${CLK_DRIVER_INC} \ | ||
-I${CLK_DRIVER_CONF_INC} \ | ||
-I${BUILD_DIR} \ | ||
-I${UART_DRIVER_DIR}/include \ | ||
-I${CLK_DRIVER_COMMON_DIR} $^ | ||
|
||
$(CLK_CONFIG_HEADER): | ||
$(PYTHON) $(CLK_DRIVER_DIR)/create_clk_config.py $(DTS_FILE) $(BUILD_DIR) | ||
|
||
clean:: | ||
rm -f clk_driver.o | ||
|
||
clobber:: | ||
rm -rf clk_driver.elf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# | ||
# Copyright 2024, UNSW | ||
# | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
# | ||
|
||
ifeq ($(strip $(MICROKIT_SDK)),) | ||
$(error MICROKIT_SDK must be specified) | ||
endif | ||
override MICROKIT_SDK := $(abspath ${MICROKIT_SDK}) | ||
|
||
ifeq ($(strip $(MICROKIT_BOARD)),) | ||
$(error MICROKIT_BOARD must be specified) | ||
endif | ||
export MICROKIT_BOARD | ||
|
||
BUILD_DIR ?= build | ||
# By default we make a debug build so that the client debug prints can be seen. | ||
MICROKIT_CONFIG ?= debug | ||
|
||
export TOP:= $(abspath $(dir ${MAKEFILE_LIST})) | ||
|
||
CC := clang | ||
LD := ld.lld | ||
export MICROKIT_TOOL ?= $(abspath $(MICROKIT_SDK)/bin/microkit) | ||
|
||
export BOARD_DIR := $(abspath $(MICROKIT_SDK)/board/$(MICROKIT_BOARD)/$(MICROKIT_CONFIG)) | ||
export SDDF := $(abspath ../..) | ||
IMAGE_FILE := $(BUILD_DIR)/loader.img | ||
REPORT_FILE := $(BUILD_DIR)/report.txt | ||
|
||
all: clean ${IMAGE_FILE} | ||
|
||
${IMAGE_FILE}: ${BUILD_DIR}/Makefile | ||
${MAKE} -C ${BUILD_DIR} MICROKIT_SDK=${MICROKIT_SDK} $(notdir $@) | ||
|
||
${BUILD_DIR}/Makefile: clk.mk | ||
mkdir -p ${BUILD_DIR} | ||
cp clk.mk ${BUILD_DIR}/Makefile | ||
|
||
clean: | ||
rm -rfd $(BUILD_DIR) | ||
|
||
FORCE: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# | ||
# Copyright 2024, UNSW | ||
# | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
# | ||
|
||
ifeq ($(strip $(MICROKIT_SDK)),) | ||
$(error MICROKIT_SDK must be specified) | ||
endif | ||
|
||
|
||
ifeq ($(strip $(MICROKIT_BOARD)), odroidc4) | ||
CPU := cortex-a55 | ||
DTS_FILE := $(TOP)/dts/odroidc4.dts | ||
SYSTEM_FILE := ${TOP}/board/odroidc4/clk.system | ||
ARCH := aarch64 | ||
DRIVER_DIR := meson | ||
CPU := cortex-a55 | ||
else | ||
$(error Unsupported MICROKIT_BOARD given) | ||
endif | ||
|
||
BUILD_DIR ?= $(TOP)/build | ||
# By default we make a debug build so that the client debug prints can be seen. | ||
MICROKIT_CONFIG ?= debug | ||
|
||
CC := aarch64-none-elf-gcc | ||
LD := aarch64-none-elf-ld | ||
AR := aarch64-none-elf-ar | ||
AS := aarch64-none-elf-as | ||
RANLIB := aarch64-none-elf-ranlib | ||
PYTHON := python3 | ||
|
||
MICROKIT_TOOL ?= $(MICROKIT_SDK)/bin/microkit | ||
|
||
BOARD_DIR := $(MICROKIT_SDK)/board/$(MICROKIT_BOARD)/$(MICROKIT_CONFIG) | ||
UTIL := $(SDDF)/util | ||
|
||
IMAGES := timer_driver.elf clk_driver.elf client.elf | ||
CFLAGS := -mcpu=$(CPU) \ | ||
-mstrict-align \ | ||
-nostdlib \ | ||
-ffreestanding \ | ||
-g3 \ | ||
-Wall -Wno-unused-function -Werror -Wno-unused-command-line-argument \ | ||
-I$(BOARD_DIR)/include \ | ||
-I$(SDDF)/include \ | ||
-I$(LIBMICROKITCO_PATH) \ | ||
-I$(TOP) | ||
|
||
LDFLAGS := -L$(BOARD_DIR)/lib -L. | ||
LIBS := --start-group -lmicrokit -Tmicrokit.ld libsddf_util_debug.a --end-group | ||
|
||
IMAGE_FILE := loader.img | ||
REPORT_FILE := report.txt | ||
CLIENT_OBJS := client.o | ||
CLK_DRIVER := $(SDDF)/drivers/clk/$(DRIVER_DIR) | ||
TIMER_DRIVER := $(SDDF)/drivers/timer/$(DRIVER_DIR) | ||
|
||
all: $(IMAGE_FILE) | ||
|
||
${IMAGES}: libsddf_util_debug.a | ||
|
||
include ${SDDF}/util/util.mk | ||
include ${TIMER_DRIVER}/timer_driver.mk | ||
include ${CLK_DRIVER}/clk_driver.mk | ||
|
||
client.o: ${TOP}/client.c | ||
$(CC) -c $(CFLAGS) $(CHIP_HEADER_INC) -DTEST_BOARD_${MICROKIT_BOARD} $< -o client.o | ||
|
||
client.elf: client.o | ||
$(LD) $(LDFLAGS) $^ $(LIBS) -o $@ | ||
|
||
$(IMAGE_FILE) $(REPORT_FILE): $(IMAGES) $(SYSTEM_FILE) | ||
$(MICROKIT_TOOL) $(SYSTEM_FILE) --search-path $(TOP)/build --board $(MICROKIT_BOARD) --config $(MICROKIT_CONFIG) -o $(IMAGE_FILE) -r $(REPORT_FILE) | ||
|
||
clean:: | ||
rm -f client.o | ||
clobber:: clean | ||
rm -f client.elf ${IMAGE_FILE} ${REPORT_FILE} |