Rainmaker Table lights

This commit is contained in:
2025-06-28 04:44:08 -04:00
parent 6395dca4d4
commit f22383f50f
394 changed files with 100141 additions and 225 deletions

View File

@@ -0,0 +1,94 @@
# A CMake script to create tar package for ESP Insights
# It is created for the esp_rainmaker component
cmake_minimum_required(VERSION 3.5)
# Set file paths
# Set app elf file path
set(elf_file_path ${BUILD_DIR}/${PROJECT_NAME}.elf)
# Set app binary file path
set(bin_file_path ${BUILD_DIR}/${PROJECT_NAME}.bin)
# Set app map file path
set(map_file_path ${BUILD_DIR}/${PROJECT_NAME}.map)
# Set project git config json file path
set(proj_config_file_path ${BUILD_DIR}/${PROJ_CONFIG_FILE})
# Set sdkconfig file path
set(sdkconfig_file_path ${PROJECT_DIR}/sdkconfig)
# Set partition table binary file path
set(partition_bin_file_path ${BUILD_DIR}/partition_table/partition-table.bin)
# Set partition table csv file path
set(partition_csv_file_path ${PROJECT_DIR}/${PARTITION_CSV_FILE})
# Set bootloader binary file path
set(bootloader_bin_file_path ${BUILD_DIR}/bootloader/bootloader.bin)
# Set ota data initial binary file path
set(ota_data_bin_file_path ${BUILD_DIR}/ota_data_initial.bin)
# Set flash args file path
set(flash_args_file_path ${BUILD_DIR}/flash_args)
# Set project build config file path
set(proj_desc_file_path ${BUILD_DIR}/project_description.json)
# Set custom project build config file path
set(custom_proj_desc_file_path ${BUILD_DIR}/project_description_custom.json)
# Create archive directory
file(MAKE_DIRECTORY ${BUILD_DIR}/${ARCHIVE_DIR})
# Copy project git config file generated to archive directory
file(COPY ${proj_config_file_path} DESTINATION ${BUILD_DIR}/${ARCHIVE_DIR})
# Copy elf file to archive directory
if(EXISTS ${elf_file_path})
file(COPY ${elf_file_path} DESTINATION ${BUILD_DIR}/${ARCHIVE_DIR})
endif()
# Copy bin file to archive directory
if(EXISTS ${bin_file_path})
file(COPY ${bin_file_path} DESTINATION ${BUILD_DIR}/${ARCHIVE_DIR})
endif()
# Copy map file to archive directory
if(EXISTS ${map_file_path})
file(COPY ${map_file_path} DESTINATION ${BUILD_DIR}/${ARCHIVE_DIR})
endif()
# Copy sdkconfig file to archive directory
if(EXISTS ${sdkconfig_file_path})
file(COPY ${sdkconfig_file_path} DESTINATION ${BUILD_DIR}/${ARCHIVE_DIR})
endif()
# Copy partition csv file to archive directory
if(EXISTS ${partition_csv_file_path})
file(COPY ${partition_csv_file_path} DESTINATION ${BUILD_DIR}/${ARCHIVE_DIR})
endif()
# Copy partition bin file to archive directory
if(EXISTS ${partition_bin_file_path})
# Create partition_table sub-dir in archive directory
file(MAKE_DIRECTORY ${BUILD_DIR}/${ARCHIVE_DIR}/partition_table)
file(COPY ${partition_bin_file_path} DESTINATION ${BUILD_DIR}/${ARCHIVE_DIR}/partition_table)
endif()
# Copy bootloader bin file to archive directory
if(EXISTS ${bootloader_bin_file_path})
# Create bootloader sub-dir in archive directory
file(MAKE_DIRECTORY ${BUILD_DIR}/${ARCHIVE_DIR}/bootloader)
file(COPY ${bootloader_bin_file_path} DESTINATION ${BUILD_DIR}/${ARCHIVE_DIR}/bootloader)
endif()
# Copy ota_data_initial bin file to archive directory
if(EXISTS ${ota_data_bin_file_path})
file(COPY ${ota_data_bin_file_path} DESTINATION ${BUILD_DIR}/${ARCHIVE_DIR})
endif()
# Copy flash args file to archive directory
if(EXISTS ${flash_args_file_path})
file(COPY ${flash_args_file_path} DESTINATION ${BUILD_DIR}/${ARCHIVE_DIR})
endif()
# Copy project description json file to archive directory
if (EXISTS ${proj_desc_file_path})
file(COPY ${proj_desc_file_path} DESTINATION ${BUILD_DIR}/${ARCHIVE_DIR}/)
endif()
# Copy custom project description json file to archive directory
if (EXISTS ${custom_proj_desc_file_path})
file(COPY ${custom_proj_desc_file_path} DESTINATION ${BUILD_DIR}/${ARCHIVE_DIR}/)
endif()

