Add hello world firmware and basic folder structure

This commit is contained in:
Renze Nicolai 2021-12-29 18:34:55 +01:00
parent b52bde9f0f
commit 48f1e80762
16 changed files with 1649 additions and 0 deletions

4
.gitmodules vendored Normal file
View file

@ -0,0 +1,4 @@
[submodule "esp-idf"]
path = esp-idf
url = https://github.com/espressif/esp-idf.git
branch = master

10
build.sh Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/bash
set -e
cd esp-idf
source ./export.sh
cd ../
cd factory_test
idf.py build

11
clean.sh Executable file
View file

@ -0,0 +1,11 @@
#!/usr/bin/bash
set -e
cd esp-idf
source ./export.sh
cd ../
cd factory_test
idf.py clean

19
command.sh Executable file
View file

@ -0,0 +1,19 @@
#!/usr/bin/bash
set -e
cd esp-idf
source ./export.sh
cd ../
cd factory_test
if [ "$#" -eq 2 ]; then
idf.py $2 -p $1
else
if [ "$#" -ne 1 ]; then
echo "Illegal number of parameters"
else
idf.py $1
fi
fi

1
esp-idf Submodule

@ -0,0 +1 @@
Subproject commit 5624dffc52271389376352974ba5911963ee207b

2
factory_test/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
sdkconfig.old
build

View file

@ -0,0 +1,4 @@
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(main)

2
factory_test/README.md Normal file
View file

@ -0,0 +1,2 @@
# Factory test firmware

View file

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

38
factory_test/main/main.c Normal file
View file

@ -0,0 +1,38 @@
#include <stdio.h>
#include "sdkconfig.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "esp_spi_flash.h"
void restart() {
for (int i = 3; i >= 0; i--) {
printf("Restarting in %d seconds...\n", i);
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
printf("Restarting now.\n");
fflush(stdout);
esp_restart();
}
void app_main(void) {
printf("Hello world!\n");
/* Print chip information */
esp_chip_info_t chip_info;
esp_chip_info(&chip_info);
printf("This is %s chip with %d CPU core(s), WiFi%s%s, ",
CONFIG_IDF_TARGET,
chip_info.cores,
(chip_info.features & CHIP_FEATURE_BT) ? "/BT" : "",
(chip_info.features & CHIP_FEATURE_BLE) ? "/BLE" : "");
printf("silicon revision %d, ", chip_info.revision);
printf("%dMB %s flash\n", spi_flash_get_chip_size() / (1024 * 1024),
(chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external");
printf("Minimum free heap size: %d bytes\n", esp_get_minimum_free_heap_size());
restart();
}

View file

@ -0,0 +1,5 @@
# ESP-IDF Partition Table
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x6000,
phy_init, data, phy, 0xf000, 0x1000,
factory, app, factory, 0x10000, 1M,
1 # ESP-IDF Partition Table
2 # Name, Type, SubType, Offset, Size, Flags
3 nvs, data, nvs, 0x9000, 0x6000,
4 phy_init, data, phy, 0xf000, 0x1000,
5 factory, app, factory, 0x10000, 1M,

1493
factory_test/sdkconfig Normal file

File diff suppressed because it is too large Load diff

19
flash.sh Executable file
View file

@ -0,0 +1,19 @@
#!/usr/bin/bash
set -e
cd esp-idf
source ./export.sh
cd ../
cd factory_test
if [ "$#" -eq 1 ]; then
idf.py flash -p $1
else
if [ "$#" -ne 0 ]; then
echo "Illegal number of parameters"
else
idf.py flash
fi
fi

10
install.sh Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -e
# Fetch the SDK and all other submodules
git submodule update --init --recursive || exit 1
# Install the toolchain and other SDK tools
cd esp-idf
bash install.sh

10
menuconfig.sh Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/bash
set -e
cd esp-idf
source ./export.sh
cd ../
cd factory_test
idf.py menuconfig

19
monitor.sh Executable file
View file

@ -0,0 +1,19 @@
#!/usr/bin/bash
set -e
cd esp-idf
source ./export.sh
cd ../
cd factory_test
if [ "$#" -eq 1 ]; then
idf.py monitor -p $1
else
if [ "$#" -ne 0 ]; then
echo "Illegal number of parameters"
else
idf.py monitor
fi
fi