Root directory content refactoring (#1725)

* Root directory refactoring: - move info about Bootup Logo from a sepatate README to main README; - replace separate root scripts build.sh and start_dev.sh by root Makefile; - make Scripts directory and move there: flash_ts100_linux.sh script, ci/ directory, dockerfile, LICENSE_RELEASE, and PULL_REQUEST_TEMPLATE; - reconfigure build & deploy scripts according to changes

* Scripts => scripts

* Scripts -> scripts: re-add missing renamed files

* Directories refactoring: add top-level Makefile, add scripts/deploy.sh script, move github templates from top-level dir to .github, organize files inside Development Resources

* Update scripts/deploy.sh accroding to codestyle syntax shellcheck

* Makefile: add docs-deploy target for mkdocs gh-deploy

* Rename IronOS.yml > Env.yml, update related files

* Docs configs: remove empty characters

* docs/devel: update usage of new script
This commit is contained in:
Ivan Zorin
2023-07-02 04:32:40 +03:00
committed by GitHub
parent 990f42ad1a
commit b524a99ff2
27 changed files with 235 additions and 24 deletions

56
scripts/IronOS-mkdocs.yml Normal file
View File

@@ -0,0 +1,56 @@
# Project info
site_name: IronOS
site_url: https://ralim.github.io/IronOS/
site_description: "IronOS Open Source Soldering Iron firmware for Miniware and Pinecil"
# repo config
repo_url: https://github.com/ralim/IronOS/
docs_dir: ../Documentation
edit_uri: edit/dev/Documentation/
# Theme and config
theme:
name: readthedocs
highlightsjs: true
hljs_languages:
- yaml
nav:
- Home: index.md
- Getting Started: GettingStarted.md
- Flashing the firmware:
- MHP30: Flashing/MHP30.md
- Pinecil V1: Flashing/Pinecil V1.md
- Pinecil V2: Flashing/Pinecil V2.md
- TS80(P): Flashing/TS80(P).md
- TS100: Flashing/TS100.md
- Operation:
- Main Menu: Menu.md
- Settings: Settings.md
- Debug Menu: DebugMenu.md
- Power: Power.md
- Temperature: Temperature.md
- Startup Logo: Logo.md
- Hardware:
- Hall Sensor (Pinecil): HallSensor.md
- Hardware Notes: Hardware.md
- Troubleshooting: Troubleshooting.md
- Known Hardware Issues: HardwareIssues.md
- Translations: Translation.md
- Development: Development.md
# Plugins
plugins:
- search
- autolinks
- awesome-pages
- git-revision-date
# Markdown Extensions
markdown_extensions:
- attr_list
- pymdownx.emoji:
emoji_index: !!python/name:pymdownx.emoji.twemoji
emoji_generator: !!python/name:pymdownx.emoji.to_svg

29
scripts/IronOS.Dockerfile Normal file
View File

@@ -0,0 +1,29 @@
FROM alpine:3.16
LABEL maintainer="Ben V. Brown <ralim@ralimtek.com>"
WORKDIR /build
# Installing the two compilers, python3, python3 pip, clang format
# Compilders ->gcc-* newlib-*
# Python3 -> py*
# Misc -> findutils make git
# musl-dev is required for the multi lang firmwares
# clang is required for clang-format (for dev)
ARG APK_COMPS="gcc-riscv-none-elf gcc-arm-none-eabi newlib-riscv-none-elf \
newlib-arm-none-eabi"
ARG APK_PYTHON="python3 py3-pip black"
ARG APK_MISC="findutils make git"
ARG APK_DEV="musl-dev clang bash clang-extra-tools"
# PIP packages
ARG PIP_PKGS='bdflib'
RUN apk add --no-cache ${APK_COMPS} ${APK_PYTHON} ${APK_MISC} ${APK_DEV}
# Install Python3 packages
RUN python3 -m pip install ${PIP_PKGS}
# Git trust
RUN git config --global --add safe.directory /build/source
COPY . /build/source
COPY ./scripts/ci /build/ci

212
scripts/LICENSE_RELEASE.md Normal file
View File

@@ -0,0 +1,212 @@
This document outlines the license of IronOS and its dependencies.
- IronOS: GPL-3.0-only
- FreeRTOS Kernel: MIT
- FUSB302 driver: Apache-2.0
- CMSIS + STM32F1xx HAL driver: BSD-3-Clause
- NMSIS: Apache-2.0
- GD32VF103 board files: BSD-3-Clause
- WenQuanYi Bitmap Song font: GPL-2.0-or-later
- BriefLZ compression library: Zlib
The source code of IronOS can be obtained on the [IronOS GitHub repo][gh].
[gh]: https://github.com/Ralim/IronOS
IronOS
---
Copyright (c) 2016-2020 Ben V. Brown and contributors
For the license text, see `LICENSE` file.
FreeRTOS Kernel
---
```
Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in al
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITN
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS O
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHE
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
```
FUSB302 driver
---
```
PD Buddy Firmware Library - USB Power Delivery for everyone
Copyright 2017-2018 Clayton G. Hobbs
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
CMSIS + STM32F1xx HAL driver
---
* Only applies to TS100, TS80 and TS80P releases.
```
COPYRIGHT(c) 2017 STMicroelectronics
Redistribution and use in source and binary forms, with or without dification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of STMicroelectronics nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
```
NMSIS
---
* Only applies to Pinecil releases.
```
Copyright (c) 2019 Nuclei Limited. All rights reserved.
SPDX-License-Identifier: Apache-2.0
Licensed under the Apache License, Version 2.0 (the License); you may
not use this file except in compliance with the License.
You may obtain a copy of the License at
www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an AS IS BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
GD32VF103 board files
---
* Only applies to Pinecil releases.
```
Copyright (c) 2019, GigaDevice Semiconductor Inc.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
```
WenQuanYi Bitmap Song font
---
* Only applies to CJK (Chinese, Japanese and Korean) language releases.
```
Copyright (c) 2004-2010, The WenQuanYi Project
Board of Trustees and Qianqian Fang
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
```
BriefLZ compression library
---
* Only applies to multi-language builds.
```
The zlib License (Zlib)
Copyright (c) 2002-2020 Joergen Ibsen
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product
documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
```

13
scripts/ci/buildAll.sh Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/sh
set -e
set -u
mkdir -p /build/ci/artefacts
# Build STM code
cd /build/source/source/
bash ./build.sh || exit 1
echo "All Firmware built"
# Copy out all the final resulting files we would like to store for the next op
cp -r /build/source/source/Hexfile/*.hex /build/ci/artefacts/
cp -r /build/source/source/Hexfile/*.bin /build/ci/artefacts/

View File

@@ -0,0 +1 @@
8312c4c91799885f222f663fc81f9a31 gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2

View File

@@ -0,0 +1 @@
add5b6a9b12987d0e72f55a4d2cd0f3b nuclei_riscv_newlibc_prebuilt_linux64_2020.08.tar.bz2

90
scripts/deploy.sh Executable file
View File

@@ -0,0 +1,90 @@
#!/usr/bin/env bash
# little helper for docker deployment to:
# - start development environment for IronOS ("shell" sub-command)
# - generate full set of builds ("build" sub-command)
#set -x
#set -e
usage()
{
echo -e "\nUsage: ${0} [CMD]\n"
echo "CMD:"
echo -e "\tshell - start docker container with shell inside to work on IronOS with all tools needed"
echo -e "\tbuild - compile builds of IronOS inside docker container for supported hardware"
echo -e "\tclean - delete created docker container (but not pre-downloaded data for it)\n"
echo -e "STORAGE NOTICE: for \"shell\" and \"build\" commands extra files will be downloaded so make sure that you have ~5GB of free space.\n"
}
### main
docker_conf="Env.yml"
# allow providing custom path to docker tool using DOCKER_BIN external env. var.
# (compose sub-command must be included, i.e. DOCKER_BIN="/usr/local/bin/docker compose" ./deploy.sh)
if [ -z "${DOCKER_BIN}" ]; then
docker_bin=""
else
docker_bin="${DOCKER_BIN}"
fi;
# detect availability of docker
docker_compose="$(command -v docker-compose)"
if [ -n "${docker_compose}" ] && [ -z "${docker_bin}" ]; then
docker_bin="${docker_compose}"
fi;
docker_tool="$(command -v docker)"
if [ -n "${docker_tool}" ] && [ -z "${docker_bin}" ]; then
docker_bin="${docker_tool} compose"
fi;
if [ -z "${docker_bin}" ]; then
echo "ERROR: Can't find docker-compose nor docker tool. Please, install docker and try again."
exit 1
fi;
# construct command to run
cmd="${1}"
if [ -z "${cmd}" ] || [ "${cmd}" = "shell" ]; then
docker_cmd="run --rm builder"
elif [ "${cmd}" = "build" ]; then
docker_cmd="run --rm builder /bin/bash /build/ci/buildAll.sh"
elif [ "${cmd}" = "clean" ]; then
docker rmi ironos-builder:latest
exit "${?}"
else
usage
exit 1
fi;
# get absolute location of project root dir to make docker happy with config(s)
# (successfully tested on relatively POSIX-compliant Dash shell)
# this script
script_file="/deploy.sh"
# IronOS/scripts/deploy.sh
script_path="${PWD}"/"${0}"
# IronOS/scripts/
script_dir=${script_path%"${script_file}"}
# IronOS/
root_dir="${script_dir}/.."
# IronOS/Env.yml
docker_file="-f ${root_dir}/${docker_conf}"
# change dir to project root dir & run constructed command
cd "${root_dir}" || exit 1
echo -e "\n====>>>> Firing up & starting container..."
if [ "${cmd}" = "shell" ]; then
echo -e "\t* type \"exit\" to end the session when done;"
fi;
echo -e "\t* type \"${0} clean\" to delete created container (but not cached data)"
echo -e "\n====>>>> ${docker_bin} ${docker_file} ${docker_cmd}\n"
eval "${docker_bin} ${docker_file} ${docker_cmd}"
exit "${?}"

140
scripts/flash_ts100_linux.sh Executable file
View File

@@ -0,0 +1,140 @@
#!/bin/bash
# TS100 Flasher for Linux by Alex Wigen (https://github.com/awigen)
# Jan 2021 - Update by Ysard (https://github.com/ysard)
DIR_TMP="/tmp/ts100"
HEX_FIRMWARE="$DIR_TMP/ts100.hex"
usage() {
echo
echo "#################"
echo "# TS100 Flasher #"
echo "#################"
echo
echo " Usage: $0 <HEXFILE>"
echo
echo "This script has been tested to work on Fedora."
echo "If you experience any issues please open a ticket at:"
echo "https://github.com/Ralim/IronOS/issues/new"
echo
}
GAUTOMOUNT=0
disable_gautomount() {
if ! GSETTINGS=$(which gsettings); then
return 1
fi
if ! gsettings get org.gnome.desktop.media-handling automount | grep true > /dev/null; then
GAUTOMOUNT=1
gsettings set org.gnome.desktop.media-handling automount false
fi
}
enable_gautomount() {
if [ "$GAUTOMOUNT" -ne 0 ]; then
gsettings set org.gnome.desktop.media-handling automount true
fi
}
is_attached() {
if ! output=$(lsblk -b --raw --output NAME,MODEL | grep 'DFU.*Disk'); then
return 1
fi
DEVICE=$(echo "$output" | awk '{print "/dev/"$1}')
}
instructions="not printed"
wait_for_ts100() {
while ! is_attached; do
if [ "$instructions" = "not printed" ]; then
echo
echo "#####################################################"
echo "# Waiting for TS100 config disk device to appear #"
echo "# #"
echo "# Connect the soldering iron with a USB cable while #"
echo "# holding the button closest to the tip pressed #"
echo "#####################################################"
echo
instructions="printed"
fi
sleep 0.1
done
}
mount_ts100() {
mkdir -p "$DIR_TMP"
user="${UID:-$(id -u)}"
if ! sudo mount -t msdos -o uid=$user "$DEVICE" "$DIR_TMP"; then
echo "Failed to mount $DEVICE on $DIR_TMP"
exit 1
fi
}
umount_ts100() {
if ! (mountpoint "$DIR_TMP" > /dev/null && sudo umount "$DIR_TMP"); then
echo "Failed to unmount $DIR_TMP"
exit 1
fi
rmdir "$DIR_TMP"
}
check_flash() {
RDY_FIRMWARE="${HEX_FIRMWARE%.*}.rdy"
ERR_FIRMWARE="${HEX_FIRMWARE%.*}.err"
if [ -f "$RDY_FIRMWARE" ]; then
echo -e "\e[92mFlash is done\e[0m"
echo "Disconnect the USB and power up the iron. You're good to go."
elif [ -f "$ERR_FIRMWARE" ]; then
echo -e "\e[91mFlash error; Please retry!\e[0m"
else
echo -e "\e[91mUNKNOWN error\e[0m"
echo "Flash result: "
ls "$DIR_TMP"/ts100*
fi
}
cleanup() {
enable_gautomount
if [ -d "$DIR_TMP" ]; then
umount_ts100
fi
}
trap cleanup EXIT
if [ "$#" -ne 1 ]; then
echo "Please provide a HEX file to flash"
usage
exit 1
fi
if [ ! -f "$1" ]; then
echo "'$1' is not a regular file, please provide a HEX file to flash"
usage
exit 1
fi
if [ "$(head -c1 "$1")" != ":" ] || [ "$(tail -n1 "$1" | head -c1)" != ":" ]; then
echo "'$1' doesn't look like a valid HEX file. Please provide a HEX file to flash"
usage
exit 1
fi
disable_gautomount
wait_for_ts100
echo "Found TS100 config disk device on $DEVICE"
mount_ts100
echo "Mounted config disk drive, flashing..."
cp -v "$1" "$HEX_FIRMWARE"
sync
echo "Waiting for TS100 to flash"
sleep 5
echo "Remounting config disk drive"
umount_ts100
wait_for_ts100
mount_ts100
check_flash