A timing app designed to run on my Odroid-GO
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
2.6 KiB

#+TITLE: esp32-timer
A timing app designed to run on my Odroid-GO.
* Setting up ESP-IDF
[[https://docs.espressif.com/projects/esp-idf/en/latest/][See docs]].
#+BEGIN_SRC sh
# Dependencies
sudo apt-get install git wget libncurses-dev flex bison gperf python python-pip python-setuptools python-serial python-click python-cryptography python-future python-pyparsing python-pyelftools cmake ninja-build ccache libffi-dev libssl-dev gawk gperf grep gettext python python-dev automake bison flex texinfo help2man libtool libtool-bin make
# Submodules
cd Dependencies/esp-idf/
git submodule update --init
#+END_SRC
Next, build the toolchain:
#+BEGIN_SRC sh
cd Dependencies/esp-idf/
./install.sh
#+END_SRC
** Possibly necessary step
I'm not sure this is necessary. [[https://code.austinmorlan.com/austin/embedded-game-programming][The readme recommends doing it]].
Comment out line 981 of ~esp-idf/components/driver/sdspi_host.c~ to enable the shared SPI bus:
#+BEGIN_SRC C
// Initialize SPI bus
esp_err_t ret = spi_bus_initialize((spi_host_device_t)slot, &buscfg,
slot_config->dma_channel);
if (ret != ESP_OK) {
ESP_LOGD(TAG, "spi_bus_initialize failed with rc=0x%x", ret);
//return ret;
}
#+END_SRC
** Building compiler from source
The following is to set up the toolchain by building as much of it from source as the docs have specified. While I could download a binary, I like the idea of compiling from source in case their website goes down. I'm doing this on Ubuntu 18.04.
TODO: This doesn't work yet.
#+BEGIN_SRC sh
# Crosstool - this builds GCC for ESP32. This will take a while (27 minutes in my case)
cd ../crosstool-NG/
git submodule update --init
./bootstrap && ./configure --enable-local && make
./ct-ng xtensa-esp32-elf
./ct-ng build
chmod -R u+w builds/xtensa-esp32-elf
cd ../../
mkdir -p tools
IDF_TOOLS_PATH=$PWD/tools
cd Dependencies/esp-idf/
# TODO: This doesn't actually use the GCC I built, nor the tools path...
./install.sh
#+END_SRC
* Building the app
Build and flash the application to the Odroid, which should be connected via USB and powered on:
#+BEGIN_SRC sh
cd Dependencies/esp-idf/
. ./export.sh
cd ../../app
idf.py build && idf.py -p /dev/ttyUSB0 flash
#+END_SRC
Monitor, if it doesn't work:
#+BEGIN_SRC sh
idf.py -p /dev/ttyUSB0 monitor
#+END_SRC
* Source
Thanks to [[https://austinmorlan.com/][Austin Morlan]] for his Odroid Go code (MIT license), some of which I have modified.
I found it much easier to get working than [[https://github.com/OtherCrashOverride/odroid-go-firmware][Odroid-Go-Firmware]] (note: different version of that firmware [[https://github.com/OtherCrashOverride/go-play][here]]).