Skip to content

Commit

Permalink
boards/xtensa: Add support for ODROID-GO Game Kit
Browse files Browse the repository at this point in the history
Add support for ODROID-GO Game Kit

Signed-off-by: Yannis Damigos <[email protected]>
  • Loading branch information
ydamigos authored and carlescufi committed Sep 25, 2019
1 parent efec7f7 commit 6768148
Show file tree
Hide file tree
Showing 10 changed files with 326 additions and 0 deletions.
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
/boards/x86/up_squared/ @gnuless
/boards/xtensa/ @nashif @dcpleung
/boards/xtensa/intel_s1000_crb/ @sathishkuttan @dcpleung
/boards/xtensa/odroid_go/ @ydamigos
# All cmake related files
/cmake/ @SebastianBoe @nashif
/CMakeLists.txt @SebastianBoe @nashif
Expand Down
34 changes: 34 additions & 0 deletions boards/xtensa/odroid_go/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# SPDX-License-Identifier: Apache-2.0


if(CONFIG_BOOTLOADER_ESP_IDF)
include(ExternalProject)

## we use hello_world project, but I think any can be used.
set(espidf_src_dir ${ESP_IDF_PATH}/examples/get-started/hello_world/)
set(espidf_prefix ${CMAKE_BINARY_DIR}/esp-idf)
set(espidf_build_dir ${espidf_prefix}/build)

ExternalProject_Add(
EspIdfBootloader
PREFIX ${espidf_prefix}
SOURCE_DIR ${espidf_src_dir}
BINARY_DIR ${espidf_src_dir}
CONFIGURE_COMMAND "" # Skip configuring the project, e.g. with autoconf
BUILD_COMMAND
PATH=$ENV{PATH}:${ESPRESSIF_TOOLCHAIN_PATH}/bin
make
IDF_PATH=${ESP_IDF_PATH}
BUILD_DIR_BASE=${espidf_build_dir}
SDKCONFIG=${espidf_build_dir}/sdkconfig
defconfig bootloader partition_table
INSTALL_COMMAND "" # This particular build system has no install command
)

add_dependencies(app EspIdfBootloader)

board_finalize_runner_args(odroid_go "--esp-flash-bootloader=${espidf_build_dir}/bootloader/bootloader.bin")

board_finalize_runner_args(odroid_go "--esp-flash-partition_table=${espidf_build_dir}/partitions_singleapp.bin")

endif()
8 changes: 8 additions & 0 deletions boards/xtensa/odroid_go/Kconfig.board
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Kconfig - ODROID-GO Game Kit configuration
#
# Copyright (c) 2019 Yannis Damigos
# SPDX-License-Identifier: Apache-2.0

config BOARD_ODROID_GO
bool "ODROID-GO Game Kit"
depends on SOC_ESP32
11 changes: 11 additions & 0 deletions boards/xtensa/odroid_go/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Kconfig - ODROID-GO Game Kit configuration
#
# Copyright (c) 2019 Yannis Damigos
# SPDX-License-Identifier: Apache-2.0

if BOARD_ODROID_GO

config BOARD
default "odroid-go"

endif # BOARD_ODROID_GO
3 changes: 3 additions & 0 deletions boards/xtensa/odroid_go/board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-License-Identifier: Apache-2.0

include(${ZEPHYR_BASE}/boards/common/esp32.board.cmake)
Binary file added boards/xtensa/odroid_go/doc/img/odroid_go.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
155 changes: 155 additions & 0 deletions boards/xtensa/odroid_go/doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
.. _odroid_go:

ODROID-GO
#########

Overview
********

ODROID-GO Game Kit is a "Do it yourself" ("DIY") portable game console by
HardKernel. It fetaures a custom ESP32-WROVER with 16 MB flash and it operates
from 80 MHz - 240 MHz [1]_.

The features include the following:

