diff --git a/build_sdk.py b/build_sdk.py index f64789b11..a579e6584 100644 --- a/build_sdk.py +++ b/build_sdk.py @@ -106,7 +106,20 @@ class ConfigInfo: examples={ "passive_server": Path("example/imx8mm_evk/passive_server") } - ) + ), + BoardInfo( + name="imx8mq_evk", + gcc_cpu="cortex-a53", + loader_link_address=0x41000000, + kernel_options = { + "KernelPlatform": "imx8mq-evk", + "KernelIsMCS": True, + "KernelArmExportPCNTUser": True, + }, + examples={ + "hello": Path("example/imx8mq_evk/hello") + } + ), ) SUPPORTED_CONFIGS = ( diff --git a/docs/manual.md b/docs/manual.md index c750fada4..85325039e 100644 --- a/docs/manual.md +++ b/docs/manual.md @@ -516,6 +516,12 @@ This chapter describes the board support packages that are available in the SDK. ## i.MX8MM-EVK +Microkit produces a raw binary file, so when using U-Boot you must execute the image using: + + => go 0x41000000 + +## i.MX8MQ-EVK + Microkit produces a raw binary file, so when using U-Boot you must execute the image using: => go 0x41000000 diff --git a/example/imx8mq_evk/hello/Makefile b/example/imx8mq_evk/hello/Makefile new file mode 100644 index 000000000..b78ab030f --- /dev/null +++ b/example/imx8mq_evk/hello/Makefile @@ -0,0 +1,55 @@ +# +# Copyright 2021, Breakaway Consulting Pty. Ltd. +# +# SPDX-License-Identifier: BSD-2-Clause +# +ifeq ($(strip $(BUILD_DIR)),) +$(error BUILD_DIR must be specified) +endif + +ifeq ($(strip $(MICROKIT_SDK)),) +$(error MICROKIT_SDK must be specified) +endif + +ifeq ($(strip $(MICROKIT_BOARD)),) +$(error MICROKIT_BOARD must be specified) +endif + +ifeq ($(strip $(MICROKIT_CONFIG)),) +$(error MICROKIT_CONFIG must be specified) +endif + +TOOLCHAIN := aarch64-none-elf + +CPU := cortex-a53 + +CC := $(TOOLCHAIN)-gcc +LD := $(TOOLCHAIN)-ld +AS := $(TOOLCHAIN)-as +MICROKIT_TOOL ?= $(MICROKIT_SDK)/bin/microkit + +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 +LDFLAGS := -L$(BOARD_DIR)/lib +LIBS := -lmicrokit -Tmicrokit.ld + +IMAGE_FILE = $(BUILD_DIR)/loader.img +REPORT_FILE = $(BUILD_DIR)/report.txt + +all: $(IMAGE_FILE) + +$(BUILD_DIR)/%.o: %.c Makefile + $(CC) -c $(CFLAGS) $< -o $@ + +$(BUILD_DIR)/%.o: %.s Makefile + $(AS) -g3 -mcpu=$(CPU) $< -o $@ + +$(BUILD_DIR)/hello.elf: $(addprefix $(BUILD_DIR)/, $(HELLO_OBJS)) + $(LD) $(LDFLAGS) $^ $(LIBS) -o $@ + +$(IMAGE_FILE) $(REPORT_FILE): $(addprefix $(BUILD_DIR)/, $(IMAGES)) hello.system + $(MICROKIT_TOOL) hello.system --search-path $(BUILD_DIR) --board $(MICROKIT_BOARD) --config $(MICROKIT_CONFIG) -o $(IMAGE_FILE) -r $(REPORT_FILE) diff --git a/example/imx8mq_evk/hello/hello.c b/example/imx8mq_evk/hello/hello.c new file mode 100644 index 000000000..493c95746 --- /dev/null +++ b/example/imx8mq_evk/hello/hello.c @@ -0,0 +1,16 @@ +/* + * Copyright 2021, Breakaway Consulting Pty. Ltd. + * + * SPDX-License-Identifier: BSD-2-Clause + */ +#include +#include + +void init(void) +{ + microkit_dbg_puts("hello, world\n"); +} + +void notified(microkit_channel ch) +{ +} diff --git a/example/imx8mq_evk/hello/hello.system b/example/imx8mq_evk/hello/hello.system new file mode 100644 index 000000000..146da4bab --- /dev/null +++ b/example/imx8mq_evk/hello/hello.system @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file diff --git a/loader/src/loader.c b/loader/src/loader.c index 394bdbfc5..255484621 100644 --- a/loader/src/loader.c +++ b/loader/src/loader.c @@ -139,7 +139,7 @@ static void putc(uint8_t ch) { *((volatile uint32_t *)(0x00FF000030)) = ch; } -#elif defined(BOARD_maaxboard) +#elif defined(BOARD_maaxboard) || defined(BOARD_imx8mq_evk) #define UART_BASE 0x30860000 #define STAT 0x98 #define TRANSMIT 0x40