diff --git a/CODEOWNERS b/CODEOWNERS index e6138be8388..66a5a140e00 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -70,6 +70,7 @@ /arch/nios2/ @nashif /arch/posix/ @aescolar @daor-oti /arch/riscv/ @kgugala @pgielda +/soc/mips/ @frantony /soc/posix/ @aescolar @daor-oti /soc/riscv/ @kgugala @pgielda /soc/riscv/openisa*/ @dleach02 diff --git a/cmake/emu/qemu.cmake b/cmake/emu/qemu.cmake index 0ae2656dad8..317a6e566ad 100644 --- a/cmake/emu/qemu.cmake +++ b/cmake/emu/qemu.cmake @@ -2,6 +2,12 @@ if("${ARCH}" STREQUAL "x86") set_ifndef(QEMU_binary_suffix i386) +elseif("${ARCH}" STREQUAL "mips") + if(CONFIG_BIG_ENDIAN) + set_ifndef(QEMU_binary_suffix mips) + else() + set_ifndef(QEMU_binary_suffix mipsel) + endif() elseif(DEFINED QEMU_ARCH) set_ifndef(QEMU_binary_suffix ${QEMU_ARCH}) else() diff --git a/soc/mips/CMakeLists.txt b/soc/mips/CMakeLists.txt new file mode 100644 index 00000000000..f4733688cca --- /dev/null +++ b/soc/mips/CMakeLists.txt @@ -0,0 +1,5 @@ +if(SOC_FAMILY) + add_subdirectory(${SOC_FAMILY}) +else() + add_subdirectory(${SOC_NAME}) +endif() diff --git a/soc/mips/qemu_malta/CMakeLists.txt b/soc/mips/qemu_malta/CMakeLists.txt new file mode 100644 index 00000000000..49a74924cdc --- /dev/null +++ b/soc/mips/qemu_malta/CMakeLists.txt @@ -0,0 +1,17 @@ +# Copyright (c) 2020, 2021 Antony Pavlov +# +# SPDX-License-Identifier: Apache-2.0 + +zephyr_compile_options( + -mips32 + ${TOOLCHAIN_C_FLAGS} +) + +zephyr_sources( + vector.S +) + +zephyr_ld_options( + -mips32 + ${TOOLCHAIN_LD_FLAGS} +) diff --git a/soc/mips/qemu_malta/Kconfig.defconfig b/soc/mips/qemu_malta/Kconfig.defconfig new file mode 100644 index 00000000000..c2811c31ac6 --- /dev/null +++ b/soc/mips/qemu_malta/Kconfig.defconfig @@ -0,0 +1,16 @@ +# Copyright (c) 2020 Antony Pavlov +# +# SPDX-License-Identifier: Apache-2.0 + +if SOC_QEMU_MALTA + +config SOC + default "qemu_malta" + +config SYS_CLOCK_HW_CYCLES_PER_SEC + default 200000000 + +config NUM_IRQS + default 8 + +endif # SOC_QEMU_MALTA diff --git a/soc/mips/qemu_malta/Kconfig.soc b/soc/mips/qemu_malta/Kconfig.soc new file mode 100644 index 00000000000..d18a881bd0a --- /dev/null +++ b/soc/mips/qemu_malta/Kconfig.soc @@ -0,0 +1,7 @@ +# Copyright (c) 2020 Antony Pavlov +# +# SPDX-License-Identifier: Apache-2.0 + +config SOC_QEMU_MALTA + bool "MIPS Qemu Malta implementation" + select MIPS diff --git a/soc/mips/qemu_malta/linker.ld b/soc/mips/qemu_malta/linker.ld new file mode 100644 index 00000000000..1b73ae9c575 --- /dev/null +++ b/soc/mips/qemu_malta/linker.ld @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2020 Antony Pavlov + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include diff --git a/soc/mips/qemu_malta/soc.h b/soc/mips/qemu_malta/soc.h new file mode 100644 index 00000000000..eacd98f162c --- /dev/null +++ b/soc/mips/qemu_malta/soc.h @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2020, 2021 Antony Pavlov + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef __QEMU_MALTA_SOC_H__ +#define __QEMU_MALTA_SOC_H__ + +#define MIPS_MACHINE_TIMER_IRQ 7 /* Machine Timer Interrupt */ + +#endif /* __QEMU_MALTA_SOC_H__ */ diff --git a/soc/mips/qemu_malta/vector.S b/soc/mips/qemu_malta/vector.S new file mode 100644 index 00000000000..a00a69b0404 --- /dev/null +++ b/soc/mips/qemu_malta/vector.S @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2021 Antony Pavlov + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +/* Imports */ +GTEXT(__initialize) + +/* Exports */ +GTEXT(__start) + +SECTION_FUNC(vectors, __start) + /* Call into Zephyr initialization. */ + la v0, __initialize + jal v0