- Dual core Xtensa microprocessor (LX6), running at 80 - 240MHz
- 4 MB of PSRAM
- 802.11b/g/n/e/i
- Bluetooth v4.2 BR/EDR and BLE
- 2.4 inch 320x240 TFT LCD
- Speaker
- Micro SD card slot
- Micro USB port (battery charging and USB_UART data communication
- Input Buttons (Menu, Volume, Select, Start, A, B, Direction Pad)
- Expansion port (I2C, GPIO, SPI)
- Cryptographic hardware acceleration (RNG, ECC, RSA, SHA-2, AES)

.. figure:: img/odroid_go.png
:align: center
:alt: ODROID-GO

ODROID-Go Game Kit

External Connector
------------------

+-------+------------------+-------------------------+
| PIN # | Signal Name | ESP32-WROVER Functions |
+=======+==================+=========================+
| 1 | GND | GND |
+-------+------------------+-------------------------+
| 2 | VSPI.SCK (IO18) | GPIO18, VSPICLK |
+-------+------------------+-------------------------+
| 3 | IO12 | GPIO12 |
+-------+------------------+-------------------------+
| 4 | IO15 | GPIO15, ADC2_CH3 |
+-------+------------------+-------------------------+
| 5 | IO4 | GPIO4, ADC2_CH0 |
+-------+------------------+-------------------------+
| 6 | P3V3 | 3.3 V |
+-------+------------------+-------------------------+
| 7 | VSPI.MISO (IO19) | GPIO19, VSPIQ |
+-------+------------------+-------------------------+
| 8 | VSPI.MOSI (IO23) | GPIO23, VSPID |
+-------+------------------+-------------------------+
| 9 | N.C | N/A |
+-------+------------------+-------------------------+
| 10 | VBUS | USB VBUS (5V) |
+-------+------------------+-------------------------+

Programming
***********

Two components are required in order to build applications for this board: the
`toolchain`_ and the `SDK`_. Both are provided by the SoC manufacturer.

The SDK contains headers and a hardware abstraction layer library (provided only
as object files) that are required for the port to function.

The toolchain is available for Linux, Windows, and macOS hosts and instructions
to obtain and set them up are available in the `ESP-IDF repository
<https://github.com/espressif/esp-idf>`_, as explained in the
`ESP-IDF Programming Guide <SDK>`_.

Set up build environment
------------------------

With both the toolchain and SDK installed, the Zephyr build system must be
instructed to use this particular variant by setting the following shell
variables:

.. code-block:: console
export ZEPHYR_TOOLCHAIN_VARIANT="espressif"
export ESPRESSIF_TOOLCHAIN_PATH="/path/to/xtensa-esp32-elf/"
Flashing
--------

The usual ``flash`` target will work with the ``odroid_go`` board configuration.
Here is an example for the :ref:`hello_world` application.

.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:host-os: unix
:board: odroid_go
:goals: build
:gen-args: -DESP_IDF_PATH=/path/to/esp-idf/

Refer to :ref:`build_an_application` and :ref:`application_run` for more
details.

All flashing options are handled by the :ref:`west` tool, including flashing
with custom options such as a different serial port. The ``west`` tool supports
specific options for the ESP32 board, as listed here:

--esp-idf-path ESP_IDF_PATH
path to ESP-IDF
--esp-device ESP_DEVICE
serial port to flash, default /dev/ttyUSB0
--esp-baud-rate ESP_BAUD_RATE
serial baud rate, default 921600
--esp-flash-size ESP_FLASH_SIZE
flash size, default "detect"
--esp-flash-freq ESP_FLASH_FREQ
flash frequency, default "40m"
--esp-flash-mode ESP_FLASH_MODE
flash mode, default "dio"
--esp-tool ESP_TOOL complete path to espidf, default is to search for it in
[ESP_IDF_PATH]/components/esptool_py/esptool/esptool.py
--esp-flash-bootloader ESP_FLASH_BOOTLOADER
Bootloader image to flash
--esp-flash-partition_table ESP_FLASH_PARTITION_TABLE
Partition table to flash

For example, to flash to ``/dev/ttyUSB0``, use the following command after
having build the application in the ``build`` directory:

.. code-block:: console
west flash -d build/ --skip-rebuild --esp-tool=/path/to/esp-idf/components/esptool_py/esptool/esptool.py --esp-device /dev/ttyUSB0
Connect ODROID-GO to your PC via the mini USB port and run your favorite
terminal program to listen for output.

.. code-block:: console
minicom -D /dev/ttyUSB0 -b 115200
Power off and then power on ODROID-GO. You should see the following message in
your terminal:

.. code-block:: console
Hello World! odroid_go
References
**********

.. [1] https://wiki.odroid.com/odroid_go/odroid_go
.. _`toolchain`: https://docs.espressif.com/projects/esp-idf/en/latest/get-started/index.html#get-started-setup-toolchain
.. _`SDK`: https://docs.espressif.com/projects/esp-idf/en/latest/get-started/index.html#get-started-get-esp-idf


.. target-notes::

72 changes: 72 additions & 0 deletions boards/xtensa/odroid_go/odroid_go.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* Copyright (c) 2019 Yannis Damigos
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;

#include "espressif/esp32.dtsi"

/ {
model = "ODROID-GO Game Kit";
compatible = "hardkernel,odroid-go", "espressif,esp32";

chosen {
zephyr,sram = &sram0;
zephyr,console = &uart0;
zephyr,shell-uart = &uart0;
};

leds {
compatible = "gpio-leds";
blue_led: led {
gpios = <&gpio0 2 GPIO_INT_ACTIVE_HIGH>;
label = "Status Led";
};
};

gpio_keys {
compatible = "gpio-keys";
menu_button: menu_button {
label = "Menu";
gpios = <&gpio0 13 GPIO_INT_ACTIVE_LOW>;
};
select_button: select_button {
label = "Select";
gpios = <&gpio0 27 GPIO_INT_ACTIVE_LOW>;
};
a_button: a_button {
label = "A";
gpios = <&gpio1 0 GPIO_INT_ACTIVE_LOW>;
};
b_button: b_button {
label = "B";
gpios = <&gpio1 1 GPIO_INT_ACTIVE_LOW>;
};
start_button: start_button {
label = "Start";
gpios = <&gpio1 7 GPIO_INT_ACTIVE_LOW>;
};
};

aliases {
uart-0 = &uart0;
led0 = &blue_led;
sw0 = &menu_button;
};
};

&cpu0 {
clock-frequency = <40000000>;
};

&cpu1 {
clock-frequency = <40000000>;
};

&uart0 {
status = "okay";
current-speed = <115200>;
tx-pin = <1>;
rx-pin = <3>;
};
11 changes: 11 additions & 0 deletions boards/xtensa/odroid_go/odroid_go.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
identifier: esp32
name: ODROID-GO
type: mcu
arch: xtensa
toolchain:
- espressif
supported:
- gpio
- watchdog
- uart
- pinmux
31 changes: 31 additions & 0 deletions boards/xtensa/odroid_go/odroid_go_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# SPDX-License-Identifier: Apache-2.0

CONFIG_XTENSA=y
CONFIG_XTENSA_RESET_VECTOR=n

CONFIG_BOARD_ODROID_GO=y
CONFIG_SOC_ESP32=y

CONFIG_MAIN_STACK_SIZE=2048

CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=40000000

CONFIG_CONSOLE=y
CONFIG_SERIAL_HAS_DRIVER=y
CONFIG_SERIAL=y
CONFIG_UART_CONSOLE=y
CONFIG_UART_ESP32=y

CONFIG_XTENSA_USE_CORE_CRT1=n

CONFIG_PINMUX=y
CONFIG_PINMUX_ESP32=y

CONFIG_GPIO=y
CONFIG_GPIO_ESP32=y

CONFIG_ENTROPY_ESP32_RNG=y

CONFIG_SW_ISR_TABLE=y
CONFIG_GEN_ISR_TABLES=y
CONFIG_GEN_IRQ_VECTOR_TABLE=n

0 comments on commit 6768148

Please sign in to comment.