mirror of
https://github.com/badgeteam/mch2022-template-app.git
synced 2024-11-21 16:21:00 +00:00
Add hello world firmware and basic folder structure
This commit is contained in:
parent
b52bde9f0f
commit
48f1e80762
16 changed files with 1649 additions and 0 deletions
4
.gitmodules
vendored
Normal file
4
.gitmodules
vendored
Normal 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
10
build.sh
Executable 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
11
clean.sh
Executable 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
19
command.sh
Executable 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
1
esp-idf
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 5624dffc52271389376352974ba5911963ee207b
|
2
factory_test/.gitignore
vendored
Normal file
2
factory_test/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
sdkconfig.old
|
||||
build
|
4
factory_test/CMakeLists.txt
Normal file
4
factory_test/CMakeLists.txt
Normal 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
2
factory_test/README.md
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Factory test firmware
|
||||
|
2
factory_test/main/CMakeLists.txt
Normal file
2
factory_test/main/CMakeLists.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
idf_component_register(SRCS "main.c"
|
||||
INCLUDE_DIRS ".")
|
38
factory_test/main/main.c
Normal file
38
factory_test/main/main.c
Normal 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();
|
||||
}
|
5
factory_test/partitions.csv
Normal file
5
factory_test/partitions.csv
Normal 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,
|
|
1493
factory_test/sdkconfig
Normal file
1493
factory_test/sdkconfig
Normal file
File diff suppressed because it is too large
Load diff
19
flash.sh
Executable file
19
flash.sh
Executable 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
10
install.sh
Executable 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
10
menuconfig.sh
Executable 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
19
monitor.sh
Executable 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
|
Loading…
Reference in a new issue