Browse Source

Part 1: Build System

Austin Morlan 5 months ago
commit
e6687c543c
Signed by: Austin Morlan <mail@austinmorlan.com> GPG Key ID: FD6B27654AF5E348
8 changed files with 99 additions and 0 deletions
  1. 2
    0
      .gitignore
  2. 9
    0
      CMakeLists.txt
  3. 21
    0
      LICENSE
  4. 9
    0
      README.md
  5. 24
    0
      export.sh
  6. 13
    0
      sdkconfig.defaults
  7. 5
    0
      src/CMakeLists.txt
  8. 16
    0
      src/main.c

+ 2
- 0
.gitignore View File

@@ -0,0 +1,2 @@
1
+sdkconfig
2
+

+ 9
- 0
CMakeLists.txt View File

@@ -0,0 +1,9 @@
1
+cmake_minimum_required(VERSION 3.5)
2
+
3
+set(EXTRA_COMPONENT_DIRS "src")
4
+set(COMPONENTS "esptool_py src")
5
+
6
+include($ENV{IDF_PATH}/tools/cmake/project.cmake)
7
+
8
+project(game)
9
+

+ 21
- 0
LICENSE View File

@@ -0,0 +1,21 @@
1
+MIT License
2
+
3
+Copyright (c) 2020 Austin Morlan
4
+
5
+Permission is hereby granted, free of charge, to any person obtaining a copy
6
+of this software and associated documentation files (the "Software"), to deal
7
+in the Software without restriction, including without limitation the rights
8
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+copies of the Software, and to permit persons to whom the Software is furnished
10
+to do so, subject to the following conditions:
11
+
12
+The above copyright notice and this permission notice (including the next
13
+paragraph) shall be included in all copies or substantial portions of the
14
+Software.
15
+
16
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
19
+OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
21
+OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 9
- 0
README.md View File

@@ -0,0 +1,9 @@
1
+# Embedded Game Programming
2
+
3
+* Get the [ESP-IDF v4.0](https://github.com/espressif/esp-idf/releases/tag/v4.0)
4
+	* 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)
5
+* Modify the `export.sh` script in this directory and fill out `IDF_PATH` and `IDF_TOOLS_PATH`
6
+	* `IDF_PATH` is the extracted ESP-IDF
7
+	* `IDF_TOOLS_PATH` is the path to the toolchain
8
+* `source export.sh`
9
+

+ 24
- 0
export.sh View File

@@ -0,0 +1,24 @@
1
+#!/usr/bin/env bash
2
+
3
+IDF_PATH=
4
+IDF_TOOLS_PATH=
5
+
6
+
7
+if [ -z "$IDF_PATH" ]
8
+then
9
+	echo "IDF_PATH not set"
10
+	return
11
+fi
12
+
13
+if [ -z "$IDF_TOOLS_PATH" ]
14
+then
15
+	echo "IDF_TOOLS_PATH not set"
16
+	return
17
+fi
18
+
19
+
20
+export IDF_PATH
21
+export IDF_TOOLS_PATH
22
+
23
+source $IDF_PATH/export.sh
24
+

+ 13
- 0
sdkconfig.defaults View File

@@ -0,0 +1,13 @@
1
+# Set flash size to 16MB
2
+CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
3
+
4
+# Set CPU frequency to 80MHz
5
+CONFIG_ESP32_DEFAULT_CPU_FREQ_80=y
6
+
7
+# Enable SPI RAM and allocate with heap_caps_malloc()
8
+CONFIG_ESP32_SPIRAM_SUPPORT=y
9
+CONFIG_SPIRAM_USE_CAPS_ALLOC=y
10
+
11
+# Enable optimizations
12
+CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE=y
13
+

+ 5
- 0
src/CMakeLists.txt View File

@@ -0,0 +1,5 @@
1
+idf_component_register(
2
+	SRCS "main.c"
3
+	INCLUDE_DIRS ""
4
+	PRIV_REQUIRES "")
5
+

+ 16
- 0
src/main.c View File

@@ -0,0 +1,16 @@
1
+#include <freertos/FreeRTOS.h>
2
+#include <freertos/task.h>
3
+#include <stdio.h>
4
+
5
+
6
+void app_main(void)
7
+{
8
+	for (;;)
9
+	{
10
+		printf("Hello World!\n");
11
+		vTaskDelay(1000 / portTICK_PERIOD_MS);
12
+	}
13
+
14
+	// Should never get here
15
+	esp_restart();
16
+}

Loading…
Cancel
Save