diff --git a/boards/arm/qomu/CMakeLists.txt b/boards/arm/qomu/CMakeLists.txt new file mode 100644 index 00000000000..a17def9a231 --- /dev/null +++ b/boards/arm/qomu/CMakeLists.txt @@ -0,0 +1,4 @@ +# Copyright (c) 2022 Antmicro +# SPDX-License-Identifier: Apache-2.0 + +zephyr_library_sources(board.c) diff --git a/boards/arm/qomu/Kconfig b/boards/arm/qomu/Kconfig new file mode 100644 index 00000000000..09746596acf --- /dev/null +++ b/boards/arm/qomu/Kconfig @@ -0,0 +1,10 @@ +# QuickLogic Qomu board + +# Copyright (c) 2022 Antmicro +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_INIT_PRIORITY + int + default KERNEL_INIT_PRIORITY_DEFAULT + help + Board initialization priority. diff --git a/boards/arm/qomu/Kconfig.board b/boards/arm/qomu/Kconfig.board new file mode 100644 index 00000000000..fd1caf385d2 --- /dev/null +++ b/boards/arm/qomu/Kconfig.board @@ -0,0 +1,8 @@ +# QuickLogic Qomu board + +# Copyright (c) 2022 Antmicro +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_QOMU + bool "QuickLogic Qomu target" + depends on SOC_EOS_S3 diff --git a/boards/arm/qomu/Kconfig.defconfig b/boards/arm/qomu/Kconfig.defconfig new file mode 100644 index 00000000000..31125f4f62f --- /dev/null +++ b/boards/arm/qomu/Kconfig.defconfig @@ -0,0 +1,11 @@ +# QuickLogic Qomu board + +# Copyright (c) 2022 Antmicro +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_QOMU + +config BOARD + default "qomu" + +endif # BOARD_QOMU diff --git a/boards/arm/qomu/board.c b/boards/arm/qomu/board.c new file mode 100644 index 00000000000..e62357f2044 --- /dev/null +++ b/boards/arm/qomu/board.c @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2022 Antmicro + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include "board.h" + +static int qomu_board_init(const struct device *arg) +{ + ARG_UNUSED(arg); + + /* IO MUX setup for UART */ + eos_s3_io_mux(UART_TX_PAD, UART_TX_PAD_CFG); + eos_s3_io_mux(UART_RX_PAD, UART_RX_PAD_CFG); + + IO_MUX->UART_rxd_SEL = UART_RX_SEL; + + /* IO MUX setup for USB */ + eos_s3_io_mux(USB_PU_CTRL_PAD, USB_PAD_CFG); + eos_s3_io_mux(USB_DN_PAD, USB_PAD_CFG); + eos_s3_io_mux(USB_DP_PAD, USB_PAD_CFG); + + return 0; +} + +SYS_INIT(qomu_board_init, PRE_KERNEL_1, CONFIG_BOARD_INIT_PRIORITY); diff --git a/boards/arm/qomu/board.h b/boards/arm/qomu/board.h new file mode 100644 index 00000000000..9bcd5820b10 --- /dev/null +++ b/boards/arm/qomu/board.h @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2022 Antmicro + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef __INC_BOARD_H +#define __INC_BOARD_H + +#include + +#define USB_PU_CTRL_PAD 23 +#define USB_DN_PAD 28 +#define USB_DP_PAD 31 +#define USB_PAD_CFG (PAD_E_4MA | PAD_P_Z | PAD_OEN_NORMAL | PAD_SMT_DISABLE \ + | PAD_REN_DISABLE | PAD_SR_SLOW | PAD_CTRL_SEL_FPGA) + +#define UART_TX_PAD 44 +#define UART_TX_PAD_CFG UART_TXD_PAD44 +#define UART_RX_PAD 45 +#define UART_RX_PAD_CFG UART_RXD_PAD45 + +#define UART_RX_SEL UART_RXD_SEL_PAD45 + +#endif /* __INC_BOARD_H */ diff --git a/boards/arm/qomu/doc/img/qomu-board.png b/boards/arm/qomu/doc/img/qomu-board.png new file mode 100644 index 00000000000..cc49487b547 Binary files /dev/null and b/boards/arm/qomu/doc/img/qomu-board.png differ diff --git a/boards/arm/qomu/doc/index.rst b/boards/arm/qomu/doc/index.rst new file mode 100644 index 00000000000..7eff3a26e8e --- /dev/null +++ b/boards/arm/qomu/doc/index.rst @@ -0,0 +1,77 @@ +.. _qomu: + +Qomu +#### + +Overview +******** + +The Qomu board is a platform with an on-board QuickLogic EOS S3 Sensor Processing Platform. + + +.. figure:: img/qomu-board.png + :align: center + :alt: Qomu + + Qomu (Credit: QuickLogic) + +Hardware +******** + +- QuickLogic EOS S3 MCU Platform +- 16 Mbit of on-board flash memory +- Touchpads (4) +- RGB LED +- Powered from USB + +Detailed information about the board can be found in a `Qomu repository`_ and `Qomu User Guide`_. + +Connections and IOs +=================== + +Detailed information about pinouts is available in the `schematics document`_. + +Programming +*********** + +The Qomu platform by default boots from flash. + +Below are steps to run Qomu sample application: + +#. Build the sample in an usual way: + + .. zephyr-app-commands:: + :zephyr-app: samples/boards/qomu + :board: qomu + :goals: build + +#. Remove Qomu board from USB port. +#. Insert Qomu board to USB port. +#. While the blue LED is blinking (for 5 seconds), touch the touch-pads with your finger. + On success, the green led will start flashing. +#. Use TinyFpgaProgrammer application to load the target application: + + .. code-block:: console + + python3 /path/to/TinyFPGA-Programmer-Application/tinyfpga-programmer-gui.py --mode m4 --m4app build/zephyr/zephyr.bin --reset + + Refer to `TinyFPGA Programmer Application repo`_ for detailed information on installation + and program usage. + + +References +********** + +.. target-notes:: + +.. _Qomu repository: + https://github.com/QuickLogic-Corp/qomu-dev-board + +.. _Qomu User Guide: + https://github.com/QuickLogic-Corp/qomu-dev-board/blob/master/doc/Qomu_UserGuide.pdf + +.. _schematics document: + https://github.com/QuickLogic-Corp/qomu-dev-board/blob/master/doc/qomu-board.pdf + +.. _TinyFPGA Programmer Application repo: + https://github.com/QuickLogic-Corp/TinyFPGA-Programmer-Application diff --git a/boards/arm/qomu/qomu.dts b/boards/arm/qomu/qomu.dts new file mode 100644 index 00000000000..c58825a5f4f --- /dev/null +++ b/boards/arm/qomu/qomu.dts @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2022 Antmicro + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include + +/ { + model = "QuickLogic Qomu board"; + compatible = "quicklogic,eos_s3"; + + chosen { + zephyr,sram = &sram0; + zephyr,console = &uart1; + zephyr,shell-uart = &uart1; + zephyr,uart-pipe = &uart1; + }; + + aliases { + led0 = &blue_led; + led1 = &green_led; + led2 = &red_led; + sw0 = &button0; + }; + + leds { + compatible = "gpio-leds"; + blue_led: led_0 { + gpios = <&gpio 3 GPIO_ACTIVE_HIGH>; + label = "LED 0"; + }; + + green_led: led_1 { + gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; + label = "LED 1"; + }; + + red_led: led_2 { + gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; + label = "LED 2"; + }; + }; + + buttons { + compatible = "gpio-keys"; + button0: button_0 { + gpios = <&gpio 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + label = "User Push Button 0"; + }; + }; + + fpga0: fpga { + status = "okay"; + }; +}; + +&cpu0 { + clock-frequency = <61440000>; +}; + +&gpio { + status = "okay"; +}; + +&uart0 { + status = "disabled"; +}; + +&uart1 { + status = "okay"; + current-speed = <115200>; +}; diff --git a/boards/arm/qomu/qomu.yaml b/boards/arm/qomu/qomu.yaml new file mode 100644 index 00000000000..9ed10212dde --- /dev/null +++ b/boards/arm/qomu/qomu.yaml @@ -0,0 +1,12 @@ +identifier: qomu +name: QuickLogic Qomu +type: mcu +arch: arm +toolchain: + - zephyr + - gnuarmemb + - xtools +testing: + ignore_tags: + - net + - bluetooth diff --git a/boards/arm/qomu/qomu_defconfig b/boards/arm/qomu/qomu_defconfig new file mode 100644 index 00000000000..4f169841289 --- /dev/null +++ b/boards/arm/qomu/qomu_defconfig @@ -0,0 +1,27 @@ +# Copyright (c) 2022 Antmicro +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_ARM_MPU=n +CONFIG_SOC_EOS_S3=y +CONFIG_BOARD_QOMU=y + +# system clock +CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=61440000 +CONFIG_CORTEX_M_SYSTICK=y + +# console +CONFIG_SERIAL=y +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +# EOS S3 Configuration Manager copies software from external flash to MCU +# memory using preconfigured DMA and execute it there. +# Thus we do not use flash directly. + +CONFIG_XIP=n +CONFIG_FLASH=n +CONFIG_FLASH_SIZE=0 +CONFIG_FLASH_BASE_ADDRESS=0x0 + +# GPIO +CONFIG_GPIO=y