diff --git a/.github/workflows/clang-format_check.yml b/.github/workflows/clang-format_check.yml
index 8374d4d..7b2c58e 100644
--- a/.github/workflows/clang-format_check.yml
+++ b/.github/workflows/clang-format_check.yml
@@ -1,10 +1,10 @@
-name: clang-format Check
-on:
+name: Run clang-format Check
+on:
+ workflow_dispatch:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
-# on: workflow_dispatch
jobs:
formatting-check:
name: Formatting Check
@@ -18,7 +18,7 @@ jobs:
exclude: '(template|unity|hw_test)' # Exclude file paths containing "template" or "unity"
steps:
- - uses: actions/checkout@v4.1.0
+ - uses: actions/checkout@v4.1.1
- name: Run clang-format style check for C/C++/Protobuf programs.
uses: jidicula/clang-format-action@v4.11.0
with:
diff --git a/.github/workflows/run_cppcheck.yml b/.github/workflows/run_cppcheck.yml
new file mode 100644
index 0000000..926d65e
--- /dev/null
+++ b/.github/workflows/run_cppcheck.yml
@@ -0,0 +1,49 @@
+name: Run cppcheck-action
+on:
+ workflow_dispatch:
+ push:
+ branches: [main, develop]
+ pull_request:
+ branches: [main, develop]
+
+jobs:
+ cppcheck-annotations_scr:
+ name: cppcheck-annotations /src
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4.1.1
+
+ - name: Run cppcheck-annotation-action for src
+ uses: Konstantin343/cppcheck-annotation-action@v1.0
+ with:
+ std: 'c99'
+ platform: 'unix64'
+ log-level: 'verbose'
+ sources: './src'
+ annotation-failures: 'warning'
+ # suppress: 'unusedFunction'
+ # annotation-level-default: 'error'
+ - name: Annotate lines with errors src
+ uses: yuzutech/annotations-action@v0.4.0
+ with:
+ repo-token: "${{ secrets.GITHUB_TOKEN }}"
+ title: 'Results of CppCheck src files'
+ input: 'annotations.json'
+ - name: Run cppcheck-annotation-action for tests
+ uses: Konstantin343/cppcheck-annotation-action@v1.0
+ with:
+ std: 'c99'
+ platform: 'unix64'
+ log-level: 'verbose'
+ sources: './test/lcd_hd44780'
+ annotation-failures: 'warning'
+ # suppress: 'unusedFunction'
+ # annotation-level-default: 'error'
+ - name: Annotate lines with errors test_src
+ uses: yuzutech/annotations-action@v0.4.0
+ with:
+ repo-token: "${{ secrets.GITHUB_TOKEN }}"
+ title: 'Results of CppCheck test lcd_hd44780 files'
+ input: 'annotations.json'
+
diff --git a/.github/workflows/run_lcd_hd44780_test .yml b/.github/workflows/run_lcd_hd44780_test .yml
index d6bd2de..cffd555 100644
--- a/.github/workflows/run_lcd_hd44780_test .yml
+++ b/.github/workflows/run_lcd_hd44780_test .yml
@@ -1,21 +1,17 @@
name: Run LCD HD44780 Unit Tests
-# on: [push, pull_request]
-# on: workflow_dispatch
-on:
+on:
+ workflow_dispatch:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
LCD_HD44780_test_running_win:
- name: LCD HD44780 Test RUN
+ name: LCD HD44780 Unit Test RUN on Win
runs-on: windows-latest
- # strategy:
- # matrix:
- # os: [ubuntu-latest, windows-latest]
steps:
- name: Checkout code
- uses: actions/checkout@v4.0.0
+ uses: actions/checkout@v4.1.1
with:
submodules: recursive
@@ -29,20 +25,16 @@ jobs:
cmake -Bout -GNinja
cmake --build out
- # - name: List files
- # working-directory: test/lcd_hd44780/out
- # run: dir
-
- name: Run LCD HD44780 tests
working-directory: test/lcd_hd44780/out
run: ./lcd_hd44780_test.exe -v
LCD_HD44780_AVR_test_running_win:
- name: LCD HD44780 AVR Test RUN
+ name: LCD HD44780 for AVR Unit Test RUN on Win
runs-on: windows-latest
steps:
- name: Checkout code
- uses: actions/checkout@v4.0.0
+ uses: actions/checkout@v4.1.1
with:
submodules: recursive
@@ -56,20 +48,16 @@ jobs:
cmake -S ./avr_code_test -B out_avr -GNinja
cmake --build out_avr
- # - name: List files
- # working-directory: test/lcd_hd44780/out
- # run: dir
-
- name: Run LCD HD44780 tests
working-directory: test/lcd_hd44780/out_avr
run: ./lcd_hd44780_test.exe -v
LCD_HD44780_test_running_ubuntu:
- name: LCD HD44780 Test RUN Ubuntu
+ name: RUN LCD HD44780 Unit Test on Ubuntu
runs-on: ubuntu-latest
steps:
- name: Checkout code
- uses: actions/checkout@v4.0.0
+ uses: actions/checkout@v4.1.1
with:
submodules: recursive
@@ -83,10 +71,6 @@ jobs:
cmake -Bout -GNinja
cmake --build out
- # - name: List files
- # working-directory: test/lcd_hd44780/out
- # run: dir
-
- name: Run LCD HD44780 tests
working-directory: test/lcd_hd44780/out
run: ./lcd_hd44780_test -v
diff --git a/.github/workflows/run_lizard_lib_check.yml b/.github/workflows/run_lizard_lib_check.yml
new file mode 100644
index 0000000..f82fdc1
--- /dev/null
+++ b/.github/workflows/run_lizard_lib_check.yml
@@ -0,0 +1,23 @@
+name: Run Lizard Library Check
+on:
+ workflow_dispatch:
+ push:
+ branches: [main, develop]
+ pull_request:
+ branches: [main, develop]
+jobs:
+ lizard:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4.1.1
+ - name: Lizard Runner
+ uses: Uno-Takashi/Lizard-Runner@v3
+ with:
+ path: "./src"
+ CCN: "12"
+ Threshold: "nloc=30"
+ language: "cpp"
+ verbose: "true"
+ arguments: "4"
+
+
diff --git a/.github/workflows/run_template_test.yml b/.github/workflows/run_template_test.yml
index e954f78..16dcf8b 100644
--- a/.github/workflows/run_template_test.yml
+++ b/.github/workflows/run_template_test.yml
@@ -1,6 +1,10 @@
-name: Run Unit Tests
-# on: [push, pull_request]
-on: workflow_dispatch
+name: Run Template Unit Tests
+on:
+ workflow_dispatch:
+ # push:
+ # branches: [main, develop]
+ # pull_request:
+ # branches: [main, develop]
jobs:
template_test_running:
name: Template Test RUN
@@ -10,7 +14,7 @@ jobs:
# os: [ubuntu-latest, windows-latest]
steps:
- name: Checkout code
- uses: actions/checkout@v4.0.0
+ uses: actions/checkout@v4.1.1
with:
submodules: recursive
diff --git a/.github/workflows/self_hosted_test_not_ready.yml b/.github/workflows/self_hosted_test_not_ready.yml
index 60b3873..1edf7fe 100644
--- a/.github/workflows/self_hosted_test_not_ready.yml
+++ b/.github/workflows/self_hosted_test_not_ready.yml
@@ -1,13 +1,17 @@
name: self-hosted test
-# on: [push, pull_request]
-on: workflow_dispatch
+on:
+ workflow_dispatch:
+ # push:
+ # branches: [main, develop]
+ # pull_request:
+ # branches: [main, develop]
jobs:
formatting_check_docker_runner:
name: Gcc_test
runs-on: test-runner
steps:
- name: Checkout
- uses: actions/checkout@v4.1.0
+ uses: actions/checkout@v4.1.1
- name: test
run: arm-none-eabi-gcc --version
diff --git a/.gitignore b/.gitignore
index a81b62c..9ef128b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,7 +3,7 @@ out_avr/
Release/
Debug/
Build/
-.vscode/settings.json
+.vscode/
# HW test ingnored files
.metadata/
.cproject
@@ -13,3 +13,4 @@ Build/
+
diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json
deleted file mode 100644
index feb4fa7..0000000
--- a/.vscode/c_cpp_properties.json
+++ /dev/null
@@ -1,51 +0,0 @@
-{
- "configurations": [
- {
- "name": "windows-gcc-x64",
- "includePath": [
- "${workspaceFolder}/**"
- ],
- "defines": [
- "_DEBUG",
- "UNICODE",
- "_UNICODE"
- ],
- "compilerPath": "C:/Qt_6_5/Tools/mingw1120_64/bin/gcc.exe",
- "cStandard": "${default}",
- "cppStandard": "${default}",
- "intelliSenseMode": "windows-gcc-x64"
- },
- {
- "name": "AVR-GCC ATMega328P",
- "includePath": [
- "${workspaceFolder}/**",
- "D:/19_EMBEDED_TOOLS/1_AVR_toolchain/avr/include/**"
- ],
- "defines": [
- "_DEBUG",
- "UNICODE",
- "_UNICODE",
- "__AVR_ATmega3250P__",
- "AVR"
- ],
- "cppStandard": "gnu++17",
- "compilerPath": "D:\\19_EMBEDED_TOOLS\\1_AVR_toolchain\\bin\\avr-gcc.exe",
- "cStandard": "c99"
- },
- {
- "name": "ARM-GCC",
- "includePath": [
- "${workspaceFolder}/**"
- ],
- "defines": [
- "_DEBUG",
- "UNICODE",
- "_UNICODE"
- ],
- "cppStandard": "gnu++17",
- "compilerPath": "C:\\ST\\STM32CubeCLT\\GNU-tools-for-STM32\\bin\\arm-none-eabi-gcc.exe",
- "cStandard": "c99"
- }
- ],
- "version": 4
-}
\ No newline at end of file
diff --git a/.vscode/launch.json b/.vscode/launch.json
deleted file mode 100644
index 109429f..0000000
--- a/.vscode/launch.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "version": "0.2.0",
- "configurations": [
- {
- "name": "C/C++ Runner: Debug Session",
- "type": "cppdbg",
- "request": "launch",
- "args": [],
- "stopAtEntry": false,
- "externalConsole": true,
- "cwd": "d:/0_Projekty/6_Biblioteki/LCD_HD44780/test/lcd_hd44780",
- "program": "d:/0_Projekty/6_Biblioteki/LCD_HD44780/test/lcd_hd44780/build/Debug/outDebug",
- "MIMode": "gdb",
- "miDebuggerPath": "gdb",
- "setupCommands": [
- {
- "description": "Enable pretty-printing for gdb",
- "text": "-enable-pretty-printing",
- "ignoreFailures": true
- }
- ]
- }
- ]
-}
\ No newline at end of file
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
deleted file mode 100644
index e876618..0000000
--- a/.vscode/tasks.json
+++ /dev/null
@@ -1,139 +0,0 @@
-{
- // See https://go.microsoft.com/fwlink/?LinkId=733558
- // for the documentation about the tasks.json format
- "version": "2.0.0",
- "tasks": [
- {
- "label": "build lcd_hd44780_test",
- "type": "shell",
- "command": "make",
- "args": [
- "all",
- "-j12",
- "-o lcd_hd44780.o"
-
- ],
- "options": {
- "cwd": "${workspaceFolder}/test/lcd_hd44780/out"
- },
- "group": {
- "kind": "build",
- "isDefault": true
- },
- // "problemMatcher": [],
- // "dependsOn":["run lizard test"],
- },
- {
- "label": "clean lcd_hd44780_test",
- "type": "shell",
- "command": "make clean",
- "args": [],
- "options": {
- "cwd": "${workspaceFolder}/test/lcd_hd44780/out"
- },
- "group": {
- "kind": "build",
- "isDefault": true
- }
- },
- {
- "type": "shell",
- "label": "run lcd_hd44780_test",
- "command": "./lcd_hd44780_test.exe",
- "args": [],
- "options": {
- "cwd": "${workspaceFolder}/test/lcd_hd44780/out"
- },
- "group": "test"
- },
- {
- "type": "shell",
- "label": "UBUNTU run lcd_hd44780_test",
- "command": "./lcd_hd44780_test",
- "args": [],
- "options": {
- "cwd": "${workspaceFolder}/test/lcd_hd44780/out"
- },
- "group": "test"
- },
- {
- "label": "run lizard test",
- "type": "shell",
- "command": "lizard src/ --CCN 12 -Tnloc=30 -a 4 --languages cpp -V -w -i 1",
- "args": [],
- "options": {
- "cwd": "${workspaceFolder}"
- },
- "group": "test",
-
- },
- {
- "label": "run lizard test with report",
- "type": "shell",
- "command": "lizard src/ --CCN 12 -Tnloc=30 -a 4 --languages cpp -V -o reports/Cyclomatic_Complexity/Lizard_report.html",
- "args": [],
- "options": {
- "cwd": "${workspaceFolder}"
- },
- "group": "test",
-
- },
- {
- "label": "run cppcheck for src",
- "type": "shell",
- "command": "cppcheck",
- "args": [
- // ".", // option for whole project
- "src/",
- // "-itest/unity/", //suppress directory test/unity/
- // "-itest/template/", //suppress directory test/template/
- "--enable=all",
- "--inconclusive",
- "--force" ,
- "--inline-suppr",
- // "--output-file=reports/cppcheck.out", // this will print out report instead of printing problems in terminal
- "--platform=win64",
- "--suppress=missingInclude",
- "--suppress=missingIncludeSystem",
- "--suppress=unusedFunction",
- ],
- "options": {
- "cwd": "${workspaceFolder}"
- },
- "group": "test",
- },
- { // to use it replace "template" with specific module and provide whole"directory_to_your_project_folder" for exampel "D_/Projects/Project_a" D:/0_Projekty/6_Biblioteki/LCD_HD44780/
- "label": "UBUNTU lcd_hd44780 code coverage report generation",
- "type": "shell",
- "command": "python3 -m gcovr CMakeFiles/lcd_hd44780_test.dir/home/sandra/Pulpit/test/LCD_HD44780 -r ../../.. --html-details ../../../reports/Code_Coverage/lcd_hd44780_gcov_report.html",
- "args": [],
- "options": {
- "cwd": "${workspaceFolder}/test/lcd_hd44780/out"
- },
- "group": "test",
-
- },
- { // to use it replace "template" with specific module and provide whole"directory_to_your_project_folder" for exampel "D_/Projects/Project_a" D:/0_Projekty/6_Biblioteki/LCD_HD44780/
- "label": "lcd_hd44780 code coverage report generation",
- "type": "shell",
- "command": "python3 -m gcovr CMakeFiles/lcd_hd44780_test.dir/home/sandra/Pulpit/test/LCD_HD44780 -r ../../.. --html-details ../../../reports/Code_Coverage/lcd_hd44780_gcov_report.html",
- "args": [],
- "options": {
- "cwd": "${workspaceFolder}/test/lcd_hd44780/out"
- },
- "group": "test",
-
- }
- // { // to use it replace "template" with specific module and provide whole"directory_to_your_project_folder" for exampel "D_/Projects/Project_a"
- // "label": "template module.c code coverage report generation",
- // "type": "shell",
- // "command": "python3 -m gcovr CMakeFiles/template_test.dir/directory_to_your_project_folder -r ../../.. --html-details ../../../reports/Code_Coverage/template_gcov_report.html",
- // "args": [],
- // "options": {
- // "cwd": "${workspaceFolder}/test/template/out"
- // },
- // "group": "test",
-
- // },
- ]
-}
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..b08e9b3
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2023 niwciu
+
+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 all
+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,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER 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.
diff --git a/ReadMe.md b/ReadMe.md
new file mode 100644
index 0000000..be9aeff
--- /dev/null
+++ b/ReadMe.md
@@ -0,0 +1,707 @@
+# LCD HD44780 lib - simple cross-platform C library
+- [LCD HD44780 lib - simple cross-platform C library](#lcd-hd44780-lib---simple-cross-platform-c-library)
+ - [Features](#features)
+ - [Hardware configuration](#hardware-configuration)
+ - [1. Requirements](#1-requirements)
+ - [2. Schematic for possible hardware configurations](#2-schematic-for-possible-hardware-configurations)
+ - [LCD\_HD44780 library src folders file structure and description](#lcd_hd44780-library-src-folders-file-structure-and-description)
+ - [1. lcd\_hd44780\_config.h](#1-lcd_hd44780_configh)
+ - [2. lcd\_hd44780\_def\_char.h](#2-lcd_hd44780_def_charh)
+ - [3. lcd\_hd44780\_interface.h](#3-lcd_hd44780_interfaceh)
+ - [4. lcd\_hd44780.c](#4-lcd_hd44780c)
+ - [5. lcd\_hd44780.h](#5-lcd_hd44780h)
+ - [Examples](#examples)
+ - [1. STM32G071RB -bare metal implementation](#1-stm32g071rb--bare-metal-implementation)
+ - [Requirements for compiling and running the example:](#requirements-for-compiling-and-running-the-example)
+ - [Hardware requirements, configuration, and connections](#hardware-requirements-configuration-and-connections)
+ - [LCD\_HD44780 library configuration - lcd\_hd44780\_config.h](#lcd_hd44780-library-configuration---lcd_hd44780_configh)
+ - [How to build and run the example](#how-to-build-and-run-the-example)
+ - [2. STM32G474 - STMCubeIDE project generated with LL drivers](#2-stm32g474---stmcubeide-project-generated-with-ll-drivers)
+ - [Requirements for compiling and running the example](#requirements-for-compiling-and-running-the-example-1)
+ - [Hardware configuration and connections](#hardware-configuration-and-connections)
+ - [LCD\_HD44780 library configuration - lcd\_hd44780\_config.h](#lcd_hd44780-library-configuration---lcd_hd44780_configh-1)
+ - [How to build and run the example](#how-to-build-and-run-the-example-1)
+ - [3. AVR ATmega 328P](#3-avr-atmega-328p)
+ - [Requirements for compiling and running the example](#requirements-for-compiling-and-running-the-example-2)
+ - [Hardware configuration and connections](#hardware-configuration-and-connections-1)
+ - [LCD\_HD44780 library configuration - lcd\_hd44780\_config.h](#lcd_hd44780-library-configuration---lcd_hd44780_configh-2)
+ - [How to build and run the example](#how-to-build-and-run-the-example-2)
+ - [4. ESP8266 NONOS SDK - TBD ...](#4-esp8266-nonos-sdk---tbd-)
+ - [Requirements](#requirements)
+ - [Hardware connections](#hardware-connections)
+ - [LCD\_HD44780 library configuration - lcd\_hd44780\_config.h](#lcd_hd44780-library-configuration---lcd_hd44780_configh-3)
+ - [How to build and run the example](#how-to-build-and-run-the-example-3)
+ - [Windows](#windows)
+ - [Linux - tbd](#linux---tbd)
+ - [How to use in your Project - simple case without user-predefined characters](#how-to-use-in-your-project---simple-case-without-user-predefined-characters)
+ - [How to use in your Project- simple case with user-predefined characters](#how-to-use-in-your-project--simple-case-with-user-predefined-characters)
+ - [How to define custom characters and custom character banks.](#how-to-define-custom-characters-and-custom-character-banks)
+ - [Example of Correspondence between EPROM Address Data and Character Pattern (5 × 8 Dots)](#example-of-correspondence-between-eprom-address-data-and-character-pattern-5--8-dots)
+ - [Defining special characters in code.](#defining-special-characters-in-code)
+ - [Defining banks for special characters.](#defining-banks-for-special-characters)
+ - [Project main folders file structure](#project-main-folders-file-structure)
+
+## Features
+- Works with LCD connected in 4-bit mode,
+- One-direction or bi-direction communication with LCD (predefined time slots or LCD RW pin usage)
+- Easy to port on different microcontrollers
+- Contain examples of porting to STM32, AVR, ESP8266
+- Allows to display strings/chars directly on LCD
+- Allows to put strings/chars in buffer and refresh LCD periodically with buffer content
+- Allows to define custom chars (more than 8) as well as custom char banks where different combinations of custom characters can be easily loaded to LCD CGRAM
+- Contain functions for displaying on LCD int values as a string representing:
+ - int format
+ - hex format
+ - bin format
+- The library has currently predefined LCD types:
+ - 2 lines 16 characters (1602)
+ - 4 lines 16 characters (1604)
+ - 4 lines 20 characters (2004)
+- Allows to configure and compile only functionality that will be needed in the project
+- Allows to control LCD backlight
+## Hardware configuration
+### 1. Requirements
+- LCD should be connected to uC in 4bit mode
+- LCD RW Pin can be connected to uC or GND -> user must define specific options in library configuration.
+- LCD data pins D4-D7 and LCD signal pins can be connected to any pins on any ports on uC side.
+### 2. Schematic for possible hardware configurations
+- Using RW pin of the LCD (set **USE_RW_PIN ON** in lcd_hd44780_config.h)
+
+- Without using RW pin of the LCD (set **USE_RW_PIN OFF** in lcd_hd44780_config.h)
+
+
+## LCD_HD44780 library src folders file structure and description
+```bash
+LCD_HD44780
+├───src
+│ ├───lcd_hd44780_config.h
+│ ├───lcd_hd44780_def_char.h
+│ ├───lcd_hd44780_interface.h
+│ ├───lcd_hd44780.c
+│ ├───lcd_hd44780.h
+...
+```
+#### 1. lcd_hd44780_config.h
+ Header file for configuration of the library. In this file, it's required to configure:
+ - LCD type
+ - Usage of RW Signal/PIN
+ - Usage of LCD buffer for displaying the content on the LCD
+ - Which functions from LCD_HD44780 lib you would like to compile and use in your project.
+#### 2. lcd_hd44780_def_char.h
+Header file for defining user special characters and user special characters banks. Each bank can contain up to 8 characters that are user-defined combinations of characters from defined user-special characters. This allows to creation of different combinations of special characters that can be loaded depending on current code needs.
+#### 3. lcd_hd44780_interface.h
+Header file with library interface declaration that needs to be implemented on the drivers' side. Please look at the code examples in the "examples" folder and search for the "LCD_IO_driver.c" file for more details.
+#### 4. lcd_hd44780.c
+Library main C file
+#### 5. lcd_hd44780.h
+Library main header file with available library functions.
+## Examples
+### 1. STM32G071RB -bare metal implementation
+#### Requirements for compiling and running the example:
+ 1. CMake installed
+ 2. Make or Ninja installed
+ 3. ARM GNU Toolchain (gcc-arm-none-eabi) installed
+ 4. STM32_Programmer_CLI installed
+ 5. ST-link (on Nucleo Board) installed
+#### Hardware requirements, configuration, and connections
+ 1. STM32G071 Nucleo-64
+
+ 2. LCD Keypad Shield for Arduino
+
+ 3. Pin connection between LCD Keypad Shield and Nucleo board
+
+#### LCD_HD44780 library configuration - lcd_hd44780_config.h
+ ```C
+ /************************************ LCD HARDWARE SETTINGS *******************************
+ * LCD_TYPE -> Set one of the predefined types:
+ * 2004 -> 4 lines 20 characters per line
+ * 1604 -> 4 lines 16 characters per line
+ * 1602 -> 2 lines 16 characters per line
+ * USE_RW_PIN -> Defines HW connection between LCD and uC
+ * ON - when the RW pin is connected
+ * OFF - when the RW pin is not connected
+ ********************************************************************************************/
+ #define LCD_TYPE 1602
+ #define USE_RW_PIN OFF
+
+ #define LCD_BCKL_PIN_EN_STATE HIGH
+
+ #define LCD_BUFFERING ON
+ ```
+
+ ```C
+ /******************************** LCD LIBRARY COMPILATION SETTINGS ************************
+ * Setting USE_(procedure name) to:
+ * ON - add specific procedure to compilation
+ * OFF - exclude specific procedure from compilation
+ ********************************************************************************************/
+ #define USE_DEF_CHAR_FUNCTION ON
+ #define USE_LCD_INT ON
+ #define USE_LCD_HEX ON
+ #define USE_LCD_BIN ON
+
+ #define USE_LCD_CURSOR_HOME ON
+ #define USE_LCD_CURSOR_ON ON
+ #define USE_LCD_CURSOR_OFF ON
+ #define USE_LCD_BLINKING_CURSOR_ON ON
+
+ #if LCD_BUFFERING == ON
+ #define USE_LCD_BUF_INT ON
+ #define USE_LCD_BUF_HEX ON
+ #define USE_LCD_BUF_BIN ON
+ #endif
+ ```
+#### How to build and run the example
+ 1. Open the location you want to clone the repository to in your terminal
+ 2. Clone the repository to your preferred localization
+ ```bash
+ git clone https://github.com/niwciu/LCD_HD44780.git
+ ```
+ 3. Enter to LCD_HD44780/examples/STM32G071RB/
+ ```bash
+ cd ./LCD_HD44780/examples/STM32G071RB
+ ```
+ 4. For make type:
+ ```bash
+ cmake -S ./ -B Debug -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug
+ ```
+ ```bash
+ cd Debug
+ ```
+ ```bash
+ make all
+ ```
+ ```bash
+ make flash
+ ```
+ 5. For Ninja type:
+ ```bash
+ cmake -S ./ -B Debug -G"Ninja" -DCMAKE_BUILD_TYPE=Debug
+ ```
+ ```bash
+ cd Debug
+ ```
+ ```bash
+ ninja
+ ```
+ ```bash
+ ninja flash
+ ```
+ 6. In some cases Nucleo board requires plugging out and in a USB port to run the program.
+
+### 2. STM32G474 - STMCubeIDE project generated with LL drivers
+#### Requirements for compiling and running the example
+ 1. CMake installed
+ 2. Make or Ninja installed
+ 3. ARM GNU Toolchain (gcc-arm-none-eabi) installed
+ 4. STM32_Programmer_CLI installed
+ 5. ST-link (on Nucleo Board) installed
+#### Hardware configuration and connections
+ 1. STM32G474 Nucleo-64
+
+ 2. LCD Keypad Shield for Arduino
+
+ 3. Pin connection between LCD Keypad Shield and Nucleo board
+
+#### LCD_HD44780 library configuration - lcd_hd44780_config.h
+ ```C
+ /************************************ LCD HARDWARE SETTINGS *******************************
+ * LCD_TYPE -> Set one of the predefined types:
+ * 2004 -> 4 lines 20 characters per line
+ * 1604 -> 4 lines 16 characters per line
+ * 1602 -> 2 lines 16 characters per line
+ * USE_RW_PIN -> Defines HW connection between LCD and uC
+ * ON - when the RW pin is connected
+ * OFF - when the RW pin is not connected
+ ********************************************************************************************/
+ #define LCD_TYPE 1602
+ #define USE_RW_PIN OFF
+
+ #define LCD_BCKL_PIN_EN_STATE HIGH
+
+ #define LCD_BUFFERING ON
+ ```
+
+ ```C
+ /******************************** LCD LIBRARY COMPILATION SETTINGS ************************
+ * Setting USE_(procedure name) to:
+ * ON - add specific procedure to compilation
+ * OFF - exclude specific procedure from compilation
+ ********************************************************************************************/
+ #define USE_DEF_CHAR_FUNCTION ON
+ #define USE_LCD_INT ON
+ #define USE_LCD_HEX ON
+ #define USE_LCD_BIN ON
+
+ #define USE_LCD_CURSOR_HOME ON
+ #define USE_LCD_CURSOR_ON ON
+ #define USE_LCD_CURSOR_OFF ON
+ #define USE_LCD_BLINKING_CURSOR_ON ON
+
+ #if LCD_BUFFERING == ON
+ #define USE_LCD_BUF_INT ON
+ #define USE_LCD_BUF_HEX ON
+ #define USE_LCD_BUF_BIN ON
+ #endif
+ ```
+#### How to build and run the example
+ 1. Open the location you want to clone the repository to in your terminal
+ 2. Clone the repository to your preferred localization
+ ```bash
+ git clone https://github.com/niwciu/LCD_HD44780.git
+ ```
+ 3. Enter to LCD_HD44780/examples/STM32G474RB/
+ ```bash
+ cd ./LCD_HD44780/examples/STM32G474RB
+ ```
+ 4. For make type:
+ ```bash
+ cmake -S ./ -B Debug -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug
+ ```
+ ```bash
+ cd Debug
+ ```
+ ```bash
+ make all
+ ```
+ ```bash
+ make flash
+ ```
+ 5. For Ninja type:
+ ```bash
+ cmake -S ./ -B Debug -G"Ninja" -DCMAKE_BUILD_TYPE=Debug
+ ```
+ ```bash
+ cd Debug
+ ```
+ ```bash
+ ninja
+ ```
+ ```bash
+ ninja flash
+ ```
+
+### 3. AVR ATmega 328P
+#### Requirements for compiling and running the example
+ 1. CMake installed
+ 2. Make or Ninja installed
+ 3. AVR 8-bit GNU Toolchain
+ 4. AVRdude Installed
+ 5. USBasp programmer installed and updated
+#### Hardware configuration and connections
+ 1. Arduino UNO R3
+
+ 2. USBasp programmer
+
+ 3. LCD Keypad Shield for Arduino
+
+ 4. Pin connection between LCD Keypad Shield and Nucleo board
+
+#### LCD_HD44780 library configuration - lcd_hd44780_config.h
+ ```C
+ /************************************ LCD HARDWARE SETTINGS *******************************
+ * LCD_TYPE -> Set one of the predefined types:
+ * 2004 -> 4 lines 20 characters per line
+ * 1604 -> 4 lines 16 characters per line
+ * 1602 -> 2 lines 16 characters per line
+ * USE_RW_PIN -> Defines HW connection between LCD and uC
+ * ON - when the RW pin is connected
+ * OFF - when the RW pin is not connected
+ ********************************************************************************************/
+ #define LCD_TYPE 1602
+ #define USE_RW_PIN OFF
+
+ #define LCD_BCKL_PIN_EN_STATE HIGH
+
+ #define LCD_BUFFERING ON
+ ```
+
+ ```C
+ /******************************** LCD LIBRARY COMPILATION SETTINGS ************************
+ * Setting USE_(procedure name) to:
+ * ON - add specific procedure to compilation
+ * OFF - exclude specific procedure from compilation
+ ********************************************************************************************/
+ #define USE_DEF_CHAR_FUNCTION ON
+ #define USE_LCD_INT ON
+ #define USE_LCD_HEX ON
+ #define USE_LCD_BIN ON
+
+ #define USE_LCD_CURSOR_HOME ON
+ #define USE_LCD_CURSOR_ON ON
+ #define USE_LCD_CURSOR_OFF ON
+ #define USE_LCD_BLINKING_CURSOR_ON ON
+
+ #if LCD_BUFFERING == ON
+ #define USE_LCD_BUF_INT ON
+ #define USE_LCD_BUF_HEX ON
+ #define USE_LCD_BUF_BIN ON
+ #endif
+ ```
+#### How to build and run the example
+ 1. Open the location you want to clone the repository to in your terminal
+ 2. Clone the repository to your preferred localization
+ ```bash
+ git clone https://github.com/niwciu/LCD_HD44780.git
+ ```
+ 3. Enter to LCD_HD44780/examples/ATMEGA328P_ARDUINO_UNO_R3 folder
+ ```bash
+ cd ./LCD_HD44780/examples/ATMEGA328P_ARDUINO_UNO_R3
+ ```
+ 4. For make type:
+ ```bash
+ cmake -S ./ -B Build -G"Unix Makefiles"
+ ```
+ ```bash
+ cd Build
+ ```
+ ```bash
+ make all
+ ```
+ ```bash
+ make write_fuses
+ ```
+ ```bash
+ make flash
+ ```
+ 5. For Ninja type:
+ ```bash
+ cmake -S ./ -B Build -G"Ninja"
+ ```
+ ```bash
+ cd Build
+ ```
+ ```bash
+ ninja
+ ```
+ ```bash
+ ninja write_fuses
+ ```
+ ```bash
+ ninja flash
+ ```
+
+### 4. ESP8266 NONOS SDK - TBD ...
+#### Requirements
+ 1. Make installed
+ 2. ESP Toolchain installed according to esspresif doc
+ - For Windows:
+ https://docs.espressif.com/projects/esp8266-rtos-sdk/en/latest/get-started/windows-setup.html
+ - For Linux:
+ https://docs.espressif.com/projects/esp8266-rtos-sdk/en/latest/get-started/linux-setup.html
+ 3. Downloaded Flash Download Tool V3.8.5
+ 4. ESP8266 node mcu V3 installed
+#### Hardware connections
+ 1. ESP8266 NodeMCU V3
+
+ 2. LCD Keypad Shield for Arduino
+
+ 3. Pin connection between LCD Keypad Shield and ESP8266 NoneMCU board
+
+#### LCD_HD44780 library configuration - lcd_hd44780_config.h
+ ```C
+ /************************************ LCD HARDWARE SETTINGS *******************************
+ * LCD_TYPE -> Set one of the predefined types:
+ * 2004 -> 4 lines 20 characters per line
+ * 1604 -> 4 lines 16 characters per line
+ * 1602 -> 2 lines 16 characters per line
+ * USE_RW_PIN -> Defines HW connection between LCD and uC
+ * ON - when the RW pin is connected
+ * OFF - when the RW pin is not connected
+ ********************************************************************************************/
+ #define LCD_TYPE 1602
+ #define USE_RW_PIN OFF
+
+ #define LCD_BCKL_PIN_EN_STATE HIGH
+
+ #define LCD_BUFFERING ON
+ ```
+
+ ```C
+ /******************************** LCD LIBRARY COMPILATION SETTINGS ************************
+ * Setting USE_(procedure name) to:
+ * ON - add specific procedure to compilation
+ * OFF - exclude specific procedure from compilation
+ ********************************************************************************************/
+ #define USE_DEF_CHAR_FUNCTION ON
+ #define USE_LCD_INT ON
+ #define USE_LCD_HEX ON
+ #define USE_LCD_BIN ON
+
+ #define USE_LCD_CURSOR_HOME ON
+ #define USE_LCD_CURSOR_ON ON
+ #define USE_LCD_CURSOR_OFF ON
+ #define USE_LCD_BLINKING_CURSOR_ON ON
+
+ #if LCD_BUFFERING == ON
+ #define USE_LCD_BUF_INT ON
+ #define USE_LCD_BUF_HEX ON
+ #define USE_LCD_BUF_BIN ON
+ #endif
+ ```
+#### How to build and run the example
+##### Windows
+ 1. Open the location you want to clone the repository to in your terminal
+ 2. Clone the repository to your preferred localization
+ ```bash
+ git clone https://github.com/niwciu/LCD_HD44780.git
+ ```
+ 3. Enter to LCD_HD44780/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST folder
+ ```bash
+ cd ./LCD_HD44780/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST
+ ```
+ 4. Clean the project running clean.bat script
+ ```bash
+ ./clean.bat
+ ```
+ 5. Build the project running build.bat script
+ ```bash
+ ./build.bat
+ ```
+ 6. Run flash_download_tool_3.8.5
+ 7. Select "Developer Mode" and "ESP8266 DownloadTool" in next window
+ 8. Set all fields as it is shown on picture bellow
+
+ 9. Select COM port on which your NodeMCU board has been installed
+ 10. Click START to flash the IC
+ 11. After Flash is done pres reset button on your NodeMCU board
+##### Linux - tbd
+## How to use in your Project - simple case without user-predefined characters
+1. Copy LCD library src files (or files from src folder) to your project.
+2. In lcd_hd44780.config.h
+ - Define specyfic **LCD_TYPE**
+ LCD_TYPE -> set one of the predefined types:
+ 2004 -> 4 lines 20 characters per line
+ 1604 -> 4 lines 16 characters per line
+ 1602 -> 2 lines 16 characters per line
+ - Define usage of **RW Pin**
+ USE_RW_PIN -> Defines HW connection between LCD and uC
+ ON - when RW pin is connected
+ OFF - when RW pin is not connected
+ - Define HW setup for **LCD_BCKL_PIN**
+ LCD_BCKL_PIN_EN_STATE -> Defines active state for enabling LCD backlight
+ HIGH - when high state on output pin is required to enable LCD backlight
+ LOW - when low state on output pin is required to enable LCD backlight
+ - Define usage of LCD buffering functionality **LCD_BUFFERING**
+ LCD_BUFFERING -> Defines whether you would ike to use LCD buffer or write directly to LCD screen
+ ON - when buffering of LCD is planned to be use in project
+ OFF - when buffering of LCD is NOT planned to be use in project
+
+
+3. Declare the LCD IO driver interface in your application on the GPIO driver side. This interface should contain the following implementation defined in lcd_hd44780_interface.h
+```C
+ /************LCD_IO_driver_interface implementation START**************/
+static const struct LCD_IO_driver_interface_struct LCD_IO_driver = {
+ init_LCD_data_and_SIG_pins,
+ set_LCD_DATA_PINS_as_outputs,
+ set_LCD_DATA_PINS_as_inputs,
+ set_LCD_DATA_PINS_state,
+ get_LCD_DATA_PINS_state,
+ LCD_set_SIG,
+ LCD_reset_SIG,
+ _delay_us,
+};
+const struct LCD_IO_driver_interface_struct *LCD_IO_driver_interface_get(void)
+{
+ return &LCD_IO_driver;
+}
+
+```
+It's a basic interface that connects the library with your HW driver layer in the application without making any dependencies between them.
In **.examples/lcd_driver_intrface_example_implementations** folder you can find a template with empty definitions of all required interface elements as well as a few files with examples of implementations for different microcontrollers. Additional details of the implementation in the project can be also found in ready to compile examples.
+
+
+## How to use in your Project- simple case with user-predefined characters
+1. Copy LCD library src files (files from src folder) to your project
+2. In lcd_hd44780.config.h
+ - Define specyfic **LCD_TYPE**
+ LCD_TYPE -> set one of the predefined types:
+ 2004 -> 4 lines 20 characters per line
+ 1604 -> 4 lines 16 characters per line
+ 1602 -> 2 lines 16 characters per line
+ - Define usage of **RW Pin**
+ USE_RW_PIN -> Defines HW connection between LCD and uC
+ ON - when RW pin is connected
+ OFF - when RW pin is not connected
+ - Define HW setup for **LCD_BCKL_PIN**
+ LCD_BCKL_PIN_EN_STATE -> Defines active state for enabling LCD backlight
+ HIGH - when high state on output pin is required to enable LCD backlight
+ LOW - when low state on output pin is required to enable LCD backlight
+ - Define usage of LCD buffering functionality **LCD_BUFFERING**
+ LCD_BUFFERING -> Defines whether you would ike to use LCD buffer or write directly to LCD screen
+ ON - when buffering of LCD is planned to be use in project
+ OFF - when buffering of LCD is NOT planned to be use in project
+
+3. Specify which procedures from to library you would like to compile and use in your project.
+ To do this, Edit defines in section:
+ ```C
+ /******************************** LCD LIBRARY COMPILATION SETTINGS ************************
+ * Setting USE_(procedure name) to:
+ * ON - add specific procedure to compilation
+ * OFF - exclude specific procedure from compilation
+ ********************************************************************************************/
+ #define USE_DEF_CHAR_FUNCTION ON
+ #define USE_LCD_INT ON
+ #define USE_LCD_HEX ON
+ #define USE_LCD_BIN ON
+
+ #define USE_LCD_CURSOR_HOME ON
+ #define USE_LCD_CURSOR_ON ON
+ #define USE_LCD_CURSOR_OFF ON
+ #define USE_LCD_BLINKING_CURSOR_ON ON
+
+ #if LCD_BUFFERING == ON
+ #define USE_LCD_BUF_INT ON
+ #define USE_LCD_BUF_HEX ON
+ #define USE_LCD_BUF_BIN ON
+ #endif
+ ```
+
+4. If setting USE_DEF_CHAR_FUNCTION ON define special characters and character banks in lcd_hd44780_def_char.h
For more details about defining custom char please refer to [How to define custom characters and custom character banks.](#how-to-define-custome-charatcters-and-custom-character-banks)
+5. Declare the LCD IO driver interface in your application on the GPIO driver side. This interface should contain the following implementation defined in lcd_hd44780_interface.h
+
+ ```C
+ /************LCD_IO_driver_interface implementation START**************/
+ static const struct LCD_IO_driver_interface_struct LCD_IO_driver = {
+ init_LCD_data_and_SIG_pins,
+ set_LCD_DATA_PINS_as_outputs,
+ set_LCD_DATA_PINS_as_inputs,
+ set_LCD_DATA_PINS_state,
+ get_LCD_DATA_PINS_state,
+ LCD_set_SIG,
+ LCD_reset_SIG,
+ _delay_us,
+ };
+ const struct LCD_IO_driver_interface_struct *LCD_IO_driver_interface_get(void)
+ {
+ return &LCD_IO_driver;
+ }
+ ```
+
+ It's a basic interface that connects the library with your HW driver layer in the application without making any dependencies between them.
In **.examples/lcd_driver_intrface_example_implementations** folder you can find a template with empty definitions of all required interface elements as well as a few files with examples of implementation for different microcontrollers. Additional details of the implementation in the project can be also found in ready to compile examples.
+## How to define custom characters and custom character banks.
+### Example of Correspondence between EPROM Address Data and Character Pattern (5 × 8 Dots)
+
+
+### Defining special characters in code.
+If the letter shown in the picture above should be defined as a special character its definition should look like this:
+```C
+static const uint8_t leter_b[8] = {16, 16, 22, 25, 17, 17, 30, 0};
+```
+### Defining banks for special characters.
+HD44780 allows the user to define a maximum of 8 user characters. Therefore on character bank can contain only up to 8 characters. Nevertheless, it's possible to define a couple of special character banks with different combinations of special characters. Depending on needs one of the banks can be loaded to the CGRAM and switched to another if the information presented on the LCD requires different special characters
+
+Below you can find a simple example of two special characters bank definitions:
+1. Definition of special characters in lcd_hd44780_def_char.h:
+ ```C
+ static const uint8_t Pol_e[8] = {0, 0, 14, 17, 31, 16, 14, 3};
+ static const uint8_t Pol_o[8] = {2, 4, 14, 17, 17, 17, 14, 0};
+ static const uint8_t Pol_s[8] = {2, 4, 14, 16, 14, 1, 30, 0};
+ static const uint8_t Pol_l[8] = {12, 4, 6, 12, 4, 4, 14, 0};
+ static const uint8_t Pol_c[8] = {2, 4, 14, 16, 16, 17, 14, 0};
+ static const uint8_t Pol_a[8] = {0, 0, 14, 1, 15, 17, 15, 3};
+ static const uint8_t Pol_n[8] = {2, 4, 22, 25, 17, 17, 17, 0};
+ static const uint8_t Zn_wody[8] = {0, 0, 0, 6, 9, 2, 4, 15};
+ static const uint8_t Pol_z1[8] = {4, 32, 31, 2, 4, 8, 31, 0};
+ static const uint8_t Pol_z2[8] = {2, 4, 31, 2, 4, 8, 31, 0};
+ ```
+2. Declaration of lcd_cgram_bank_1 in lcd_hd44780_def_char.h:
+ ```C
+ static const struct char_bank_struct lcd_cgram_bank_1 =
+ {
+ Pol_e,
+ Pol_o,
+ Pol_s,
+ Pol_l,
+ Pol_c,
+ Pol_a,
+ Pol_n,
+ Zn_wody
+ };
+ enum LCD_CGRAM_BANK_1
+ {
+ pol_e,
+ pol_o,
+ pol_s,
+ pol_l,
+ pol_c,
+ pol_a,
+ pol_n,
+ zn_wody,
+ };
+ ```
+3. Declaration of lcd_cgram_bank_2 in lcd_hd44780_def_char.h:
+ ```C
+ static const struct char_bank_struct lcd_cgram_bank_1 =
+ {
+ Pol_e,
+ Pol_o,
+ Pol_s,
+ Pol_l,
+ Pol_c,
+ Pol_a,
+ Pol_z1,
+ Pol_z2
+ };
+ enum LCD_CGRAM_BANK_1
+ {
+ pol_e,
+ pol_o,
+ pol_s,
+ pol_l,
+ pol_c,
+ pol_a,
+ pol_z1,
+ pol_z2,
+ };
+ ```
+4. When special characters from bank_1 are needed to display content on an LCD screen, it's required to call in the code:
+ ```C
+ lcd_load_char_bank(&lcd_cgram_bank_1);
+ ```
+5. When special characters from bank_2 are required to display content on an LCD screen, then it's required to call in code:
+ ```C
+ lcd_load_char_bank(&lcd_cgram_bank_2);
+ ```
+
+
+## Project main folders file structure
+```bash
+LCD_HD44780
+├───.github
+├───doc
+├───examples
+│ ├───ATMEGA328P_ARDUINO_UNO_R3
+│ ├───config
+│ ├───doc
+│ ├───lcd_driver_intrface_example_implementations
+│ └───STM32G071RB_NUCLEO_BARE_METAL
+│ └───STM32G474RE_NUCLEO_CUBE_IDE_LL
+├───reports
+│ ├───Code_Coverage
+│ └───Cyclomatic_Complexity
+├───src
+└───test
+ ├───hw_test
+ │ ├───ATMEGA328P_ARDUINO_UNO_R3
+ │ └───STM32F030R8_CUBE_IDE
+ ├───lcd_hd44780
+ ├───template
+ └───unity
+```
+Folder description:
+- .github -> Folder with githubactions .yml scripts
+- doc -> folder for any documentation needed or created in the project
+- examples -> folder with example hardware implementations contain ready to compile examples for different uC and templates of lcd_driver_interface implementations.
+ - ATMEGA328P_ARDUINO_UNO_R3 -> example project
+ - config -> tollchain files
+ - doc -> documentation of used hardware in examples
+ - lcd_driver_intrface_example_implementations -> as named
+ - STM32G071RB_NUCLEO_BARE_METAL -> example project
+ - STM32G474RE_NUCLEO_CUBE_IDE_LL -> example project
+- src -> library source files
+- test -> folder where all tests are written. The folder contains following subfolders:
+ - hw_test -> folder with configurations/setups for specific ucontrollers to make integration tests
+ - lcd_hd44780 -> folder where all unit tests for lcd_hd44780 module are kept
+ - template -> empty setup for uint test (copy, paste, rename, edit for new module unit testing)
+ - unity -> unity framework
+
diff --git a/ReadMe.txt b/ReadMe.txt
deleted file mode 100644
index 485b9ba..0000000
--- a/ReadMe.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-Tools that are used along with this project template and need to be instaled
-1) Lizard -> https://pypi.org/project/lizard/
-2) cppcheck -> https://cppcheck.sourceforge.io/
-3) gcc ->mingw
-4) Ninja
-5) Git
-6) LLVM
\ No newline at end of file
diff --git a/doc/HW connection no RW.png b/doc/HW connection no RW.png
new file mode 100644
index 0000000..171cdab
Binary files /dev/null and b/doc/HW connection no RW.png differ
diff --git a/doc/HW connection using RW.png b/doc/HW connection using RW.png
new file mode 100644
index 0000000..1e85f58
Binary files /dev/null and b/doc/HW connection using RW.png differ
diff --git a/doc/font map.png b/doc/font map.png
new file mode 100644
index 0000000..92ff324
Binary files /dev/null and b/doc/font map.png differ
diff --git a/hw/ATMEGA328P_ARDUINO_UNO_R3/.gitignore b/examples/ATMEGA328P_ARDUINO_UNO_R3/.gitignore
similarity index 100%
rename from hw/ATMEGA328P_ARDUINO_UNO_R3/.gitignore
rename to examples/ATMEGA328P_ARDUINO_UNO_R3/.gitignore
diff --git a/hw/ATMEGA328P_ARDUINO_UNO_R3/CMakeLists.txt b/examples/ATMEGA328P_ARDUINO_UNO_R3/CMakeLists.txt
similarity index 72%
rename from hw/ATMEGA328P_ARDUINO_UNO_R3/CMakeLists.txt
rename to examples/ATMEGA328P_ARDUINO_UNO_R3/CMakeLists.txt
index e3926e7..027a4cf 100644
--- a/hw/ATMEGA328P_ARDUINO_UNO_R3/CMakeLists.txt
+++ b/examples/ATMEGA328P_ARDUINO_UNO_R3/CMakeLists.txt
@@ -4,18 +4,22 @@
#
# usage: Edit MCPU-Variable to suit STM32 project requirements.
# For debug build using Unix Makefiles:
-# cmake -S ./ -B Debug -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug
-# make -C Debug all (optional with VERBOSE=1 and -jxx ->xx numnber of cores)
+# cmake -S ./ -B Build -G"Unix Makefiles"
+# make -C Build all (optional with VERBOSE=1 and -jxx ->xx numnber of cores)
# For debug build using Ninja:
-# cmake -S ./ -B Debug -G"Ninja" -DCMAKE_BUILD_TYPE=Debug
-# ninja -C Debug (optional with -V and -jxx ->xx numnber of cores)
-#
-# For release build Unix Makefiles:
-# cmake -S ./ -B Release -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release
-# make all -C Release VERBOSE=1 -j12 (optional with VERBOSE=1 and -jxx ->xx numnber of cores)
-# For Release build using Ninja:
-# cmake -S ./ -B Release -G"Ninja" -DCMAKE_BUILD_TYPE=Release
-# ninja -C Release (optional -V and -jxx ->xx numnber of cores)
+# cmake -S ./ -B Build -G"Ninja" -DCMAKE_BUILD_TYPE=Debug
+# ninja -C Build (optional with -V and -jxx ->xx numnber of cores)
+# additional custom targets for this project:
+# Erase Atmega chip:
+# 1. make erase / ninja erase
+# Read Fuse Bits:
+# 1. make write_fuses / ninja write_fuses
+# Write Fuse Bits:
+# 1. make write_fuses / ninja write_fuses
+# Read Flash:
+# 1. make read_flash / ninja read_flash
+# Write Flash:
+# 1. make flash / ninja flash
#############################################################################################################################
cmake_minimum_required(VERSION 3.10)
@@ -47,12 +51,17 @@ set(L_FUSE 0xfd)
set(LOCK_BIT 0xff)
set(INCLUDE_DIRS
- ./inc
+ ./inc
+ ../../src
)
set(C_SRCS
./src/main.c
./src/debug.c
+ ./src/LCD_IO_driver.c
+
+ ../../src/lcd_hd44780.c
+
)
set(ASM_SRCS
@@ -61,6 +70,7 @@ set(ASM_SRCS
set(GLOBAL_DEFINES
-DF_CPU=${F_CPU}
+-DAVR
# -DBAUD=${BAUD}
)
diff --git a/hw/ATMEGA328P_ARDUINO_UNO_R3/inc/debug.h b/examples/ATMEGA328P_ARDUINO_UNO_R3/inc/debug.h
similarity index 100%
rename from hw/ATMEGA328P_ARDUINO_UNO_R3/inc/debug.h
rename to examples/ATMEGA328P_ARDUINO_UNO_R3/inc/debug.h
diff --git a/hw/ATMEGA328P_ARDUINO_UNO_R3/inc/project_config.h b/examples/ATMEGA328P_ARDUINO_UNO_R3/inc/project_config.h
similarity index 88%
rename from hw/ATMEGA328P_ARDUINO_UNO_R3/inc/project_config.h
rename to examples/ATMEGA328P_ARDUINO_UNO_R3/inc/project_config.h
index 0e3f5ca..750b67e 100644
--- a/hw/ATMEGA328P_ARDUINO_UNO_R3/inc/project_config.h
+++ b/examples/ATMEGA328P_ARDUINO_UNO_R3/inc/project_config.h
@@ -8,7 +8,7 @@
#define ON 1
#define OFF 0
-#define DEBUG_CONSOLE ON
+#define DEBUG_CONSOLE OFF
#ifdef __cplusplus
}
diff --git a/examples/ATMEGA328P_ARDUINO_UNO_R3/src/LCD_IO_driver.c b/examples/ATMEGA328P_ARDUINO_UNO_R3/src/LCD_IO_driver.c
new file mode 100644
index 0000000..1ebced1
--- /dev/null
+++ b/examples/ATMEGA328P_ARDUINO_UNO_R3/src/LCD_IO_driver.c
@@ -0,0 +1,186 @@
+/*
+ * @Author: lukasz.niewelt
+ * @Date: 2023-12-04 20:13:23
+ * @Last Modified by: lukasz.niewelt
+ * @Last Modified time: 2023-12-08 10:49:44
+ */
+
+
+#include "lcd_hd44780_interface.h"
+#include "lcd_hd44780_config.h"
+#include
+#include
+#include
+
+#define LCD_DATA_PORT PORTD
+#define LCD_DATA_PORT_DIR DDRD
+#define LCD_DATA_INPUT PIND
+
+#define LCD_SIG_PORT PORTB
+#define LCD_SIG_PORT_DIR DDRB
+
+#define LCD_BCKL_PORT PORTB
+#define LCD_BCKL_PORT_DIR DDRB
+
+#define LCD_PIN_D7 (1 << PIND7)
+#define LCD_PIN_D6 (1 << PIND6)
+#define LCD_PIN_D5 (1 << PIND5)
+#define LCD_PIN_D4 (1 << PIND4)
+#define LCD_PIN_RS (1 << PINB0)
+#define LCD_PIN_RW (1 << PINC1)
+#define LCD_PIN_E (1 << PINB1)
+#define LCD_BCKL_PIN (1 << PINB2)
+
+#define LCD_D4_MASK 0x01
+#define LCD_D5_MASK 0x02
+#define LCD_D6_MASK 0x04
+#define LCD_D7_MASK 0x08
+
+static void init_LCD_data_and_SIG_pins(void);
+static void init_LCD_DATA_PINS_as_outputs(void);
+static void init_LCD_DATA_PINS_as_inputs(void);
+static void set_LCD_DATA_PINS_state(uint8_t data);
+static uint8_t get_LCD_DATA_PINS_state(void);
+static void LCD_set_SIG(enum lcd_sig LCD_SIG);
+static void LCD_reset_SIG(enum lcd_sig LCD_SIG);
+static void wraper_delay_us(uint32_t delay_us);
+static void init_LCD_SIGNAL_PINS_as_outputs(void);
+
+/************LCD_IO_driver_interface implementation START**************/
+static const struct LCD_IO_driver_interface_struct LCD_IO_driver = {
+ init_LCD_data_and_SIG_pins,
+ init_LCD_DATA_PINS_as_outputs,
+ init_LCD_DATA_PINS_as_inputs,
+ set_LCD_DATA_PINS_state,
+ get_LCD_DATA_PINS_state,
+ LCD_set_SIG,
+ LCD_reset_SIG,
+ wraper_delay_us,
+};
+const struct LCD_IO_driver_interface_struct *LCD_IO_driver_interface_get(void)
+{
+ return &LCD_IO_driver;
+}
+
+/*************LCD_IO_driver_interface implementation END***************/
+
+static void init_LCD_data_and_SIG_pins(void)
+{
+ //set BCKL PIN as output
+ LCD_BCKL_PORT_DIR |= LCD_BCKL_PIN;
+ //disable LCD backlight
+ LCD_BCKL_PORT &= ~ LCD_BCKL_PIN;
+ init_LCD_DATA_PINS_as_outputs();
+ init_LCD_SIGNAL_PINS_as_outputs();
+}
+static void init_LCD_DATA_PINS_as_outputs(void)
+{
+ //set pins as output
+ LCD_DATA_PORT_DIR |= (LCD_PIN_D4 | LCD_PIN_D5 | LCD_PIN_D6 | LCD_PIN_D7);
+}
+static void init_LCD_DATA_PINS_as_inputs(void)
+{
+
+ //set pins as inputs
+ LCD_DATA_PORT_DIR &= ~(LCD_PIN_D4 | LCD_PIN_D5 | LCD_PIN_D6 | LCD_PIN_D7);
+ // enable pull-up on input pins
+ LCD_DATA_PORT |= (LCD_PIN_D4 | LCD_PIN_D5 | LCD_PIN_D6 | LCD_PIN_D7);
+}
+
+static void set_LCD_DATA_PINS_state(uint8_t data)
+{
+ if ((data & LCD_D4_MASK))
+ LCD_DATA_PORT |= LCD_PIN_D4;
+ else
+ LCD_DATA_PORT &= ~LCD_PIN_D4;
+
+ if ((data & LCD_D5_MASK))
+ LCD_DATA_PORT |= LCD_PIN_D5;
+ else
+ LCD_DATA_PORT &= ~LCD_PIN_D5;
+
+ if ((data & LCD_D6_MASK))
+ LCD_DATA_PORT |= LCD_PIN_D6;
+ else
+ LCD_DATA_PORT &= ~LCD_PIN_D6;
+
+ if ((data & LCD_D7_MASK))
+ LCD_DATA_PORT |= LCD_PIN_D7;
+ else
+ LCD_DATA_PORT &= ~LCD_PIN_D7;
+}
+
+static uint8_t get_LCD_DATA_PINS_state(void)
+{
+ uint8_t data = 0;
+ if (LCD_DATA_INPUT & LCD_PIN_D4)
+ data = LCD_D4_MASK;
+ if (LCD_DATA_INPUT & LCD_PIN_D5)
+ data |= LCD_D5_MASK;
+ if (LCD_DATA_INPUT & LCD_PIN_D6)
+ data |= LCD_D6_MASK;
+ if (LCD_DATA_INPUT & LCD_PIN_D7)
+ data |= LCD_D7_MASK;
+ return data;
+}
+
+static void LCD_set_SIG(enum lcd_sig LCD_SIG)
+{
+ switch (LCD_SIG)
+ {
+ case LCD_RS:
+ LCD_SIG_PORT |= LCD_PIN_RS;
+ break;
+ case LCD_E:
+ LCD_SIG_PORT |= LCD_PIN_E;
+ break;
+#if USE_RW_PIN == ON
+ case LCD_RW:
+ LCD_SIG_PORT |= LCD_PIN_RW;
+ break;
+#endif
+ case LCD_BCKL:
+ LCD_SIG_PORT |= LCD_BCKL_PIN;
+ break;
+ default:
+ break;
+ }
+}
+
+static void LCD_reset_SIG(enum lcd_sig LCD_SIG)
+{
+ switch (LCD_SIG)
+ {
+ case LCD_RS:
+ LCD_SIG_PORT &= ~LCD_PIN_RS;
+ break;
+ case LCD_E:
+ LCD_SIG_PORT &= ~LCD_PIN_E;
+ break;
+#if USE_RW_PIN == ON
+ case LCD_RW:
+ LCD_SIG_PORT &= ~LCD_PIN_RW;
+ break;
+#endif
+ case LCD_BCKL:
+ LCD_SIG_PORT &= ~LCD_BCKL_PIN;
+ break;
+ default:
+ break;
+ }
+}
+
+static void wraper_delay_us(uint32_t delay_us)
+{
+ _delay_us((double)(delay_us));
+}
+
+static void init_LCD_SIGNAL_PINS_as_outputs(void)
+{
+#if USE_RW_PIN == ON
+ LCD_SIG_PORT_DIR |= (LCD_PIN_RS | LCD_PIN_RW | LCD_PIN_E);
+
+#else
+ LCD_SIG_PORT_DIR |= (LCD_PIN_RS | LCD_PIN_E);
+#endif
+}
diff --git a/hw/ATMEGA328P_ARDUINO_UNO_R3/src/debug.c b/examples/ATMEGA328P_ARDUINO_UNO_R3/src/debug.c
similarity index 100%
rename from hw/ATMEGA328P_ARDUINO_UNO_R3/src/debug.c
rename to examples/ATMEGA328P_ARDUINO_UNO_R3/src/debug.c
diff --git a/examples/ATMEGA328P_ARDUINO_UNO_R3/src/main.c b/examples/ATMEGA328P_ARDUINO_UNO_R3/src/main.c
new file mode 100644
index 0000000..7d4c86b
--- /dev/null
+++ b/examples/ATMEGA328P_ARDUINO_UNO_R3/src/main.c
@@ -0,0 +1,92 @@
+#include
+#include
+#include
+#include
+#include
+#include
+#include "project_config.h"
+#if DEBUG_CONSOLE == ON
+#include "debug.h"
+#endif
+#include "lcd_hd44780.h"
+
+#define SHIFT_DELAY 300
+
+const char *demo_tekst = {"Congratulation, you have just run LCD demo example."};
+const char *demo_title = {"LCD HD44780 Demo"};
+
+static void lcd_buf_slide_str_in(const char *str, enum LCD_LINES lcd_line, uint16_t speed);
+static void lcd_buf_slide_str_out(const char *str, enum LCD_LINES lcd_line, uint16_t speed);
+static void blink_backlight(uint8_t blinks_no);
+
+uint8_t j = 0;
+uint8_t i = 0;
+
+int main(void)
+{
+
+#if DEBUG_CONSOLE == ON
+ // Init the debug UART allowing us to use `printf`
+ debug_console_init();
+#endif
+ lcd_init();
+ lcd_enable_backlight();
+ lcd_buf_str(demo_title);
+ lcd_update();
+ blink_backlight(3);
+ while (1)
+ {
+ lcd_buf_slide_str_in(demo_tekst, LINE_2, SHIFT_DELAY);
+ lcd_buf_slide_str_out(demo_tekst, LINE_2, SHIFT_DELAY);
+ }
+ return 0;
+}
+
+static void lcd_buf_slide_str_out(const char *str, enum LCD_LINES lcd_line, uint16_t speed)
+{
+ uint8_t str_end_flag = 0;
+ for (j = 0; j <= strlen(str); j++)
+ {
+ _delay_ms(speed);
+ lcd_buf_locate(lcd_line, C1);
+ for (i = 0; i < LCD_X; i++)
+ {
+ if ((str[j + i] != '\0') && (str_end_flag == 0))
+ {
+ lcd_buf_char(str[j + i]);
+ }
+ else
+ {
+ str_end_flag = 0xFF;
+ lcd_buf_char(' ');
+ }
+ }
+ str_end_flag = 0;
+ lcd_update();
+ }
+}
+
+static void lcd_buf_slide_str_in(const char *str, enum LCD_LINES lcd_line, uint16_t speed)
+{
+ for (i = LCD_X - 1; i > C1; i--)
+ {
+ _delay_ms(speed);
+ lcd_buf_locate(lcd_line, i);
+ for (uint8_t j = 0; j < (LCD_X - i); j++)
+ {
+ lcd_buf_char(str[j]);
+ }
+ lcd_update();
+ }
+}
+
+static void blink_backlight(uint8_t blinks_no)
+{
+ for(uint8_t i=0; i> ~/.ssh/id_rsa_base64
+ - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
+ - chmod 600 ~/.ssh/id_rsa
+ - echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
+ - *install_compiler
+
+build_ssc:
+ <<: *build_template
+ artifacts:
+ paths:
+ - ./SSC/ssc_bin
+ expire_in: 6 mos
+ script:
+ - git clone $GITLAB_SSH_SERVER/yinling/SSC.git
+ - cd SSC
+ # ssc master branch does not support nonos any more, now checkout to the reserved branch
+ - git checkout ${SSC_DEFAULT_BRANCH}
+ - chmod +x gen_misc_non_os.sh
+ - ./gen_misc_non_os.sh
+
+build_at:
+ <<: *build_template
+ artifacts:
+ paths:
+ - ./bin/upgrade
+ - ./bin/*.bin
+ expire_in: 6 mos
+ script:
+ - cp -rf examples/at at
+ - cd at
+ - make COMPILE=gcc BOOT=new APP=1 SPI_SPEED=40 SPI_MODE=QIO SPI_SIZE_MAP=5
+
+push_master_to_github:
+ stage: deploy
+ only:
+ - master
+ - /^release\/v.*$/
+ tags:
+ - deploy
+ when: on_success
+ image: $CI_DOCKER_REGISTRY/esp8266-ci-env
+ variables:
+ GIT_STRATEGY: clone
+ GITHUB_PUSH_REFS: refs/remotes/origin/release refs/remotes/origin/master
+ script:
+ - mkdir -p ~/.ssh
+ - chmod 700 ~/.ssh
+ - echo -n $GH_PUSH_KEY > ~/.ssh/id_rsa_base64
+ - base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
+ - chmod 600 ~/.ssh/id_rsa
+ - echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
+ - git remote add github git@github.com:espressif/ESP8266_NONOS_SDK.git
+ # - git push --follow-tags github HEAD:master
+ - eval $(git for-each-ref --shell bash --format 'if [ $CI_COMMIT_SHA == %(objectname) ]; then git checkout -B %(refname:strip=3); git push --follow-tags github %(refname:strip=3); fi;' $GITHUB_PUSH_REFS)
diff --git a/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/Makefile b/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/Makefile
new file mode 100644
index 0000000..b01d653
--- /dev/null
+++ b/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/Makefile
@@ -0,0 +1,121 @@
+#############################################################
+# Required variables for each makefile
+# Discard this section from all parent makefiles
+# Expected variables (with automatic defaults):
+# CSRCS (all "C" files in the dir)
+# SUBDIRS (all subdirs with a Makefile)
+# GEN_LIBS - list of libs to be generated ()
+# GEN_IMAGES - list of object file images to be generated ()
+# GEN_BINS - list of binaries to be generated ()
+# COMPONENTS_xxx - a list of libs/objs in the form
+# subdir/lib to be extracted and rolled up into
+# a generated lib/image xxx.a ()
+#
+TARGET = eagle
+#FLAVOR = release
+FLAVOR = debug
+
+#EXTRA_CCFLAGS += -u
+
+ifndef PDIR # {
+GEN_IMAGES= eagle.app.v6.out
+GEN_BINS= eagle.app.v6.bin
+SPECIAL_MKTARGETS=$(APP_MKTARGETS)
+SUBDIRS= \
+ user
+
+endif # } PDIR
+
+APPDIR = .
+LDDIR = ../ld
+
+CCFLAGS += -Os
+
+TARGET_LDFLAGS = \
+ -nostdlib \
+ -Wl,-EL \
+ --longcalls \
+ --text-section-literals
+
+ifeq ($(FLAVOR),debug)
+ TARGET_LDFLAGS += -g -O2
+endif
+
+ifeq ($(FLAVOR),release)
+ TARGET_LDFLAGS += -g -O0
+endif
+
+COMPONENTS_eagle.app.v6 = \
+ user/libuser.a
+
+LINKFLAGS_eagle.app.v6 = \
+ -L../lib \
+ -nostdlib \
+ -T$(LD_FILE) \
+ -Wl,--no-check-sections \
+ -Wl,--gc-sections \
+ -u call_user_start \
+ -Wl,-static \
+ -Wl,--start-group \
+ -lc \
+ -lgcc \
+ -lhal \
+ -lphy \
+ -lpp \
+ -lnet80211 \
+ -llwip \
+ -lwpa \
+ -lcrypto \
+ -lmain \
+ -ldriver \
+ $(DEP_LIBS_eagle.app.v6) \
+ -Wl,--end-group
+
+DEPENDS_eagle.app.v6 = \
+ $(LD_FILE) \
+ $(LDDIR)/eagle.rom.addr.v6.ld
+
+#############################################################
+# Configuration i.e. compile options etc.
+# Target specific stuff (defines etc.) goes in here!
+# Generally values applying to a tree are captured in the
+# makefile at its root level - these are then overridden
+# for a subtree within the makefile rooted therein
+#
+
+#UNIVERSAL_TARGET_DEFINES = \
+
+# Other potential configuration flags include:
+# -DTXRX_TXBUF_DEBUG
+# -DTXRX_RXBUF_DEBUG
+# -DWLAN_CONFIG_CCX
+CONFIGURATION_DEFINES = -DICACHE_FLASH
+
+DEFINES += \
+ $(UNIVERSAL_TARGET_DEFINES) \
+ $(CONFIGURATION_DEFINES)
+
+DDEFINES += \
+ $(UNIVERSAL_TARGET_DEFINES) \
+ $(CONFIGURATION_DEFINES)
+
+
+#############################################################
+# Recursion Magic - Don't touch this!!
+#
+# Each subtree potentially has an include directory
+# corresponding to the common APIs applicable to modules
+# rooted at that subtree. Accordingly, the INCLUDE PATH
+# of a module can only contain the include directories up
+# its parent path, and not its siblings
+#
+# Required for each makefile to inherit from the parent
+#
+
+INCLUDES := $(INCLUDES) -I $(PDIR)include
+PDIR := ../$(PDIR)
+sinclude $(PDIR)Makefile
+
+.PHONY: FORCE
+FORCE:
+
diff --git a/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/build.bat b/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/build.bat
new file mode 100644
index 0000000..8dd23ed
--- /dev/null
+++ b/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/build.bat
@@ -0,0 +1,31 @@
+
+
+@echo off
+set PATH=C:/msys32/xtensa-lx106-elf/bin;C:/msys32/usr/bin;C:/msys32/mingw32/bin
+echo =======================================================================
+echo UPDATING LIBRARY FILES
+echo =======================================================================
+if not exist user (
+ call mkdir user
+) else (
+ echo folder "user" exist
+)
+copy "..\..\..\src\lcd_hd44780.c" "user\"
+
+if not exist include (
+ call mkdir include
+ echo folder "include" created
+) else (
+ echo folder "include" exist
+)
+
+echo Copy files to include\lcd_hd44780\
+copy "..\..\..\src\lcd_hd44780.h" "include\"
+copy "..\..\..\src\lcd_hd44780_interface.h" "include\"
+copy "..\..\..\src\lcd_hd44780_def_char.h" "include\"
+copy "..\..\..\src\lcd_hd44780_config.h" "include\"
+echo =======================================================================
+echo BUILD PROJECT
+echo =======================================================================
+
+call make COMPILE=gcc BOOT=new APP=1 SPI_SPEED=40 SPI_MODE=DIO SPI_SIZE_MAP=6 all
\ No newline at end of file
diff --git a/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/build.sh b/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/build.sh
new file mode 100644
index 0000000..e3fe887
--- /dev/null
+++ b/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/build.sh
@@ -0,0 +1,7 @@
+#!/bin/bash -x
+echo "make_lib.sh version 20160307"
+
+# $env:PATH = "C:/msys32/xtensa-lx106-elf/bin;C:/msys32/usr/bin;C:/msys32/mingw32/bin";
+export PATH="C:/msys32/xtensa-lx106-elf/bin;C:/msys32/usr/bin;C:/msys32/mingw32/bin"
+make clean
+make COMPILE=gcc BOOT=new APP=1 SPI_SPEED=40 SPI_MODE=DIO SPI_SIZE_MAP=6 all
\ No newline at end of file
diff --git a/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/clean.bat b/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/clean.bat
new file mode 100644
index 0000000..31df2a9
--- /dev/null
+++ b/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/clean.bat
@@ -0,0 +1,8 @@
+
+
+@echo off
+set PATH=C:/msys32/xtensa-lx106-elf/bin;C:/msys32/usr/bin;C:/msys32/mingw32/bin
+echo =======================================================================
+echo CLEAN PROJECT
+echo =======================================================================
+call make clean
\ No newline at end of file
diff --git a/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/include/lcd_hd44780.h b/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/include/lcd_hd44780.h
new file mode 100644
index 0000000..d239d50
--- /dev/null
+++ b/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/include/lcd_hd44780.h
@@ -0,0 +1,62 @@
+/*
+ * @Author: lukasz.niewelt
+ * @Date: 2023-12-06 21:40:29
+ * @Last Modified by: lukasz.niewelt
+ * @Last Modified time: 2024-01-10 14:00:22
+ */
+
+#ifndef _LCD_HD_44780_H_
+#define _LCD_HD_44780_H_
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+#include
+#include "lcd_hd44780_config.h"
+#include "lcd_hd44780_interface.h"
+#include "lcd_hd44780_def_char.h"
+
+ enum alignment
+ {
+ left,
+ right
+ };
+
+ extern bool LCD_UPDATE_EVENT;
+
+ void lcd_init(void);
+ void lcd_enable_backlight(void);
+ void lcd_disable_backlight(void);
+ void lcd_cls(void);
+
+ void lcd_def_char(const uint8_t CGRAM_bank_x_char_adr, const uint8_t *def_char);
+ void lcd_load_char_bank(const struct char_bank_struct *char_bank);
+
+ void lcd_char(const char C);
+ void lcd_str(const char *str);
+ void lcd_int(int val, uint8_t width, enum alignment alignment);
+ void lcd_hex(int val, uint8_t width, enum alignment alignment);
+ void lcd_bin(int val, uint8_t width);
+
+ void lcd_locate(enum LCD_LINES y, enum LCD_COLUMNS x);
+
+ void lcd_home(void);
+ void lcd_cursor_on(void);
+ void lcd_cursor_off(void);
+ void lcd_blinking_cursor_on(void);
+
+ void lcd_buf_cls(void);
+ void lcd_buf_char(const char c);
+ void lcd_buf_locate(enum LCD_LINES y, enum LCD_COLUMNS x);
+ void lcd_buf_str(const char *str);
+ void lcd_update(void);
+
+ void lcd_buf_int(int val, uint8_t width, enum alignment alignment);
+ void lcd_buf_hex(int val, uint8_t width, enum alignment alignment);
+ void lcd_buf_bin(int val, uint8_t width);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _LCD_HD_44780_H_ */
\ No newline at end of file
diff --git a/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/include/lcd_hd44780_config.h b/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/include/lcd_hd44780_config.h
new file mode 100644
index 0000000..4e9b234
--- /dev/null
+++ b/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/include/lcd_hd44780_config.h
@@ -0,0 +1,110 @@
+/*
+ * @Author: lukasz.niewelt
+ * @Date: 2023-12-06 21:38:27
+ * @Last Modified by: lukasz.niewelt
+ * @Last Modified time: 2024-01-09 21:20:52
+ */
+
+#ifndef _LCD_HD44780_CONFIG_H_
+#define _LCD_HD44780_CONFIG_H_
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+ // clang-format off
+#define ON 1
+#define OFF 0
+#define HIGH 1
+#define LOW 0
+
+/************************************ LCD HARDWARE SETTINGS *******************************
+ * LCD_TYPE -> Set one of the predefined types:
+ * 2004 -> 4 lines 20 characters per line
+ * 1604 -> 4 lines 16 characters per line
+ * 1602 -> 2 lines 16 characters per line
+ * USE_RW_PIN -> Defines HW connection between LCD and uC
+ * ON - when the RW pin is connected
+ * OFF - when the RW pin is not connected
+ ********************************************************************************************/
+#define LCD_TYPE 1602
+#define USE_RW_PIN OFF
+
+#define LCD_BCKL_PIN_EN_STATE HIGH
+
+#define LCD_BUFFERING ON
+
+//definitions of Line and column labels for lcd_locate
+enum LCD_LINES
+{
+ LINE_1,
+ LINE_2,
+ #if ((LCD_TYPE==2004) ||(LCD_TYPE ==1604))
+ LINE_3,
+ LINE_4,
+#endif
+};
+enum LCD_COLUMNS{
+ C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,
+#if LCD_TYPE==2004
+ C17,C18,C19,C20
+#endif
+};
+
+/******************************** LCD LIBRARY COMPILATION SETTINGS ************************
+ * Setting USE_(procedure name) to:
+ * ON - add specific procedure to compilation
+ * OFF - exclude specific procedure from compilation
+********************************************************************************************/
+#define USE_DEF_CHAR_FUNCTION ON
+#define USE_LCD_INT ON
+#define USE_LCD_HEX ON
+#define USE_LCD_BIN ON
+
+#define USE_LCD_CURSOR_HOME ON
+#define USE_LCD_CURSOR_ON ON
+#define USE_LCD_CURSOR_OFF ON
+#define USE_LCD_BLINKING_CURSOR_ON ON
+
+#if LCD_BUFFERING == ON
+#define USE_LCD_BUF_INT ON
+#define USE_LCD_BUF_HEX ON
+#define USE_LCD_BUF_BIN ON
+#endif
+
+
+/******************** definitions of Line address for different LCD screens ****************/
+//https://web.alfredstate.edu/faculty/weimandn/lcd/lcd_addressing/lcd_addressing_index.html
+
+#if LCD_TYPE ==1604
+#define LCD_Y 4
+#define LCD_X 16
+#define LCD_LINE1_ADR 0x00
+#define LCD_LINE2_ADR 0x40
+#define LCD_LINE3_ADR 0x10
+#define LCD_LINE4_ADR 0x50
+#endif
+
+#if LCD_TYPE==2004
+#define LCD_Y 4
+#define LCD_X 20
+#define LCD_LINE1_ADR 0x00
+#define LCD_LINE2_ADR 0x40
+#define LCD_LINE3_ADR 0x14
+#define LCD_LINE4_ADR 0x54
+#endif
+
+#if LCD_TYPE==1602
+#define LCD_Y 2
+#define LCD_X 16
+#define LCD_LINE1_ADR 0x00
+#define LCD_LINE2_ADR 0x40
+#endif
+
+ // clang-format on
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _LCD_HD44780_CONFIG_H_ */
diff --git a/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/include/lcd_hd44780_def_char.h b/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/include/lcd_hd44780_def_char.h
new file mode 100644
index 0000000..6156113
--- /dev/null
+++ b/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/include/lcd_hd44780_def_char.h
@@ -0,0 +1,93 @@
+/*
+ * @Author: lukasz.niewelt
+ * @Date: 2023-12-08 11:15:52
+ * @Last Modified by: lukasz.niewelt
+ * @Last Modified time: 2023-12-13 13:17:53
+ */
+
+#ifndef _LCD_HD44780_DEF_CHAR_H_
+#define _LCD_HD44780_DEF_CHAR_H_
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+ struct char_bank_struct
+ {
+ const uint8_t *char_0;
+ const uint8_t *char_1;
+ const uint8_t *char_2;
+ const uint8_t *char_3;
+ const uint8_t *char_4;
+ const uint8_t *char_5;
+ const uint8_t *char_6;
+ const uint8_t *char_7;
+ };
+
+#if USE_DEF_CHAR_FUNCTION == ON
+#define LCD_CGRAM_BYTES_PER_CHAR 8
+#define DEF_CHAR_ADR_MASK 7
+ /**********************USER CHAR DEFINITIONS START*******************************/
+ /******To sace flash when using defchar comment char definitions that are unused*/
+ static const uint8_t Pol_e[8] = {32, 32, 14, 17, 31, 16, 14, 3};
+ static const uint8_t Pol_o[8] = {2, 4, 14, 17, 17, 17, 14, 0};
+ static const uint8_t Pol_s[8] = {2, 4, 14, 16, 14, 1, 30, 32};
+ static const uint8_t Pol_l[8] = {12, 4, 6, 12, 4, 4, 14, 32};
+ static const uint8_t Pol_c[8] = {2, 4, 14, 16, 16, 17, 14, 32};
+ static const uint8_t Pol_a[8] = {32, 32, 14, 1, 15, 17, 15, 3};
+ static const uint8_t Pol_n[8] = {2, 4, 22, 25, 17, 17, 17, 0};
+ static const uint8_t Zn_wody[8] = {0, 0, 0, 6, 9, 2, 4, 15};
+ // here add "definition" of new chars
+ /**********************USER CHAR DEFINITIONS END********************************/
+
+ /**********************USER CHAR CGRAM BANKS DEFINITIONS START*******************/
+ static const struct char_bank_struct lcd_cgram_bank_1 = {
+ Pol_e,
+ Pol_o,
+ Pol_s,
+ Pol_l,
+ Pol_c,
+ Pol_a,
+ Pol_n,
+ Zn_wody};
+ enum LCD_CGRAM_BANK_1
+ {
+ pol_e,
+ pol_o,
+ pol_s,
+ pol_l,
+ pol_c,
+ pol_a,
+ pol_n,
+ zn_wody,
+ };
+ // //here define new bank with adreses for chars that you want load to this specifci bank
+ // static const struct char_bank_struct lcd_cgram_bank_x = {
+ // Pol_e,
+ // Pol_o,
+ // Pol_s,
+ // Pol_l,
+ // Pol_c,
+ // Pol_a,
+ // Pol_n,
+ // Zn_wody};
+ // // here define labels for lcd_cgram_bank_x
+ // enum LCD_CGRAM_BANK_x
+ // {
+ // pol_e_bank_x,
+ // pol_o_bank_x,
+ // pol_s_bank_x,
+ // pol_l_bank_x,
+ // pol_c_bank_x,
+ // pol_a_bank_x,
+ // pol_n_bank_x,
+ // zn_wody_bank_x,
+ // };
+ /**********************USER CHAR CGRAM BANKS DEFINITIONS END*********************/
+
+#endif // USE_DEF_CHAR_FUNC
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /*_LCD_HD44780_DEF_CHAR_H_*/
\ No newline at end of file
diff --git a/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/include/lcd_hd44780_interface.h b/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/include/lcd_hd44780_interface.h
new file mode 100644
index 0000000..2b7d99a
--- /dev/null
+++ b/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/include/lcd_hd44780_interface.h
@@ -0,0 +1,51 @@
+/*
+ * @Author: lukasz.niewelt
+ * @Date: 2023-12-06 21:38:59
+ * @Last Modified by: lukasz.niewelt
+ * @Last Modified time: 2023-12-07 12:46:27
+ */
+
+#ifndef _LCD_HD44780_INTERFACE_H_
+#define _LCD_HD44780_INTERFACE_H_
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+#include
+ enum lcd_sig
+ {
+ LCD_RS,
+ LCD_RW,
+ LCD_E,
+ LCD_BCKL,
+ };
+
+ typedef void (*init_LCD_data_and_SIG_pins_func_p)(void);
+ typedef void (*set_LCD_data_pins_as_outputs_func_p)(void);
+ typedef void (*set_LCD_data_pins_as_inputs_func_p)(void);
+ typedef void (*set_LCD_data_port_func_p)(uint8_t data);
+ typedef uint8_t (*get_LCD_data_port_func_p)(void);
+ typedef void (*set_LCD_SIG_func_p)(enum lcd_sig LCD_SIG);
+ typedef void (*reset_LCD_SIG_func_p)(enum lcd_sig LCD_SIG);
+ typedef void (*delay_us_func_p)(uint32_t delay_us);
+
+ struct LCD_IO_driver_interface_struct
+ {
+ init_LCD_data_and_SIG_pins_func_p init_LCD_pins;
+ set_LCD_data_pins_as_outputs_func_p set_data_pins_as_outputs;
+ set_LCD_data_pins_as_inputs_func_p set_data_pins_as_inputs;
+ set_LCD_data_port_func_p write_data;
+ get_LCD_data_port_func_p read_data;
+ set_LCD_SIG_func_p set_SIG;
+ reset_LCD_SIG_func_p reset_SIG;
+ delay_us_func_p delay_us;
+ };
+ // clang-format off
+ const struct LCD_IO_driver_interface_struct* LCD_IO_driver_interface_get(void);
+ // clang-format on
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _LCD_HD_44780_H_ */
\ No newline at end of file
diff --git a/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/include/user_config.h b/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/include/user_config.h
new file mode 100644
index 0000000..3edc1ee
--- /dev/null
+++ b/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/include/user_config.h
@@ -0,0 +1,29 @@
+/*
+ * ESPRESSIF MIT License
+ *
+ * Copyright (c) 2016
+ *
+ * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case,
+ * it is 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 all 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, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * 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.
+ *
+ */
+
+#ifndef __USER_CONFIG_H__
+#define __USER_CONFIG_H__
+
+#endif
+
diff --git a/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/user/LCD_IO_driver_interface.c b/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/user/LCD_IO_driver_interface.c
new file mode 100644
index 0000000..69183db
--- /dev/null
+++ b/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/user/LCD_IO_driver_interface.c
@@ -0,0 +1,235 @@
+/*
+ * @Author: lukasz.niewelt
+ * @Date: 2023-12-07 15:51:41
+ * @Last Modified by: lukasz.niewelt
+ * @Last Modified time: 2023-12-08 00:34:48
+ */
+#include
+#include "lcd_hd44780_interface.h"
+#include "lcd_hd44780_config.h"
+#include "user_interface.h"
+#include "ets_sys.h"
+#include "osapi.h"
+// #include "..\gpio.h"
+
+
+// clang-format off
+#define ON 1
+#define OFF 0
+
+/*********************************Define hardware connection in your project*******************************/
+// ToDo define here name of lcd PINS and it's hardware represetation
+#define LCD_D5_MUX PERIPHS_IO_MUX_MTDI_U
+#define LCD_D5_PIN BIT12
+#define LCD_D5_FUNC FUNC_GPIO12
+
+#define LCD_D6_MUX PERIPHS_IO_MUX_MTCK_U
+#define LCD_D6_PIN BIT13
+#define LCD_D6_FUNC FUNC_GPIO13
+
+#define LCD_D4_MUX PERIPHS_IO_MUX_MTMS_U
+#define LCD_D4_PIN BIT14
+#define LCD_D4_FUNC FUNC_GPIO14
+
+#define LCD_D7_MUX PERIPHS_IO_MUX_MTDO_U
+#define LCD_D7_PIN BIT15
+#define LCD_D7_FUNC FUNC_GPIO15
+
+#define LCD_BCKL_MUX PERIPHS_IO_MUX_GPIO4_U
+#define LCD_BCKL_PIN BIT4
+#define LCD_BCKL_FUNC FUNC_GPIO4
+
+#define LCD_E_MUX PERIPHS_IO_MUX_U0TXD_U
+#define LCD_E_PIN BIT1
+#define LCD_E_FUNC FUNC_GPIO1
+
+#define LCD_RS_MUX PERIPHS_IO_MUX_U0RXD_U
+#define LCD_RS_PIN BIT3
+#define LCD_RS_FUNC FUNC_GPIO3
+
+/****************************END OFF define hardware connection in your application***********************/
+
+#define LCD_D4_MASK 0x01
+#define LCD_D5_MASK 0x02
+#define LCD_D6_MASK 0x04
+#define LCD_D7_MASK 0x08
+// clang-format on
+
+static void init_LCD_data_and_SIG_pins(void);
+static void set_LCD_DATA_PINS_as_outputs(void);
+static void set_LCD_DATA_PINS_as_inputs(void);
+static void set_LCD_DATA_PINS_state(uint8_t data);
+static uint8_t get_LCD_DATA_PINS_state(void);
+static void LCD_set_SIG(enum lcd_sig LCD_SIG);
+static void LCD_reset_SIG(enum lcd_sig LCD_SIG);
+static void wraper_delay_us(uint32_t delay_us);
+// static void init_LCD_SIGNAL_PINS_as_outputs(void);
+// static void init_LCD_BCKL_PIN_as_output(void);
+
+/************LCD_IO_driver_interface implementation START**************/
+static const struct LCD_IO_driver_interface_struct LCD_IO_driver = {
+ init_LCD_data_and_SIG_pins,
+ set_LCD_DATA_PINS_as_outputs,
+ set_LCD_DATA_PINS_as_inputs,
+ set_LCD_DATA_PINS_state,
+ get_LCD_DATA_PINS_state,
+ LCD_set_SIG,
+ LCD_reset_SIG,
+ wraper_delay_us,
+};
+const struct LCD_IO_driver_interface_struct *LCD_IO_driver_interface_get(void)
+{
+ return &LCD_IO_driver;
+}
+
+/*************LCD_IO_driver_interface implementation END***************/
+
+static void init_LCD_data_and_SIG_pins(void)
+{
+ PIN_FUNC_SELECT(LCD_RS_MUX,LCD_RS_FUNC);
+ PIN_FUNC_SELECT(LCD_E_MUX,LCD_E_FUNC);
+ PIN_FUNC_SELECT(LCD_D4_MUX,LCD_D4_FUNC);
+ PIN_FUNC_SELECT(LCD_D5_MUX,LCD_D5_FUNC);
+ PIN_FUNC_SELECT(LCD_D6_MUX,LCD_D6_FUNC);
+ PIN_FUNC_SELECT(LCD_D7_MUX,LCD_D7_FUNC);
+ PIN_FUNC_SELECT(LCD_BCKL_MUX,LCD_BCKL_FUNC);
+ gpio_output_set(0,
+ LCD_D4_PIN|LCD_D5_PIN|LCD_D6_PIN|LCD_D7_PIN|LCD_RS_PIN|LCD_E_PIN|LCD_BCKL_PIN,
+ LCD_D4_PIN|LCD_D5_PIN|LCD_D6_PIN|LCD_D7_PIN|LCD_RS_PIN|LCD_E_PIN|LCD_BCKL_PIN,
+ 0);
+
+}
+
+static void set_LCD_DATA_PINS_as_outputs(void)
+{
+// configure LCD_D4, LCD_D5, LCD_D6, LCD_D7 as output
+ gpio_output_set(
+ 0,
+ LCD_D4_PIN|LCD_D5_PIN|LCD_D6_PIN|LCD_D7_PIN,
+ LCD_D4_PIN|LCD_D5_PIN|LCD_D6_PIN|LCD_D7_PIN,
+ 0);
+
+}
+static void set_LCD_DATA_PINS_as_inputs(void)
+{
+// configure LCD_D4, LCD_D5, LCD_D6, LCD_D7 as input
+ gpio_output_set(
+ 0,
+ 0,
+ 0,
+ LCD_D4_PIN|LCD_D5_PIN|LCD_D6_PIN|LCD_D7_PIN);
+}
+
+static void set_LCD_DATA_PINS_state(uint8_t data)
+{
+ if ((data & LCD_D4_MASK))
+ //Set LCD_D4 to HIGH
+ gpio_output_set(LCD_D4_PIN,0,LCD_D4_PIN, 0);
+ else
+ //Set LCD_D4 to LOW
+ gpio_output_set(0,LCD_D4_PIN,LCD_D4_PIN, 0);
+
+ if ((data & LCD_D5_MASK))
+ //set LCD_D5 to HIGH
+ gpio_output_set(LCD_D5_PIN,0,LCD_D5_PIN, 0);
+ else
+ //Set LCD_D5 to LOW
+ gpio_output_set(0,LCD_D5_PIN,LCD_D5_PIN, 0);
+
+ if ((data & LCD_D6_MASK))
+ // Set LCD_D6 to HIGH
+ gpio_output_set(LCD_D6_PIN,0,LCD_D6_PIN, 0);
+ else
+ //Set LCD_D6 to LOW
+ gpio_output_set(0,LCD_D6_PIN,LCD_D6_PIN, 0);
+ if ((data & LCD_D7_MASK))
+ //Set LCD_D7 to HIGH
+ gpio_output_set(LCD_D7_PIN,0,LCD_D7_PIN, 0);
+ else
+ //Set LCD_D7 to LOW
+ gpio_output_set(0,LCD_D7_PIN,LCD_D7_PIN, 0);
+}
+
+static uint8_t get_LCD_DATA_PINS_state(void)
+{
+ // uint8_t data = 0;
+ // // if (LCD_D4 input port is set to HIGH)
+ // data = LCD_D4_MASK;
+ // // if (LCD_D5 input port is set to HIGH)
+ // data |= LCD_D5_MASK;
+ // // if (LCD_D6 input port is set to HIGH)
+ // data |= LCD_D6_MASK;
+ // // if (LCD_D7 input port is set to HIGH)
+ // data |= LCD_D7_MASK;
+ // return data;
+}
+
+static void LCD_set_SIG(enum lcd_sig LCD_SIG)
+{
+ switch (LCD_SIG)
+ {
+ case LCD_RS:
+ // Set LCD_RS to High
+ gpio_output_set(LCD_RS_PIN,0,LCD_RS_PIN, 0);
+ break;
+ case LCD_E:
+ // Set LCD_E to High
+ gpio_output_set(LCD_E_PIN,0,LCD_E_PIN, 0);
+ break;
+#if USE_RW_PIN == ON
+ case LCD_RW:
+ // Set LCD_RW to High
+ gpio_output_set(LCD_RW_PIN,0,LCD_RW_PIN, 0);
+ break;
+#endif
+ case LCD_BCKL:
+ // Set LCD_BCKL to High
+ gpio_output_set(LCD_BCKL_PIN,0,LCD_BCKL_PIN, 0);
+ break;
+ default:
+ break;
+ }
+}
+
+static void LCD_reset_SIG(enum lcd_sig LCD_SIG)
+{
+ switch (LCD_SIG)
+ {
+ case LCD_RS:
+ // Set LCD_RS to LOW
+ gpio_output_set(0,LCD_RS_PIN,LCD_RS_PIN, 0);
+ break;
+ case LCD_E:
+ // Set LCD_E to LOW
+ gpio_output_set(0,LCD_E_PIN,LCD_E_PIN, 0);
+ break;
+#if USE_RW_PIN == 1
+ case LCD_RW:
+ // Set LCD_RW to LOW
+ gpio_output_set(0,LCD_RW_PIN,LCD_RW_PIN, 0);
+ break;
+#endif
+ case LCD_BCKL:
+ // Set LCD_BCKL to LOW
+ gpio_output_set(0,LCD_BCKL_PIN,LCD_BCKL_PIN,0);
+ break;
+ default:
+ break;
+ }
+}
+
+static void wraper_delay_us(uint32_t delay_us)
+{
+ // ToDo update wraper
+ os_delay_us((uint16_t)(delay_us));
+}
+
+// static void init_LCD_SIGNAL_PINS_as_outputs(void)
+// {
+// // Initialize LCD_E LCD_RS and optionl LCD_RW GPIOs as outputs
+// }
+
+// static void init_LCD_BCKL_PIN_as_output(void)
+// {
+// // Initialize LCD_BCKL GPIO as outputs
+// }
diff --git a/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/user/Makefile b/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/user/Makefile
new file mode 100644
index 0000000..639fe9b
--- /dev/null
+++ b/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/user/Makefile
@@ -0,0 +1,45 @@
+
+#############################################################
+# Required variables for each makefile
+# Discard this section from all parent makefiles
+# Expected variables (with automatic defaults):
+# CSRCS (all "C" files in the dir)
+# SUBDIRS (all subdirs with a Makefile)
+# GEN_LIBS - list of libs to be generated ()
+# GEN_IMAGES - list of images to be generated ()
+# COMPONENTS_xxx - a list of libs/objs in the form
+# subdir/lib to be extracted and rolled up into
+# a generated lib/image xxx.a ()
+#
+ifndef PDIR
+GEN_LIBS = libuser.a
+endif
+
+
+#############################################################
+# Configuration i.e. compile options etc.
+# Target specific stuff (defines etc.) goes in here!
+# Generally values applying to a tree are captured in the
+# makefile at its root level - these are then overridden
+# for a subtree within the makefile rooted therein
+#
+#DEFINES +=
+
+#############################################################
+# Recursion Magic - Don't touch this!!
+#
+# Each subtree potentially has an include directory
+# corresponding to the common APIs applicable to modules
+# rooted at that subtree. Accordingly, the INCLUDE PATH
+# of a module can only contain the include directories up
+# its parent path, and not its siblings
+#
+# Required for each makefile to inherit from the parent
+#
+
+INCLUDES := $(INCLUDES) -I $(PDIR)include
+INCLUDES += -I ./
+INCLUDES += -I ../../include/ets
+PDIR := ../$(PDIR)
+sinclude $(PDIR)Makefile
+
diff --git a/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/user/lcd_hd44780.c b/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/user/lcd_hd44780.c
new file mode 100644
index 0000000..985c2a2
--- /dev/null
+++ b/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/user/lcd_hd44780.c
@@ -0,0 +1,947 @@
+/*
+ * @Author: lukasz.niewelt
+ * @Date: 2023-12-06 21:39:30
+ * @Last Modified by: lukasz.niewelt
+ * @Last Modified time: 2024-01-10 18:04:17
+ */
+
+#include "lcd_hd44780.h"
+#include
+#include
+#include
+#include
+
+typedef char lcd_pos_t;
+// clang-format off
+#define BUSY_FLAG 1 << 7
+#define VAL_PREFIX_LENGHT 2U
+
+// LCD driver commands
+#define LCDC_CLS 0x01
+#define LCDC_HOME 0x02
+/********************************/
+#define LCDC_ENTRY_MODE 0x04
+ #define LCDC_ENTRYR 0x02
+ #define LCDC_ENTRYL 0x00
+ #define LCDC_MOVE 0x01
+/********************************/
+#define LCDC_ONOFF 0x08
+ #define LCDC_DISPLAYON 0x04
+ #define LCDC_CURSORON 0x02
+ #define LCDC_CURSOROFF 0x00
+ #define LCDC_BLINKON 0x01
+/********************************/
+#define LCDC_SHIFT 0x10
+ #define LCDC_SHIFTDISP 0x08
+ #define LCDC_SHIFTR 0x04
+ #define LCDC_SHIFTL 0x00
+/********************************/
+#define LCDC_FUNC 0x20
+ #define LCDC_FUNC8B 0x10
+ #define LCDC_FUNC4B 0x00
+ #define LCDC_FUNC2L 0x08
+ #define LCDC_FUNC1L 0x00
+ #define LCDC_FUNC5x10 0x04
+ #define LCDC_FUNC5x7 0x00
+/********************************/
+#define LCDC_SET_CGRAM 0x40
+#define LCDC_SET_DDRAM 0x80
+
+#ifndef UNIT_TEST
+#define PRIVATE static
+#else
+#define PRIVATE
+#endif
+
+#if LCD_BUFFERING == ON
+
+#define LAST_CHAR_IN_LCD_LINE (LCD_X-1)
+#define LAST_LCD_LINE (LCD_Y-1)
+
+PRIVATE char lcd_buffer[LCD_Y][LCD_X];
+PRIVATE char prev_lcd_buffer[LCD_Y][LCD_X];
+
+static lcd_pos_t *lcd_buf_position_ptr;
+#endif
+
+static const struct LCD_IO_driver_interface_struct *LCD = NULL;
+bool LCD_UPDATE_EVENT = false;
+
+static void register_LCD_IO_driver(void);
+static void lcd_set_all_SIG(void);
+static void lcd_reset_all_SIG(void);
+static void lcd_write_4bit_data(uint8_t data);
+static void lcd_write_cmd(uint8_t cmd);
+static void lcd_write_data(uint8_t data);
+static void lcd_write_byte(uint8_t byte);
+
+#if USE_RW_PIN == ON
+static uint8_t lcd_read_byte(void);
+static uint8_t lcd_read_4bit_data(void);
+#endif
+#ifdef AVR
+#if ((USE_LCD_INT == ON) || (USE_LCD_HEX == ON))
+static void lcd_put_spaces(uint8_t empty_spaces);
+#endif
+#if USE_LCD_INT == ON
+static void lcd_int_AVR(int val, uint8_t width, enum alignment alignment);
+#endif
+#if USE_LCD_HEX == ON
+static void lcd_hex_AVR(int val, uint8_t width, enum alignment alignment);
+#endif
+#if USE_LCD_BIN == ON
+static void lcd_bin_AVR(int val, uint8_t width);
+#endif
+#if LCD_BUFFERING == ON
+#if ((USE_LCD_BUF_INT == ON) || (USE_LCD_BUF_HEX == ON))
+static void lcd_buf_put_spaces(uint8_t empty_spaces);
+#endif
+#if USE_LCD_BUF_INT == ON
+static void lcd_buf_int_AVR(int val, uint8_t width, enum alignment alignment);
+#endif
+#if USE_LCD_BUF_HEX == ON
+static void lcd_buf_hex_AVR(int val, uint8_t width, enum alignment alignment);
+#endif
+#if USE_LCD_BUF_BIN == ON
+static void lcd_buf_bin_AVR(int val, uint8_t width);
+#endif
+#endif
+#else
+#if (USE_LCD_BIN == ON || ((LCD_BUFFERING == ON) && (LCD_USE_BUF_BIN == ON)))
+static void fill_bin_value_buffer(int val, char *bin_val_buffer);
+static void fill_zeros_buffer(const char *buffer, uint8_t width, char *zeros_buf);
+#endif
+#endif
+#if LCD_BUFFERING==ON
+static void check_lcd_buf_possition_ptr_overflow(void);
+static void copy_lcd_buf_2_prev_lcd_buf(void);
+static void update_lcd_curosr_possition(uint8_t *lcd_cursor_position,uint8_t *lcd_line, uint8_t *missed_char_counter_in_LCD_line);
+static void write_lcd_buf_2_lcd(const uint8_t *lcd_cursor_position,const uint8_t *lcd_line,uint8_t * missed_char_counter_in_LCD_line, const lcd_pos_t *prev_lcd_buff_pos_ptr);
+#endif
+
+static void register_LCD_IO_driver(void)
+{
+ LCD = LCD_IO_driver_interface_get();
+}
+
+static void lcd_set_all_SIG(void)
+{
+ LCD->set_SIG(LCD_E);
+ LCD->set_SIG(LCD_RS);
+#if USE_RW_PIN == ON
+ LCD->set_SIG(LCD_RW);
+#endif
+}
+
+static void lcd_reset_all_SIG(void)
+{
+#if USE_RW_PIN == ON
+ LCD->reset_SIG(LCD_RW);
+#endif
+ LCD->reset_SIG(LCD_RS);
+ LCD->reset_SIG(LCD_E);
+}
+
+void lcd_write_4bit_data(uint8_t data)
+{
+ LCD->set_SIG(LCD_E);
+ data &= 0x0F;
+ LCD->write_data(data);
+ LCD->reset_SIG(LCD_E);
+}
+
+static void lcd_write_cmd(uint8_t cmd)
+{
+ LCD->reset_SIG(LCD_RS);
+ lcd_write_byte(cmd);
+}
+
+void lcd_write_data(uint8_t data)
+{
+ LCD->set_SIG(LCD_RS);
+ lcd_write_byte(data);
+}
+
+void lcd_write_byte(uint8_t byte)
+{
+#if USE_RW_PIN == ON
+ LCD->reset_SIG(LCD_RW);
+#endif
+ lcd_write_4bit_data((byte) >> 4);
+ lcd_write_4bit_data((byte) & 0x0F);
+#if USE_RW_PIN == ON
+ // check_BUSSY_FALG
+ LCD->set_data_pins_as_inputs();
+ LCD->reset_SIG(LCD_RS);
+ LCD->set_SIG(LCD_RW);
+ while (lcd_read_byte() & BUSY_FLAG)
+ {
+ }
+ LCD->reset_SIG(LCD_RW);
+ LCD->set_data_pins_as_outputs();
+
+#else
+ LCD->delay_us(120);
+#endif
+}
+
+#if USE_RW_PIN == ON
+uint8_t lcd_read_byte(void)
+{
+ uint8_t data;
+ // read 4 MSB
+ data = (lcd_read_4bit_data() << 4);
+ // read 4 LSB
+ data |= (lcd_read_4bit_data() & 0x0F);
+ return data;
+}
+
+uint8_t lcd_read_4bit_data(void)
+{
+ uint8_t data;
+ LCD->set_SIG(LCD_E);
+ data = LCD->read_data();
+ LCD->reset_SIG(LCD_E);
+ return data;
+}
+#endif
+#ifdef AVR
+#if ((USE_LCD_INT == ON) || (USE_LCD_HEX == ON))
+static void lcd_put_spaces(uint8_t empty_spaces)
+{
+ for (uint8_t i = 0; i < empty_spaces; i++)
+ {
+ lcd_char(' ');
+ }
+}
+#endif
+#if USE_LCD_INT == ON
+static void lcd_int_AVR(int val, uint8_t width, enum alignment alignment)
+{
+ uint8_t buf_lenght = 0;
+ char buffer[20]; // 19chars for 64 bit int + end char '\0'
+ buffer[0] = '\0';
+ itoa(val, buffer, 10);
+ buf_lenght = strlen(buffer);
+ if (buf_lenght >= (width))
+ {
+ lcd_str(buffer);
+ }
+ else
+ {
+ uint8_t empty_spaces_qty = width - buf_lenght;
+ if (alignment == right)
+ {
+ lcd_put_spaces(empty_spaces_qty);
+ lcd_str(buffer);
+ }
+ else
+ {
+ lcd_str(buffer);
+ lcd_put_spaces(empty_spaces_qty);
+ }
+ }
+}
+#endif
+#if USE_LCD_HEX == ON
+static void lcd_hex_AVR(int val, uint8_t width, enum alignment alignment)
+{
+ char buffer[17];
+ buffer[0] = '\0';
+ itoa(val, buffer, 16);
+ static const char *prefix = {"0x"};
+ if (width <= (strlen(buffer) + VAL_PREFIX_LENGHT))
+ {
+ lcd_str(prefix);
+ lcd_str(buffer);
+ }
+ else
+ {
+ uint8_t empty_spaces_qty = width - (VAL_PREFIX_LENGHT + strlen(buffer));
+
+ if (alignment == right)
+ {
+ lcd_put_spaces(empty_spaces_qty);
+ lcd_str(prefix);
+ lcd_str(buffer);
+ }
+ else
+ {
+ lcd_str(prefix);
+ lcd_str(buffer);
+ lcd_put_spaces(empty_spaces_qty);
+ }
+ }
+}
+#endif
+#if USE_LCD_BIN == ON
+static void lcd_bin_AVR(int val, uint8_t width)
+{
+ char buffer[35]; // 0b 0000 0000 0000 0000 0000 0000 0000 0000
+ static const char *prefix = {"0b"};
+ buffer[0] = '\0';
+
+ itoa(val, buffer, 2);
+ // if (buf_lenght < (width - VAL_PREFIX_LENGHT))
+ if (width <= (strlen(buffer) + VAL_PREFIX_LENGHT))
+ {
+ lcd_str(prefix);
+ lcd_str(buffer);
+ }
+ else
+ {
+ uint8_t zeros_qty = (width - (VAL_PREFIX_LENGHT + strlen(buffer)));
+ lcd_str(prefix);
+ for (uint8_t i = 0; i < zeros_qty; i++)
+ {
+ lcd_char('0');
+ }
+ lcd_str(buffer);
+ }
+}
+#endif
+
+#if LCD_BUFFERING== ON
+#if ((USE_LCD_BUF_INT == ON) || (USE_LCD_BUF_HEX == ON))
+static void lcd_buf_put_spaces(uint8_t empty_spaces)
+{
+ for (uint8_t i = 0; i < empty_spaces; i++)
+ {
+ lcd_buf_char(' ');
+ }
+}
+#endif
+#if USE_LCD_BUF_INT == ON
+static void lcd_buf_int_AVR(int val, uint8_t width, enum alignment alignment)
+{
+ uint8_t buf_lenght = 0;
+ char buffer[20]; // 19chars for 64 bit int + end char '\0'
+ buffer[0] = '\0';
+ itoa(val, buffer, 10);
+ buf_lenght = strlen(buffer);
+ if (buf_lenght >= (width))
+ {
+ lcd_buf_str(buffer);
+ }
+ else
+ {
+ uint8_t empty_spaces_qty = width - buf_lenght;
+ if (alignment == right)
+ {
+ lcd_buf_put_spaces(empty_spaces_qty);
+ lcd_buf_str(buffer);
+ }
+ else
+ {
+ lcd_buf_str(buffer);
+ lcd_buf_put_spaces(empty_spaces_qty);
+ }
+ }
+}
+#endif
+
+#if USE_LCD_BUF_HEX == ON
+void lcd_buf_hex_AVR(int val, uint8_t width, enum alignment alignment)
+{
+ char buffer[17];
+ buffer[0] = '\0';
+ itoa(val, buffer, 16);
+ static const char *prefix = {"0x"};
+ if (width <= (strlen(buffer) + VAL_PREFIX_LENGHT))
+ {
+ lcd_buf_str(prefix);
+ lcd_buf_str(buffer);
+ }
+ else
+ {
+ uint8_t empty_spaces_qty = width - (VAL_PREFIX_LENGHT + strlen(buffer));
+
+ if (alignment == right)
+ {
+ lcd_buf_put_spaces(empty_spaces_qty);
+ lcd_buf_str(prefix);
+ lcd_buf_str(buffer);
+ }
+ else
+ {
+ lcd_buf_str(prefix);
+ lcd_buf_str(buffer);
+ lcd_buf_put_spaces(empty_spaces_qty);
+ }
+ }
+}
+#endif
+#if USE_LCD_BUF_BIN == ON
+static void lcd_buf_bin_AVR(int val, uint8_t width)
+{
+ char buffer[35]; // 0b 0000 0000 0000 0000 0000 0000 0000 0000
+ static const char *prefix = {"0b"};
+ buffer[0] = '\0';
+
+ itoa(val, buffer, 2);
+ // if (buf_lenght < (width - VAL_PREFIX_LENGHT))
+ if (width <= (strlen(buffer) + VAL_PREFIX_LENGHT))
+ {
+ lcd_buf_str(prefix);
+ lcd_buf_str(buffer);
+ }
+ else
+ {
+ uint8_t zeros_qty = (width - (VAL_PREFIX_LENGHT + strlen(buffer)));
+ lcd_buf_str(prefix);
+ for (uint8_t i = 0; i < zeros_qty; i++)
+ {
+ lcd_buf_char('0');
+ }
+ lcd_buf_str(buffer);
+ }
+}
+#endif
+#endif
+#else
+#if USE_LCD_BIN == ON
+static void fill_bin_value_buffer(int val, char *bin_val_buffer)
+{
+ uint32_t bit_mask = 0x80000000;
+ while (bit_mask != 0)
+ {
+ if ((bit_mask & val) != 0)
+ {
+ strcat(bin_val_buffer, "1");
+ }
+ else
+ {
+ if (strlen(bin_val_buffer) != 0)
+ {
+ strcat(bin_val_buffer, "0");
+ }
+ }
+ bit_mask = bit_mask >> 1;
+ }
+}
+
+static void fill_zeros_buffer(const char *buffer, uint8_t width, char *zeros_buf)
+{
+ if (strlen(buffer) < (width + VAL_PREFIX_LENGHT))
+ {
+ uint8_t zeros_qty = width - ((strlen(buffer) + VAL_PREFIX_LENGHT));
+ for (uint8_t t = 0; t < zeros_qty; t++)
+ {
+ strcat(zeros_buf, "0");
+ }
+ }
+}
+#endif
+#endif
+
+#if LCD_BUFFERING==ON
+static void check_lcd_buf_possition_ptr_overflow(void)
+{
+ if(++lcd_buf_position_ptr>&lcd_buffer[LAST_LCD_LINE][LAST_CHAR_IN_LCD_LINE])
+ {
+ lcd_buf_position_ptr=&lcd_buffer[LINE_1][C1];
+ }
+}
+static void copy_lcd_buf_2_prev_lcd_buf(void)
+{
+ for(uint8_t y=0;y=LCD_X)
+ {
+ *lcd_cursor_position=0;
+ (*lcd_line)++;
+ *missed_char_counter_in_LCD_line=0;
+ if(*lcd_line==LCD_Y)
+ {
+ *lcd_line=LINE_1;
+ }
+ lcd_locate(*lcd_line,*lcd_cursor_position);
+
+ }
+}
+
+void write_lcd_buf_2_lcd(const uint8_t * lcd_cursor_position, const uint8_t *lcd_line, uint8_t * missed_char_counter_in_LCD_line, const lcd_pos_t *prev_lcd_buff_pos_ptr)
+{
+ if(*lcd_buf_position_ptr!=*prev_lcd_buff_pos_ptr)
+ {
+ if (*missed_char_counter_in_LCD_line!=0)
+ {
+ lcd_locate(*lcd_line,*lcd_cursor_position);
+ *missed_char_counter_in_LCD_line=0;
+ }
+ lcd_char(*lcd_buf_position_ptr);
+ }
+ else
+ {
+ (*missed_char_counter_in_LCD_line)++;
+ }
+}
+
+#endif
+
+/**
+ * @brief Function that initializes LCD in 4-bit mode with or without LCD R/W Pin handling.
+ * @attention LCD R/W handling should be configured in lcd_hd44780_config.h by setting USE_RW_PIN to 1 (Enable R/W Pin
+ * handling) or 0 (disable R/W Pin handling).
+ */
+void lcd_init(void)
+{
+ register_LCD_IO_driver();
+ LCD->init_LCD_pins();
+ lcd_disable_backlight();
+ /**************************BASIC LCD INIT - basing on DS init procedure***************************************/
+ // set all LCD signals to High for more than 15ms ->bit different than in DS based on other implementations from the internet
+ lcd_set_all_SIG();
+ LCD->delay_us(15000);
+ lcd_reset_all_SIG();
+ // send 0x03 & wait more then 4,1ms
+ lcd_write_4bit_data(0x03);
+ LCD->delay_us(4500);
+ // send 0x03 & wait more then 100us
+ lcd_write_4bit_data(0x03);
+ LCD->delay_us(110);
+ // send 0x03 & wait more then 100us
+ lcd_write_4bit_data(0x03);
+ LCD->delay_us(110);
+ // send 0x02 & wait more then 100us
+ lcd_write_4bit_data(0x02);
+ LCD->delay_us(110);
+ // FUNCTION SET ->send cmd -> LCD in 4-bit mode, 2 rows, char size 5x7
+ lcd_write_cmd(LCDC_FUNC | LCDC_FUNC4B | LCDC_FUNC2L | LCDC_FUNC5x7);
+ // DISPLAY_ON_OFF send cmd -> enable lcd
+ lcd_write_cmd(LCDC_ONOFF | LCDC_CURSOROFF | LCDC_DISPLAYON);
+ // LCD clear screen
+ lcd_cls();
+ // ENTRY MODe SET do not shift the LCD shift cursor right after placing a char
+ lcd_write_cmd(LCDC_ENTRY_MODE | LCDC_ENTRYR);
+ /*********************************END of BASIC LCD INIT***************************************/
+#if LCD_BUFFERING == ON
+ //clear lcd_buffer by putting spaces inside of the buffer
+ lcd_buf_cls();
+ //copy lcd_buffer with spaces to prev_lcd_buffer
+ copy_lcd_buf_2_prev_lcd_buf();
+ // clear flag due to init procedure that reset LCD screen and buffers
+ LCD_UPDATE_EVENT=false;
+#endif
+
+}
+
+void lcd_enable_backlight(void)
+{
+#if LCD_BCKL_PIN_EN_STATE == HIGH
+ LCD->set_SIG(LCD_BCKL);
+#else
+ LCD->reset_SIG(LCD_BCKL);
+#endif
+}
+
+void lcd_disable_backlight(void)
+{
+#if LCD_BCKL_PIN_EN_STATE == HIGH
+ LCD->reset_SIG(LCD_BCKL);
+#else
+ LCD->set_SIG(LCD_BCKL);
+#endif
+}
+
+/**
+ * @brief Function that clears the LCD screen and sets the cursor on the position of the first character in the first line of the LCD
+ * screen.
+ */
+void lcd_cls(void)
+{
+ lcd_write_cmd(LCDC_CLS);
+#if USE_RW_PIN == OFF
+ LCD->delay_us(4900);
+#endif
+}
+
+#if USE_DEF_CHAR_FUNCTION == ON
+/**
+ * @brief Function for defining custom user characters in CGRAM of the LCD.
+ * @param CGRAM_char_index Position/address of the character in CGRAM of the LCD where defined char should be written.
+ * For the predefined example of special characters, taken values are defined in the type enum LCD_CGRAM that is defined
+ * in lcd-hd44780.h
+ * @param def_char Pointer to the predefined special character.
+ * @note CGRAM_char_index - This Parameter can take values from 0 to 7. For the predefined example of special
+ * characters, taken values are defined in the type enum LCD_CGRAM that is defined in lcd-hd44780.h
+ */
+void lcd_def_char(const uint8_t CGRAM_bank_x_char_adr, const uint8_t *def_char)
+{
+ lcd_write_cmd(LCDC_SET_CGRAM | ((DEF_CHAR_ADR_MASK & CGRAM_bank_x_char_adr) * LCD_CGRAM_BYTES_PER_CHAR));
+ for (uint8_t j = 0; j < LCD_CGRAM_BYTES_PER_CHAR; j++)
+ {
+ lcd_write_data(def_char[j]);
+ }
+ lcd_write_cmd(LCDC_SET_DDRAM);
+}
+
+void lcd_load_char_bank(const struct char_bank_struct *char_bank)
+{
+ lcd_def_char(0, char_bank->char_0);
+ lcd_def_char(1, char_bank->char_1);
+ lcd_def_char(2, char_bank->char_2);
+ lcd_def_char(3, char_bank->char_3);
+ lcd_def_char(4, char_bank->char_4);
+ lcd_def_char(5, char_bank->char_5);
+ lcd_def_char(6, char_bank->char_6);
+ lcd_def_char(7, char_bank->char_7);
+}
+#endif
+
+/**
+ * @brief Function for printing the char on the LCD screen under the current position of the LCD cursor.
+ * @param C char (for example '1') or its ASCI code (0x31).
+ * @note For user-defined char, place CGRAM_char_index (Position/address of the character in CGRAM of the LCD where
+ * defined char was written).
+ */
+void lcd_char(const char C)
+{
+ uint8_t data = (uint8_t)(C);
+ lcd_write_data(data);
+}
+
+/**
+ * @brief Function for printing/writing the string on the LCD screen starting from the current LCD cursor position.
+ * @param str string that should be printed/written on the LCD screen
+ */
+void lcd_str(const char *str)
+{
+ register char znak;
+ while ((znak = *(str++)))
+ {
+ lcd_write_data((uint8_t)(znak));
+ }
+}
+
+#if USE_LCD_INT == ON
+/**
+ * @brief Function for printing the integer value on the LCD screen under the current position of the LCD cursor.
+ * @param val int type value to print on LCD screen
+ * @param width Minimum number of characters to be printed. If the value to be printed is shorter than this number, the
+ * result is padded with blank spaces. The value is not truncated even if the result is larger.
+ * @param alignment If the value to be printed is shorter than the width, this parameter will specify the alignment of the
+ * printed text value. This parameter can be set to "left" or "right"
+ * @attention to compile for AVR ucontrollers definition of flag AVR is required.
+ */
+void lcd_int(int val, uint8_t width, enum alignment alignment)
+{
+#ifdef AVR
+ lcd_int_AVR(val, width, alignment);
+#else
+ char buffer[20]; // 19chars for 64 bit int + end char '\0'
+ buffer[0] = '\0';
+ if (alignment == right)
+ sprintf(buffer, "%*i", width, val);
+ else
+ sprintf(buffer, "%-*i", width, val);
+ lcd_str(buffer);
+#endif
+}
+#endif
+
+#if USE_LCD_HEX == ON
+/**
+ * @brief Function for printing the integer value in hexadecimal format on the LCD screen under the current position of the LCD
+ * cursor.
+ * @param val int type value to print on LCD screen in hexadecimal format
+ * @param width Minimum number of characters to be printed. If the value to be printed is shorter than this number, the
+ * result is padded with blank spaces. The value is not truncated even if the result is larger. The width should contain
+ * additional 2 characters for '0x' at the beginning of the printed value.
+ * @param alignment If the value to be printed is shorter than the width, this parameter will specify the alignment of the
+ * printed text value. This parameter can be set to "left" or "right"
+ * @attention to compile for AVR ucontrollers definition of flag AVR is required.
+ */
+void lcd_hex(int val, uint8_t width, enum alignment alignment)
+{
+#ifdef AVR
+ lcd_hex_AVR(val, width, alignment);
+#else
+ char buffer[17];
+ buffer[0] = '\0';
+ if (alignment == right)
+ sprintf(buffer, "%#*x", width, val);
+ else
+ sprintf(buffer, "%-#*x", width, val);
+ lcd_str(buffer);
+#endif
+}
+#endif
+
+#if USE_LCD_BIN == ON
+/**
+ * @brief Function for printing the integer value in hexadecimal format on the LCD screen under the current position of the LCD
+ * cursor.
+ * @param val int type value to print on LCD screen in hexadecimal format
+ * @param width Minimum number of characters to be printed. If the value to be printed is shorter than this number, the
+ * result is padded with blank spaces. The value is not truncated even if the result is larger. The width should contain
+ * additional 2 characters for '0x' at the beginning of the printed value.
+ * @attention to compile for AVR ucontrollers definition of flag AVR is required.
+ */
+void lcd_bin(int val, uint8_t width)
+{
+#ifdef AVR
+ lcd_bin_AVR(val, width);
+#else
+ char buffer[35];
+ char bin_val_buffer[35];
+ char zeros_buf[35];
+ buffer[0] = '\0';
+ bin_val_buffer[0] = '\0';
+ zeros_buf[0] = '\0';
+
+ fill_bin_value_buffer(val, bin_val_buffer);
+ fill_zeros_buffer(bin_val_buffer, width, zeros_buf);
+ strcat(buffer, "0b");
+ strcat(buffer, zeros_buf);
+ strcat(buffer, bin_val_buffer);
+ lcd_str(buffer);
+#endif
+}
+
+#endif
+
+/**
+ * @brief Function that moves LCD cursor to a specific position located under the x and y coordinate
+ * @param y LCD row/line number. Defined enum value LINE_1, LINE_2,... etc.
+ * @param x LCD column number. Defined enum value C1, C2, C3,... etc.
+ */
+void lcd_locate(enum LCD_LINES y, enum LCD_COLUMNS x)
+{
+ switch (y)
+ {
+ case 0:
+ y = LCD_LINE1_ADR;
+ break;
+
+#if (LCD_Y > 1)
+ case 1:
+ y = LCD_LINE2_ADR;
+ break;
+#endif
+#if (LCD_Y > 2)
+ case 2:
+ y = LCD_LINE3_ADR;
+ break;
+#endif
+#if (LCD_Y > 3)
+ case 3:
+ y = LCD_LINE4_ADR;
+ break;
+#endif
+ default:
+ break;
+ }
+ lcd_write_cmd((uint8_t)(LCDC_SET_DDRAM + y + x));
+}
+#if USE_LCD_CURSOR_HOME == ON
+/**
+ * @brief Function that moves LCD cursor to the first position at the first row of the LCD screen
+ */
+void lcd_home(void)
+{
+ lcd_write_cmd(LCDC_CLS | LCDC_HOME);
+#if USE_RW_PIN == OFF
+ LCD->delay_us(4900);
+#endif
+}
+#endif
+
+#if USE_LCD_CURSOR_ON == ON
+/**
+ * @brief Function that activates the visibility of the LCD cursor.
+ */
+void lcd_cursor_on(void)
+{
+ lcd_write_cmd(LCDC_ONOFF | LCDC_DISPLAYON | LCDC_CURSORON);
+}
+#endif
+
+#if USE_LCD_CURSOR_OFF == ON
+/**
+ * @brief Function that deactivates the visibility and blinking of the LCD cursor.
+ */
+void lcd_cursor_off(void)
+{
+ lcd_write_cmd(LCDC_ONOFF | LCDC_DISPLAYON);
+}
+#endif
+#if USE_LCD_BLINKING_CURSOR_ON == ON
+/**
+ * @brief Function that activates the visibility and blinking of the LCD cursor.
+ */
+void lcd_blinking_cursor_on(void)
+{
+ lcd_write_cmd(LCDC_ONOFF | LCDC_DISPLAYON | LCDC_CURSORON | LCDC_BLINKON);
+}
+#endif
+
+#if LCD_BUFFERING == ON
+/**
+ * @brief Function that puts spaces(0x32) in the whole LCD buffer and sets the cursor on the position of the first character in the first line of the LCD
+ * buffer.
+ */
+void lcd_buf_cls(void)
+{
+ for(lcd_buf_position_ptr=&lcd_buffer[LINE_1][C1]; lcd_buf_position_ptr<=&lcd_buffer[LAST_LCD_LINE][LAST_CHAR_IN_LCD_LINE]; lcd_buf_position_ptr++)
+ {
+ *lcd_buf_position_ptr=' ';
+ }
+ lcd_buf_position_ptr=&lcd_buffer[LINE_1][C1];
+ LCD_UPDATE_EVENT=true;
+}
+
+/**
+ * @brief Function for adding the char to the LCD buffer under the current position of the LCD buffer.
+ * @param C char (for example '1') or its ASCI code (0x31).
+ * @note For user-defined char, place CGRAM_char_index (Position/address of the character in CGRAM of the LCD where
+ * defined char was written).
+ */
+void lcd_buf_char(const char c)
+{
+ *lcd_buf_position_ptr=c;
+ check_lcd_buf_possition_ptr_overflow();
+ LCD_UPDATE_EVENT=true;
+}
+
+/**
+ * @brief Function that changes the current LCD buffer position pointer to a specific position located under the x and y coordinate
+ * @param y LCD row/line number. Defined enum value LINE_1, LINE_2,... etc.
+ * @param x LCD column number. Defined enum value C1, C2, C3,... etc.
+ */
+void lcd_buf_locate(enum LCD_LINES y, enum LCD_COLUMNS x)
+{
+ lcd_buf_position_ptr=&lcd_buffer[y][x];
+}
+
+/**
+ * @brief Function for placing the string in the LCD buffer starts from the current LCD buffer position pointer.
+ * @param str string that should be placed in the LCD buffer
+ */
+void lcd_buf_str(const char *str)
+{
+ while (*str)
+ {
+ *(lcd_buf_position_ptr)=*(str++);
+ check_lcd_buf_possition_ptr_overflow();
+ }
+ LCD_UPDATE_EVENT=true;
+}
+
+/**
+ * @brief Function that prints on the LCD screen the content of The LCD buffer.
+ * The function sets also The LCD buffer position pointer to the First line's first character.
+ */
+void lcd_update(void)
+{
+ uint8_t lcd_cursor_position=0;
+ uint8_t lcd_line=0;
+ uint8_t missed_char_counter_in_LCD_line=0;
+ const lcd_pos_t *prev_lcd_buff_pos_ptr=&prev_lcd_buffer[LINE_1][C1];
+
+ for(lcd_buf_position_ptr=&lcd_buffer[LINE_1][C1]; lcd_buf_position_ptr<=&lcd_buffer[LAST_LCD_LINE][LAST_CHAR_IN_LCD_LINE]; lcd_buf_position_ptr++)
+ {
+ write_lcd_buf_2_lcd(&lcd_cursor_position,&lcd_line,&missed_char_counter_in_LCD_line,prev_lcd_buff_pos_ptr);
+ update_lcd_curosr_possition(&lcd_cursor_position,&lcd_line,&missed_char_counter_in_LCD_line);
+ prev_lcd_buff_pos_ptr++;
+ }
+
+ lcd_buf_position_ptr=&lcd_buffer[LINE_1][C1];
+ copy_lcd_buf_2_prev_lcd_buf();
+ LCD_UPDATE_EVENT=false;
+}
+
+#if USE_LCD_BUF_INT == ON
+/**
+ * @brief Function for adding integer value as string to the LCD buffer under the current position of the LCD buffer pointer.
+ * @param val int type value to add to LCD buffer
+ * @param width Minimum number of characters to be added to LCD buffer. If the value to be added to the LCD buffer is shorter than width, the
+ * result is padded with blank spaces. The value to be added to the buffer as a string is not truncated if the string length is larger than the width value.
+ * @param alignment If the value is to be added to the LCD buffer as a string is shorter than the width, this parameter will specify the alignment of the
+ * text representing the value. This parameter can be set to "left" or "right"
+ * @attention to compile for AVR ucontrollers definition of flag AVR is required.
+ */
+void lcd_buf_int(int val, uint8_t width, enum alignment alignment)
+{
+#ifdef AVR
+ lcd_buf_int_AVR(val, width, alignment);
+#else
+ char buffer[20]; // 19chars for 64 bit int + end char '\0'
+ buffer[0] = '\0';
+ if (alignment == right)
+ sprintf(buffer, "%*i", width, val);
+ else
+ sprintf(buffer, "%-*i", width, val);
+ lcd_buf_str(buffer);
+#endif
+}
+#endif
+
+#if USE_LCD_BUF_HEX == ON
+/**
+ * @brief Function for adding integer value in hexadecimal format as a string to the LCD buffer under the current position of the LCD buffer pointer.
+ * @param val int type value to add to LCD buffer as a string in hexadecimal format
+ * @param width Minimum number of characters to be added to lcd buffer. If the value to be added to the buffer is shorter than the width, the
+ * result is padded with blank spaces. The value to be added to the buffer as a string is not truncated if the string length is larger than the width value. Width should contain
+ * additional 2 characters for "0x" at the beginning of the value represented as a string. example: 0x01-> width=4
+ * @param alignment If the value to be added to the LCD buffer as a string is shorter than the width, this parameter will specify the alignment of the
+* text represented the value. This parameter can be set to "left" or "right"
+ * @attention to compile for AVR ucontrollers definition of flag AVR is required.
+ */
+void lcd_buf_hex(int val, uint8_t width, enum alignment alignment)
+{
+#ifdef AVR
+ lcd_buf_hex_AVR(val, width, alignment);
+#else
+ char buffer[17];
+ buffer[0] = '\0';
+ if (alignment == right)
+ sprintf(buffer, "%#*x", width, val);
+ else
+ sprintf(buffer, "%-#*x", width, val);
+ lcd_buf_str(buffer);
+#endif
+}
+#endif
+
+#if USE_LCD_BUF_BIN == ON
+/**
+ * @brief Function for adding to the LCD buffer the integer value in binary format as a string under the current position of the LCD buffer pointer
+ * @param val int type value to be added to the LCD buffer as a string in hexadecimal format
+ * @param width Minimum number of characters to be added to LCD buffer. If the value to be added to the buffer as string length is shorter than width, the
+ * result is padded with blank spaces. The value to be added to the buffer as a string is not truncated if the string length represents the value in binary format length
+ * is larger than the width value. The width should contain an additional 2 characters for "0b" at the beginning of the value represented as a string. example: 0b01-> width=4
+ * @attention to compile for AVR ucontrollers definition of flag AVR is required.
+ */
+void lcd_buf_bin(int val, uint8_t width)
+{
+#ifdef AVR
+ lcd_buf_bin_AVR(val, width);
+#else
+ char buffer[35];
+ char bin_val_buffer[35];
+ char zeros_buf[35];
+ buffer[0] = '\0';
+ bin_val_buffer[0] = '\0';
+ zeros_buf[0] = '\0';
+
+ fill_bin_value_buffer(val, bin_val_buffer);
+ fill_zeros_buffer(bin_val_buffer, width, zeros_buf);
+ strcat(buffer, "0b");
+ strcat(buffer, zeros_buf);
+ strcat(buffer, bin_val_buffer);
+ lcd_buf_str(buffer);
+#endif
+}
+
+#endif
+#endif
+
diff --git a/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/user/partitions.c b/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/user/partitions.c
new file mode 100644
index 0000000..a293274
--- /dev/null
+++ b/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/user/partitions.c
@@ -0,0 +1,64 @@
+/*
+ * partitions.c
+ *
+ * Created on: 8 pa 2021
+ * Author: Mirosaw Karda
+ */
+#include "ets_sys.h"
+#include "osapi.h"
+#include "user_interface.h"
+
+
+
+#if ((SPI_FLASH_SIZE_MAP == 0) || (SPI_FLASH_SIZE_MAP == 1))
+#error "The flash map is not supported"
+#elif (SPI_FLASH_SIZE_MAP == 2) // 1 MB
+#define SYSTEM_PARTITION_OTA_SIZE 0x78000 // 0x78000-480 KB // 0x7A000-488KB // 0x6A000-424KB
+#define SYSTEM_PARTITION_OTA_2_ADDR 0x81000
+#define SYSTEM_PARTITION_RF_CAL_ADDR 0xfb000
+#define SYSTEM_PARTITION_PHY_DATA_ADDR 0xfc000
+#define SYSTEM_PARTITION_SYSTEM_PARAMETER_ADDR 0xfd000
+#elif (SPI_FLASH_SIZE_MAP == 3) // 2 MB
+#define SYSTEM_PARTITION_OTA_SIZE 0x6A000
+#define SYSTEM_PARTITION_OTA_2_ADDR 0x81000
+#define SYSTEM_PARTITION_RF_CAL_ADDR 0x1fb000
+#define SYSTEM_PARTITION_PHY_DATA_ADDR 0x1fc000
+#define SYSTEM_PARTITION_SYSTEM_PARAMETER_ADDR 0x1fd000
+#elif (SPI_FLASH_SIZE_MAP == 4) // 4MB
+#define SYSTEM_PARTITION_OTA_SIZE 0x6A000
+#define SYSTEM_PARTITION_OTA_2_ADDR 0x81000
+#define SYSTEM_PARTITION_RF_CAL_ADDR 0x3fb000
+#define SYSTEM_PARTITION_PHY_DATA_ADDR 0x3fc000
+#define SYSTEM_PARTITION_SYSTEM_PARAMETER_ADDR 0x3fd000
+#elif (SPI_FLASH_SIZE_MAP == 5) // 5 MB
+#define SYSTEM_PARTITION_OTA_SIZE 0x6A000
+#define SYSTEM_PARTITION_OTA_2_ADDR 0x101000
+#define SYSTEM_PARTITION_RF_CAL_ADDR 0x1fb000
+#define SYSTEM_PARTITION_PHY_DATA_ADDR 0x1fc000
+#define SYSTEM_PARTITION_SYSTEM_PARAMETER_ADDR 0x1fd000
+#elif (SPI_FLASH_SIZE_MAP == 6) // 4 MB
+#define SYSTEM_PARTITION_OTA_SIZE 0x6A000
+#define SYSTEM_PARTITION_OTA_2_ADDR 0x101000
+#define SYSTEM_PARTITION_RF_CAL_ADDR 0x3fb000
+#define SYSTEM_PARTITION_PHY_DATA_ADDR 0x3fc000
+#define SYSTEM_PARTITION_SYSTEM_PARAMETER_ADDR 0x3fd000
+#else
+#error "The flash map is not supported"
+#endif
+
+static const partition_item_t at_partition_table[] = {
+ { SYSTEM_PARTITION_BOOTLOADER, 0x0, 0x1000},
+ { SYSTEM_PARTITION_OTA_1, 0x1000, SYSTEM_PARTITION_OTA_SIZE},
+ { SYSTEM_PARTITION_OTA_2, SYSTEM_PARTITION_OTA_2_ADDR, SYSTEM_PARTITION_OTA_SIZE},
+ { SYSTEM_PARTITION_RF_CAL, SYSTEM_PARTITION_RF_CAL_ADDR, 0x1000},
+ { SYSTEM_PARTITION_PHY_DATA, SYSTEM_PARTITION_PHY_DATA_ADDR, 0x1000},
+ { SYSTEM_PARTITION_SYSTEM_PARAMETER, SYSTEM_PARTITION_SYSTEM_PARAMETER_ADDR, 0x3000},
+};
+
+void ICACHE_FLASH_ATTR user_pre_init(void)
+{
+ if(!system_partition_table_regist(at_partition_table, sizeof(at_partition_table)/sizeof(at_partition_table[0]),SPI_FLASH_SIZE_MAP)) {
+ os_printf("system_partition_table_regist fail\r\n");
+ while(1);
+ }
+}
diff --git a/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/user/user_main.c b/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/user/user_main.c
new file mode 100644
index 0000000..ab9f238
--- /dev/null
+++ b/examples/ESP8266_NONOS_SDK/LCD_HD44780_TEST/user/user_main.c
@@ -0,0 +1,144 @@
+/*
+ * ESPRESSIF MIT License
+ *
+ * Copyright (c) 2015
+ *
+ * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case,
+ * it is 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 all 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, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * 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.
+ *
+ */
+#include "ets_sys.h"
+#include "osapi.h"
+#include "user_interface.h"
+#include "lcd_hd44780.h"
+
+#define SHIFT_DELAY 300
+enum
+{
+ slide_in_init,
+ slide_in,
+ slide_out_init,
+ slide_out,
+};
+
+const char *demo_tekst = {"Congratulation, you have just run LCD demo example on ESP8266 using ESP826 NONOS SDK"};
+// const char *demo_tekst = {"Congratulation, you hav SDK\0"};
+const char *demo_title = {"LCD HD44780 Demo\0"};
+
+static void lcd_buf_slide_str_in(const char *str, enum LCD_LINES lcd_line);
+static void lcd_buf_slide_str_out(const char *str, enum LCD_LINES lcd_line);
+static void blink_backlight(uint8_t blinks_no);
+
+uint8_t j = 0;
+uint8_t i = 0;
+uint8_t shift_str_state_machine=0;
+
+static os_timer_t lcd_shift_timer;
+
+
+void ICACHE_FLASH_ATTR lcd_update_cb(void *arg)
+{
+ switch(shift_str_state_machine)
+ {
+ case slide_in_init:
+ lcd_buf_cls();
+ lcd_buf_str(demo_title);
+ lcd_update();
+ i = LCD_X - 1;
+ shift_str_state_machine=slide_in;
+ case slide_in:
+ lcd_buf_slide_str_in(demo_tekst,LINE_2);
+ if(i==C1) shift_str_state_machine=slide_out_init;
+ break;
+ case slide_out_init:
+ j=0;
+ shift_str_state_machine=slide_out;
+ case slide_out:
+ lcd_buf_slide_str_out(demo_tekst,LINE_2);
+ if(j > strlen(demo_tekst)) shift_str_state_machine=slide_in_init;
+ break;
+ default:
+ shift_str_state_machine=slide_in_init;
+ break;
+ }
+
+}
+
+void ICACHE_FLASH_ATTR lcd_blink_cb(void *arg)
+{
+ static uint8_t blink_cnt=6;
+ if((blink_cnt % 2)==0)
+ {
+ lcd_disable_backlight();
+ }
+ else
+ {
+ lcd_enable_backlight();
+ }
+ if(--blink_cnt==0)
+ {
+ os_timer_disarm(&lcd_shift_timer);
+ os_timer_setfn(&lcd_shift_timer,lcd_update_cb,NULL);
+ os_timer_arm(&lcd_shift_timer,SHIFT_DELAY,1);
+ }
+}
+
+void ICACHE_FLASH_ATTR user_init(void)
+{
+
+ lcd_init();
+ lcd_enable_backlight();
+ lcd_str(demo_title);
+
+ os_timer_disarm(&lcd_shift_timer);
+ os_timer_setfn(&lcd_shift_timer,lcd_blink_cb,NULL);
+ os_timer_arm(&lcd_shift_timer,500,1);
+}
+
+static void lcd_buf_slide_str_out(const char *str, enum LCD_LINES lcd_line)
+{
+
+ uint8_t str_end_flag = 0;
+ lcd_buf_locate(lcd_line, C1);
+ for (i = 0; i < LCD_X; i++)
+ {
+ if ((str[j + i] != '\0') && (str_end_flag == 0))
+ {
+ lcd_buf_char(str[j + i]);
+ }
+ else
+ {
+ str_end_flag = 0xFF;
+ lcd_buf_char(' ');
+ }
+ }
+ str_end_flag = 0;
+ lcd_update();
+ j++;
+}
+
+static void lcd_buf_slide_str_in(const char *str, enum LCD_LINES lcd_line)
+{
+
+ lcd_buf_locate(lcd_line, i);
+ for (uint8_t j = 0; j < (LCD_X - i); j++)
+ {
+ lcd_buf_char(str[j]);
+ }
+ lcd_update();
+ i--;
+}
diff --git a/examples/ESP8266_NONOS_SDK/License b/examples/ESP8266_NONOS_SDK/License
new file mode 100644
index 0000000..8a9fade
--- /dev/null
+++ b/examples/ESP8266_NONOS_SDK/License
@@ -0,0 +1,24 @@
+ESPRESSIF MIT License
+
+Copyright (c) 2015
+
+Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, it is 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 all 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, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 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.
+
+
+ MIT ֤
+
+Ȩ (c) 2015 <ϢƼϺ˾>
+
+֤ȨϢƼ ESP8266 ƷӦÿڴ£֤ȨκλøĵͳΪƵؾӪƵʹáơġϲ淢СɢȨȨȨЩȨͬʱ
+
+ижϵİȨȨ
+
+ṩûκȷĵڹԡʺijһض;ͷȨı֤ߺͰȨκ¾ʹԺͬʽȨʽκ⡢θ
+
+
+
+
diff --git a/examples/ESP8266_NONOS_SDK/Makefile b/examples/ESP8266_NONOS_SDK/Makefile
new file mode 100755
index 0000000..a580a7b
--- /dev/null
+++ b/examples/ESP8266_NONOS_SDK/Makefile
@@ -0,0 +1,417 @@
+# copyright (c) 2010 Espressif System
+#
+ifndef PDIR
+
+endif
+
+ifeq ($(COMPILE), gcc)
+ AR = xtensa-lx106-elf-ar
+ CC = xtensa-lx106-elf-gcc
+ CXX = xtensa-lx106-elf-g++
+ NM = xtensa-lx106-elf-nm
+ CPP = xtensa-lx106-elf-cpp
+ OBJCOPY = xtensa-lx106-elf-objcopy
+ OBJDUMP = xtensa-lx106-elf-objdump
+else
+ AR = xt-ar
+ CC = xt-xcc
+ CXX = xt-xcc
+ NM = xt-nm
+ CPP = xt-cpp
+ OBJCOPY = xt-objcopy
+ OBJDUMP = xt-objdump
+endif
+
+BOOT?=none
+APP?=0
+SPI_SPEED?=40
+SPI_MODE?=QIO
+SPI_SIZE_MAP?=0
+
+ifeq ($(BOOT), new)
+ boot = new
+else
+ ifeq ($(BOOT), old)
+ boot = old
+ else
+ boot = none
+ endif
+endif
+
+ifeq ($(APP), 1)
+ app = 1
+else
+ ifeq ($(APP), 2)
+ app = 2
+ else
+ app = 0
+ endif
+endif
+
+ifeq ($(SPI_SPEED), 26.7)
+ freqdiv = 1
+else
+ ifeq ($(SPI_SPEED), 20)
+ freqdiv = 2
+ else
+ ifeq ($(SPI_SPEED), 80)
+ freqdiv = 15
+ else
+ freqdiv = 0
+ endif
+ endif
+endif
+
+
+ifeq ($(SPI_MODE), QOUT)
+ mode = 1
+else
+ ifeq ($(SPI_MODE), DIO)
+ mode = 2
+ else
+ ifeq ($(SPI_MODE), DOUT)
+ mode = 3
+ else
+ mode = 0
+ endif
+ endif
+endif
+
+addr = 0x01000
+
+ifeq ($(SPI_SIZE_MAP), 1)
+ size_map = 1
+ flash = 256
+else
+ ifeq ($(SPI_SIZE_MAP), 2)
+ size_map = 2
+ flash = 1024
+ ifeq ($(app), 2)
+ addr = 0x81000
+ endif
+ else
+ ifeq ($(SPI_SIZE_MAP), 3)
+ size_map = 3
+ flash = 2048
+ ifeq ($(app), 2)
+ addr = 0x81000
+ endif
+ else
+ ifeq ($(SPI_SIZE_MAP), 4)
+ size_map = 4
+ flash = 4096
+ ifeq ($(app), 2)
+ addr = 0x81000
+ endif
+ else
+ ifeq ($(SPI_SIZE_MAP), 5)
+ size_map = 5
+ flash = 2048
+ ifeq ($(app), 2)
+ addr = 0x101000
+ endif
+ else
+ ifeq ($(SPI_SIZE_MAP), 6)
+ size_map = 6
+ flash = 4096
+ ifeq ($(app), 2)
+ addr = 0x101000
+ endif
+ else
+ ifeq ($(SPI_SIZE_MAP), 8)
+ size_map = 8
+ flash = 8192
+ ifeq ($(app), 2)
+ addr = 0x101000
+ endif
+ else
+ ifeq ($(SPI_SIZE_MAP), 9)
+ size_map = 9
+ flash = 16384
+ ifeq ($(app), 2)
+ addr = 0x101000
+ endif
+ else
+ size_map = 0
+ flash = 512
+ ifeq ($(app), 2)
+ addr = 0x41000
+ endif
+ endif
+ endif
+ endif
+ endif
+ endif
+ endif
+ endif
+endif
+
+LD_FILE = $(LDDIR)/eagle.app.v6.ld
+
+ifneq ($(boot), none)
+ifneq ($(app),0)
+ ifneq ($(findstring $(size_map), 6 8 9),)
+ LD_FILE = $(LDDIR)/eagle.app.v6.$(boot).2048.ld
+ else
+ ifeq ($(size_map), 5)
+ LD_FILE = $(LDDIR)/eagle.app.v6.$(boot).2048.ld
+ else
+ ifeq ($(size_map), 4)
+ LD_FILE = $(LDDIR)/eagle.app.v6.$(boot).1024.app$(app).ld
+ else
+ ifeq ($(size_map), 3)
+ LD_FILE = $(LDDIR)/eagle.app.v6.$(boot).1024.app$(app).ld
+ else
+ ifeq ($(size_map), 2)
+ LD_FILE = $(LDDIR)/eagle.app.v6.$(boot).1024.app$(app).ld
+ else
+ ifeq ($(size_map), 0)
+ LD_FILE = $(LDDIR)/eagle.app.v6.$(boot).512.app$(app).ld
+ endif
+ endif
+ endif
+ endif
+ endif
+ endif
+ BIN_NAME = user$(app).$(flash).$(boot).$(size_map)
+endif
+else
+ app = 0
+endif
+
+CSRCS ?= $(wildcard *.c)
+CXXSRCS ?= $(wildcard *.cpp)
+ASRCs ?= $(wildcard *.s)
+ASRCS ?= $(wildcard *.S)
+SUBDIRS ?= $(patsubst %/,%,$(dir $(wildcard */Makefile)))
+
+ODIR := .output
+OBJODIR := $(ODIR)/$(TARGET)/$(FLAVOR)/obj
+
+OBJS := $(CSRCS:%.c=$(OBJODIR)/%.o) \
+ $(CXXSRCS:%.cpp=$(OBJODIR)/%.o) \
+ $(ASRCs:%.s=$(OBJODIR)/%.o) \
+ $(ASRCS:%.S=$(OBJODIR)/%.o)
+
+DEPS := $(CSRCS:%.c=$(OBJODIR)/%.d) \
+ $(CXXSCRS:%.cpp=$(OBJODIR)/%.d) \
+ $(ASRCs:%.s=$(OBJODIR)/%.d) \
+ $(ASRCS:%.S=$(OBJODIR)/%.d)
+
+LIBODIR := $(ODIR)/$(TARGET)/$(FLAVOR)/lib
+OLIBS := $(GEN_LIBS:%=$(LIBODIR)/%)
+
+IMAGEODIR := $(ODIR)/$(TARGET)/$(FLAVOR)/image
+OIMAGES := $(GEN_IMAGES:%=$(IMAGEODIR)/%)
+
+BINODIR := $(ODIR)/$(TARGET)/$(FLAVOR)/bin
+OBINS := $(GEN_BINS:%=$(BINODIR)/%)
+
+CCFLAGS += \
+ -g \
+ -Os \
+ -Wpointer-arith \
+ -Wundef \
+ -Wl,-EL \
+ -fno-inline-functions \
+ -nostdlib \
+ -mlongcalls \
+ -mtext-section-literals \
+ -ffunction-sections \
+ -fdata-sections \
+ -fno-builtin-printf \
+ -fno-jump-tables \
+ -fno-guess-branch-probability \
+ -freorder-blocks-and-partition \
+ -fno-cse-follow-jumps
+# -Wall
+
+DEFINES += -DSPI_FLASH_SIZE_MAP=$(size_map)
+CFLAGS = $(CCFLAGS) $(DEFINES) $(EXTRA_CCFLAGS) $(INCLUDES)
+DFLAGS = $(CCFLAGS) $(DDEFINES) $(EXTRA_CCFLAGS) $(INCLUDES)
+
+
+#############################################################
+# Functions
+#
+
+define ShortcutRule
+$(1): .subdirs $(2)/$(1)
+endef
+
+define MakeLibrary
+DEP_LIBS_$(1) = $$(foreach lib,$$(filter %.a,$$(COMPONENTS_$(1))),$$(dir $$(lib))$$(LIBODIR)/$$(notdir $$(lib)))
+DEP_OBJS_$(1) = $$(foreach obj,$$(filter %.o,$$(COMPONENTS_$(1))),$$(dir $$(obj))$$(OBJODIR)/$$(notdir $$(obj)))
+$$(LIBODIR)/$(1).a: $$(OBJS) $$(DEP_OBJS_$(1)) $$(DEP_LIBS_$(1)) $$(DEPENDS_$(1))
+ @mkdir -p $$(LIBODIR)
+ $$(if $$(filter %.a,$$?),mkdir -p $$(EXTRACT_DIR)_$(1))
+ $$(if $$(filter %.a,$$?),cd $$(EXTRACT_DIR)_$(1); $$(foreach lib,$$(filter %.a,$$?),$$(AR) xo $$(UP_EXTRACT_DIR)/$$(lib);))
+ $$(AR) ru $$@ $$(filter %.o,$$?) $$(if $$(filter %.a,$$?),$$(EXTRACT_DIR)_$(1)/*.o)
+ $$(if $$(filter %.a,$$?),$$(RM) -r $$(EXTRACT_DIR)_$(1))
+endef
+
+define MakeImage
+DEP_LIBS_$(1) = $$(foreach lib,$$(filter %.a,$$(COMPONENTS_$(1))),$$(dir $$(lib))$$(LIBODIR)/$$(notdir $$(lib)))
+DEP_OBJS_$(1) = $$(foreach obj,$$(filter %.o,$$(COMPONENTS_$(1))),$$(dir $$(obj))$$(OBJODIR)/$$(notdir $$(obj)))
+$$(IMAGEODIR)/$(1).out: $$(OBJS) $$(DEP_OBJS_$(1)) $$(DEP_LIBS_$(1)) $$(DEPENDS_$(1))
+ @mkdir -p $$(IMAGEODIR)
+ $$(CC) $$(LDFLAGS) $$(if $$(LINKFLAGS_$(1)),$$(LINKFLAGS_$(1)),$$(LINKFLAGS_DEFAULT) $$(OBJS) $$(DEP_OBJS_$(1)) $$(DEP_LIBS_$(1))) -o $$@
+endef
+
+$(BINODIR)/%.bin: $(IMAGEODIR)/%.out
+ @mkdir -p $(BINODIR)
+
+ifeq ($(APP), 0)
+ @$(RM) -r ../bin/eagle.S ../bin/eagle.dump
+ @$(OBJDUMP) -x -s $< > ../bin/eagle.dump
+ @$(OBJDUMP) -S $< > ../bin/eagle.S
+else
+ mkdir -p ../bin/upgrade
+ @$(RM) -r ../bin/upgrade/$(BIN_NAME).S ../bin/upgrade/$(BIN_NAME).dump
+ @$(OBJDUMP) -x -s $< > ../bin/upgrade/$(BIN_NAME).dump
+ @$(OBJDUMP) -S $< > ../bin/upgrade/$(BIN_NAME).S
+endif
+
+ @$(OBJCOPY) --only-section .text -O binary $< eagle.app.v6.text.bin
+ @$(OBJCOPY) --only-section .data -O binary $< eagle.app.v6.data.bin
+ @$(OBJCOPY) --only-section .rodata -O binary $< eagle.app.v6.rodata.bin
+ @$(OBJCOPY) --only-section .irom0.text -O binary $< eagle.app.v6.irom0text.bin
+
+ @echo ""
+ @echo "!!!"
+
+ifeq ($(app), 0)
+ @python2 ../tools/gen_appbin.py $< 0 $(mode) $(freqdiv) $(size_map) $(app)
+ @mv eagle.app.flash.bin ../bin/eagle.flash.bin
+ @mv eagle.app.v6.irom0text.bin ../bin/eagle.irom0text.bin
+ @rm eagle.app.v6.*
+ @echo "No boot needed."
+ @echo "Generate eagle.flash.bin and eagle.irom0text.bin successully in folder bin."
+ @echo "eagle.flash.bin-------->0x00000"
+ @echo "eagle.irom0text.bin---->0x10000"
+else
+ ifneq ($(boot), new)
+ @python2 ../tools/gen_appbin.py $< 1 $(mode) $(freqdiv) $(size_map) $(app)
+ @echo "Support boot_v1.1 and +"
+ else
+ @python2 ../tools/gen_appbin.py $< 2 $(mode) $(freqdiv) $(size_map) $(app)
+
+ ifeq ($(size_map), 6)
+ @echo "Support boot_v1.4 and +"
+ else
+ ifeq ($(size_map), 5)
+ @echo "Support boot_v1.4 and +"
+ else
+ @echo "Support boot_v1.2 and +"
+ endif
+ endif
+ endif
+
+ @mv eagle.app.flash.bin ../bin/upgrade/$(BIN_NAME).bin
+ @rm eagle.app.v6.*
+ @echo "Generate $(BIN_NAME).bin successully in folder bin/upgrade."
+ @echo "boot.bin------------>0x00000"
+ @echo "$(BIN_NAME).bin--->$(addr)"
+endif
+
+ @echo "!!!"
+
+#############################################################
+# Rules base
+# Should be done in top-level makefile only
+#
+
+all: .subdirs $(OBJS) $(OLIBS) $(OIMAGES) $(OBINS) $(SPECIAL_MKTARGETS)
+
+clean:
+ $(foreach d, $(SUBDIRS), $(MAKE) -C $(d) clean;)
+ $(RM) -r $(ODIR)/$(TARGET)/$(FLAVOR)
+
+clobber: $(SPECIAL_CLOBBER)
+ $(foreach d, $(SUBDIRS), $(MAKE) -C $(d) clobber;)
+ $(RM) -r $(ODIR)
+
+.subdirs:
+ @set -e; $(foreach d, $(SUBDIRS), $(MAKE) -C $(d);)
+
+#.subdirs:
+# $(foreach d, $(SUBDIRS), $(MAKE) -C $(d))
+
+ifneq ($(MAKECMDGOALS),clean)
+ifneq ($(MAKECMDGOALS),clobber)
+ifdef DEPS
+sinclude $(DEPS)
+endif
+endif
+endif
+
+$(OBJODIR)/%.o: %.c
+ @mkdir -p $(OBJODIR);
+ $(CC) $(if $(findstring $<,$(DSRCS)),$(DFLAGS),$(CFLAGS)) $(COPTS_$(*F)) -o $@ -c $<
+
+$(OBJODIR)/%.d: %.c
+ @mkdir -p $(OBJODIR);
+ @echo DEPEND: $(CC) -M $(CFLAGS) $<
+ @set -e; rm -f $@; \
+ $(CC) -M $(CFLAGS) $< > $@.$$$$; \
+ sed 's,\($*\.o\)[ :]*,$(OBJODIR)/\1 $@ : ,g' < $@.$$$$ > $@; \
+ rm -f $@.$$$$
+
+$(OBJODIR)/%.o: %.cpp
+ @mkdir -p $(OBJODIR);
+ $(CXX) $(if $(findstring $<,$(DSRCS)),$(DFLAGS),$(CFLAGS)) $(COPTS_$(*F)) -o $@ -c $<
+
+$(OBJODIR)/%.d: %.cpp
+ @mkdir -p $(OBJODIR);
+ @echo DEPEND: $(CXX) -M $(CFLAGS) $<
+ @set -e; rm -f $@; \
+ sed 's,\($*\.o\)[ :]*,$(OBJODIR)/\1 $@ : ,g' < $@.$$$$ > $@; \
+ rm -f $@.$$$$
+
+$(OBJODIR)/%.o: %.s
+ @mkdir -p $(OBJODIR);
+ $(CC) $(CFLAGS) -o $@ -c $<
+
+$(OBJODIR)/%.d: %.s
+ @mkdir -p $(OBJODIR); \
+ set -e; rm -f $@; \
+ $(CC) -M $(CFLAGS) $< > $@.$$$$; \
+ sed 's,\($*\.o\)[ :]*,$(OBJODIR)/\1 $@ : ,g' < $@.$$$$ > $@; \
+ rm -f $@.$$$$
+
+$(OBJODIR)/%.o: %.S
+ @mkdir -p $(OBJODIR);
+ $(CC) $(CFLAGS) -D__ASSEMBLER__ -o $@ -c $<
+
+$(OBJODIR)/%.d: %.S
+ @mkdir -p $(OBJODIR); \
+ set -e; rm -f $@; \
+ $(CC) -M $(CFLAGS) $< > $@.$$$$; \
+ sed 's,\($*\.o\)[ :]*,$(OBJODIR)/\1 $@ : ,g' < $@.$$$$ > $@; \
+ rm -f $@.$$$$
+
+$(foreach lib,$(GEN_LIBS),$(eval $(call ShortcutRule,$(lib),$(LIBODIR))))
+
+$(foreach image,$(GEN_IMAGES),$(eval $(call ShortcutRule,$(image),$(IMAGEODIR))))
+
+$(foreach bin,$(GEN_BINS),$(eval $(call ShortcutRule,$(bin),$(BINODIR))))
+
+$(foreach lib,$(GEN_LIBS),$(eval $(call MakeLibrary,$(basename $(lib)))))
+
+$(foreach image,$(GEN_IMAGES),$(eval $(call MakeImage,$(basename $(image)))))
+
+#############################################################
+# Recursion Magic - Don't touch this!!
+#
+# Each subtree potentially has an include directory
+# corresponding to the common APIs applicable to modules
+# rooted at that subtree. Accordingly, the INCLUDE PATH
+# of a module can only contain the include directories up
+# its parent path, and not its siblings
+#
+# Required for each makefile to inherit from the parent
+#
+
+INCLUDES := $(INCLUDES) -I $(PDIR)include -I $(PDIR)include/$(TARGET) -I $(PDIR)driver_lib/include
+PDIR := ../$(PDIR)
+sinclude $(PDIR)Makefile
diff --git a/examples/ESP8266_NONOS_SDK/README.md b/examples/ESP8266_NONOS_SDK/README.md
new file mode 100644
index 0000000..764f1c7
--- /dev/null
+++ b/examples/ESP8266_NONOS_SDK/README.md
@@ -0,0 +1,52 @@
+# Support Policy for ESP8266 NonOS
+
+Starting from December 2019,
+
+* We will not add any new features to the ESP8266 NonOS SDK.
+* We will only fix critical bugs in the ESP8266 NonOS SDK.
+* We will only maintain the master branch of ESP8266 NonOS SDK, which is a continuously bug-fix version based on v3.0. This means:
+ * All other released branches will not be updated.
+ * All the future versions will be released from only the master branch mentioned above.
+* It is suggested that the [ESP8266_RTOS_SDK](https://github.com/espressif/ESP8266_RTOS_SDK), instead of ESP8266 NonOS SDK, be used for your projects.
+
+The latest ESP8266_RTOS_SDK allows users to develop applications using an architecture that are compatible with the SDKs of all Espressif chips, including ESP8266 series, ESP32 series, and the upcoming new series of chips. Switching to ESP8266_RTOS_SDK will helps users to:
+
+* Eliminate the necessity to maintain more than one applications (for different chips), thus greatly reducing maintenance costs.
+* Easily switch to other Espressif chips in the future for enhanced flexibility, less dependency, and reduced time-to-market.
+
+Thank you for your interest in Espressif products.
+
+# ESP8266 NonOS 支持政策
+
+自 2019 年 12 月起,我们将:
+
+* 停止为 ESP8266 NonOS 新增任何功能。
+* 仅修复 ESP8266 NonOS 的关键 bug。
+* 所有更新仅在 master 分支进行,即基于 v3.0.0 的持续 bug 修复版本。这意味着:
+ * 其他任何 release 分支均不再提供维护;
+ * 所有更新均将通过上述 master 分支发布。
+* 建议客户使用新版 [ESP8266_RTOS_SDK](https://github.com/espressif/ESP8266_RTOS_SDK)。
+
+简单来说,新版 ESP8266_RTOS_SDK 可帮助客户避免对单一 SDK 的依赖,允许客户应用程序同时兼容多款乐鑫芯片,包括 ESP8266 系列、ESP32 系列以及未来发布的新产品。使用 ESP8266_RTOS_SDK 允许客户:
+
+* 避免同时维护针对不同芯片的多套应用程序,从而降低维护成本。
+* 未来可轻松切换至其他乐鑫芯片,从而提高灵活性、降低对单一芯片的依赖,并缩短上市时间。
+
+感谢大家对乐鑫的支持与关注。
+
+# ESP8266_NONOS_SDK
+
+All documentations @ http://espressif.com/en/support/download/documents?keys=&field_type_tid%5B%5D=14
+
+
+## Notes ##
+Please add `user_pre_init()` in your project, which will be called before `user_init()`. And you MUST call `system_partition_table_regist()` in `user_pre_init` to register your project partition table.
+
+The following partition address CAN NOT be modified, and you MUST give the correct address. They are retated to the flash map, please refer to [ESP8266 SDK Getting Started Guide](https://www.espressif.com/sites/default/files/documentation/2a-esp8266-sdk_getting_started_guide_en.pdf) or [ESP8266 SDK 入门指南](https://www.espressif.com/sites/default/files/documentation/2a-esp8266-sdk_getting_started_guide_cn.pdf).
+
+- SYSTEM\_PARTITION\_BOOTLOADER
+- SYSTEM\_PARTITION\_OTA_1
+- SYSTEM\_PARTITION\_OTA_2
+- SYSTEM\_PARTITION\_SYSTEM_PARAMETER
+
+If you donot use Non-FOTA bin, eagle.irom0.text.bin and irom0.text MUST be downloaded the fixed address, which also can be found in [ESP8266 SDK Getting Started Guide](https://www.espressif.com/sites/default/files/documentation/2a-esp8266-sdk_getting_started_guide_en.pdf) or [ESP8266 SDK 入门指南](https://www.espressif.com/sites/default/files/documentation/2a-esp8266-sdk_getting_started_guide_cn.pdf), and you can define their partition type after `SYSTEM_PARTITION_CUSTOMER_BEGIN`.
\ No newline at end of file
diff --git a/examples/ESP8266_NONOS_SDK/VERSION b/examples/ESP8266_NONOS_SDK/VERSION
new file mode 100755
index 0000000..3a21ff5
--- /dev/null
+++ b/examples/ESP8266_NONOS_SDK/VERSION
@@ -0,0 +1,22 @@
+gwen:
+ at : 865fa65
+ crypto : 865fa65
+ espnow : 865fa65
+ main : 072755c
+ net80211 : 072755c
+ pp : 865fa65
+ ssl : 865fa65
+ upgrade : 81bde69
+ wpa : 1cef03c
+ wpa2 : 865fa65
+ wps : 865fa65
+
+phy:
+ phy : 1156_0
+
+gitlab:
+ driver : 5a2a54b4
+ json : f55d5fee
+ lwip : 3c984cd8
+ mbedtls : 82b93fe5
+ smartconfig : ea1d4a13(v2.5.5)
diff --git a/examples/ESP8266_NONOS_SDK/bin/at/1024+1024/user1.2048.new.5.bin b/examples/ESP8266_NONOS_SDK/bin/at/1024+1024/user1.2048.new.5.bin
new file mode 100644
index 0000000..4e7da13
Binary files /dev/null and b/examples/ESP8266_NONOS_SDK/bin/at/1024+1024/user1.2048.new.5.bin differ
diff --git a/examples/ESP8266_NONOS_SDK/bin/at/1024+1024/user2.2048.new.5.bin b/examples/ESP8266_NONOS_SDK/bin/at/1024+1024/user2.2048.new.5.bin
new file mode 100644
index 0000000..b8a5225
Binary files /dev/null and b/examples/ESP8266_NONOS_SDK/bin/at/1024+1024/user2.2048.new.5.bin differ
diff --git a/examples/ESP8266_NONOS_SDK/bin/at/512+512/user1.1024.new.2.bin b/examples/ESP8266_NONOS_SDK/bin/at/512+512/user1.1024.new.2.bin
new file mode 100644
index 0000000..3de7ffa
Binary files /dev/null and b/examples/ESP8266_NONOS_SDK/bin/at/512+512/user1.1024.new.2.bin differ
diff --git a/examples/ESP8266_NONOS_SDK/bin/at/512+512/user2.1024.new.2.bin b/examples/ESP8266_NONOS_SDK/bin/at/512+512/user2.1024.new.2.bin
new file mode 100644
index 0000000..f10bedb
Binary files /dev/null and b/examples/ESP8266_NONOS_SDK/bin/at/512+512/user2.1024.new.2.bin differ
diff --git a/examples/ESP8266_NONOS_SDK/bin/at/README.md b/examples/ESP8266_NONOS_SDK/bin/at/README.md
new file mode 100755
index 0000000..abe0333
--- /dev/null
+++ b/examples/ESP8266_NONOS_SDK/bin/at/README.md
@@ -0,0 +1,72 @@
+# Notice:
+AT firmware becomes larger since it supports more functions. So, we provide two firmwares here:
+
+* 1024+1024: Normal AT, which is compiled from ESP8266_NONOS_SDK/examples/at, and uses mbedTLS lib.
+* 512+512: Nano AT, which is compiled from ESP8266_NONOS_SDK/examples/at_nano, and uses SSL lib that supports less cipher suites.
+It is suggested to use normal AT(1024+1024), if your flash size is 2MB or larger.
+
+# BOOT MODE
+## download
+
+### Flash size 8Mbit: 512KB+512KB
+ boot_v1.2+.bin 0x00000
+ user1.1024.new.2.bin 0x01000
+ esp_init_data_default.bin 0xfc000
+ blank.bin 0x7e000 & 0xfe000
+
+
+### Flash size 16Mbit-C1: 1024KB+1024KB
+ boot_v1.2+.bin 0x00000
+ user1.2048.new.5.bin 0x01000
+ esp_init_data_default.bin 0x1fc000
+ blank.bin 0xfe000 & 0x1fe000
+
+# NON-BOOT MODE
+## download
+ eagle.flash.bin 0x00000
+ eagle.irom0text.bin 0x10000
+ blank.bin
+ Flash size 8Mbit: 0x7e000 & 0xfe000
+ Flash size 16Mbit: 0x7e000 & 0x1fe000
+ Flash size 16Mbit-C1: 0xfe000 & 0x1fe000
+ Flash size 32Mbit: 0x7e000 & 0x3fe000
+ Flash size 32Mbit-C1: 0xfe000 & 0x3fe000
+ esp_init_data_default.bin
+ Flash size 8Mbit: 0xfc000
+ Flash size 16Mbit: 0x1fc000
+ Flash size 16Mbit-C1: 0x1fc000
+ Flash size 32Mbit: 0x3fc000
+ Flash size 32Mbit-C1: 0x3fc000
+
+## compile
+ modify eagle.app.v6.ld, as
+ irom0_0_seg : org = 0x40210000, len = 0x6C000
+
+
+> NOTICE: UPDATE is not supported in non-boot mode; 4Mbit Flash is not supported in non-boot mode;
+
+# Update steps
+1.Make sure TE(terminal equipment) is in sta or sta+ap mode
+
+ AT+CWMODE=3
+ OK
+
+2.Make sure TE got ip address
+
+ AT+CWJAP="ssid","12345678"
+ OK
+
+ AT+CIFSR
+ 192.168.1.134
+
+3.Let's update
+
+ AT+CIUPDATE
+ +CIPUPDATE:1 found server
+ +CIPUPDATE:2 connect server
+ +CIPUPDATE:3 got edition
+ +CIPUPDATE:4 start start
+
+ OK
+
+> NOTICE: If there are mistakes in the updating, then break update and print ERROR.
diff --git a/examples/ESP8266_NONOS_SDK/bin/at_sdio/1024+1024/user1.2048.new.5.bin b/examples/ESP8266_NONOS_SDK/bin/at_sdio/1024+1024/user1.2048.new.5.bin
new file mode 100644
index 0000000..011f414
Binary files /dev/null and b/examples/ESP8266_NONOS_SDK/bin/at_sdio/1024+1024/user1.2048.new.5.bin differ
diff --git a/examples/ESP8266_NONOS_SDK/bin/at_sdio/1024+1024/user2.2048.new.5.bin b/examples/ESP8266_NONOS_SDK/bin/at_sdio/1024+1024/user2.2048.new.5.bin
new file mode 100644
index 0000000..97ba857
Binary files /dev/null and b/examples/ESP8266_NONOS_SDK/bin/at_sdio/1024+1024/user2.2048.new.5.bin differ
diff --git a/examples/ESP8266_NONOS_SDK/bin/at_sdio/README.md b/examples/ESP8266_NONOS_SDK/bin/at_sdio/README.md
new file mode 100755
index 0000000..d5097b2
--- /dev/null
+++ b/examples/ESP8266_NONOS_SDK/bin/at_sdio/README.md
@@ -0,0 +1,63 @@
+# BOOT MODE
+## download
+### Flash size 16Mbit-C1: 1024KB+1024KB
+ boot_v1.2+.bin 0x00000
+ user1.2048.new.5.bin 0x01000
+ esp_init_data_default.bin 0x1fc000
+ blank.bin 0xfe000 & 0x1fe000
+
+### Flash size 32Mbit-C1: 1024KB+1024KB
+ boot_v1.2+.bin 0x00000
+ user1.2048.new.5.bin 0x01000
+ esp_init_data_default.bin 0x3fc000
+ blank.bin 0xfe000 & 0x3fe000
+
+# NON-BOOT MODE
+## download
+ eagle.flash.bin 0x00000
+ eagle.irom0text.bin 0x10000
+ blank.bin
+ Flash size 8Mbit: 0x7e000 & 0xfe000
+ Flash size 16Mbit: 0x7e000 & 0x1fe000
+ Flash size 16Mbit-C1: 0xfe000 & 0x1fe000
+ Flash size 32Mbit: 0x7e000 & 0x3fe000
+ Flash size 32Mbit-C1: 0xfe000 & 0x3fe000
+ esp_init_data_default.bin
+ Flash size 8Mbit: 0xfc000
+ Flash size 16Mbit: 0x1fc000
+ Flash size 16Mbit-C1: 0x1fc000
+ Flash size 32Mbit: 0x3fc000
+ Flash size 32Mbit-C1: 0x3fc000
+
+## compile
+ modify eagle.app.v6.ld, as
+ irom0_0_seg : org = 0x40210000, len = 0x6C000
+
+
+> NOTICE: UPDATE is not supported in non-boot mode; 4Mbit Flash is not supported in non-boot mode;
+
+# Update steps
+1.Make sure TE(terminal equipment) is in sta or sta+ap mode
+
+ AT+CWMODE=3
+ OK
+
+2.Make sure TE got ip address
+
+ AT+CWJAP="ssid","12345678"
+ OK
+
+ AT+CIFSR
+ 192.168.1.134
+
+3.Let's update
+
+ AT+CIUPDATE
+ +CIPUPDATE:1 found server
+ +CIPUPDATE:2 connect server
+ +CIPUPDATE:3 got edition
+ +CIPUPDATE:4 start start
+
+ OK
+
+> NOTICE: If there are mistakes in the updating, then break update and print ERROR.
\ No newline at end of file
diff --git a/examples/ESP8266_NONOS_SDK/bin/blank.bin b/examples/ESP8266_NONOS_SDK/bin/blank.bin
new file mode 100644
index 0000000..7de9e36
--- /dev/null
+++ b/examples/ESP8266_NONOS_SDK/bin/blank.bin
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/examples/ESP8266_NONOS_SDK/bin/boot_v1.2.bin b/examples/ESP8266_NONOS_SDK/bin/boot_v1.2.bin
new file mode 100644
index 0000000..78e1254
Binary files /dev/null and b/examples/ESP8266_NONOS_SDK/bin/boot_v1.2.bin differ
diff --git a/examples/ESP8266_NONOS_SDK/bin/boot_v1.6.bin b/examples/ESP8266_NONOS_SDK/bin/boot_v1.6.bin
new file mode 100644
index 0000000..6b11db7
Binary files /dev/null and b/examples/ESP8266_NONOS_SDK/bin/boot_v1.6.bin differ
diff --git a/examples/ESP8266_NONOS_SDK/bin/boot_v1.7.bin b/examples/ESP8266_NONOS_SDK/bin/boot_v1.7.bin
new file mode 100644
index 0000000..94a1257
Binary files /dev/null and b/examples/ESP8266_NONOS_SDK/bin/boot_v1.7.bin differ
diff --git a/examples/ESP8266_NONOS_SDK/bin/esp_init_data_default_v05.bin b/examples/ESP8266_NONOS_SDK/bin/esp_init_data_default_v05.bin
new file mode 100644
index 0000000..0df6544
Binary files /dev/null and b/examples/ESP8266_NONOS_SDK/bin/esp_init_data_default_v05.bin differ
diff --git a/examples/ESP8266_NONOS_SDK/bin/esp_init_data_default_v08.bin b/examples/ESP8266_NONOS_SDK/bin/esp_init_data_default_v08.bin
new file mode 100644
index 0000000..32385dc
Binary files /dev/null and b/examples/ESP8266_NONOS_SDK/bin/esp_init_data_default_v08.bin differ
diff --git a/examples/ESP8266_NONOS_SDK/bin/upgrade/user1.4096.new.6.S b/examples/ESP8266_NONOS_SDK/bin/upgrade/user1.4096.new.6.S
new file mode 100644
index 0000000..353df6e
--- /dev/null
+++ b/examples/ESP8266_NONOS_SDK/bin/upgrade/user1.4096.new.6.S
@@ -0,0 +1,86464 @@
+
+.output/eagle/debug/image/eagle.app.v6.out: file format elf32-xtensa-le
+
+
+Disassembly of section .irom0.text:
+
+40201010 :
+40201010: 0018a4 excw
+40201013: 18b440 excw
+40201016: 00 .byte 00
+40201017: 40 .byte 0x40
+
+40201018 :
+40201018: c0c112 addi a1, a1, -64
+4020101b: d1d9 s32i.n a13, a1, 52
+4020101d: c1e9 s32i.n a14, a1, 48
+4020101f: b1f9 s32i.n a15, a1, 44
+40201021: 02dd mov.n a13, a2
+40201023: 04fd mov.n a15, a4
+40201025: 052d mov.n a2, a5
+40201027: 03ed mov.n a14, a3
+40201029: 840c movi.n a4, 8
+4020102b: a6a032 movi a3, 166
+4020102e: f109 s32i.n a0, a1, 60
+40201030: e1c9 s32i.n a12, a1, 56
+40201032: 20c550 or a12, a5, a5
+40201035: fff601 l32r a0, 40201010 <_irom0_text_start>
+40201038: 0000c0 callx0 a0
+4020103b: 0f3d mov.n a3, a15
+4020103d: 114ed0 slli a4, a14, 3
+40201040: 08cc22 addi a2, a12, 8
+40201043: fff401 l32r a0, 40201014 <_irom0_text_start+0x4>
+40201046: 0000c0 callx0 a0
+40201049: 031c movi.n a3, 16
+4020104b: 0d2d mov.n a2, a13
+4020104d: 004bc5 call0 4020150c
+40201050: 02fd mov.n a15, a2
+40201052: f27c movi.n a2, -1
+40201054: 07cf16 beqz a15, 402010d4
+40201057: 7480e0 extui a8, a14, 0, 8
+4020105a: 050c movi.n a5, 0
+4020105c: 670c movi.n a7, 6
+4020105e: 1d0c movi.n a13, 1
+40201060: b02dc0 addx8 a2, a13, a12
+40201063: 4129 s32i.n a2, a1, 16
+40201065: 572ed7 blt a14, a13, 402010c0
+40201068: 840c movi.n a4, 8
+4020106a: 0c3d mov.n a3, a12
+4020106c: 012d mov.n a2, a1
+4020106e: 5179 s32i.n a7, a1, 20
+40201070: 7189 s32i.n a8, a1, 28
+40201072: 6159 s32i.n a5, a1, 24
+40201074: ffe801 l32r a0, 40201014 <_irom0_text_start+0x4>
+40201077: 0000c0 callx0 a0
+4020107a: 840c movi.n a4, 8
+4020107c: 4138 l32i.n a3, a1, 16
+4020107e: 214a add.n a2, a1, a4
+40201080: ffe501 l32r a0, 40201014 <_irom0_text_start+0x4>
+40201083: 0000c0 callx0 a0
+40201086: 014d mov.n a4, a1
+40201088: 013d mov.n a3, a1
+4020108a: 0f2d mov.n a2, a15
+4020108c: 004e05 call0 40201570
+4020108f: 840c movi.n a4, 8
+40201091: 013d mov.n a3, a1
+40201093: 0c2d mov.n a2, a12
+40201095: ffdf01 l32r a0, 40201014 <_irom0_text_start+0x4>
+40201098: 0000c0 callx0 a0
+4020109b: 6158 l32i.n a5, a1, 24
+4020109d: 070c22 l8ui a2, a12, 7
+402010a0: 35da add.n a3, a5, a13
+402010a2: 302320 xor a2, a3, a2
+402010a5: 074c22 s8i a2, a12, 7
+402010a8: 840c movi.n a4, 8
+402010aa: 4128 l32i.n a2, a1, 16
+402010ac: 314a add.n a3, a1, a4
+402010ae: ffd901 l32r a0, 40201014 <_irom0_text_start+0x4>
+402010b1: 0000c0 callx0 a0
+402010b4: dd1b addi.n a13, a13, 1
+402010b6: 7188 l32i.n a8, a1, 28
+402010b8: 5178 l32i.n a7, a1, 20
+402010ba: 6158 l32i.n a5, a1, 24
+402010bc: ffe806 j 40201060
+402010bf: 558000 extui a8, a0, 16, 6
+402010c2: c77280 excw
+402010c5: ff .byte 0xff
+402010c6: 745050 extui a5, a5, 0, 8
+402010c9: f91756 bnez a7, 4020105e
+402010cc: 202ff0 or a2, a15, a15
+402010cf: 004bc5 call0 4020158c
+402010d2: 020c movi.n a2, 0
+402010d4: f108 l32i.n a0, a1, 60
+402010d6: e1c8 l32i.n a12, a1, 56
+402010d8: d1d8 l32i.n a13, a1, 52
+402010da: c1e8 l32i.n a14, a1, 48
+402010dc: b1f8 l32i.n a15, a1, 44
+402010de: 40c112 addi a1, a1, 64
+402010e1: f00d ret.n
+402010e3: ccf000 excw
+402010e6: ff .byte 0xff
+402010e7: 3f .byte 0x3f
+402010e8: 000000 ill
+402010eb: ff .byte 0xff
+402010ec: ff0000 excw
+402010ef: ff0000 excw
+ ...
+
+402010f4 :
+402010f4: e0c112 addi a1, a1, -32
+402010f7: 71c9 s32i.n a12, a1, 28
+402010f9: 61d9 s32i.n a13, a1, 24
+402010fb: 51e9 s32i.n a14, a1, 20
+402010fd: 41f9 s32i.n a15, a1, 16
+402010ff: 0268 l32i.n a6, a2, 0
+40201101: 0304b2 l8ui a11, a4, 3
+40201104: 000472 l8ui a7, a4, 0
+40201107: 30bb60 xor a11, a11, a6
+4020110a: 010462 l8ui a6, a4, 1
+4020110d: 017780 slli a7, a7, 24
+40201110: 30bb70 xor a11, a11, a7
+40201113: 116600 slli a6, a6, 16
+40201116: 306b60 xor a6, a11, a6
+40201119: 0204b2 l8ui a11, a4, 2
+4020111c: 0704a2 l8ui a10, a4, 7
+4020111f: 11bb80 slli a11, a11, 8
+40201122: 30b6b0 xor a11, a6, a11
+40201125: 1268 l32i.n a6, a2, 4
+40201127: 040472 l8ui a7, a4, 4
+4020112a: 30aa60 xor a10, a10, a6
+4020112d: 050462 l8ui a6, a4, 5
+40201130: 017780 slli a7, a7, 24
+40201133: 30aa70 xor a10, a10, a7
+40201136: 116600 slli a6, a6, 16
+40201139: 306a60 xor a6, a10, a6
+4020113c: 0604a2 l8ui a10, a4, 6
+4020113f: 0b0492 l8ui a9, a4, 11
+40201142: 11aa80 slli a10, a10, 8
+40201145: 30a6a0 xor a10, a6, a10
+40201148: 2268 l32i.n a6, a2, 8
+4020114a: 080472 l8ui a7, a4, 8
+4020114d: 309960 xor a9, a9, a6
+40201150: 090462 l8ui a6, a4, 9
+40201153: 017780 slli a7, a7, 24
+40201156: 309970 xor a9, a9, a7
+40201159: 116600 slli a6, a6, 16
+4020115c: 306960 xor a6, a9, a6
+4020115f: 0a0492 l8ui a9, a4, 10
+40201162: 0f0472 l8ui a7, a4, 15
+40201165: 119980 slli a9, a9, 8
+40201168: 309690 xor a9, a6, a9
+4020116b: 3268 l32i.n a6, a2, 12
+4020116d: 0c0482 l8ui a8, a4, 12
+40201170: 307760 xor a7, a7, a6
+40201173: 0d0462 l8ui a6, a4, 13
+40201176: 018880 slli a8, a8, 24
+40201179: 307780 xor a7, a7, a8
+4020117c: 116600 slli a6, a6, 16
+4020117f: 306760 xor a6, a7, a6
+40201182: 0e0472 l8ui a7, a4, 14
+40201185: ffd7c1 l32r a12, 402010e4
+40201188: 213130 srai a3, a3, 1
+4020118b: 117780 slli a7, a7, 8
+4020118e: 0139 s32i.n a3, a1, 0
+40201190: 03ed mov.n a14, a3
+40201192: 307670 xor a7, a6, a7
+40201195: 02dd mov.n a13, a2
+40201197: 0c3d mov.n a3, a12
+40201199: 7548b0 extui a4, a11, 24, 8
+4020119c: a044c0 addx4 a4, a4, a12
+4020119f: 0468 l32i.n a6, a4, 0
+402011a1: 4d48 l32i.n a4, a13, 16
+402011a3: ee0b addi.n a14, a14, -1
+402011a5: 304640 xor a4, a6, a4
+402011a8: 746070 extui a6, a7, 0, 8
+402011ab: a066c0 addx4 a6, a6, a12
+402011ae: 0668 l32i.n a6, a6, 0
+402011b0: 404810 ssai 24
+402011b3: 816660 src a6, a6, a6
+402011b6: 306460 xor a6, a4, a6
+402011b9: 7540a0 extui a4, a10, 16, 8
+402011bc: a044c0 addx4 a4, a4, a12
+402011bf: 0488 l32i.n a8, a4, 0
+402011c1: 404800 ssai 8
+402011c4: 818880 src a8, a8, a8
+402011c7: 304680 xor a4, a6, a8
+402011ca: 746890 extui a6, a9, 8, 8
+402011cd: a066c0 addx4 a6, a6, a12
+402011d0: 0688 l32i.n a8, a6, 0
+402011d2: 7460b0 extui a6, a11, 0, 8
+402011d5: 404010 ssai 16
+402011d8: 818880 src a8, a8, a8
+402011db: 308480 xor a8, a4, a8
+402011de: 7548a0 extui a4, a10, 24, 8
+402011e1: a044c0 addx4 a4, a4, a12
+402011e4: 04f8 l32i.n a15, a4, 0
+402011e6: 5d48 l32i.n a4, a13, 20
+402011e8: a066c0 addx4 a6, a6, a12
+402011eb: 304f40 xor a4, a15, a4
+402011ee: 06f8 l32i.n a15, a6, 0
+402011f0: 404810 ssai 24
+402011f3: 816ff0 src a6, a15, a15
+402011f6: 30f460 xor a15, a4, a6
+402011f9: 754090 extui a4, a9, 16, 8
+402011fc: a044c0 addx4 a4, a4, a12
+402011ff: 0468 l32i.n a6, a4, 0
+40201201: 404800 ssai 8
+40201204: 816660 src a6, a6, a6
+40201207: 304f60 xor a4, a15, a6
+4020120a: 746870 extui a6, a7, 8, 8
+4020120d: a066c0 addx4 a6, a6, a12
+40201210: 0668 l32i.n a6, a6, 0
+40201212: 404010 ssai 16
+40201215: 816660 src a6, a6, a6
+40201218: 306460 xor a6, a4, a6
+4020121b: 754890 extui a4, a9, 24, 8
+4020121e: a044c0 addx4 a4, a4, a12
+40201221: 04f8 l32i.n a15, a4, 0
+40201223: 6d48 l32i.n a4, a13, 24
+40201225: 749090 extui a9, a9, 0, 8
+40201228: 30ff40 xor a15, a15, a4
+4020122b: 7440a0 extui a4, a10, 0, 8
+4020122e: a044c0 addx4 a4, a4, a12
+40201231: 0448 l32i.n a4, a4, 0
+40201233: a099c0 addx4 a9, a9, a12
+40201236: 404810 ssai 24
+40201239: 814440 src a4, a4, a4
+4020123c: 30ff40 xor a15, a15, a4
+4020123f: 754070 extui a4, a7, 16, 8
+40201242: a044c0 addx4 a4, a4, a12
+40201245: 0448 l32i.n a4, a4, 0
+40201247: 757870 extui a7, a7, 24, 8
+4020124a: 404800 ssai 8
+4020124d: 814440 src a4, a4, a4
+40201250: 30ff40 xor a15, a15, a4
+40201253: 7448b0 extui a4, a11, 8, 8
+40201256: a044c0 addx4 a4, a4, a12
+40201259: 0448 l32i.n a4, a4, 0
+4020125b: a077c0 addx4 a7, a7, a12
+4020125e: 404010 ssai 16
+40201261: 814440 src a4, a4, a4
+40201264: 304f40 xor a4, a15, a4
+40201267: 07f8 l32i.n a15, a7, 0
+40201269: 7d78 l32i.n a7, a13, 28
+4020126b: 75b0b0 extui a11, a11, 16, 8
+4020126e: 307f70 xor a7, a15, a7
+40201271: 09f8 l32i.n a15, a9, 0
+40201273: a0bbc0 addx4 a11, a11, a12
+40201276: 404810 ssai 24
+40201279: 81fff0 src a15, a15, a15
+4020127c: 3077f0 xor a7, a7, a15
+4020127f: 0bf8 l32i.n a15, a11, 0
+40201281: 74a8a0 extui a10, a10, 8, 8
+40201284: a0aac0 addx4 a10, a10, a12
+40201287: 404800 ssai 8
+4020128a: 81fff0 src a15, a15, a15
+4020128d: 30f7f0 xor a15, a7, a15
+40201290: 0a78 l32i.n a7, a10, 0
+40201292: 20cdd2 addi a13, a13, 32
+40201295: 404010 ssai 16
+40201298: 817770 src a7, a7, a7
+4020129b: 307f70 xor a7, a15, a7
+4020129e: 039d mov.n a9, a3
+402012a0: 75a880 extui a10, a8, 24, 8
+402012a3: 0ffe16 beqz a14, 402013a6
+402012a6: a0aa30 addx4 a10, a10, a3
+402012a9: 0aa8 l32i.n a10, a10, 0
+402012ab: 0d98 l32i.n a9, a13, 0
+402012ad: 309a90 xor a9, a10, a9
+402012b0: 74a070 extui a10, a7, 0, 8
+402012b3: a0aa30 addx4 a10, a10, a3
+402012b6: 0aa8 l32i.n a10, a10, 0
+402012b8: 404810 ssai 24
+402012bb: 81aaa0 src a10, a10, a10
+402012be: 30a9a0 xor a10, a9, a10
+402012c1: 759060 extui a9, a6, 16, 8
+402012c4: a09930 addx4 a9, a9, a3
+402012c7: 09b8 l32i.n a11, a9, 0
+402012c9: 404800 ssai 8
+402012cc: 81bbb0 src a11, a11, a11
+402012cf: 309ab0 xor a9, a10, a11
+402012d2: 74a840 extui a10, a4, 8, 8
+402012d5: a0aa30 addx4 a10, a10, a3
+402012d8: 0ab8 l32i.n a11, a10, 0
+402012da: 74a080 extui a10, a8, 0, 8
+402012dd: 404010 ssai 16
+402012e0: 81bbb0 src a11, a11, a11
+402012e3: 30b9b0 xor a11, a9, a11
+402012e6: 759860 extui a9, a6, 24, 8
+402012e9: a09930 addx4 a9, a9, a3
+402012ec: 09f8 l32i.n a15, a9, 0
+402012ee: 1d98 l32i.n a9, a13, 4
+402012f0: a0aa30 addx4 a10, a10, a3
+402012f3: 309f90 xor a9, a15, a9
+402012f6: 0af8 l32i.n a15, a10, 0
+402012f8: 404810 ssai 24
+402012fb: 81aff0 src a10, a15, a15
+402012fe: 30f9a0 xor a15, a9, a10
+40201301: 759040 extui a9, a4, 16, 8
+40201304: a09930 addx4 a9, a9, a3
+40201307: 09a8 l32i.n a10, a9, 0
+40201309: 404800 ssai 8
+4020130c: 81aaa0 src a10, a10, a10
+4020130f: 309fa0 xor a9, a15, a10
+40201312: 74a870 extui a10, a7, 8, 8
+40201315: a0aa30 addx4 a10, a10, a3
+40201318: 0aa8 l32i.n a10, a10, 0
+4020131a: 404010 ssai 16
+4020131d: 81aaa0 src a10, a10, a10
+40201320: 30a9a0 xor a10, a9, a10
+40201323: 759840 extui a9, a4, 24, 8
+40201326: a09930 addx4 a9, a9, a3
+40201329: 09f8 l32i.n a15, a9, 0
+4020132b: 2d98 l32i.n a9, a13, 8
+4020132d: 744040 extui a4, a4, 0, 8
+40201330: 30ff90 xor a15, a15, a9
+40201333: 749060 extui a9, a6, 0, 8
+40201336: a09930 addx4 a9, a9, a3
+40201339: 0998 l32i.n a9, a9, 0
+4020133b: a04430 addx4 a4, a4, a3
+4020133e: 404810 ssai 24
+40201341: 819990 src a9, a9, a9
+40201344: 30ff90 xor a15, a15, a9
+40201347: 759070 extui a9, a7, 16, 8
+4020134a: a09930 addx4 a9, a9, a3
+4020134d: 0998 l32i.n a9, a9, 0
+4020134f: 757870 extui a7, a7, 24, 8
+40201352: 404800 ssai 8
+40201355: 819990 src a9, a9, a9
+40201358: 30ff90 xor a15, a15, a9
+4020135b: 749880 extui a9, a8, 8, 8
+4020135e: a09930 addx4 a9, a9, a3
+40201361: 0998 l32i.n a9, a9, 0
+40201363: a07730 addx4 a7, a7, a3
+40201366: 404010 ssai 16
+40201369: 819990 src a9, a9, a9
+4020136c: 309f90 xor a9, a15, a9
+4020136f: 07f8 l32i.n a15, a7, 0
+40201371: 3d78 l32i.n a7, a13, 12
+40201373: 758080 extui a8, a8, 16, 8
+40201376: 307f70 xor a7, a15, a7
+40201379: 04f8 l32i.n a15, a4, 0
+4020137b: a08830 addx4 a8, a8, a3
+4020137e: 404810 ssai 24
+40201381: 81fff0 src a15, a15, a15
+40201384: 3077f0 xor a7, a7, a15
+40201387: 08f8 l32i.n a15, a8, 0
+40201389: 746860 extui a6, a6, 8, 8
+4020138c: 404800 ssai 8
+4020138f: 81fff0 src a15, a15, a15
+40201392: a06630 addx4 a6, a6, a3
+40201395: 30f7f0 xor a15, a7, a15
+40201398: 0678 l32i.n a7, a6, 0
+4020139a: 404010 ssai 16
+4020139d: 817770 src a7, a7, a7
+402013a0: 307f70 xor a7, a15, a7
+402013a3: ff7c86 j 40201199
+402013a6: 01b8 l32i.n a11, a1, 0
+402013a8: a0aa90 addx4 a10, a10, a9
+402013ab: 113bb0 slli a3, a11, 5
+402013ae: 223a add.n a2, a2, a3
+402013b0: 0a38 l32i.n a3, a10, 0
+402013b2: ff4db1 l32r a11, 402010e8
+402013b5: 113380 slli a3, a3, 8
+402013b8: 10d3b0 and a13, a3, a11
+402013bb: 753060 extui a3, a6, 16, 8
+402013be: a03390 addx4 a3, a3, a9
+402013c1: ff4aa1 l32r a10, 402010ec
+402013c4: 0338 l32i.n a3, a3, 0
+402013c6: 02c8 l32i.n a12, a2, 0
+402013c8: 1033a0 and a3, a3, a10
+402013cb: 303d30 xor a3, a13, a3
+402013ce: 30c3c0 xor a12, a3, a12
+402013d1: 743840 extui a3, a4, 8, 8
+402013d4: a03390 addx4 a3, a3, a9
+402013d7: 03d8 l32i.n a13, a3, 0
+402013d9: ff4531 l32r a3, 402010f0
+402013dc: 10dd30 and a13, a13, a3
+402013df: 30dcd0 xor a13, a12, a13
+402013e2: 74c070 extui a12, a7, 0, 8
+402013e5: a0cc90 addx4 a12, a12, a9
+402013e8: 010cc2 l8ui a12, a12, 1
+402013eb: 30cdc0 xor a12, a13, a12
+402013ee: 75d8c0 extui a13, a12, 24, 8
+402013f1: 0045d2 s8i a13, a5, 0
+402013f4: f5d0c0 extui a13, a12, 16, 16
+402013f7: 0145d2 s8i a13, a5, 1
+402013fa: 0345c2 s8i a12, a5, 3
+402013fd: 41d8c0 srli a13, a12, 8
+40201400: 75c860 extui a12, a6, 24, 8
+40201403: a0cc90 addx4 a12, a12, a9
+40201406: 0cc8 l32i.n a12, a12, 0
+40201408: 0245d2 s8i a13, a5, 2
+4020140b: 11cc80 slli a12, a12, 8
+4020140e: 10dcb0 and a13, a12, a11
+40201411: 75c040 extui a12, a4, 16, 8
+40201414: a0cc90 addx4 a12, a12, a9
+40201417: 0cc8 l32i.n a12, a12, 0
+40201419: 10cca0 and a12, a12, a10
+4020141c: 30cdc0 xor a12, a13, a12
+4020141f: 12d8 l32i.n a13, a2, 4
+40201421: 30ccd0 xor a12, a12, a13
+40201424: 74d870 extui a13, a7, 8, 8
+40201427: a0dd90 addx4 a13, a13, a9
+4020142a: 0dd8 l32i.n a13, a13, 0
+4020142c: 10dd30 and a13, a13, a3
+4020142f: 30dcd0 xor a13, a12, a13
+40201432: 74c080 extui a12, a8, 0, 8
+40201435: a0cc90 addx4 a12, a12, a9
+40201438: 010cc2 l8ui a12, a12, 1
+4020143b: 30cdc0 xor a12, a13, a12
+4020143e: 75d8c0 extui a13, a12, 24, 8
+40201441: 0445d2 s8i a13, a5, 4
+40201444: f5d0c0 extui a13, a12, 16, 16
+40201447: 0545d2 s8i a13, a5, 5
+4020144a: 0745c2 s8i a12, a5, 7
+4020144d: 41d8c0 srli a13, a12, 8
+40201450: 75c840 extui a12, a4, 24, 8
+40201453: a0cc90 addx4 a12, a12, a9
+40201456: 0cc8 l32i.n a12, a12, 0
+40201458: 0645d2 s8i a13, a5, 6
+4020145b: 11cc80 slli a12, a12, 8
+4020145e: 10dcb0 and a13, a12, a11
+40201461: 75c070 extui a12, a7, 16, 8
+40201464: a0cc90 addx4 a12, a12, a9
+40201467: 0cc8 l32i.n a12, a12, 0
+40201469: 757870 extui a7, a7, 24, 8
+4020146c: 10cca0 and a12, a12, a10
+4020146f: 30cdc0 xor a12, a13, a12
+40201472: 22d8 l32i.n a13, a2, 8
+40201474: a07790 addx4 a7, a7, a9
+40201477: 30ccd0 xor a12, a12, a13
+4020147a: 74d880 extui a13, a8, 8, 8
+4020147d: a0dd90 addx4 a13, a13, a9
+40201480: 0dd8 l32i.n a13, a13, 0
+40201482: 0778 l32i.n a7, a7, 0
+40201484: 10dd30 and a13, a13, a3
+40201487: 30dcd0 xor a13, a12, a13
+4020148a: 74c060 extui a12, a6, 0, 8
+4020148d: a0cc90 addx4 a12, a12, a9
+40201490: 010cc2 l8ui a12, a12, 1
+40201493: 758080 extui a8, a8, 16, 8
+40201496: 30cdc0 xor a12, a13, a12
+40201499: 75d8c0 extui a13, a12, 24, 8
+4020149c: 0845d2 s8i a13, a5, 8
+4020149f: f5d0c0 extui a13, a12, 16, 16
+402014a2: 0945d2 s8i a13, a5, 9
+402014a5: 117780 slli a7, a7, 8
+402014a8: 41d8c0 srli a13, a12, 8
+402014ab: a08890 addx4 a8, a8, a9
+402014ae: 0a45d2 s8i a13, a5, 10
+402014b1: 0b45c2 s8i a12, a5, 11
+402014b4: 10b7b0 and a11, a7, a11
+402014b7: 0878 l32i.n a7, a8, 0
+402014b9: 746860 extui a6, a6, 8, 8
+402014bc: 3228 l32i.n a2, a2, 12
+402014be: 10a7a0 and a10, a7, a10
+402014c1: a06690 addx4 a6, a6, a9
+402014c4: 30aba0 xor a10, a11, a10
+402014c7: 30aa20 xor a10, a10, a2
+402014ca: 744040 extui a4, a4, 0, 8
+402014cd: 0628 l32i.n a2, a6, 0
+402014cf: a09490 addx4 a9, a4, a9
+402014d2: 103230 and a3, a2, a3
+402014d5: 010922 l8ui a2, a9, 1
+402014d8: 303a30 xor a3, a10, a3
+402014db: 303320 xor a3, a3, a2
+402014de: 752830 extui a2, a3, 24, 8
+402014e1: 0c4522 s8i a2, a5, 12
+402014e4: f52030 extui a2, a3, 16, 16
+402014e7: 0d4522 s8i a2, a5, 13
+402014ea: 412830 srli a2, a3, 8
+402014ed: 71c8 l32i.n a12, a1, 28
+402014ef: 61d8 l32i.n a13, a1, 24
+402014f1: 51e8 l32i.n a14, a1, 20
+402014f3: 41f8 l32i.n a15, a1, 16
+402014f5: 0e4522 s8i a2, a5, 14
+402014f8: 0f4532 s8i a3, a5, 15
+402014fb: 20c112 addi a1, a1, 32
+402014fe: f00d ret.n
+40201500: 230981 l32r a8, 401ca124 <_lit4_end+0xc3df8>
+40201503: 209840 or a9, a8, a4
+40201506: d04010 subx2 a4, a0, a1
+40201509: 1e .byte 0x1e
+4020150a: 10 .byte 0x10
+4020150b: 40 .byte 0x40
+
+4020150c :
+4020150c: e0c112 addi a1, a1, -32
+4020150f: 0561d2 s32i a13, a1, 20
+40201512: fffbd1 l32r a13, 40201500
+40201515: 0461e2 s32i a14, a1, 16
+40201518: 0361f2 s32i a15, a1, 12
+4020151b: 02ed mov.n a14, a2
+4020151d: 03fd mov.n a15, a3
+4020151f: 050c movi.n a5, 0
+40201521: 73a042 movi a4, 115
+40201524: 0d3d mov.n a3, a13
+40201526: f4a022 movi a2, 244
+40201529: 61c9 s32i.n a12, a1, 24
+4020152b: 7109 s32i.n a0, a1, 28
+4020152d: fff501 l32r a0, 40201504
+40201530: 0000c0 callx0 a0
+40201533: 02cd mov.n a12, a2
+40201535: 020c movi.n a2, 0
+40201537: 231c27 beq a12, a2, 4020155e
+4020153a: 114fd0 slli a4, a15, 3
+4020153d: 0e3d mov.n a3, a14
+4020153f: 0c2d mov.n a2, a12
+40201541: 000785 call0 402015bc
+40201544: 0112d6 bgez a2, 40201559
+40201547: 0c2d mov.n a2, a12
+40201549: 78a042 movi a4, 120
+4020154c: 0d3d mov.n a3, a13
+4020154e: ffee01 l32r a0, 40201508
+40201551: 0000c0 callx0 a0
+40201554: 020c movi.n a2, 0
+40201556: 000106 j 4020155e
+40201559: 3c6c22 s32i a2, a12, 240
+4020155c: 0c2d mov.n a2, a12
+4020155e: 7108 l32i.n a0, a1, 28
+40201560: 61c8 l32i.n a12, a1, 24
+40201562: 51d8 l32i.n a13, a1, 20
+40201564: 41e8 l32i.n a14, a1, 16
+40201566: 31f8 l32i.n a15, a1, 12
+40201568: 20c112 addi a1, a1, 32
+4020156b: f00d ret.n
+4020156d: 000000 ill
+
+40201570 :
+40201570: 205440 or a5, a4, a4
+40201573: 204330 or a4, a3, a3
+40201576: 3c2232 l32i a3, a2, 240
+40201579: f0c112 addi a1, a1, -16
+4020157c: 036102 s32i a0, a1, 12
+4020157f: ffb745 call0 402010f4
+40201582: 3108 l32i.n a0, a1, 12
+40201584: 10c112 addi a1, a1, 16
+40201587: f00d ret.n
+40201589: 000000 ill
+
+4020158c :
+4020158c: f0c112 addi a1, a1, -16
+4020158f: f4a042 movi a4, 244
+40201592: 030c movi.n a3, 0
+40201594: 3109 s32i.n a0, a1, 12
+40201596: 21c9 s32i.n a12, a1, 8
+40201598: 02cd mov.n a12, a2
+4020159a: fe9d01 l32r a0, 40201010 <_irom0_text_start>
+4020159d: 0000c0 callx0 a0
+402015a0: ffd831 l32r a3, 40201500
+402015a3: 0c2d mov.n a2, a12
+402015a5: 8aa042 movi a4, 138
+402015a8: ffd801 l32r a0, 40201508
+402015ab: 0000c0 callx0 a0
+402015ae: 3108 l32i.n a0, a1, 12
+402015b0: 21c8 l32i.n a12, a1, 8
+402015b2: 10c112 addi a1, a1, 16
+402015b5: f00d ret.n
+402015b7: d0f000 subx2 a15, a0, a0
+402015ba: ff .byte 0xff
+402015bb: 3f .byte 0x3f
+
+402015bc :
+402015bc: f0c112 addi a1, a1, -16
+402015bf: 31c9 s32i.n a12, a1, 12
+402015c1: 21d9 s32i.n a13, a1, 8
+402015c3: 11e9 s32i.n a14, a1, 4
+402015c5: 01f9 s32i.n a15, a1, 0
+402015c7: 000352 l8ui a5, a3, 0
+402015ca: 016580 slli a6, a5, 24
+402015cd: 010352 l8ui a5, a3, 1
+402015d0: 115500 slli a5, a5, 16
+402015d3: 305650 xor a5, a6, a5
+402015d6: 030362 l8ui a6, a3, 3
+402015d9: 306560 xor a6, a5, a6
+402015dc: 020352 l8ui a5, a3, 2
+402015df: 115580 slli a5, a5, 8
+402015e2: 305650 xor a5, a6, a5
+402015e5: 0259 s32i.n a5, a2, 0
+402015e7: 040352 l8ui a5, a3, 4
+402015ea: 016580 slli a6, a5, 24
+402015ed: 050352 l8ui a5, a3, 5
+402015f0: 115500 slli a5, a5, 16
+402015f3: 305650 xor a5, a6, a5
+402015f6: 070362 l8ui a6, a3, 7
+402015f9: 306560 xor a6, a5, a6
+402015fc: 060352 l8ui a5, a3, 6
+402015ff: 115580 slli a5, a5, 8
+40201602: 305650 xor a5, a6, a5
+40201605: 1259 s32i.n a5, a2, 4
+40201607: 080352 l8ui a5, a3, 8
+4020160a: 016580 slli a6, a5, 24
+4020160d: 090352 l8ui a5, a3, 9
+40201610: 115500 slli a5, a5, 16
+40201613: 305650 xor a5, a6, a5
+40201616: 0b0362 l8ui a6, a3, 11
+40201619: 306560 xor a6, a5, a6
+4020161c: 0a0352 l8ui a5, a3, 10
+4020161f: 115580 slli a5, a5, 8
+40201622: 305650 xor a5, a6, a5
+40201625: 2259 s32i.n a5, a2, 8
+40201627: 0c0352 l8ui a5, a3, 12
+4020162a: 016580 slli a6, a5, 24
+4020162d: 0d0352 l8ui a5, a3, 13
+40201630: 115500 slli a5, a5, 16
+40201633: 305650 xor a5, a6, a5
+40201636: 0f0362 l8ui a6, a3, 15
+40201639: 306560 xor a6, a5, a6
+4020163c: 0e0352 l8ui a5, a3, 14
+4020163f: 115580 slli a5, a5, 8
+40201642: 305650 xor a5, a6, a5
+40201645: 3259 s32i.n a5, a2, 12
+40201647: 7de466 bnei a4, 128, 402016c8
+4020164a: a0a062 movi a6, 160
+4020164d: ffda71 l32r a7, 402015b8
+40201650: fea551 l32r a5, 402010e4
+40201653: fea7a1 l32r a10, 402010f0
+40201656: fea591 l32r a9, 402010ec
+40201659: fea381 l32r a8, 402010e8
+4020165c: 626a add.n a6, a2, a6
+4020165e: 32b8 l32i.n a11, a2, 12
+40201660: 0248 l32i.n a4, a2, 0
+40201662: 7430b0 extui a3, a11, 0, 8
+40201665: a03350 addx4 a3, a3, a5
+40201668: 0338 l32i.n a3, a3, 0
+4020166a: 1033a0 and a3, a3, a10
+4020166d: 303340 xor a3, a3, a4
+40201670: 7448b0 extui a4, a11, 8, 8
+40201673: a04450 addx4 a4, a4, a5
+40201676: 0448 l32i.n a4, a4, 0
+40201678: 104490 and a4, a4, a9
+4020167b: 303340 xor a3, a3, a4
+4020167e: 7548b0 extui a4, a11, 24, 8
+40201681: a04450 addx4 a4, a4, a5
+40201684: 010442 l8ui a4, a4, 1
+40201687: 303340 xor a3, a3, a4
+4020168a: 000742 l8ui a4, a7, 0
+4020168d: 771b addi.n a7, a7, 1
+4020168f: 014480 slli a4, a4, 24
+40201692: 303340 xor a3, a3, a4
+40201695: 7540b0 extui a4, a11, 16, 8
+40201698: a04450 addx4 a4, a4, a5
+4020169b: 0448 l32i.n a4, a4, 0
+4020169d: 114480 slli a4, a4, 8
+402016a0: 104480 and a4, a4, a8
+402016a3: 303340 xor a3, a3, a4
+402016a6: 1248 l32i.n a4, a2, 4
+402016a8: 4239 s32i.n a3, a2, 16
+402016aa: 303340 xor a3, a3, a4
+402016ad: 2248 l32i.n a4, a2, 8
+402016af: 5239 s32i.n a3, a2, 20
+402016b1: 303340 xor a3, a3, a4
+402016b4: 6239 s32i.n a3, a2, 24
+402016b6: 303b30 xor a3, a11, a3
+402016b9: 7239 s32i.n a3, a2, 28
+402016bb: 10c222 addi a2, a2, 16
+402016be: 9c9267 bne a2, a6, 4020165e
+402016c1: a30c movi.n a3, 10
+402016c3: 007ec6 j 402018c2
+402016c6: 520000 excw
+402016c9: 801003 excw
+402016cc: 520165 excw
+402016cf: 001103 excw
+402016d2: 501155 excw
+402016d5: 623056 bnez a0, 40201cfc
+402016d8: 601303 excw
+402016db: 523065 excw
+402016de: 801203 excw
+402016e1: 501155 excw
+402016e4: 593056 bnez a0, 40201c7b
+402016e7: 035242 s16i a4, a2, 6
+402016ea: 658014 excw
+402016ed: 035201 l32r a0, 401c2438 <_lit4_end+0xbc10c>
+402016f0: 550015 excw
+402016f3: 565011 l32r a1, 401d7034 <_lit4_end+0xd0d08>
+402016f6: 036230 excw
+402016f9: 656017 bbci a0, 1, 40201762
+402016fc: 035230 excw
+402016ff: 558016 beqz a0, 40201c5b
+40201702: 565011 l32r a1, 401d7044 <_lit4_end+0xd0d18>
+40201705: 525930 excw
+40201708: c0a052 movi a5, 192
+4020170b: 021457 beq a4, a5, 40201711
+4020170e: 002286 j 4020179c
+40201711: a8a062 movi a6, 168
+40201714: ffa971 l32r a7, 402015b8
+40201717: fe7351 l32r a5, 402010e4
+4020171a: fe7581 l32r a8, 402010f0
+4020171d: fe7391 l32r a9, 402010ec
+40201720: fe72a1 l32r a10, 402010e8
+40201723: 626a add.n a6, a2, a6
+40201725: 52b8 l32i.n a11, a2, 20
+40201727: 0248 l32i.n a4, a2, 0
+40201729: 7430b0 extui a3, a11, 0, 8
+4020172c: a03350 addx4 a3, a3, a5
+4020172f: 0338 l32i.n a3, a3, 0
+40201731: 103380 and a3, a3, a8
+40201734: 303340 xor a3, a3, a4
+40201737: 7448b0 extui a4, a11, 8, 8
+4020173a: a04450 addx4 a4, a4, a5
+4020173d: 0448 l32i.n a4, a4, 0
+4020173f: 104490 and a4, a4, a9
+40201742: 303340 xor a3, a3, a4
+40201745: 7548b0 extui a4, a11, 24, 8
+40201748: a04450 addx4 a4, a4, a5
+4020174b: 010442 l8ui a4, a4, 1
+4020174e: 303340 xor a3, a3, a4
+40201751: 000742 l8ui a4, a7, 0
+40201754: 771b addi.n a7, a7, 1
+40201756: 014480 slli a4, a4, 24
+40201759: 304340 xor a4, a3, a4
+4020175c: 7530b0 extui a3, a11, 16, 8
+4020175f: a03350 addx4 a3, a3, a5
+40201762: 0338 l32i.n a3, a3, 0
+40201764: 113380 slli a3, a3, 8
+40201767: 1033a0 and a3, a3, a10
+4020176a: 303430 xor a3, a4, a3
+4020176d: 1248 l32i.n a4, a2, 4
+4020176f: 6239 s32i.n a3, a2, 24
+40201771: 303340 xor a3, a3, a4
+40201774: 2248 l32i.n a4, a2, 8
+40201776: 7239 s32i.n a3, a2, 28
+40201778: 303340 xor a3, a3, a4
+4020177b: 3248 l32i.n a4, a2, 12
+4020177d: 8239 s32i.n a3, a2, 32
+4020177f: 303340 xor a3, a3, a4
+40201782: 9239 s32i.n a3, a2, 36
+40201784: 029267 bne a2, a6, 4020178a
+40201787: 004d46 j 402018c0
+4020178a: 4248 l32i.n a4, a2, 16
+4020178c: 18c222 addi a2, a2, 24
+4020178f: 303340 xor a3, a3, a4
+40201792: 4239 s32i.n a3, a2, 16
+40201794: 303b30 xor a3, a11, a3
+40201797: 5239 s32i.n a3, a2, 20
+40201799: ffe206 j 40201725
+4020179c: 180352 l8ui a5, a3, 24
+4020179f: 016580 slli a6, a5, 24
+402017a2: 190352 l8ui a5, a3, 25
+402017a5: 115500 slli a5, a5, 16
+402017a8: 305650 xor a5, a6, a5
+402017ab: 1b0362 l8ui a6, a3, 27
+402017ae: 306560 xor a6, a5, a6
+402017b1: 1a0352 l8ui a5, a3, 26
+402017b4: 115580 slli a5, a5, 8
+402017b7: 305650 xor a5, a6, a5
+402017ba: 6259 s32i.n a5, a2, 24
+402017bc: 1c0352 l8ui a5, a3, 28
+402017bf: 016580 slli a6, a5, 24
+402017c2: 1d0352 l8ui a5, a3, 29
+402017c5: 115500 slli a5, a5, 16
+402017c8: 305650 xor a5, a6, a5
+402017cb: 1f0362 l8ui a6, a3, 31
+402017ce: 1e0332 l8ui a3, a3, 30
+402017d1: 305560 xor a5, a5, a6
+402017d4: 113380 slli a3, a3, 8
+402017d7: 303530 xor a3, a5, a3
+402017da: 7239 s32i.n a3, a2, 28
+402017dc: f37c movi.n a3, -1
+402017de: 02f426 beqi a4, 0x100, 402017e4
+402017e1: 003746 j 402018c2
+402017e4: fe4041 l32r a4, 402010e4
+402017e7: fe42c1 l32r a12, 402010f0
+402017ea: c0a082 movi a8, 192
+402017ed: ff7291 l32r a9, 402015b8
+402017f0: fe3ed1 l32r a13, 402010e8
+402017f3: fe3ee1 l32r a14, 402010ec
+402017f6: 828a add.n a8, a2, a8
+402017f8: 047d mov.n a7, a4
+402017fa: 0cfd mov.n a15, a12
+402017fc: 7258 l32i.n a5, a2, 28
+402017fe: 02a8 l32i.n a10, a2, 0
+40201800: 743050 extui a3, a5, 0, 8
+40201803: a03340 addx4 a3, a3, a4
+40201806: 0338 l32i.n a3, a3, 0
+40201808: fe39b1 l32r a11, 402010ec
+4020180b: 1033c0 and a3, a3, a12
+4020180e: 30a3a0 xor a10, a3, a10
+40201811: 743850 extui a3, a5, 8, 8
+40201814: a03340 addx4 a3, a3, a4
+40201817: 0338 l32i.n a3, a3, 0
+40201819: 1063b0 and a6, a3, a11
+4020181c: 303a60 xor a3, a10, a6
+4020181f: 756850 extui a6, a5, 24, 8
+40201822: a06640 addx4 a6, a6, a4
+40201825: 0106a2 l8ui a10, a6, 1
+40201828: fe30b1 l32r a11, 402010e8
+4020182b: 3033a0 xor a3, a3, a10
+4020182e: 0009a2 l8ui a10, a9, 0
+40201831: 991b addi.n a9, a9, 1
+40201833: 016a80 slli a6, a10, 24
+40201836: 30a360 xor a10, a3, a6
+40201839: 753050 extui a3, a5, 16, 8
+4020183c: a03340 addx4 a3, a3, a4
+4020183f: 0338 l32i.n a3, a3, 0
+40201841: 113380 slli a3, a3, 8
+40201844: 1063b0 and a6, a3, a11
+40201847: 303a60 xor a3, a10, a6
+4020184a: 1268 l32i.n a6, a2, 4
+4020184c: 8239 s32i.n a3, a2, 32
+4020184e: 303360 xor a3, a3, a6
+40201851: 2268 l32i.n a6, a2, 8
+40201853: 9239 s32i.n a3, a2, 36
+40201855: 303360 xor a3, a3, a6
+40201858: 3268 l32i.n a6, a2, 12
+4020185a: a239 s32i.n a3, a2, 40
+4020185c: 303360 xor a3, a3, a6
+4020185f: b239 s32i.n a3, a2, 44
+40201861: 551287 beq a2, a8, 402018ba
+40201864: 756830 extui a6, a3, 24, 8
+40201867: a06670 addx4 a6, a6, a7
+4020186a: 06a8 l32i.n a10, a6, 0
+4020186c: 756030 extui a6, a3, 16, 8
+4020186f: a06670 addx4 a6, a6, a7
+40201872: 0668 l32i.n a6, a6, 0
+40201874: 11aa80 slli a10, a10, 8
+40201877: 10aad0 and a10, a10, a13
+4020187a: 1066e0 and a6, a6, a14
+4020187d: 306a60 xor a6, a10, a6
+40201880: 42a8 l32i.n a10, a2, 16
+40201882: 30a6a0 xor a10, a6, a10
+40201885: 746830 extui a6, a3, 8, 8
+40201888: a06670 addx4 a6, a6, a7
+4020188b: 0668 l32i.n a6, a6, 0
+4020188d: 743030 extui a3, a3, 0, 8
+40201890: a03370 addx4 a3, a3, a7
+40201893: 1066f0 and a6, a6, a15
+40201896: 306a60 xor a6, a10, a6
+40201899: 0103a2 l8ui a10, a3, 1
+4020189c: 5238 l32i.n a3, a2, 20
+4020189e: 3066a0 xor a6, a6, a10
+402018a1: c269 s32i.n a6, a2, 48
+402018a3: 306630 xor a6, a6, a3
+402018a6: 6238 l32i.n a3, a2, 24
+402018a8: d269 s32i.n a6, a2, 52
+402018aa: 306630 xor a6, a6, a3
+402018ad: 305560 xor a5, a5, a6
+402018b0: e269 s32i.n a6, a2, 56
+402018b2: f259 s32i.n a5, a2, 60
+402018b4: 20c222 addi a2, a2, 32
+402018b7: ffd046 j 402017fc
+402018ba: e30c movi.n a3, 14
+402018bc: 000086 j 402018c2
+402018bf: c30c00 excw
+402018c2: 032d mov.n a2, a3
+402018c4: 31c8 l32i.n a12, a1, 12
+402018c6: 21d8 l32i.n a13, a1, 8
+402018c8: 11e8 l32i.n a14, a1, 4
+402018ca: 01f8 l32i.n a15, a1, 0
+402018cc: 10c112 addi a1, a1, 16
+402018cf: f00d ret.n
+402018d1: 000000 ill
+402018d4: ff .byte 0xff
+402018d5: 7f .byte 0x7f
+402018d6: b00000 addx8 a0, a0, a0
+402018d9: 3ffe83 excw
+402018dc: 0598 l32i.n a9, a5, 0
+402018de: 684023 excw
+402018e1: 4000e2 l8ui a14, a0, 64
+402018e4: f0c112 addi a1, a1, -16
+402018e7: 21c9 s32i.n a12, a1, 8
+402018e9: fffbc1 l32r a12, 402018d8
+402018ec: 11d9 s32i.n a13, a1, 4
+402018ee: 036102 s32i a0, a1, 12
+402018f1: ffa3d2 movi a13, 0x3ff
+402018f4: 0ddbc5 call0 4020f6b4
+402018f7: fff731 l32r a3, 402018d4
+402018fa: f42020 extui a2, a2, 0, 16
+402018fd: fff801 l32r a0, 402018e0
+40201900: 0000c0 callx0 a0
+40201903: f42020 extui a2, a2, 0, 16
+40201906: 005c22 s16i a2, a12, 0
+40201909: 053d27 bltu a13, a2, 40201912
+4020190c: 04d222 addmi a2, a2, 0x400
+4020190f: 005c22 s16i a2, a12, 0
+40201912: 001c22 l16ui a2, a12, 0
+40201915: fff151 l32r a5, 402018dc
+40201918: 030c movi.n a3, 0
+4020191a: 435a add.n a4, a3, a5
+4020191c: 0448 l32i.n a4, a4, 0
+4020191e: 0448 l32i.n a4, a4, 0
+40201920: c48c beqz.n a4, 40201930
+40201922: 101462 l16ui a6, a4, 32
+40201925: cb1627 beq a6, a2, 402018f4
+40201928: 3448 l32i.n a4, a4, 12
+4020192a: fffc86 j 40201920
+4020192d: 000000 ill
+40201930: 334b addi.n a3, a3, 4
+40201932: e4b366 bnei a3, 16, 4020191a
+40201935: 3108 l32i.n a0, a1, 12
+40201937: 21c8 l32i.n a12, a1, 8
+40201939: 11d8 l32i.n a13, a1, 4
+4020193b: 10c112 addi a1, a1, 16
+4020193e: f00d ret.n
+40201940: 0011f0 excw
+40201943: e76460 excw
+40201946: fe .byte 0xfe
+40201947: 3f .byte 0x3f
+40201948: fee770 excw
+4020194b: 3f .byte 0x3f
+4020194c: e778 l32i.n a7, a7, 56
+4020194e: fe .byte 0xfe
+4020194f: 3f .byte 0x3f
+40201950: fee774 excw
+40201953: 3f .byte 0x3f
+40201954: fe8863 excw
+40201957: 3f .byte 0x3f
+40201958: e76c movi.n a7, -18
+4020195a: fe .byte 0xfe
+4020195b: 3f .byte 0x3f
+4020195c: f0c112 addi a1, a1, -16
+4020195f: 21c9 s32i.n a12, a1, 8
+40201961: 3109 s32i.n a0, a1, 12
+40201963: 11d9 s32i.n a13, a1, 4
+40201965: 02cd mov.n a12, a2
+40201967: 4228 l32i.n a2, a2, 16
+40201969: 07c316 beqz a3, 402019e9
+4020196c: 021266 bnei a2, 1, 40201972
+4020196f: 003886 j 40201a55
+40201972: 212c32 l32i a3, a12, 132
+40201975: c3cc bnez.n a3, 40201985
+40201977: fff231 l32r a3, 40201940
+4020197a: 161c42 l16ui a4, a12, 44
+4020197d: 0020c0 memw
+40201980: 0338 l32i.n a3, a3, 0
+40201982: 631437 beq a4, a3, 402019e9
+40201985: 0a2c32 l32i a3, a12, 40
+40201988: 111c72 l16ui a7, a12, 34
+4020198b: 101c62 l16ui a6, a12, 32
+4020198e: 172c22 l32i a2, a12, 92
+40201991: 04cc52 addi a5, a12, 4
+40201994: 0c4d mov.n a4, a12
+40201996: 2a1845 call0 4022bb1c
+40201999: 0c2d mov.n a2, a12
+4020199b: 27ee85 call0 40229884
+4020199e: ffe931 l32r a3, 40201944
+402019a1: 0328 l32i.n a2, a3, 0
+402019a3: 059c27 bne a12, a2, 402019ac
+402019a6: 3c28 l32i.n a2, a12, 12
+402019a8: 000886 j 402019ce
+402019ab: e73100 excw
+402019ae: ff .byte 0xff
+402019af: 040c movi.n a4, 0
+402019b1: 0329 s32i.n a2, a3, 0
+402019b3: 529c beqz.n a2, 402019cc
+402019b5: 3258 l32i.n a5, a2, 12
+402019b7: 0a9c57 bne a12, a5, 402019c5
+402019ba: 048c beqz.n a4, 402019be
+402019bc: 0329 s32i.n a2, a3, 0
+402019be: 3c38 l32i.n a3, a12, 12
+402019c0: 3239 s32i.n a3, a2, 12
+402019c2: 0002c6 j 402019d1
+402019c5: 140c movi.n a4, 1
+402019c7: 052d mov.n a2, a5
+402019c9: fff986 j 402019b3
+402019cc: 148c beqz.n a4, 402019d1
+402019ce: 006322 s32i a2, a3, 0
+402019d1: 0aa022 movi a2, 10
+402019d4: 046c22 s32i a2, a12, 16
+402019d7: ffdd21 l32r a2, 4020194c
+402019da: 002232 l32i a3, a2, 0
+402019dd: 02c9 s32i.n a12, a2, 0
+402019df: 3c39 s32i.n a3, a12, 12
+402019e1: 2aaf05 call0 4022c4d4
+402019e4: 020c movi.n a2, 0
+402019e6: 003506 j 40201abe
+402019e9: 022266 bnei a2, 2, 402019ef
+402019ec: 002146 j 40201a75
+402019ef: 0932f6 bgeui a2, 3, 402019fc
+402019f2: b29c beqz.n a2, 40201a11
+402019f4: 5d1226 beqi a2, 1, 40201a55
+402019f7: 002c06 j 40201aab
+402019fa: 660000 excw
+402019fd: c60242 l8ui a4, a2, 198
+40201a00: f60020 excw
+40201a03: 460242 l8ui a4, a2, 70
+40201a06: 1f .byte 0x1f
+40201a07: 726600 excw
+40201a0a: 224602 s8i a0, a6, 34
+40201a0d: 264600 excw
+40201a10: 1c2200 excw
+40201a13: 42bc10 excw
+40201a16: ffce31 l32r a3, 40201950
+40201a19: 0328 l32i.n a2, a3, 0
+40201a1b: 059c27 bne a12, a2, 40201a24
+40201a1e: 3c28 l32i.n a2, a12, 12
+40201a20: 000886 j 40201a46
+40201a23: c93100 excw
+40201a26: ff .byte 0xff
+40201a27: 040c movi.n a4, 0
+40201a29: 0329 s32i.n a2, a3, 0
+40201a2b: 529c beqz.n a2, 40201a44
+40201a2d: 3258 l32i.n a5, a2, 12
+40201a2f: 0a9c57 bne a12, a5, 40201a3d
+40201a32: 048c beqz.n a4, 40201a36
+40201a34: 0329 s32i.n a2, a3, 0
+40201a36: 3c38 l32i.n a3, a12, 12
+40201a38: 3239 s32i.n a3, a2, 12
+40201a3a: 000286 j 40201a48
+40201a3d: 140c movi.n a4, 1
+40201a3f: 052d mov.n a2, a5
+40201a41: fff986 j 40201a2b
+40201a44: 048c beqz.n a4, 40201a48
+40201a46: 0329 s32i.n a2, a3, 0
+40201a48: 020c movi.n a2, 0
+40201a4a: 3c29 s32i.n a2, a12, 12
+40201a4c: c2a042 movi a4, 194
+40201a4f: 000386 j 40201a61
+40201a52: 000000 ill
+40201a55: ffc021 l32r a2, 40201958
+40201a58: 203cc0 or a3, a12, a12
+40201a5b: 27e7c5 call0 402298d8
+40201a5e: c8a042 movi a4, 200
+40201a61: ffbc31 l32r a3, 40201954
+40201a64: 202cc0 or a2, a12, a12
+40201a67: 00a0c2 movi a12, 0
+40201a6a: fea701 l32r a0, 40201508
+40201a6d: 0000c0 callx0 a0
+40201a70: 0cdd mov.n a13, a12
+40201a72: 000e86 j 40201ab0
+40201a75: ffb321 l32r a2, 40201944
+40201a78: 0c3d mov.n a3, a12
+40201a7a: 27e5c5 call0 402298d8
+40201a7d: cea042 movi a4, 206
+40201a80: fff746 j 40201a61
+40201a83: 000000 ill
+40201a86: 202cc0 or a2, a12, a12
+40201a89: 2a0485 call0 4022bad4
+40201a8c: 20d220 or a13, a2, a2
+40201a8f: 05a022 movi a2, 5
+40201a92: 0d9c beqz.n a13, 40201aa6
+40201a94: 000606 j 40201ab0
+40201a97: 2cc000 excw
+40201a9a: 038520 excw
+40201a9d: 202a add.n a2, a0, a2
+40201a9f: 5620d2 l32i a13, a0, 0x158
+40201aa2: 0c00b2 l8ui a11, a0, 12
+40201aa5: 4c2992 l32i a9, a9, 0x130
+40201aa8: 000106 j 40201ab0
+40201aab: 0d0c movi.n a13, 0
+40201aad: 20cdd0 or a12, a13, a13
+40201ab0: 008c16 beqz a12, 40201abc
+40201ab3: 005d56 bnez a13, 40201abc
+40201ab6: 202cc0 or a2, a12, a12
+40201ab9: 2a3305 call0 4022bdec
+40201abc: 0d2d mov.n a2, a13
+40201abe: 3108 l32i.n a0, a1, 12
+40201ac0: 21c8 l32i.n a12, a1, 8
+40201ac2: 11d8 l32i.n a13, a1, 4
+40201ac4: 10c112 addi a1, a1, 16
+40201ac7: f00d ret.n
+40201ac9: 000000 ill
+40201acc: 201ad0 or a1, a10, a13
+40201acf: c11240 mul16u a1, a2, a4
+40201ad2: 6102f0 excw
+40201ad5: ad0503 excw
+40201ad8: fc3124 excw
+40201adb: ff .byte 0xff
+40201adc: 00a042 movi a4, 0
+40201adf: e8a322 movi a2, 0x3e8
+40201ae2: 2a7bc5 call0 4022c2a0
+40201ae5: 032102 l32i a0, a1, 12
+40201ae8: 10c112 addi a1, a1, 16
+40201aeb: f00d ret.n
+40201aed: 000000 ill
+40201af0: 201af4 excw
+40201af3: c11240 mul16u a1, a2, a4
+40201af6: 6102f0 excw
+40201af9: ba8503 excw
+40201afc: 312c movi.n a1, 35
+40201afe: fffc bnez.n a15, 40201b41
+40201b00: 00a042 movi a4, 0
+40201b03: 64a022 movi a2, 100
+40201b06: 2a7985 call0 4022c2a0
+40201b09: 032102 l32i a0, a1, 12
+40201b0c: 10c112 addi a1, a1, 16
+40201b0f: f00d ret.n
+40201b11: 000000 ill
+40201b14: 1b18 l32i.n a1, a11, 4
+40201b16: 124020 excw
+40201b19: 02f0c1 l32r a12, 401c26dc <_lit4_end+0xbc3b0>
+40201b1c: c50361 l32r a6, 401f2f28 <_lit4_end+0xecbfc>
+40201b1f: 312364 excw
+40201b22: fffc bnez.n a15, 40201b65
+40201b24: 00a042 movi a4, 0
+40201b27: f4a122 movi a2, 0x1f4
+40201b2a: 2a7745 call0 4022c2a0
+40201b2d: 032102 l32i a0, a1, 12
+40201b30: 10c112 addi a1, a1, 16
+40201b33: f00d ret.n
+40201b35: 000000 ill
+40201b38: 201b40 or a1, a11, a4
+40201b3b: ea6040 excw
+40201b3e: 120000 excw
+40201b41: 02f0c1 l32r a12, 401c2704 <_lit4_end+0xbc3d8>
+40201b44: c50361 l32r a6, 401f2f50 <_lit4_end+0xecc24>
+40201b47: 452347 blt a3, a4, 40201b90
+40201b4a: 23d8 l32i.n a13, a3, 8
+40201b4c: fffb31 l32r a3, 40201b38
+40201b4f: fffb21 l32r a2, 40201b3c
+40201b52: 00a042 movi a4, 0
+40201b55: 2a7485 call0 4022c2a0
+40201b58: 3108 l32i.n a0, a1, 12
+40201b5a: 10c112 addi a1, a1, 16
+40201b5d: f00d ret.n
+40201b5f: 827c00 mull a7, a12, a0
+40201b62: f00d ret.n
+40201b64: fedf24 excw
+40201b67: 3f .byte 0x3f
+40201b68: 006c movi.n a0, -32
+40201b6a: 003ff2 excw
+40201b6d: 004000 break 0, 0
+
+40201b70 :
+40201b70: fffd21 l32r a2, 40201b64
+40201b73: 02d222 addmi a2, a2, 0x200
+40201b76: 140222 l8ui a2, a2, 20
+40201b79: 0142b6 bltui a2, 4, 40201b7e
+40201b7c: 220c movi.n a2, 2
+40201b7e: fec222 addi a2, a2, -2
+40201b81: 743020 extui a3, a2, 0, 8
+40201b84: f27c movi.n a2, -1
+40201b86: 1423f6 bgeui a3, 2, 40201b9e
+40201b89: fff731 l32r a3, 40201b68
+40201b8c: fff821 l32r a2, 40201b6c
+40201b8f: 0020c0 memw
+40201b92: 0348 l32i.n a4, a3, 0
+40201b94: 202420 or a2, a4, a2
+40201b97: 0020c0 memw
+40201b9a: 0329 s32i.n a2, a3, 0
+40201b9c: 020c movi.n a2, 0
+40201b9e: f00d ret.n
+40201ba0: ff .byte 0xff
+40201ba1: ff .byte 0xff
+40201ba2: bf .byte 0xbf
+40201ba3: ff .byte 0xff
+
+40201ba4 :
+40201ba4: fff131 l32r a3, 40201b68
+40201ba7: fffe21 l32r a2, 40201ba0
+40201baa: 0020c0 memw
+40201bad: 0348 l32i.n a4, a3, 0
+40201baf: 102420 and a2, a4, a2
+40201bb2: 0020c0 memw
+40201bb5: 0329 s32i.n a2, a3, 0
+40201bb7: f00d ret.n
+40201bb9: 000000 ill
+
+40201bbc :
+40201bbc: ffeb31 l32r a3, 40201b68
+40201bbf: fff821 l32r a2, 40201ba0
+40201bc2: 0020c0 memw
+40201bc5: 0348 l32i.n a4, a3, 0
+40201bc7: 102420 and a2, a4, a2
+40201bca: 0020c0 memw
+40201bcd: 0329 s32i.n a2, a3, 0
+40201bcf: ffe521 l32r a2, 40201b64
+40201bd2: 030c movi.n a3, 0
+40201bd4: 7c6232 s32i a3, a2, 0x1f0
+40201bd7: f00d ret.n
+40201bd9: 000000 ill
+
+40201bdc :
+40201bdc: f0c112 addi a1, a1, -16
+40201bdf: 040252 l8ui a5, a2, 4
+40201be2: 3109 s32i.n a0, a1, 12
+40201be4: 0a6507 bbci a5, 0, 40201bf2
+40201be7: ffdf51 l32r a5, 40201b64
+40201bea: 7c2552 l32i a5, a5, 0x1f0
+40201bed: 158c beqz.n a5, 40201bf2
+40201bef: 0005c0 callx0 a5
+40201bf2: 3108 l32i.n a0, a1, 12
+40201bf4: 10c112 addi a1, a1, 16
+40201bf7: f00d ret.n
+40201bf9: 000000 ill
+
+40201bfc :
+40201bfc: 023d mov.n a3, a2
+40201bfe: f27c movi.n a2, -1
+40201c00: 638c beqz.n a3, 40201c0a
+40201c02: ffd821 l32r a2, 40201b64
+40201c05: 7c6232 s32i a3, a2, 0x1f0
+40201c08: 020c movi.n a2, 0
+40201c0a: f00d ret.n
+
+40201c0c :
+40201c0c: ffd621 l32r a2, 40201b64
+40201c0f: 030c movi.n a3, 0
+40201c11: 7c6232 s32i a3, a2, 0x1f0
+40201c14: f00d ret.n
+40201c16: 880000 excw
+40201c19: 00dc bnez.n a0, 40201c2d
+40201c1b: 18d440 excw
+40201c1e: 00 .byte 00
+40201c1f: 40 .byte 0x40
+
+40201c20 :
+40201c20: e0c112 addi a1, a1, -32
+40201c23: 61c9 s32i.n a12, a1, 24
+40201c25: 03cd mov.n a12, a3
+40201c27: ffcf31 l32r a3, 40201b64
+40201c2a: 7109 s32i.n a0, a1, 28
+40201c2c: 51d9 s32i.n a13, a1, 20
+40201c2e: 41e9 s32i.n a14, a1, 16
+40201c30: 01d332 addmi a3, a3, 0x100
+40201c33: 350332 l8ui a3, a3, 53
+40201c36: 021366 bnei a3, 1, 40201c3c
+40201c39: 002a46 j 40201ce6
+40201c3c: 42cc bnez.n a2, 40201c44
+40201c3e: 020c movi.n a2, 0
+40201c40: 002906 j 40201ce8
+40201c43: a1d200 sll a13, a2
+40201c46: da2c movi.n a10, 45
+40201c48: 640cd2 l8ui a13, a12, 100
+40201c4b: 030c movi.n a3, 0
+40201c4d: 0d2d mov.n a2, a13
+40201c4f: fcf001 l32r a0, 40201010 <_irom0_text_start>
+40201c52: 0000c0 callx0 a0
+40201c55: fe5c16 beqz a12, 40201c3e
+40201c58: 010c22 l8ui a2, a12, 1
+40201c5b: 330c movi.n a3, 3
+40201c5d: fdc222 addi a2, a2, -3
+40201c60: ffee01 l32r a0, 40201c18
+40201c63: 0000c0 callx0 a0
+40201c66: 74e020 extui a14, a2, 0, 8
+40201c69: d12ef6 bgeui a14, 2, 40201c3e
+40201c6c: 640c movi.n a4, 6
+40201c6e: 030c movi.n a3, 0
+40201c70: 202110 or a2, a1, a1
+40201c73: fce701 l32r a0, 40201010 <_irom0_text_start>
+40201c76: 0000c0 callx0 a0
+40201c79: 020c22 l8ui a2, a12, 2
+40201c7c: 030152 l8ui a5, a1, 3
+40201c7f: 004122 s8i a2, a1, 0
+40201c82: 030c22 l8ui a2, a12, 3
+40201c85: 040142 l8ui a4, a1, 4
+40201c88: 014122 s8i a2, a1, 1
+40201c8b: 040c22 l8ui a2, a12, 4
+40201c8e: e80c movi.n a8, 14
+40201c90: 024122 s8i a2, a1, 2
+40201c93: 020c movi.n a2, 0
+40201c95: 026d mov.n a6, a2
+40201c97: 023d mov.n a3, a2
+40201c99: f90c movi.n a9, 15
+40201c9b: 1bb3e7 bgeu a3, a14, 40201cba
+40201c9e: 050c32 l8ui a3, a12, 5
+40201ca1: 0f3837 bltu a8, a3, 40201cb4
+40201ca4: 060c72 l8ui a7, a12, 6
+40201ca7: a73a add.n a10, a7, a3
+40201ca9: 0729a7 blt a9, a10, 40201cb4
+40201cac: 120c movi.n a2, 1
+40201cae: 074d mov.n a4, a7
+40201cb0: 035d mov.n a5, a3
+40201cb2: 026d mov.n a6, a2
+40201cb4: 130c movi.n a3, 1
+40201cb6: fff846 j 40201c9b
+40201cb9: 261600 excw
+40201cbc: 415200 srli a5, a0, 2
+40201cbf: 128c03 excw
+40201cc2: 044142 s8i a4, a1, 4
+40201cc5: 030122 l8ui a2, a1, 3
+40201cc8: f72216 beqz a2, 40201c3e
+40201ccb: 640c movi.n a4, 6
+40201ccd: 203110 or a3, a1, a1
+40201cd0: 0d2d mov.n a2, a13
+40201cd2: ffd201 l32r a0, 40201c1c
+40201cd5: 0000c0 callx0 a0
+40201cd8: a28c beqz.n a2, 40201ce6
+40201cda: 640c movi.n a4, 6
+40201cdc: 013d mov.n a3, a1
+40201cde: 0d2d mov.n a2, a13
+40201ce0: fccd01 l32r a0, 40201014 <_irom0_text_start+0x4>
+40201ce3: 0000c0 callx0 a0
+40201ce6: 120c movi.n a2, 1
+40201ce8: 7108 l32i.n a0, a1, 28
+40201cea: 61c8 l32i.n a12, a1, 24
+40201cec: 51d8 l32i.n a13, a1, 20
+40201cee: 41e8 l32i.n a14, a1, 16
+40201cf0: 20c112 addi a1, a1, 32
+40201cf3: f00d ret.n
+40201cf5: 000000 ill
+40201cf8: fee054 excw
+40201cfb: 3f .byte 0x3f
+
+40201cfc :
+40201cfc: ff9a21 l32r a2, 40201b64
+40201cff: 01d232 addmi a3, a2, 0x100
+40201d02: 350342 l8ui a4, a3, 53
+40201d05: 023d mov.n a3, a2
+40201d07: fffc21 l32r a2, 40201cf8
+40201d0a: e4dc bnez.n a4, 40201d2c
+40201d0c: 4338 l32i.n a3, a3, 16
+40201d0e: a39c beqz.n a3, 40201d2c
+40201d10: 112342 l32i a4, a3, 68
+40201d13: 155466 bnei a4, 5, 40201d2c
+40201d16: 242332 l32i a3, a3, 144
+40201d19: f38c beqz.n a3, 40201d2c
+40201d1b: 01d322 addmi a2, a3, 0x100
+40201d1e: 2f0242 l8ui a4, a2, 47
+40201d21: fff521 l32r a2, 40201cf8
+40201d24: 448c beqz.n a4, 40201d2c
+40201d26: 2ca122 movi a2, 0x12c
+40201d29: 802320 add a2, a3, a2
+40201d2c: f00d ret.n
+ ...
+
+40201d30 :
+40201d30: f0c112 addi a1, a1, -16
+40201d33: 3109 s32i.n a0, a1, 12
+40201d35: 21c9 s32i.n a12, a1, 8
+40201d37: 02cd mov.n a12, a2
+40201d39: fffc05 call0 40201cfc
+40201d3c: 730c movi.n a3, 7
+40201d3e: 004c32 s8i a3, a12, 0
+40201d41: 630c movi.n a3, 6
+40201d43: 014c32 s8i a3, a12, 1
+40201d46: 000232 l8ui a3, a2, 0
+40201d49: 3108 l32i.n a0, a1, 12
+40201d4b: 024c32 s8i a3, a12, 2
+40201d4e: 010232 l8ui a3, a2, 1
+40201d51: 034c32 s8i a3, a12, 3
+40201d54: 020232 l8ui a3, a2, 2
+40201d57: 044c32 s8i a3, a12, 4
+40201d5a: 030232 l8ui a3, a2, 3
+40201d5d: 054c32 s8i a3, a12, 5
+40201d60: 040222 l8ui a2, a2, 4
+40201d63: 064c22 s8i a2, a12, 6
+40201d66: 421c movi.n a2, 20
+40201d68: 074c22 s8i a2, a12, 7
+40201d6b: 2c8b addi.n a2, a12, 8
+40201d6d: 21c8 l32i.n a12, a1, 8
+40201d6f: 10c112 addi a1, a1, 16
+40201d72: f00d ret.n
+
+40201d74 :
+40201d74: f0c112 addi a1, a1, -16
+40201d77: 3109 s32i.n a0, a1, 12
+40201d79: fff805 call0 40201cfc
+40201d7c: 030232 l8ui a3, a2, 3
+40201d7f: 040222 l8ui a2, a2, 4
+40201d82: 3108 l32i.n a0, a1, 12
+40201d84: 232a add.n a2, a3, a2
+40201d86: 220b addi.n a2, a2, -1
+40201d88: 742020 extui a2, a2, 0, 8
+40201d8b: 10c112 addi a1, a1, 16
+40201d8e: f00d ret.n
+
+40201d90 :
+40201d90: f0c112 addi a1, a1, -16
+40201d93: 3109 s32i.n a0, a1, 12
+40201d95: fff645 call0 40201cfc
+40201d98: 3108 l32i.n a0, a1, 12
+40201d9a: 030222 l8ui a2, a2, 3
+40201d9d: 10c112 addi a1, a1, 16
+40201da0: f00d ret.n
+ ...
+
+40201da4 :
+40201da4: f0c112 addi a1, a1, -16
+40201da7: 21c9 s32i.n a12, a1, 8
+40201da9: 3109 s32i.n a0, a1, 12
+40201dab: 74c020 extui a12, a2, 0, 8
+40201dae: fffc45 call0 40201d74
+40201db1: 00a032 movi a3, 0
+40201db4: 0c32c7 bltu a2, a12, 40201dc4
+40201db7: fffd85 call0 40201d90
+40201dba: 130c movi.n a3, 1
+40201dbc: 01bc27 bgeu a12, a2, 40201dc1
+40201dbf: 030c movi.n a3, 0
+40201dc1: 743030 extui a3, a3, 0, 8
+40201dc4: 3108 l32i.n a0, a1, 12
+40201dc6: 032d mov.n a2, a3
+40201dc8: 21c8 l32i.n a12, a1, 8
+40201dca: 10c112 addi a1, a1, 16
+40201dcd: f00d ret.n
+ ...
+
+40201dd0 :
+40201dd0: f0c112 addi a1, a1, -16
+40201dd3: 0261c2 s32i a12, a1, 8
+40201dd6: ff63c1 l32r a12, 40201b64
+40201dd9: 0161d2 s32i a13, a1, 4
+40201ddc: 0061e2 s32i a14, a1, 0
+40201ddf: 3109 s32i.n a0, a1, 12
+40201de1: 74d020 extui a13, a2, 0, 8
+40201de4: 4ce8 l32i.n a14, a12, 16
+40201de6: fff8c5 call0 40201d74
+40201de9: 01dcc2 addmi a12, a12, 0x100
+40201dec: 023d mov.n a3, a2
+40201dee: 350c22 l8ui a2, a12, 53
+40201df1: d2cc bnez.n a2, 40201e02
+40201df3: be8c beqz.n a14, 40201e02
+40201df5: 112e22 l32i a2, a14, 68
+40201df8: 065226 beqi a2, 5, 40201e02
+40201dfb: b20c movi.n a2, 11
+40201dfd: 01b237 bgeu a2, a3, 40201e02
+40201e00: 023d mov.n a3, a2
+40201e02: 020c movi.n a2, 0
+40201e04: 0e33d7 bltu a3, a13, 40201e16
+40201e07: 0d2d mov.n a2, a13
+40201e09: fff985 call0 40201da4
+40201e0c: 030c movi.n a3, 0
+40201e0e: 140c movi.n a4, 1
+40201e10: 933420 movnez a3, a4, a2
+40201e13: 742030 extui a2, a3, 0, 8
+40201e16: 3108 l32i.n a0, a1, 12
+40201e18: 21c8 l32i.n a12, a1, 8
+40201e1a: 11d8 l32i.n a13, a1, 4
+40201e1c: 01e8 l32i.n a14, a1, 0
+40201e1e: 10c112 addi a1, a1, 16
+40201e21: f00d ret.n
+ ...
+
+40201e24 :
+40201e24: ff5031 l32r a3, 40201b64
+40201e27: f0c112 addi a1, a1, -16
+40201e2a: 01d342 addmi a4, a3, 0x100
+40201e2d: 3109 s32i.n a0, a1, 12
+40201e2f: 150c movi.n a5, 1
+40201e31: ff4452 s8i a5, a4, 255
+40201e34: 034d mov.n a4, a3
+40201e36: a29c beqz.n a2, 40201e54
+40201e38: 9228 l32i.n a2, a2, 36
+40201e3a: 629c beqz.n a2, 40201e54
+40201e3c: 0f0222 l8ui a2, a2, 15
+40201e3f: 150c movi.n a5, 1
+40201e41: 320b addi.n a3, a2, -1
+40201e43: 020c movi.n a2, 0
+40201e45: 932530 movnez a2, a5, a3
+40201e48: 7b2432 l32i a3, a4, 0x1ec
+40201e4b: 742020 extui a2, a2, 0, 8
+40201e4e: 002316 beqz a3, 40201e54
+40201e51: 0003c0 callx0 a3
+40201e54: 3108 l32i.n a0, a1, 12
+40201e56: 10c112 addi a1, a1, 16
+40201e59: f00d ret.n
+ ...
+
+40201e5c :
+40201e5c: ff4221 l32r a2, 40201b64
+40201e5f: 130c movi.n a3, 1
+40201e61: 01d222 addmi a2, a2, 0x100
+40201e64: f94232 s8i a3, a2, 249
+40201e67: 030c movi.n a3, 0
+40201e69: fa4232 s8i a3, a2, 250
+40201e6c: fe4232 s8i a3, a2, 254
+40201e6f: f00d ret.n
+40201e71: 000000 ill
+40201e74: 201e24 excw
+40201e77: 40 .byte 0x40
+
+40201e78 :
+40201e78: ff3b21 l32r a2, 40201b64
+40201e7b: f0c112 addi a1, a1, -16
+40201e7e: 036102 s32i a0, a1, 12
+40201e81: 01d232 addmi a3, a2, 0x100
+40201e84: 01a042 movi a4, 1
+40201e87: ff4342 s8i a4, a3, 255
+40201e8a: 00a032 movi a3, 0
+40201e8d: 7b6232 s32i a3, a2, 0x1ec
+40201e90: fff921 l32r a2, 40201e74
+40201e93: 830c movi.n a3, 8
+40201e95: 1ee545 call0 40220cec
+40201e98: 3108 l32i.n a0, a1, 12
+40201e9a: 10c112 addi a1, a1, 16
+40201e9d: f00d ret.n
+ ...
+
+40201ea0 :
+40201ea0: ff3121 l32r a2, 40201b64
+40201ea3: 030c movi.n a3, 0
+40201ea5: 596232 s32i a3, a2, 0x164
+40201ea8: 5a6232 s32i a3, a2, 0x168
+40201eab: 5b6232 s32i a3, a2, 0x16c
+40201eae: 5c6232 s32i a3, a2, 0x170
+40201eb1: 5d6232 s32i a3, a2, 0x174
+40201eb4: 5e6232 s32i a3, a2, 0x178
+40201eb7: 786232 s32i a3, a2, 0x1e0
+40201eba: f00d ret.n
+40201ebc: 0009b4 excw
+40201ebf: 09b300 excw
+40201ec2: 990000 excw
+40201ec5: fffff6 bgeui a15, 0x100, 40201ec8
+40201ec8: fff630 excw
+40201ecb: ff .byte 0xff
+40201ecc: e21c movi.n a2, 30
+40201ece: 00 .byte 00
+40201ecf: 40 .byte 0x40
+
+40201ed0 :
+40201ed0: f0c112 addi a1, a1, -16
+40201ed3: 3109 s32i.n a0, a1, 12
+40201ed5: 024d mov.n a4, a2
+40201ed7: fff951 l32r a5, 40201ebc
+40201eda: e20c movi.n a2, 14
+40201edc: 2d6377 bbci a3, 7, 40201f0d
+40201edf: 351457 beq a4, a5, 40201f18
+40201ee2: fff721 l32r a2, 40201ec0
+40201ee5: 0f3247 bltu a2, a4, 40201ef8
+40201ee8: fff721 l32r a2, 40201ec4
+40201eeb: 530c movi.n a3, 5
+40201eed: 242a add.n a2, a4, a2
+40201eef: ff4a01 l32r a0, 40201c18
+40201ef2: 0000c0 callx0 a0
+40201ef5: 0007c6 j 40201f18
+40201ef8: fff421 l32r a2, 40201ec8
+40201efb: 431c movi.n a3, 20
+40201efd: 242a add.n a2, a4, a2
+40201eff: fff301 l32r a0, 40201ecc
+40201f02: 0000c0 callx0 a0
+40201f05: 22fb addi.n a2, a2, 15
+40201f07: 000346 j 40201f18
+40201f0a: 000000 ill
+40201f0d: 071457 beq a4, a5, 40201f18
+40201f10: ffec21 l32r a2, 40201ec0
+40201f13: d1b247 bgeu a2, a4, 40201ee8
+40201f16: f27c movi.n a2, -1
+40201f18: 3108 l32i.n a0, a1, 12
+40201f1a: 10c112 addi a1, a1, 16
+40201f1d: f00d ret.n
+40201f1f: 096c00 excw
+40201f22: b20000 excw
+40201f25: 0009 s32i.n a0, a0, 0
+ ...
+
+40201f28 :
+40201f28: d0c112 addi a1, a1, -48
+40201f2b: a1c9 s32i.n a12, a1, 40
+40201f2d: 91d9 s32i.n a13, a1, 36
+40201f2f: 81e9 s32i.n a14, a1, 32
+40201f31: 02dd mov.n a13, a2
+40201f33: 71f9 s32i.n a15, a1, 28
+40201f35: b109 s32i.n a0, a1, 44
+40201f37: 098ec5 call0 4020b824
+40201f3a: e20c movi.n a2, 14
+40201f3c: 84a0c2 movi a12, 132
+40201f3f: fff8e1 l32r a14, 40201f20