From e6687c543c2782206de84b36d9321c1661df7291 Mon Sep 17 00:00:00 2001 From: Austin Morlan Date: Sat, 9 May 2020 19:07:57 -0700 Subject: [PATCH] Part 1: Build System --- .gitignore | 2 ++ CMakeLists.txt | 9 +++++++++ LICENSE | 21 +++++++++++++++++++++ README.md | 9 +++++++++ export.sh | 24 ++++++++++++++++++++++++ sdkconfig.defaults | 13 +++++++++++++ src/CMakeLists.txt | 5 +++++ src/main.c | 16 ++++++++++++++++ 8 files changed, 99 insertions(+) create mode 100644 .gitignore create mode 100644 CMakeLists.txt create mode 100644 LICENSE create mode 100644 README.md create mode 100644 export.sh create mode 100644 sdkconfig.defaults create mode 100644 src/CMakeLists.txt create mode 100644 src/main.c diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8846863 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +sdkconfig + diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..9eb2f37 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.5) + +set(EXTRA_COMPONENT_DIRS "src") +set(COMPONENTS "esptool_py src") + +include($ENV{IDF_PATH}/tools/cmake/project.cmake) + +project(game) + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..23809ed --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Austin Morlan + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice (including the next +paragraph) shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS +OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..aeee955 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# Embedded Game Programming + +* Get the [ESP-IDF v4.0](https://github.com/espressif/esp-idf/releases/tag/v4.0) + * Follow Steps 1 through 3 of the [Documentation](https://docs.espressif.com/projects/esp-idf/en/v4.0/get-started/index.html#step-1-install-prerequisites) +* Modify the `export.sh` script in this directory and fill out `IDF_PATH` and `IDF_TOOLS_PATH` + * `IDF_PATH` is the extracted ESP-IDF + * `IDF_TOOLS_PATH` is the path to the toolchain +* `source export.sh` + diff --git a/export.sh b/export.sh new file mode 100644 index 0000000..421e576 --- /dev/null +++ b/export.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +IDF_PATH= +IDF_TOOLS_PATH= + + +if [ -z "$IDF_PATH" ] +then + echo "IDF_PATH not set" + return +fi + +if [ -z "$IDF_TOOLS_PATH" ] +then + echo "IDF_TOOLS_PATH not set" + return +fi + + +export IDF_PATH +export IDF_TOOLS_PATH + +source $IDF_PATH/export.sh + diff --git a/sdkconfig.defaults b/sdkconfig.defaults new file mode 100644 index 0000000..7fd2bb4 --- /dev/null +++ b/sdkconfig.defaults @@ -0,0 +1,13 @@ +# Set flash size to 16MB +CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y + +# Set CPU frequency to 80MHz +CONFIG_ESP32_DEFAULT_CPU_FREQ_80=y + +# Enable SPI RAM and allocate with heap_caps_malloc() +CONFIG_ESP32_SPIRAM_SUPPORT=y +CONFIG_SPIRAM_USE_CAPS_ALLOC=y + +# Enable optimizations +CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE=y + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..6c19f3f --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,5 @@ +idf_component_register( + SRCS "main.c" + INCLUDE_DIRS "" + PRIV_REQUIRES "") + diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..d90c908 --- /dev/null +++ b/src/main.c @@ -0,0 +1,16 @@ +#include +#include +#include + + +void app_main(void) +{ + for (;;) + { + printf("Hello World!\n"); + vTaskDelay(1000 / portTICK_PERIOD_MS); + } + + // Should never get here + esp_restart(); +}