View File

@@ -0,0 +1,120 @@
# This file is expected to be present in ${COMPONENT_DIR}
# accessed from components/esp_insights/CMakeLists.txt
# Used in:
# 1. Project ESP Insights build package tar file
#from __future__ import unicode_literals
import os
import sys
import json
import subprocess
from builtins import range, str
from io import open
# Input project directory from CMakeLists.txt
PROJ_DIR=sys.argv[1]
# Input project name
PROJ_NAME=sys.argv[2]
# Input project version
PROJ_VER=sys.argv[3]
# Input custom config filename from CMakeLists.txt
FILENAME=sys.argv[4]
# Input IDF_PATH from CMakeLists.txt
IDF_PATH=sys.argv[5]
# Toolchain Prefix
TOOLCHAIN_PREFIX=sys.argv[6]
NEWLINE = "\n"
CONFIG = {}
# Set Config
# Set current directory i.e Set ${COMPONENT_DIR} as current directory
CURR_DIR = os.getcwd()
def _change_dir(dirname):
# Change directory
os.chdir(dirname)
def _set_submodule_cfg(submodules, repo_name):
# Set config for submodules
CFG_TITLE = "submodules"
NAME_STR = "name"
VERSION_STR = "version"
CONFIG[repo_name][CFG_TITLE] = []
if submodules:
# Get the submodule name and version
submodules_list = submodules.strip().split(NEWLINE)
for i in range(0, len(submodules_list), 2):
name = submodules_list[i].split('\'')[1]
version = submodules_list[i+1]
submodule_json = { NAME_STR: name, VERSION_STR: version }
CONFIG[repo_name][CFG_TITLE].append(submodule_json)
def run_cmd(command, get_basename=False):
try:
resp = subprocess.check_output(command, shell=True).strip().decode('utf-8')
if get_basename:
resp = os.path.basename(resp)
return resp
except subprocess.CalledProcessError:
raise Exception("ERROR: Please check command : {}".format(command))
def set_cfg(config_name):
# Set config for ESP-IDF Repo
if config_name == "esp-idf":
# Get repo name (for IDF repo)
REPO_CMD='git rev-parse --show-toplevel'
repo_name = run_cmd(REPO_CMD, get_basename=True)
CONFIG[repo_name] = {}
# Get commit HEAD
GITHEAD_STR = "HEAD"
HEAD='git describe --always --tags --dirty'
head_ver = run_cmd(HEAD)
CONFIG[repo_name][GITHEAD_STR] = head_ver
# Get submodule latest refs
SUBMODULE = 'git submodule foreach git describe --always --tags --dirty'
submodules = run_cmd(SUBMODULE)
_set_submodule_cfg(submodules, repo_name)
elif config_name == "toolchain":
# Get toolchain version
TOOLCHAIN_STR = "toolchain"
TOOLCHAIN = TOOLCHAIN_PREFIX + 'gcc --version'
toolchain = run_cmd(TOOLCHAIN)
CONFIG[TOOLCHAIN_STR] = toolchain.strip().split(NEWLINE)[0]
# Set project details - name and version
def set_project_details():
# Set project name and version
CONFIG['project'] = {}
CONFIG['project']['name'] = PROJ_NAME
CONFIG['project']['version'] = PROJ_VER
try:
with open(FILENAME, "w+", encoding="utf-8") as output_file:
# ESP-IDF REPO CONFIG
# Change to ESP-IDF Directory
_change_dir(IDF_PATH)
set_cfg("esp-idf")
# Change back to ${COMPONENT_DIR}
_change_dir(CURR_DIR)
# Set project name and version
set_project_details()
# GET TOOLCHAIN VERSION
set_cfg("toolchain")
output_file.write(str(json.dumps(CONFIG, indent=4, sort_keys=True)))
except Exception as e:
# Remove config file created if error occurs
os.system("rm " + FILENAME)
sys.exit(e)