Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca410736f7 | ||
|
|
2ca8bf1483 | ||
|
|
35393827a9 | ||
|
|
ea84d1889d | ||
|
|
bc41a21f23 | ||
|
|
e48180ac10 | ||
|
|
e47a5477f9 | ||
|
|
e944a994a7 | ||
|
|
6535b49551 | ||
|
|
2cb8586c94 | ||
|
|
ec1cebdd4c | ||
|
|
af5a3a64ed | ||
|
|
7b94eef448 | ||
|
|
c8067122d5 | ||
|
|
12385b7a5f | ||
|
|
5564147f67 | ||
|
|
32ba7dc0d7 | ||
|
|
80721c1715 | ||
|
|
e22d3f26d9 | ||
|
|
24a6a0dfd3 | ||
|
|
8a182f072d | ||
|
|
76b447d03e | ||
|
|
319427ba2e | ||
|
|
f8c60b0668 | ||
|
|
4eaee9389d | ||
|
|
0a731bd35e | ||
|
|
0b3cfe0e74 | ||
|
|
4551ad6dbe | ||
|
|
3f4b8a94f1 | ||
|
|
373affb582 | ||
|
|
b48bb12067 | ||
|
|
110f461cf5 | ||
|
|
3ae1451821 | ||
|
|
d711909812 | ||
|
|
76167b8014 | ||
|
|
e42407ad62 | ||
|
|
083eb4a9b3 | ||
|
|
97d4ff12da | ||
|
|
481c671f03 | ||
|
|
50c877d7bb | ||
|
|
9a9ed1445a | ||
|
|
ff6f4e35c4 | ||
|
|
28a170faa3 | ||
|
|
314239842e | ||
|
|
7f8f7d8ad1 | ||
|
|
5f3cb6685d | ||
|
|
3c202a1f50 | ||
|
|
b238390ca8 | ||
|
|
3f09cc3601 | ||
|
|
812feebf54 | ||
|
|
f6621252f6 | ||
|
|
21b304de9f | ||
|
|
232e8802e2 | ||
|
|
357a9b6513 | ||
|
|
856a694f0b | ||
|
|
a85582b94e | ||
|
|
d5bd53b78a | ||
|
|
5c8eab387e | ||
|
|
509b19a9bc | ||
|
|
e617b4f283 | ||
|
|
c39391f4a0 | ||
|
|
fd5c8f3a6b | ||
|
|
13564727d9 | ||
|
|
c04433b7f5 | ||
|
|
ab00467914 | ||
|
|
97044c2a17 | ||
|
|
8eb01a725b | ||
|
|
b074eb4f2c | ||
|
|
9dd5a1f082 | ||
|
|
e7c26b3e94 | ||
|
|
b6a0e796d8 | ||
|
|
29f726c073 |
@@ -13,7 +13,6 @@ eagle.app.sym
|
||||
|
||||
# Garbage added by CLion
|
||||
.idea/
|
||||
CMakeLists.txt
|
||||
cmake-build-debug/
|
||||
.sass-cache
|
||||
|
||||
|
||||
+151
@@ -0,0 +1,151 @@
|
||||
cmake_minimum_required(VERSION 3.7)
|
||||
|
||||
###################################################################
|
||||
# This is a fake CMake config to make the project work in CLion #
|
||||
# Do not attempt to build it with cmake, use make instead. #
|
||||
###################################################################
|
||||
|
||||
project(esp_vt100_firmware)
|
||||
|
||||
set(CMAKE_CXX_STANDARD GNU99)
|
||||
|
||||
set(SOURCE_FILES
|
||||
libesphttpd/core/auth.c
|
||||
libesphttpd/core/base64.c
|
||||
libesphttpd/core/httpd.c
|
||||
libesphttpd/core/httpdespfs.c
|
||||
libesphttpd/core/httpd-freertos.c
|
||||
libesphttpd/core/httpd-nonos.c
|
||||
libesphttpd/core/sha1.c
|
||||
libesphttpd/core/uptime.c
|
||||
libesphttpd/core/httpd-platform.h
|
||||
|
||||
libesphttpd/espfs/heatshrink_decoder.c
|
||||
libesphttpd/espfs/heatshrink_config_custom.h
|
||||
libesphttpd/espfs/espfsformat.h
|
||||
libesphttpd/espfs/espfs.c
|
||||
|
||||
libesphttpd/include/webpages-espfs.h
|
||||
libesphttpd/include/user_config.h
|
||||
libesphttpd/include/uptime.h
|
||||
libesphttpd/include/sha1.h
|
||||
libesphttpd/include/platform.h
|
||||
libesphttpd/include/logging.h
|
||||
libesphttpd/include/httpd.h
|
||||
libesphttpd/include/httpdespfs.h
|
||||
libesphttpd/include/espmissingincludes.h
|
||||
libesphttpd/include/espfs.h
|
||||
libesphttpd/include/esp8266.h
|
||||
libesphttpd/include/cgiwebsocket.h
|
||||
libesphttpd/include/cgiflash.h
|
||||
libesphttpd/include/captdns.h
|
||||
libesphttpd/include/base64.h
|
||||
libesphttpd/include/auth.h
|
||||
libesphttpd/lib/heatshrink/heatshrink_encoder.h
|
||||
libesphttpd/lib/heatshrink/heatshrink_decoder.h
|
||||
libesphttpd/lib/heatshrink/heatshrink_config.h
|
||||
libesphttpd/lib/heatshrink/heatshrink_common.h
|
||||
libesphttpd/lib/heatshrink/greatest.h
|
||||
libesphttpd/lib/heatshrink/test_heatshrink_static.c
|
||||
libesphttpd/lib/heatshrink/test_heatshrink_dynamic_theft.c
|
||||
libesphttpd/lib/heatshrink/test_heatshrink_dynamic.c
|
||||
libesphttpd/lib/heatshrink/heatshrink_encoder.c
|
||||
libesphttpd/lib/heatshrink/heatshrink_decoder.c
|
||||
libesphttpd/lib/heatshrink/heatshrink.c
|
||||
libesphttpd/mkupgimg/mkupgimg.c
|
||||
libesphttpd/util/cgiwebsocket.c
|
||||
libesphttpd/util/cgiflash.c
|
||||
libesphttpd/util/captdns.c
|
||||
|
||||
esp_iot_sdk_v1.5.2/include/user_interface.h
|
||||
esp_iot_sdk_v1.5.2/include/upgrade.h
|
||||
esp_iot_sdk_v1.5.2/include/uart_register.h
|
||||
esp_iot_sdk_v1.5.2/include/spi_register.h
|
||||
esp_iot_sdk_v1.5.2/include/spi_flash.h
|
||||
esp_iot_sdk_v1.5.2/include/sntp.h
|
||||
esp_iot_sdk_v1.5.2/include/smartconfig.h
|
||||
esp_iot_sdk_v1.5.2/include/slc_register.h
|
||||
esp_iot_sdk_v1.5.2/include/queue.h
|
||||
esp_iot_sdk_v1.5.2/include/pwm.h
|
||||
esp_iot_sdk_v1.5.2/include/ping.h
|
||||
esp_iot_sdk_v1.5.2/include/os_type.h
|
||||
esp_iot_sdk_v1.5.2/include/osapi.h
|
||||
esp_iot_sdk_v1.5.2/include/mesh.h
|
||||
esp_iot_sdk_v1.5.2/include/mem.h
|
||||
esp_iot_sdk_v1.5.2/include/ip_addr.h
|
||||
esp_iot_sdk_v1.5.2/include/gpio.h
|
||||
esp_iot_sdk_v1.5.2/include/ets_sys.h
|
||||
esp_iot_sdk_v1.5.2/include/esp_sdk_ver.h
|
||||
esp_iot_sdk_v1.5.2/include/espnow.h
|
||||
esp_iot_sdk_v1.5.2/include/espconn.h
|
||||
esp_iot_sdk_v1.5.2/include/eagle_soc.h
|
||||
esp_iot_sdk_v1.5.2/include/c_types.h
|
||||
esp_iot_sdk_v1.5.2/include/at_custom.h
|
||||
esp_iot_sdk_v1.5.2/include/airkiss.h
|
||||
esp_iot_sdk_v1.5.2/include/json/jsontree.h
|
||||
esp_iot_sdk_v1.5.2/include/json/jsonparse.h
|
||||
esp_iot_sdk_v1.5.2/include/json/json.h
|
||||
|
||||
include/user_config.h
|
||||
include/ets_sys_extra.h
|
||||
user/io.c
|
||||
user/io.h
|
||||
user/cgi_wifi.c
|
||||
user/cgi_wifi.h
|
||||
user/cgi_persist.c
|
||||
user/cgi_persist.h
|
||||
user/cgi_network.c
|
||||
user/cgi_network.h
|
||||
user/cgi_term_cfg.c
|
||||
user/cgi_term_cfg.h
|
||||
user/cgi_system.c
|
||||
user/uart_driver.c
|
||||
user/uart_handler.c
|
||||
user/ansi_parser.c
|
||||
user/ansi_parser.h
|
||||
user/ansi_parser.rl
|
||||
user/screen.c
|
||||
user/user_main.c
|
||||
user/serial.c
|
||||
user/serial.h
|
||||
user/routes.c
|
||||
user/routes.h
|
||||
user/cgi_main.c
|
||||
user/cgi_main.h
|
||||
user/cgi_sockets.c
|
||||
user/cgi_sockets.c
|
||||
user/cgi_sockets.h
|
||||
user/ansi_parser_callbacks.c
|
||||
user/ansi_parser_callbacks.h
|
||||
user/user_main.h
|
||||
user/wifimgr.c
|
||||
user/wifimgr.h
|
||||
user/persist.c
|
||||
user/persist.h
|
||||
include/helpers.h
|
||||
user/syscfg.c
|
||||
user/syscfg.h)
|
||||
|
||||
include_directories(include)
|
||||
include_directories(user)
|
||||
include_directories(libesphttpd/include)
|
||||
include_directories(libesphttpd/espfs)
|
||||
include_directories(libesphttpd/core)
|
||||
include_directories(libesphttpd/lib/heatshrink)
|
||||
|
||||
include_directories(esp_iot_sdk_v1.5.2/include)
|
||||
|
||||
add_definitions(
|
||||
-D__ets__
|
||||
-DICACHE_FLASH
|
||||
-DHTTPD_MAX_CONNECTIONS=5
|
||||
-DHTTPD_STACKSIZE=1000
|
||||
-DICACHE_FLASH_ATTR=
|
||||
-DICACHE_RODATA_ATTR=
|
||||
-DFLAG_GZIP=2
|
||||
-DADMIN_PASSWORD="asdf"
|
||||
-DGIT_HASH="blabla"
|
||||
-DDEBUG_ANSI=1
|
||||
-DESPFS_HEATSHRINK)
|
||||
|
||||
add_executable(esp_vt100_firmware ${SOURCE_FILES})
|
||||
@@ -65,7 +65,15 @@ LIBS += esphttpd
|
||||
# compiler flags using during compilation of source files
|
||||
CFLAGS = -Os -ggdb -std=gnu99 -Werror -Wpointer-arith -Wundef -Wall -Wl,-EL -fno-inline-functions \
|
||||
-nostdlib -mlongcalls -mtext-section-literals -D__ets__ -DICACHE_FLASH \
|
||||
-Wno-address -Wno-unused -DHTTPD_MAX_BACKLOG_SIZE=8192
|
||||
-Wno-address -Wno-unused
|
||||
|
||||
CFLAGS += -DHTTPD_MAX_BACKLOG_SIZE=10240
|
||||
CFLAGS += -DGIT_HASH='"$(shell git rev-parse --short HEAD)"'
|
||||
CFLAGS += -DADMIN_PASSWORD=$(ADMIN_PASSWORD)
|
||||
|
||||
# Debug logging
|
||||
CFLAGS += -DDEBUG_ANSI=1
|
||||
CFLAGS += -DDEBUG_INPUT=0
|
||||
|
||||
# linker flags used to generate the main object file
|
||||
LDFLAGS = -nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static
|
||||
@@ -196,7 +204,7 @@ libesphttpd/Makefile:
|
||||
$(Q) [[ -e "libesphttpd/Makefile" ]] || echo -e "\e[31mlibesphttpd submodule missing.\nIf build fails, run \"git submodule init\" and \"git submodule update\".\e[0m"
|
||||
|
||||
libesphttpd: libesphttpd/Makefile
|
||||
$(Q) make -C libesphttpd USE_OPENSDK=$(USE_OPENSDK)
|
||||
$(Q) make -C libesphttpd USE_OPENSDK=$(USE_OPENSDK) SERVERNAME_PREFIX="ESPTerm "
|
||||
|
||||
$(APP_AR): libesphttpd $(OBJ)
|
||||
$(vecho) "AR $@"
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
# esp-vt100-firmware
|
||||
# ESPTerm
|
||||
|
||||
ESP8266 Remote Terminal project
|
||||
ESP8266 Wireless Terminal Emulator project
|
||||
|
||||
This project is based on SpriteTM's esphttpd and libesphttpd, forked by MightyPork to
|
||||
[MightyPork/esphttpd](https://github.com/MightyPork/esphttpd) and
|
||||
[MightyPork/libesphttpd](https://github.com/MightyPork/libesphttpd) respectively.
|
||||
|
||||
Those forks include improvements not yet available upstream.
|
||||
Those forks include improvements not available upstream.
|
||||
|
||||
## Goals
|
||||
|
||||
This project aims to be a wireless terminal emulator that'll work with the likes of
|
||||
The project aims to be a wireless terminal emulator that'll work with the likes of
|
||||
Arduino, AVR, PIC, STM8, STM32, mbed etc, anything with UART, even your USB-serial dongle will work.
|
||||
|
||||
Connect it to the master device via UART and use the terminal on the built-in web page for debug logging,
|
||||
remote control etc. It works like a simple LCD screen, in a way.
|
||||
|
||||
It lets you make simple UI (manipulating the screen with ANSI sequences) and receive input from buttons on
|
||||
the webpage (and keyboard on PC). Touch input is planned as well.
|
||||
the webpage (and keyboard on PC). There is some rudimentary touch input as well.
|
||||
|
||||
The screen size is adjustable up to 25x80 (via a special control sequence) and uses 16 standard colors
|
||||
(8 dark and 8 bright).
|
||||
(8 dark and 8 bright). Both default size and colors can be configured in the settings.
|
||||
|
||||
## Project status
|
||||
|
||||
*Almost finished, still possibly buggy, but it looks promising. Most of the features are there now.*
|
||||
*A little buggy, but mostly okay! There are many features and fixes planned, but it should be fairly usable already.*
|
||||
|
||||
- We have a working **2-way terminal** (UART->ESP->Browser and vice versa) with real-time update via websocket.
|
||||
|
||||
@@ -42,11 +42,9 @@ The screen size is adjustable up to 25x80 (via a special control sequence) and u
|
||||
Arrow keys generate ANSI sequences, ESC sends literal ASCII code 27 etc. Almost everything can be input
|
||||
straight from the browser.
|
||||
|
||||
- To resize the screen, send `\e]W<rows>;<cols>\a` (it's an OSC code, terminated by ST).
|
||||
|
||||
- Buttons pressed in the browser UI send ASCII codes 1..5. Mouse clicks are sent as `\e[<row>;<col>M`.
|
||||
|
||||
- There's a built-in WiFi config page and a Help page with a list of all supported ANSI sequences etc.
|
||||
- There's a built-in WiFi config page and a Help page with a list of all supported ANSI sequences and other details.
|
||||
|
||||
## Development
|
||||
|
||||
@@ -67,33 +65,18 @@ The screen size is adjustable up to 25x80 (via a special control sequence) and u
|
||||
KERNEL=="tty[A-Z]*[0-9]*", GROUP="uucp", MODE="0666"
|
||||
```
|
||||
|
||||
- Install Ragel if you wish to make modifications to the parser.
|
||||
If not, comment out it's call in `build_parser.sh`. The `.rl` file is the actual source, the `.c` is generated.
|
||||
- Install Ragel if you wish to make modifications to the ANSI sequence parser.
|
||||
If not, comment out its call in `build_parser.sh`. The `.rl` file is the actual source, the `.c` is generated.
|
||||
|
||||
- Install Ruby and then the `sass` package with `gem install sass` (or try some other implementation, such as
|
||||
`sassc`)
|
||||
|
||||
- Get the IoT SDK from one of:
|
||||
|
||||
```
|
||||
ESP8266_NONOS_SDK_V2.0.0_16_08_10.zip:
|
||||
wget --content-disposition "http://bbs.espressif.com/download/file.php?id=1690"
|
||||
ESP8266_NONOS_SDK_V2.0.0_16_07_19.zip:
|
||||
wget --content-disposition "http://bbs.espressif.com/download/file.php?id=1613"
|
||||
ESP8266_NONOS_SDK_V1.5.4_16_05_20.zip:
|
||||
wget --content-disposition "http://bbs.espressif.com/download/file.php?id=1469"
|
||||
ESP8266_NONOS_SDK_V1.5.3_16_04_18.zip:
|
||||
wget --content-disposition "http://bbs.espressif.com/download/file.php?id=1361"
|
||||
ESP8266_NONOS_SDK_V1.5.2_16_01_29.zip:
|
||||
wget --content-disposition "http://bbs.espressif.com/download/file.php?id=1079"
|
||||
```
|
||||
|
||||
It's tested with 1.5.2, 2.0.0 won't work without adjusting the build scripts. Any 1.5.x could be fine.
|
||||
|
||||
The `esp-open-sdk` Makefile could also download this for you with the right flags.
|
||||
|
||||
- Make sure your `esphttpdconfig.mk` is set up properly - link to the SDK etc.
|
||||
|
||||
The IoT SDK is now included in the project due to problems with obtaining the correct version and patching it.
|
||||
It works with version 1.5.2, any newer seems to be incompatible. If you get it working with a newer SDK, a PR is more
|
||||
than welcome!
|
||||
|
||||
### Web resources
|
||||
|
||||
The web resources are in `html_orig`. To prepare for a build, run `build_web.sh`, which packs them and
|
||||
@@ -104,6 +87,9 @@ then embedded in the firmware image.
|
||||
It's kind of tricky to develop the web resources locally; you might want to try the "split image"
|
||||
Makefile option, then you can flash just the html portion with `make htmlflash`. I haven't tried this.
|
||||
|
||||
For local development, use the `server.sh` script in `html_orig`. It's possible to talk to API of a running
|
||||
ESP8266 from here, if you configure `_env.php` with its IP.
|
||||
|
||||
### Flashing
|
||||
|
||||
The Makefile should automatically build the parser and web resources for you when you run `make`.
|
||||
|
||||
+9
-18
@@ -7,24 +7,15 @@ mkdir -p html/img
|
||||
mkdir -p html/js
|
||||
mkdir -p html/css
|
||||
|
||||
# Join scripts
|
||||
DD=html_orig/jssrc
|
||||
cat $DD/chibi.js \
|
||||
$DD/utils.js \
|
||||
$DD/modal.js \
|
||||
$DD/appcommon.js \
|
||||
$DD/term.js \
|
||||
$DD/wifi.js > html/js/app.js
|
||||
cd html_orig
|
||||
sh ./packjs.sh
|
||||
php ./build_html.php
|
||||
cd ..
|
||||
|
||||
sass --sourcemap=none html_orig/sass/app.scss html_orig/css/app.css
|
||||
cp html_orig/js/app.js html/js/
|
||||
|
||||
# No need to compress CSS and JS now, we run YUI on it later
|
||||
cp html_orig/css/app.css html/css/app.css
|
||||
cp html_orig/term.html html/term.tpl
|
||||
cp html_orig/wifi.html html/wifi.tpl
|
||||
cp html_orig/about.html html/about.tpl
|
||||
cp html_orig/help.html html/help.tpl
|
||||
cp html_orig/wifi_conn.html html/wifi_conn.tpl
|
||||
cp html_orig/img/loader.gif html/img/loader.gif
|
||||
cp html_orig/img/cvut.svg html/img/cvut.svg
|
||||
sass html_orig/sass/app.scss html/css/app.css
|
||||
rm html/css/app.css.map
|
||||
|
||||
cp html_orig/img/* html/img/
|
||||
cp html_orig/favicon.ico html/favicon.ico
|
||||
|
||||
Executable
Executable
+24
@@ -0,0 +1,24 @@
|
||||
ESPRSSIF MIT License
|
||||
|
||||
Copyright (c) 2015 <ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD>
|
||||
|
||||
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 产品的应用开发。在此情况下,该许可证免费授权任何获得该软件及其相关文档(统称为“软件”)的人无限制地经营该软件,包括无限制的使用、复制、修改、合并、出版发行、散布、再授权、及贩售软件及软件副本的权利。被授权人在享受这些权利的同时,需服从下面的条件:
|
||||
|
||||
在软件和软件的所有副本中都必须包含以上的版权声明和授权声明。
|
||||
|
||||
该软件按本来的样子提供,没有任何明确或暗含的担保,包括但不仅限于关于试销性、适合某一特定用途和非侵权的保证。作者和版权持有人在任何情况下均不就由软件或软件使用引起的以合同形式、民事侵权或其它方式提出的任何索赔、损害或其它责任负责。
|
||||
|
||||
|
||||
|
||||
|
||||
Executable
+379
@@ -0,0 +1,379 @@
|
||||
# copyright (c) 2010 Espressif System
|
||||
#
|
||||
ifndef PDIR
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($(COMPILE), gcc)
|
||||
AR = xtensa-lx106-elf-ar
|
||||
CC = xtensa-lx106-elf-gcc
|
||||
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
|
||||
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
|
||||
size_map = 0
|
||||
flash = 512
|
||||
ifeq ($(app), 2)
|
||||
addr = 0x41000
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
LD_FILE = $(LDDIR)/eagle.app.v6.ld
|
||||
|
||||
ifneq ($(boot), none)
|
||||
ifneq ($(app),0)
|
||||
ifeq ($(size_map), 6)
|
||||
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)
|
||||
ASRCs ?= $(wildcard *.s)
|
||||
ASRCS ?= $(wildcard *.S)
|
||||
SUBDIRS ?= $(patsubst %/,%,$(dir $(wildcard */Makefile)))
|
||||
|
||||
ODIR := .output
|
||||
OBJODIR := $(ODIR)/$(TARGET)/$(FLAVOR)/obj
|
||||
|
||||
OBJS := $(CSRCS:%.c=$(OBJODIR)/%.o) \
|
||||
$(ASRCs:%.s=$(OBJODIR)/%.o) \
|
||||
$(ASRCS:%.S=$(OBJODIR)/%.o)
|
||||
|
||||
DEPS := $(CSRCS:%.c=$(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 \
|
||||
-Wpointer-arith \
|
||||
-Wundef \
|
||||
-Werror \
|
||||
-Wl,-EL \
|
||||
-fno-inline-functions \
|
||||
-nostdlib \
|
||||
-mlongcalls \
|
||||
-mtext-section-literals \
|
||||
-ffunction-sections \
|
||||
-fdata-sections
|
||||
# -Wall
|
||||
|
||||
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)
|
||||
@python ../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---->0x40000"
|
||||
else
|
||||
ifneq ($(boot), new)
|
||||
@python ../tools/gen_appbin.py $< 1 $(mode) $(freqdiv) $(size_map) $(app)
|
||||
@echo "Support boot_v1.1 and +"
|
||||
else
|
||||
@python ../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: %.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)
|
||||
PDIR := ../$(PDIR)
|
||||
sinclude $(PDIR)Makefile
|
||||
Executable
+147
@@ -0,0 +1,147 @@
|
||||
@echo off
|
||||
|
||||
echo gen_misc.bat version 20150511
|
||||
echo .
|
||||
|
||||
echo Please follow below steps(1-5) to generate specific bin(s):
|
||||
echo STEP 1: choose boot version(0=boot_v1.1, 1=boot_v1.2+, 2=none)
|
||||
set input=default
|
||||
set /p input=enter(0/1/2, default 2):
|
||||
|
||||
if %input% equ 0 (
|
||||
set boot=old
|
||||
) else (
|
||||
if %input% equ 1 (
|
||||
set boot=new
|
||||
) else (
|
||||
set boot=none
|
||||
)
|
||||
)
|
||||
|
||||
echo boot mode: %boot%
|
||||
echo.
|
||||
|
||||
echo STEP 2: choose bin generate(0=eagle.flash.bin+eagle.irom0text.bin, 1=user1.bin, 2=user2.bin)
|
||||
set input=default
|
||||
set /p input=enter (0/1/2, default 0):
|
||||
|
||||
if %input% equ 1 (
|
||||
if %boot% equ none (
|
||||
set app=0
|
||||
echo choose no boot before
|
||||
echo generate bin: eagle.flash.bin+eagle.irom0text.bin
|
||||
) else (
|
||||
set app=1
|
||||
echo generate bin: user1.bin
|
||||
)
|
||||
) else (
|
||||
if %input% equ 2 (
|
||||
if %boot% equ none (
|
||||
set app=0
|
||||
echo choose no boot before
|
||||
echo generate bin: eagle.flash.bin+eagle.irom0text.bin
|
||||
) else (
|
||||
set app=2
|
||||
echo generate bin: user2.bin
|
||||
)
|
||||
) else (
|
||||
if %boot% neq none (
|
||||
set boot=none
|
||||
echo ignore boot
|
||||
)
|
||||
set app=0
|
||||
echo generate bin: eagle.flash.bin+eagle.irom0text.bin
|
||||
))
|
||||
|
||||
echo.
|
||||
|
||||
echo STEP 3: choose spi speed(0=20MHz, 1=26.7MHz, 2=40MHz, 3=80MHz)
|
||||
set input=default
|
||||
set /p input=enter (0/1/2/3, default 2):
|
||||
|
||||
if %input% equ 0 (
|
||||
set spi_speed=20
|
||||
) else (
|
||||
if %input% equ 1 (
|
||||
set spi_speed=26.7
|
||||
) else (
|
||||
if %input% equ 3 (
|
||||
set spi_speed=80
|
||||
) else (
|
||||
set spi_speed=40
|
||||
)))
|
||||
|
||||
echo spi speed: %spi_speed% MHz
|
||||
echo.
|
||||
|
||||
echo STEP 4: choose spi mode(0=QIO, 1=QOUT, 2=DIO, 3=DOUT)
|
||||
set input=default
|
||||
set /p input=enter (0/1/2/3, default 0):
|
||||
|
||||
if %input% equ 1 (
|
||||
set spi_mode=QOUT
|
||||
) else (
|
||||
if %input% equ 2 (
|
||||
set spi_mode=DIO
|
||||
) else (
|
||||
if %input% equ 3 (
|
||||
set spi_mode=DOUT
|
||||
) else (
|
||||
set spi_mode=QIO
|
||||
)))
|
||||
|
||||
echo spi mode: %spi_mode%
|
||||
echo.
|
||||
|
||||
echo STEP 5: choose flash size and map
|
||||
echo 0= 512KB( 256KB+ 256KB)
|
||||
echo 2=1024KB( 512KB+ 512KB)
|
||||
echo 3=2048KB( 512KB+ 512KB)
|
||||
echo 4=4096KB( 512KB+ 512KB)
|
||||
echo 5=2048KB(1024KB+1024KB)
|
||||
echo 6=4096KB(1024KB+1024KB)
|
||||
set input=default
|
||||
set /p input=enter (0/1/2/3/4/5/6, default 0):
|
||||
|
||||
if %input% equ 2 (
|
||||
set spi_size_map=2
|
||||
echo spi size: 1024KB
|
||||
echo spi ota map: 512KB + 512KB
|
||||
) else (
|
||||
if %input% equ 3 (
|
||||
set spi_size_map=3
|
||||
echo spi size: 2048KB
|
||||
echo spi ota map: 512KB + 512KB
|
||||
) else (
|
||||
if %input% equ 4 (
|
||||
set spi_size_map=4
|
||||
echo spi size: 4096KB
|
||||
echo spi ota map: 512KB + 512KB
|
||||
) else (
|
||||
if %input% equ 5 (
|
||||
set spi_size_map=5
|
||||
echo spi size: 2048KB
|
||||
echo spi ota map: 1024KB + 1024KB
|
||||
) else (
|
||||
if %input% equ 6 (
|
||||
set spi_size_map=6
|
||||
echo spi size: 4096KB
|
||||
echo spi ota map: 1024KB + 1024KB
|
||||
) else (
|
||||
set spi_size_map=0
|
||||
echo spi size: 512KB
|
||||
echo spi ota map: 256KB + 256KB
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
touch user/user_main.c
|
||||
|
||||
echo.
|
||||
echo start...
|
||||
echo.
|
||||
|
||||
make BOOT=%boot% APP=%app% SPI_SPEED=%spi_speed% SPI_MODE=%spi_mode% SPI_SIZE=%spi_size_map%
|
||||
|
||||
Executable
+150
@@ -0,0 +1,150 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "gen_misc.sh version 20150511"
|
||||
echo ""
|
||||
|
||||
echo "Please follow below steps(1-5) to generate specific bin(s):"
|
||||
echo "STEP 1: choose boot version(0=boot_v1.1, 1=boot_v1.2+, 2=none)"
|
||||
echo "enter(0/1/2, default 2):"
|
||||
read input
|
||||
|
||||
if [ -z "$input" ]; then
|
||||
boot=none
|
||||
elif [ $input == 0 ]; then
|
||||
boot=old
|
||||
elif [ $input == 1 ]; then
|
||||
boot=new
|
||||
else
|
||||
boot=none
|
||||
fi
|
||||
|
||||
echo "boot mode: $boot"
|
||||
echo ""
|
||||
|
||||
echo "STEP 2: choose bin generate(0=eagle.flash.bin+eagle.irom0text.bin, 1=user1.bin, 2=user2.bin)"
|
||||
echo "enter (0/1/2, default 0):"
|
||||
read input
|
||||
|
||||
if [ -z "$input" ]; then
|
||||
if [ $boot != none ]; then
|
||||
boot=none
|
||||
echo "ignore boot"
|
||||
fi
|
||||
app=0
|
||||
echo "generate bin: eagle.flash.bin+eagle.irom0text.bin"
|
||||
elif [ $input == 1 ]; then
|
||||
if [ $boot == none ]; then
|
||||
app=0
|
||||
echo "choose no boot before"
|
||||
echo "generate bin: eagle.flash.bin+eagle.irom0text.bin"
|
||||
else
|
||||
app=1
|
||||
echo "generate bin: user1.bin"
|
||||
fi
|
||||
elif [ $input == 2 ]; then
|
||||
if [ $boot == none ]; then
|
||||
app=0
|
||||
echo "choose no boot before"
|
||||
echo "generate bin: eagle.flash.bin+eagle.irom0text.bin"
|
||||
else
|
||||
app=2
|
||||
echo "generate bin: user2.bin"
|
||||
fi
|
||||
else
|
||||
if [ $boot != none ]; then
|
||||
boot=none
|
||||
echo "ignore boot"
|
||||
fi
|
||||
app=0
|
||||
echo "generate bin: eagle.flash.bin+eagle.irom0text.bin"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
echo "STEP 3: choose spi speed(0=20MHz, 1=26.7MHz, 2=40MHz, 3=80MHz)"
|
||||
echo "enter (0/1/2/3, default 2):"
|
||||
read input
|
||||
|
||||
if [ -z "$input" ]; then
|
||||
spi_speed=40
|
||||
elif [ $input == 0 ]; then
|
||||
spi_speed=20
|
||||
elif [ $input == 1 ]; then
|
||||
spi_speed=26.7
|
||||
elif [ $input == 3 ]; then
|
||||
spi_speed=80
|
||||
else
|
||||
spi_speed=40
|
||||
fi
|
||||
|
||||
echo "spi speed: $spi_speed MHz"
|
||||
echo ""
|
||||
|
||||
echo "STEP 4: choose spi mode(0=QIO, 1=QOUT, 2=DIO, 3=DOUT)"
|
||||
echo "enter (0/1/2/3, default 0):"
|
||||
read input
|
||||
|
||||
if [ -z "$input" ]; then
|
||||
spi_mode=QIO
|
||||
elif [ $input == 1 ]; then
|
||||
spi_mode=QOUT
|
||||
elif [ $input == 2 ]; then
|
||||
spi_mode=DIO
|
||||
elif [ $input == 3 ]; then
|
||||
spi_mode=DOUT
|
||||
else
|
||||
spi_mode=QIO
|
||||
fi
|
||||
|
||||
echo "spi mode: $spi_mode"
|
||||
echo ""
|
||||
|
||||
echo "STEP 5: choose spi size and map"
|
||||
echo " 0= 512KB( 256KB+ 256KB)"
|
||||
echo " 2=1024KB( 512KB+ 512KB)"
|
||||
echo " 3=2048KB( 512KB+ 512KB)"
|
||||
echo " 4=4096KB( 512KB+ 512KB)"
|
||||
echo " 5=2048KB(1024KB+1024KB)"
|
||||
echo " 6=4096KB(1024KB+1024KB)"
|
||||
echo "enter (0/2/3/4/5/6, default 0):"
|
||||
read input
|
||||
|
||||
if [ -z "$input" ]; then
|
||||
spi_size_map=0
|
||||
echo "spi size: 512KB"
|
||||
echo "spi ota map: 256KB + 256KB"
|
||||
elif [ $input == 2 ]; then
|
||||
spi_size_map=2
|
||||
echo "spi size: 1024KB"
|
||||
echo "spi ota map: 512KB + 512KB"
|
||||
elif [ $input == 3 ]; then
|
||||
spi_size_map=3
|
||||
echo "spi size: 2048KB"
|
||||
echo "spi ota map: 512KB + 512KB"
|
||||
elif [ $input == 4 ]; then
|
||||
spi_size_map=4
|
||||
echo "spi size: 4096KB"
|
||||
echo "spi ota map: 512KB + 512KB"
|
||||
elif [ $input == 5 ]; then
|
||||
spi_size_map=5
|
||||
echo "spi size: 2048KB"
|
||||
echo "spi ota map: 1024KB + 1024KB"
|
||||
elif [ $input == 6 ]; then
|
||||
spi_size_map=6
|
||||
echo "spi size: 4096KB"
|
||||
echo "spi ota map: 1024KB + 1024KB"
|
||||
else
|
||||
spi_size_map=0
|
||||
echo "spi size: 512KB"
|
||||
echo "spi ota map: 256KB + 256KB"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
touch user/user_main.c
|
||||
|
||||
echo ""
|
||||
echo "start..."
|
||||
echo ""
|
||||
|
||||
make COMPILE=gcc BOOT=$boot APP=$app SPI_SPEED=$spi_speed SPI_MODE=$spi_mode SPI_SIZE_MAP=$spi_size_map
|
||||
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Executable
+77
@@ -0,0 +1,77 @@
|
||||
***********************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 (optional)
|
||||
blank.bin 0x7e000 & 0xfe000
|
||||
|
||||
Flash size 16Mbit: 512KB+512KB
|
||||
boot_v1.2+.bin 0x00000
|
||||
user1.1024.new.2.bin 0x01000
|
||||
esp_init_data_default.bin 0x1fc000 (optional)
|
||||
blank.bin 0x7e000 & 0x1fe000
|
||||
|
||||
Flash size 16Mbit-C1: 1024KB+1024KB
|
||||
boot_v1.2+.bin 0x00000
|
||||
user1.2048.new.5.bin 0x01000
|
||||
esp_init_data_default.bin 0x1fc000 (optional)
|
||||
blank.bin 0xfe000 & 0x1fe000
|
||||
|
||||
Flash size 32Mbit: 512KB+512KB
|
||||
boot_v1.2+.bin 0x00000
|
||||
user1.1024.new.2.bin 0x01000
|
||||
esp_init_data_default.bin 0x3fc000 (optional)
|
||||
blank.bin 0x7e000 & 0x3fe000
|
||||
|
||||
Flash size 32Mbit-C1: 1024KB+1024KB
|
||||
boot_v1.2+.bin 0x00000
|
||||
user1.2048.new.5.bin 0x01000
|
||||
esp_init_data_default.bin 0x3fc000 (optional)
|
||||
blank.bin 0xfe000 & 0x3fe000
|
||||
|
||||
***********************NON-BOOT MODE***********************
|
||||
download
|
||||
eagle.flash.bin 0x00000
|
||||
eagle.irom0text.bin 0x40000
|
||||
blank.bin
|
||||
Flash size 4Mbit: not supported
|
||||
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 (optional)
|
||||
Flash size 8Mbit: 0xfc000
|
||||
Flash size 16Mbit: 0x1fc000
|
||||
Flash size 16Mbit-C1: 0x1fc000
|
||||
Flash size 32Mbit: 0x3fc000
|
||||
Flash size 32Mbit-C1: 0x3fc000
|
||||
|
||||
*NOTICE*:
|
||||
UPDATE is not supported in non-boot mode
|
||||
|
||||
***********************************************************
|
||||
|
||||
Update steps
|
||||
1.Make sure TE(terminal equipment) is in sta or sta+ap mode
|
||||
ex. AT+CWMODE=3
|
||||
OK
|
||||
|
||||
2.Make sure TE got ip address
|
||||
ex. AT+CWJAP="ssid","12345678"
|
||||
OK
|
||||
|
||||
AT+CIFSR
|
||||
192.168.1.134
|
||||
|
||||
3.Let's update
|
||||
ex. AT+CIUPDATE
|
||||
+CIPUPDATE:1 found server
|
||||
+CIPUPDATE:2 connect server
|
||||
+CIPUPDATE:3 got edition
|
||||
+CIPUPDATE:4 start start
|
||||
|
||||
OK
|
||||
|
||||
note. If there are mistakes in the updating, then break update and print ERROR.
|
||||
Executable
+1
@@ -0,0 +1 @@
|
||||
����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
|
||||
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
BIN
Binary file not shown.
Executable
+122
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* airkiss.h
|
||||
*
|
||||
* Created on: 2015-1-26
|
||||
* Author: peterfan
|
||||
*/
|
||||
|
||||
#ifndef AIRKISS_H_
|
||||
#define AIRKISS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
typedef void* (*airkiss_memset_fn) (void* ptr, int value, unsigned int num);
|
||||
typedef void* (*airkiss_memcpy_fn) (void* dst, const void* src, unsigned int num);
|
||||
typedef int (*airkiss_memcmp_fn) (const void* ptr1, const void* ptr2, unsigned int num);
|
||||
typedef int (*airkiss_printf_fn) (const char* format, ...);
|
||||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
airkiss_memset_fn memset;
|
||||
airkiss_memcpy_fn memcpy;
|
||||
airkiss_memcmp_fn memcmp;
|
||||
airkiss_printf_fn printf;
|
||||
|
||||
} airkiss_config_t;
|
||||
|
||||
/**
|
||||
* @brief Get airkiss lib version.
|
||||
*
|
||||
* @attention The lenth of version is unknown
|
||||
*
|
||||
* @param null.
|
||||
*
|
||||
* @return const char*
|
||||
*/
|
||||
|
||||
const char* airkiss_version(void);
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
/* the length of the data buffer is lack*/
|
||||
AIRKISS_LAN_ERR_OVERFLOW = -5,
|
||||
|
||||
/* Do not support the type of instruction */
|
||||
AIRKISS_LAN_ERR_CMD = -4,
|
||||
|
||||
/* Error reading data package */
|
||||
AIRKISS_LAN_ERR_PAKE = -3,
|
||||
|
||||
/* Error function passing parameters */
|
||||
AIRKISS_LAN_ERR_PARA = -2,
|
||||
|
||||
/* Packet data error */
|
||||
AIRKISS_LAN_ERR_PKG = -1,
|
||||
|
||||
/* Message format is correct */
|
||||
AIRKISS_LAN_CONTINUE = 0,
|
||||
|
||||
/* Find equipment request packet is received */
|
||||
AIRKISS_LAN_SSDP_REQ = 1,
|
||||
|
||||
/* Packet packaging complete */
|
||||
AIRKISS_LAN_PAKE_READY = 2
|
||||
|
||||
|
||||
} airkiss_lan_ret_t;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
AIRKISS_LAN_SSDP_REQ_CMD = 0x1,
|
||||
AIRKISS_LAN_SSDP_RESP_CMD = 0x1001,
|
||||
AIRKISS_LAN_SSDP_NOTIFY_CMD = 0x1002
|
||||
} airkiss_lan_cmdid_t;
|
||||
|
||||
/**
|
||||
* @brief Receive UDP packet and input this API for analyzing.
|
||||
*
|
||||
* @attention null.
|
||||
*
|
||||
* @param const void* body : The start of the UDP message body data pointer.
|
||||
* @param unsigned short length : the effective length of data.
|
||||
* @param const airkiss_config_t* config : input struct airkiss_config_t
|
||||
*
|
||||
* @return >=0 : succeed (reference airkiss_lan_ret_t)
|
||||
* @return <0 : error code (reference airkiss_lan_ret_t)
|
||||
*/
|
||||
|
||||
int airkiss_lan_recv(const void* body, unsigned short length, const airkiss_config_t* config);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Packaging the UDP packet to send.
|
||||
*
|
||||
* @attention null.
|
||||
*
|
||||
* @param airkiss_lan_cmdid_t ak_lan_cmdid : The packet type.
|
||||
* @param void* appid : Vendor's Wechat public number id.
|
||||
* @param void* deviceid : device model id.
|
||||
* @param void* _datain : the data to be sent.
|
||||
* @param unsigned short inlength : the lenth of data to be sent.
|
||||
* @param void* _dataout : Data buffer addr.
|
||||
* @param unsigned short* outlength : the size of data buffer.
|
||||
* @param const airkiss_config_t* config : input struct airkiss_config_t
|
||||
*
|
||||
* @return >=0 : succeed (reference airkiss_lan_ret_t)
|
||||
* @return <0 : error code (reference airkiss_lan_ret_t)
|
||||
*/
|
||||
|
||||
int airkiss_lan_pack(airkiss_lan_cmdid_t ak_lan_cmdid, void* appid, void* deviceid, void* _datain, unsigned short inlength, void* _dataout, unsigned short* outlength, const airkiss_config_t* config);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* AIRKISS_H_ */
|
||||
Executable
+161
@@ -0,0 +1,161 @@
|
||||
|
||||
/*
|
||||
* custom_at.h
|
||||
*
|
||||
* This file is part of Espressif's AT+ command set program.
|
||||
* Copyright (C) 2013 - 2016, Espressif Systems
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of version 3 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CUSTOM_AT_H_
|
||||
#define CUSTOM_AT_H_
|
||||
|
||||
#include "c_types.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *at_cmdName;
|
||||
int8_t at_cmdLen;
|
||||
void (*at_testCmd)(uint8_t id);
|
||||
void (*at_queryCmd)(uint8_t id);
|
||||
void (*at_setupCmd)(uint8_t id, char *pPara);
|
||||
void (*at_exeCmd)(uint8_t id);
|
||||
}at_funcationType;
|
||||
|
||||
typedef void (*at_custom_uart_rx_intr)(uint8* data,int32 len);
|
||||
|
||||
typedef void (*at_custom_response_func_type)(const char *str);
|
||||
|
||||
typedef void (*at_fake_uart_tx_func_type)(const uint8*data,uint32 length);
|
||||
|
||||
extern uint8 at_customLinkMax;
|
||||
|
||||
/**
|
||||
* @brief Response "OK" to uart.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void at_response_ok(void);
|
||||
/**
|
||||
* @brief Response "ERROR" to uart.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void at_response_error(void);
|
||||
/**
|
||||
* @brief Response string.
|
||||
* It is equivalent to at_port_print,if not call at_register_response_func or call at_register_response_func(NULL);
|
||||
* It will run custom response function,if call at_register_response_func and parameter is not NULL.
|
||||
* @param string
|
||||
* @retval None
|
||||
*/
|
||||
void at_response(const char *str);
|
||||
/**
|
||||
* @brief register custom response function.
|
||||
* @param response_func: the function that will run when call at_response
|
||||
* @retval None
|
||||
*/
|
||||
void at_register_response_func(at_custom_response_func_type response_func);
|
||||
/**
|
||||
* @brief Task of process command or txdata.
|
||||
* @param custom_at_cmd_array: the array of at cmd that custom defined
|
||||
* cmd_num : the num of at cmd that custom defined
|
||||
* @retval None
|
||||
*/
|
||||
void at_cmd_array_regist(at_funcationType *custom_at_cmd_array,uint32 cmd_num);
|
||||
/**
|
||||
* @brief get digit form at cmd line.the maybe alter pSrc
|
||||
* @param p_src: at cmd line string
|
||||
* result:the buffer to be placed result
|
||||
* err : err num
|
||||
* @retval TRUE:
|
||||
* FALSE:
|
||||
*/
|
||||
bool at_get_next_int_dec(char **p_src,int*result,int* err);
|
||||
/**
|
||||
* @brief get string form at cmd line.the maybe alter pSrc
|
||||
* @param p_dest: the buffer to be placed result
|
||||
* p_src: at cmd line string
|
||||
* max_len :max len of string excepted to get
|
||||
* @retval None
|
||||
*/
|
||||
int32 at_data_str_copy(char *p_dest, char **p_src, int32 max_len);
|
||||
|
||||
/**
|
||||
* @brief initialize at module
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void at_init(void);
|
||||
/**
|
||||
* @brief print string to at port
|
||||
* @param string
|
||||
* @retval None
|
||||
*/
|
||||
void at_port_print(const char *str);
|
||||
/**
|
||||
* @brief print custom information when AT+GMR
|
||||
* @param string
|
||||
* @retval None
|
||||
*/
|
||||
void at_set_custom_info(char* info);
|
||||
/**
|
||||
* @brief if current at command is processing,you can call at_enter_special_state,
|
||||
* then if other comamnd coming,it will return busy.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void at_enter_special_state(void);
|
||||
/**
|
||||
* @brief
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void at_leave_special_state(void);
|
||||
/**
|
||||
* @brief get at version
|
||||
* @param None
|
||||
* @retval at version
|
||||
* bit24~31: at main version
|
||||
* bit23~16: at sub version
|
||||
* bit15~8 : at test version
|
||||
* bit7~0 : customized version
|
||||
*/
|
||||
uint32 at_get_version(void);
|
||||
|
||||
/**
|
||||
* @brief register custom uart rx interrupt function
|
||||
* @param rx_func: custom uart rx interrupt function.
|
||||
* If rx_func is non-void,when rx interrupt comming,it will call rx_func(data,len),
|
||||
* data is the buffer of data,len is the length of data.Otherwise,it will run AT rx function.
|
||||
* @retval None
|
||||
*/
|
||||
void at_register_uart_rx_intr(at_custom_uart_rx_intr rx_func);
|
||||
/**
|
||||
* @brief notify at module that has receive data
|
||||
* @param data: data buffer.
|
||||
* @param length: data length
|
||||
* @retval data len,if ok len == length
|
||||
*/
|
||||
uint32 at_fake_uart_rx(uint8* data,uint32 length);
|
||||
|
||||
/**
|
||||
* @brief enable fake uart,and register fake uart tx
|
||||
* @param enable: enable fake uart.
|
||||
* @param at_fake_uart_tx_func:
|
||||
* @retval data len,if ok len == length
|
||||
*/
|
||||
bool at_fake_uart_enable(bool enable,at_fake_uart_tx_func_type at_fake_uart_tx_func);
|
||||
|
||||
#endif
|
||||
Executable
+97
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright (c) 2010 - 2011 Espressif System
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _C_TYPES_H_
|
||||
#define _C_TYPES_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
//typedef unsigned char uint8_t;
|
||||
typedef signed char sint8_t;
|
||||
//typedef signed char int8_t;
|
||||
//typedef unsigned short uint16_t;
|
||||
typedef signed short sint16_t;
|
||||
//typedef signed short int16_t;
|
||||
//typedef unsigned long uint32_t;
|
||||
typedef signed long sint32_t;
|
||||
//typedef signed long int32_t;
|
||||
typedef signed long long sint64_t;
|
||||
//typedef unsigned long long uint64_t;
|
||||
typedef unsigned long long u_int64_t;
|
||||
typedef float real32_t;
|
||||
typedef double real64_t;
|
||||
|
||||
typedef unsigned char uint8;
|
||||
typedef unsigned char u8;
|
||||
typedef signed char sint8;
|
||||
typedef signed char int8;
|
||||
typedef signed char s8;
|
||||
typedef unsigned short uint16;
|
||||
typedef unsigned short u16;
|
||||
typedef signed short sint16;
|
||||
typedef signed short s16;
|
||||
typedef unsigned int uint32;
|
||||
typedef unsigned int u_int;
|
||||
typedef unsigned int u32;
|
||||
typedef signed int sint32;
|
||||
typedef signed int s32;
|
||||
typedef int int32;
|
||||
typedef signed long long sint64;
|
||||
typedef unsigned long long uint64;
|
||||
typedef unsigned long long u64;
|
||||
typedef float real32;
|
||||
typedef double real64;
|
||||
|
||||
#define __le16 u16
|
||||
|
||||
typedef unsigned int size_t;
|
||||
|
||||
#define __packed __attribute__((packed))
|
||||
|
||||
#define LOCAL static
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL (void *)0
|
||||
#endif /* NULL */
|
||||
|
||||
/* probably should not put STATUS here */
|
||||
typedef enum {
|
||||
OK = 0,
|
||||
FAIL,
|
||||
PENDING,
|
||||
BUSY,
|
||||
CANCEL,
|
||||
} STATUS;
|
||||
|
||||
#define BIT(nr) (1UL << (nr))
|
||||
|
||||
#define REG_SET_BIT(_r, _b) (*(volatile uint32_t*)(_r) |= (_b))
|
||||
#define REG_CLR_BIT(_r, _b) (*(volatile uint32_t*)(_r) &= ~(_b))
|
||||
|
||||
#define DMEM_ATTR __attribute__((section(".bss")))
|
||||
#define SHMEM_ATTR
|
||||
|
||||
#ifdef ICACHE_FLASH
|
||||
#define ICACHE_FLASH_ATTR __attribute__((section(".irom0.text")))
|
||||
#define ICACHE_RODATA_ATTR __attribute__((section(".irom.text")))
|
||||
#else
|
||||
#define ICACHE_FLASH_ATTR
|
||||
#define ICACHE_RODATA_ATTR
|
||||
#endif /* ICACHE_FLASH */
|
||||
|
||||
#define STORE_ATTR __attribute__((aligned(4)))
|
||||
|
||||
#ifndef __cplusplus
|
||||
//typedef unsigned char bool;
|
||||
#define BOOL bool
|
||||
//#define true (1)
|
||||
//#define false (0)
|
||||
#define TRUE true
|
||||
#define FALSE false
|
||||
|
||||
|
||||
#endif /* !__cplusplus */
|
||||
|
||||
#endif /* _C_TYPES_H_ */
|
||||
Executable
+95
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright (c) 2010 - 2011 Espressif System
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _C_TYPES_H_
|
||||
#define _C_TYPES_H_
|
||||
|
||||
typedef unsigned char uint8_t;
|
||||
typedef signed char sint8_t;
|
||||
typedef signed char int8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef signed short sint16_t;
|
||||
typedef signed short int16_t;
|
||||
typedef unsigned long uint32_t;
|
||||
typedef signed long sint32_t;
|
||||
typedef signed long int32_t;
|
||||
typedef signed long long sint64_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
typedef unsigned long long u_int64_t;
|
||||
typedef float real32_t;
|
||||
typedef double real64_t;
|
||||
|
||||
typedef unsigned char uint8;
|
||||
typedef unsigned char u8;
|
||||
typedef signed char sint8;
|
||||
typedef signed char int8;
|
||||
typedef signed char s8;
|
||||
typedef unsigned short uint16;
|
||||
typedef unsigned short u16;
|
||||
typedef signed short sint16;
|
||||
typedef signed short s16;
|
||||
typedef unsigned int uint32;
|
||||
typedef unsigned int u_int;
|
||||
typedef unsigned int u32;
|
||||
typedef signed int sint32;
|
||||
typedef signed int s32;
|
||||
typedef int int32;
|
||||
typedef signed long long sint64;
|
||||
typedef unsigned long long uint64;
|
||||
typedef unsigned long long u64;
|
||||
typedef float real32;
|
||||
typedef double real64;
|
||||
|
||||
#define __le16 u16
|
||||
|
||||
typedef unsigned int size_t;
|
||||
|
||||
#define __packed __attribute__((packed))
|
||||
|
||||
#define LOCAL static
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL (void *)0
|
||||
#endif /* NULL */
|
||||
|
||||
/* probably should not put STATUS here */
|
||||
typedef enum {
|
||||
OK = 0,
|
||||
FAIL,
|
||||
PENDING,
|
||||
BUSY,
|
||||
CANCEL,
|
||||
} STATUS;
|
||||
|
||||
#define BIT(nr) (1UL << (nr))
|
||||
|
||||
#define REG_SET_BIT(_r, _b) (*(volatile uint32_t*)(_r) |= (_b))
|
||||
#define REG_CLR_BIT(_r, _b) (*(volatile uint32_t*)(_r) &= ~(_b))
|
||||
|
||||
#define DMEM_ATTR __attribute__((section(".bss")))
|
||||
#define SHMEM_ATTR
|
||||
|
||||
#ifdef ICACHE_FLASH
|
||||
#define ICACHE_FLASH_ATTR __attribute__((section(".irom0.text")))
|
||||
#define ICACHE_RODATA_ATTR __attribute__((section(".irom.text")))
|
||||
#else
|
||||
#define ICACHE_FLASH_ATTR
|
||||
#define ICACHE_RODATA_ATTR
|
||||
#endif /* ICACHE_FLASH */
|
||||
|
||||
#define STORE_ATTR __attribute__((aligned(4)))
|
||||
|
||||
#ifndef __cplusplus
|
||||
typedef unsigned char bool;
|
||||
#define BOOL bool
|
||||
#define true (1)
|
||||
#define false (0)
|
||||
#define TRUE true
|
||||
#define FALSE false
|
||||
|
||||
|
||||
#endif /* !__cplusplus */
|
||||
|
||||
#endif /* _C_TYPES_H_ */
|
||||
Executable
+315
@@ -0,0 +1,315 @@
|
||||
/*
|
||||
* Copyright (c) Espressif System 2010 - 2012
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _EAGLE_SOC_H_
|
||||
#define _EAGLE_SOC_H_
|
||||
|
||||
#include "c_types.h"
|
||||
|
||||
#define UL(x) ((unsigned long)(x))
|
||||
|
||||
//Register Bits{{
|
||||
#define BIT31 BIT(31)
|
||||
#define BIT30 BIT(30)
|
||||
#define BIT29 BIT(29)
|
||||
#define BIT28 BIT(28)
|
||||
#define BIT27 BIT(27)
|
||||
#define BIT26 BIT(26)
|
||||
#define BIT25 BIT(25)
|
||||
#define BIT24 BIT(24)
|
||||
#define BIT23 BIT(23)
|
||||
#define BIT22 BIT(22)
|
||||
#define BIT21 BIT(21)
|
||||
#define BIT20 BIT(20)
|
||||
#define BIT19 BIT(19)
|
||||
#define BIT18 BIT(18)
|
||||
#define BIT17 BIT(17)
|
||||
#define BIT16 BIT(16)
|
||||
#define BIT15 BIT(15)
|
||||
#define BIT14 BIT(14)
|
||||
#define BIT13 BIT(13)
|
||||
#define BIT12 BIT(12)
|
||||
#define BIT11 BIT(11)
|
||||
#define BIT10 BIT(10)
|
||||
#define BIT9 BIT(9)
|
||||
#define BIT8 BIT(8)
|
||||
#define BIT7 BIT(7)
|
||||
#define BIT6 BIT(6)
|
||||
#define BIT5 BIT(5)
|
||||
#define BIT4 BIT(4)
|
||||
#define BIT3 BIT(3)
|
||||
#define BIT2 BIT(2)
|
||||
#define BIT1 BIT(1)
|
||||
#define BIT0 BIT(0)
|
||||
//}}
|
||||
|
||||
//Registers Operation {{
|
||||
#define ETS_UNCACHED_ADDR(addr) (addr)
|
||||
#define ETS_CACHED_ADDR(addr) (addr)
|
||||
|
||||
|
||||
#define READ_PERI_REG(addr) (*((volatile uint32_t *)ETS_UNCACHED_ADDR(addr)))
|
||||
#define WRITE_PERI_REG(addr, val) (*((volatile uint32_t *)ETS_UNCACHED_ADDR(addr))) = (uint32_t)(val)
|
||||
#define CLEAR_PERI_REG_MASK(reg, mask) WRITE_PERI_REG((reg), (READ_PERI_REG(reg)&(~((uint32_t)mask))))
|
||||
#define SET_PERI_REG_MASK(reg, mask) WRITE_PERI_REG((reg), (READ_PERI_REG(reg)|((uint32_t)mask)))
|
||||
#define GET_PERI_REG_BITS(reg, hipos,lowpos) ((READ_PERI_REG(reg)>>(lowpos))&((1<<((hipos)-(lowpos)+1))-1))
|
||||
#define SET_PERI_REG_BITS(reg,bit_map,value,shift) (WRITE_PERI_REG((reg), (READ_PERI_REG(reg) & (~(UL(bit_map)<<(shift)))) | (UL(value)<<UL(shift)) ))
|
||||
//}}
|
||||
|
||||
//Periheral Clock {{
|
||||
#define CPU_CLK_FREQ 80*1000000 //unit: Hz
|
||||
#define APB_CLK_FREQ CPU_CLK_FREQ
|
||||
#define UART_CLK_FREQ APB_CLK_FREQ
|
||||
#define TIMER_CLK_FREQ (APB_CLK_FREQ>>8) //divided by 256
|
||||
//}}
|
||||
|
||||
//Peripheral device base address define{{
|
||||
#define PERIPHS_DPORT_BASEADDR 0x3ff00000
|
||||
#define PERIPHS_GPIO_BASEADDR 0x60000300
|
||||
#define PERIPHS_TIMER_BASEDDR 0x60000600
|
||||
#define PERIPHS_RTC_BASEADDR 0x60000700
|
||||
#define PERIPHS_IO_MUX 0x60000800
|
||||
//}}
|
||||
|
||||
//Interrupt remap control registers define{{
|
||||
#define EDGE_INT_ENABLE_REG (PERIPHS_DPORT_BASEADDR+0x04)
|
||||
#define TM1_EDGE_INT_ENABLE() SET_PERI_REG_MASK(EDGE_INT_ENABLE_REG, BIT1)
|
||||
#define TM1_EDGE_INT_DISABLE() CLEAR_PERI_REG_MASK(EDGE_INT_ENABLE_REG, BIT1)
|
||||
//}}
|
||||
|
||||
//GPIO reg {{
|
||||
#define GPIO_REG_READ(reg) READ_PERI_REG(PERIPHS_GPIO_BASEADDR + reg)
|
||||
#define GPIO_REG_WRITE(reg, val) WRITE_PERI_REG(PERIPHS_GPIO_BASEADDR + reg, val)
|
||||
#define GPIO_OUT_ADDRESS 0x00
|
||||
#define GPIO_OUT_W1TS_ADDRESS 0x04
|
||||
#define GPIO_OUT_W1TC_ADDRESS 0x08
|
||||
|
||||
#define GPIO_ENABLE_ADDRESS 0x0c
|
||||
#define GPIO_ENABLE_W1TS_ADDRESS 0x10
|
||||
#define GPIO_ENABLE_W1TC_ADDRESS 0x14
|
||||
#define GPIO_OUT_W1TC_DATA_MASK 0x0000ffff
|
||||
|
||||
#define GPIO_IN_ADDRESS 0x18
|
||||
|
||||
#define GPIO_STATUS_ADDRESS 0x1c
|
||||
#define GPIO_STATUS_W1TS_ADDRESS 0x20
|
||||
#define GPIO_STATUS_W1TC_ADDRESS 0x24
|
||||
#define GPIO_STATUS_INTERRUPT_MASK 0x0000ffff
|
||||
|
||||
#define GPIO_RTC_CALIB_SYNC PERIPHS_GPIO_BASEADDR+0x6c
|
||||
#define RTC_CALIB_START BIT31 //first write to zero, then to one to start
|
||||
#define RTC_PERIOD_NUM_MASK 0x3ff //max 8ms
|
||||
#define GPIO_RTC_CALIB_VALUE PERIPHS_GPIO_BASEADDR+0x70
|
||||
#define RTC_CALIB_RDY_S 31 //after measure, flag to one, when start from zero to one, turn to zero
|
||||
#define RTC_CALIB_VALUE_MASK 0xfffff
|
||||
|
||||
#define GPIO_PIN0_ADDRESS 0x28
|
||||
|
||||
#define GPIO_ID_PIN0 0
|
||||
#define GPIO_ID_PIN(n) (GPIO_ID_PIN0+(n))
|
||||
#define GPIO_LAST_REGISTER_ID GPIO_ID_PIN(15)
|
||||
#define GPIO_ID_NONE 0xffffffff
|
||||
|
||||
#define GPIO_PIN_COUNT 16
|
||||
|
||||
#define GPIO_PIN_CONFIG_MSB 12
|
||||
#define GPIO_PIN_CONFIG_LSB 11
|
||||
#define GPIO_PIN_CONFIG_MASK 0x00001800
|
||||
#define GPIO_PIN_CONFIG_GET(x) (((x) & GPIO_PIN_CONFIG_MASK) >> GPIO_PIN_CONFIG_LSB)
|
||||
#define GPIO_PIN_CONFIG_SET(x) (((x) << GPIO_PIN_CONFIG_LSB) & GPIO_PIN_CONFIG_MASK)
|
||||
|
||||
#define GPIO_WAKEUP_ENABLE 1
|
||||
#define GPIO_WAKEUP_DISABLE (~GPIO_WAKEUP_ENABLE)
|
||||
#define GPIO_PIN_WAKEUP_ENABLE_MSB 10
|
||||
#define GPIO_PIN_WAKEUP_ENABLE_LSB 10
|
||||
#define GPIO_PIN_WAKEUP_ENABLE_MASK 0x00000400
|
||||
#define GPIO_PIN_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN_WAKEUP_ENABLE_MASK) >> GPIO_PIN_WAKEUP_ENABLE_LSB)
|
||||
#define GPIO_PIN_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN_WAKEUP_ENABLE_LSB) & GPIO_PIN_WAKEUP_ENABLE_MASK)
|
||||
|
||||
#define GPIO_PIN_INT_TYPE_MASK 0x380
|
||||
#define GPIO_PIN_INT_TYPE_MSB 9
|
||||
#define GPIO_PIN_INT_TYPE_LSB 7
|
||||
#define GPIO_PIN_INT_TYPE_GET(x) (((x) & GPIO_PIN_INT_TYPE_MASK) >> GPIO_PIN_INT_TYPE_LSB)
|
||||
#define GPIO_PIN_INT_TYPE_SET(x) (((x) << GPIO_PIN_INT_TYPE_LSB) & GPIO_PIN_INT_TYPE_MASK)
|
||||
|
||||
#define GPIO_PAD_DRIVER_ENABLE 1
|
||||
#define GPIO_PAD_DRIVER_DISABLE (~GPIO_PAD_DRIVER_ENABLE)
|
||||
#define GPIO_PIN_PAD_DRIVER_MSB 2
|
||||
#define GPIO_PIN_PAD_DRIVER_LSB 2
|
||||
#define GPIO_PIN_PAD_DRIVER_MASK 0x00000004
|
||||
#define GPIO_PIN_PAD_DRIVER_GET(x) (((x) & GPIO_PIN_PAD_DRIVER_MASK) >> GPIO_PIN_PAD_DRIVER_LSB)
|
||||
#define GPIO_PIN_PAD_DRIVER_SET(x) (((x) << GPIO_PIN_PAD_DRIVER_LSB) & GPIO_PIN_PAD_DRIVER_MASK)
|
||||
|
||||
#define GPIO_AS_PIN_SOURCE 0
|
||||
#define SIGMA_AS_PIN_SOURCE (~GPIO_AS_PIN_SOURCE)
|
||||
#define GPIO_PIN_SOURCE_MSB 0
|
||||
#define GPIO_PIN_SOURCE_LSB 0
|
||||
#define GPIO_PIN_SOURCE_MASK 0x00000001
|
||||
#define GPIO_PIN_SOURCE_GET(x) (((x) & GPIO_PIN_SOURCE_MASK) >> GPIO_PIN_SOURCE_LSB)
|
||||
#define GPIO_PIN_SOURCE_SET(x) (((x) << GPIO_PIN_SOURCE_LSB) & GPIO_PIN_SOURCE_MASK)
|
||||
// }}
|
||||
|
||||
// TIMER reg {{
|
||||
#define RTC_REG_READ(addr) READ_PERI_REG(PERIPHS_TIMER_BASEDDR + addr)
|
||||
#define RTC_REG_WRITE(addr, val) WRITE_PERI_REG(PERIPHS_TIMER_BASEDDR + addr, val)
|
||||
#define RTC_CLR_REG_MASK(reg, mask) CLEAR_PERI_REG_MASK(PERIPHS_TIMER_BASEDDR +reg, mask)
|
||||
/* Returns the current time according to the timer timer. */
|
||||
#define NOW() RTC_REG_READ(FRC2_COUNT_ADDRESS)
|
||||
|
||||
//load initial_value to timer1
|
||||
#define FRC1_LOAD_ADDRESS 0x00
|
||||
|
||||
//timer1's counter value(count from initial_value to 0)
|
||||
#define FRC1_COUNT_ADDRESS 0x04
|
||||
|
||||
#define FRC1_CTRL_ADDRESS 0x08
|
||||
|
||||
//clear timer1's interrupt when write this address
|
||||
#define FRC1_INT_ADDRESS 0x0c
|
||||
#define FRC1_INT_CLR_MASK 0x00000001
|
||||
|
||||
//timer2's counter value(count from initial_value to 0)
|
||||
#define FRC2_COUNT_ADDRESS 0x24
|
||||
// }}
|
||||
|
||||
//RTC reg {{
|
||||
#define REG_RTC_BASE PERIPHS_RTC_BASEADDR
|
||||
|
||||
#define RTC_GPIO_OUT (REG_RTC_BASE + 0x068)
|
||||
#define RTC_GPIO_ENABLE (REG_RTC_BASE + 0x074)
|
||||
#define RTC_GPIO_IN_DATA (REG_RTC_BASE + 0x08C)
|
||||
#define RTC_GPIO_CONF (REG_RTC_BASE + 0x090)
|
||||
#define PAD_XPD_DCDC_CONF (REG_RTC_BASE + 0x0A0)
|
||||
//}}
|
||||
|
||||
//PIN Mux reg {{
|
||||
#define PERIPHS_IO_MUX_FUNC 0x13
|
||||
#define PERIPHS_IO_MUX_FUNC_S 4
|
||||
#define PERIPHS_IO_MUX_PULLUP BIT7
|
||||
#define PERIPHS_IO_MUX_PULLUP2 BIT6
|
||||
#define PERIPHS_IO_MUX_SLEEP_PULLUP BIT3
|
||||
#define PERIPHS_IO_MUX_SLEEP_PULLUP2 BIT2
|
||||
#define PERIPHS_IO_MUX_SLEEP_OE BIT1
|
||||
#define PERIPHS_IO_MUX_OE BIT0
|
||||
|
||||
#define PERIPHS_IO_MUX_CONF_U (PERIPHS_IO_MUX + 0x00)
|
||||
#define SPI0_CLK_EQU_SYS_CLK BIT8
|
||||
#define SPI1_CLK_EQU_SYS_CLK BIT9
|
||||
|
||||
#define PERIPHS_IO_MUX_MTDI_U (PERIPHS_IO_MUX + 0x04)
|
||||
#define FUNC_MTDI 0
|
||||
#define FUNC_I2SI_DATA 1
|
||||
#define FUNC_HSPIQ_MISO 2
|
||||
#define FUNC_GPIO12 3
|
||||
#define FUNC_UART0_DTR 4
|
||||
|
||||
#define PERIPHS_IO_MUX_MTCK_U (PERIPHS_IO_MUX + 0x08)
|
||||
#define FUNC_MTCK 0
|
||||
#define FUNC_I2SI_BCK 1
|
||||
#define FUNC_HSPID_MOSI 2
|
||||
#define FUNC_GPIO13 3
|
||||
#define FUNC_UART0_CTS 4
|
||||
|
||||
#define PERIPHS_IO_MUX_MTMS_U (PERIPHS_IO_MUX + 0x0C)
|
||||
#define FUNC_MTMS 0
|
||||
#define FUNC_I2SI_WS 1
|
||||
#define FUNC_HSPI_CLK 2
|
||||
#define FUNC_GPIO14 3
|
||||
#define FUNC_UART0_DSR 4
|
||||
|
||||
#define PERIPHS_IO_MUX_MTDO_U (PERIPHS_IO_MUX + 0x10)
|
||||
#define FUNC_MTDO 0
|
||||
#define FUNC_I2SO_BCK 1
|
||||
#define FUNC_HSPI_CS0 2
|
||||
#define FUNC_GPIO15 3
|
||||
#define FUNC_U0RTS 4
|
||||
#define FUNC_UART0_RTS 4
|
||||
|
||||
#define PERIPHS_IO_MUX_U0RXD_U (PERIPHS_IO_MUX + 0x14)
|
||||
#define FUNC_U0RXD 0
|
||||
#define FUNC_I2SO_DATA 1
|
||||
#define FUNC_GPIO3 3
|
||||
#define FUNC_CLK_XTAL_BK 4
|
||||
|
||||
#define PERIPHS_IO_MUX_U0TXD_U (PERIPHS_IO_MUX + 0x18)
|
||||
#define FUNC_U0TXD 0
|
||||
#define FUNC_SPICS1 1
|
||||
#define FUNC_GPIO1 3
|
||||
#define FUNC_CLK_RTC_BK 4
|
||||
|
||||
#define PERIPHS_IO_MUX_SD_CLK_U (PERIPHS_IO_MUX + 0x1c)
|
||||
#define FUNC_SDCLK 0
|
||||
#define FUNC_SPICLK 1
|
||||
#define FUNC_GPIO6 3
|
||||
#define UART1_CTS 4
|
||||
|
||||
#define PERIPHS_IO_MUX_SD_DATA0_U (PERIPHS_IO_MUX + 0x20)
|
||||
#define FUNC_SDDATA0 0
|
||||
#define FUNC_SPIQ_MISO 1
|
||||
#define FUNC_SPIQ 1
|
||||
#define FUNC_GPIO7 3
|
||||
#define FUNC_U1TXD 4
|
||||
#define FUNC_UART1_TXD 4
|
||||
|
||||
#define PERIPHS_IO_MUX_SD_DATA1_U (PERIPHS_IO_MUX + 0x24)
|
||||
#define FUNC_SDDATA1 0
|
||||
#define FUNC_SPID_MOSI 1
|
||||
#define FUNC_SPID 1
|
||||
#define FUNC_GPIO8 3
|
||||
#define FUNC_U1RXD 4
|
||||
#define FUNC_UART1_RXD 4
|
||||
#define FUNC_SDDATA1_U1RXD 7
|
||||
|
||||
#define PERIPHS_IO_MUX_SD_DATA2_U (PERIPHS_IO_MUX + 0x28)
|
||||
#define FUNC_SDDATA2 0
|
||||
#define FUNC_SPIHD 1
|
||||
#define FUNC_GPIO9 3
|
||||
#define UFNC_HSPIHD 4
|
||||
|
||||
#define PERIPHS_IO_MUX_SD_DATA3_U (PERIPHS_IO_MUX + 0x2c)
|
||||
#define FUNC_SDDATA3 0
|
||||
#define FUNC_SPIWP 1
|
||||
#define FUNC_GPIO10 3
|
||||
#define FUNC_HSPIWP 4
|
||||
|
||||
#define PERIPHS_IO_MUX_SD_CMD_U (PERIPHS_IO_MUX + 0x30)
|
||||
#define FUNC_SDCMD 0
|
||||
#define FUNC_SPICS0 1
|
||||
#define FUNC_GPIO11 3
|
||||
#define U1RTS 4
|
||||
#define UART1_RTS 4
|
||||
|
||||
#define PERIPHS_IO_MUX_GPIO0_U (PERIPHS_IO_MUX + 0x34)
|
||||
#define FUNC_GPIO0 0
|
||||
#define FUNC_SPICS2 1
|
||||
#define FUNC_CLK_OUT 4
|
||||
|
||||
#define PERIPHS_IO_MUX_GPIO2_U (PERIPHS_IO_MUX + 0x38)
|
||||
#define FUNC_GPIO2 0
|
||||
#define FUNC_I2SO_WS 1
|
||||
#define FUNC_U1TXD_BK 2
|
||||
#define FUNC_UART1_TXD_BK 2
|
||||
#define FUNC_U0TXD_BK 4
|
||||
#define FUNC_UART0_TXD_BK 4
|
||||
|
||||
#define PERIPHS_IO_MUX_GPIO4_U (PERIPHS_IO_MUX + 0x3C)
|
||||
#define FUNC_GPIO4 0
|
||||
#define FUNC_CLK_XTAL 1
|
||||
|
||||
#define PERIPHS_IO_MUX_GPIO5_U (PERIPHS_IO_MUX + 0x40)
|
||||
#define FUNC_GPIO5 0
|
||||
#define FUNC_CLK_RTC 1
|
||||
|
||||
#define PIN_PULLUP_DIS(PIN_NAME) CLEAR_PERI_REG_MASK(PIN_NAME, PERIPHS_IO_MUX_PULLUP)
|
||||
#define PIN_PULLUP_EN(PIN_NAME) SET_PERI_REG_MASK(PIN_NAME, PERIPHS_IO_MUX_PULLUP)
|
||||
#define PIN_FUNC_SELECT(PIN_NAME, FUNC) do { \
|
||||
WRITE_PERI_REG(PIN_NAME, READ_PERI_REG(PIN_NAME) \
|
||||
& UL(~(PERIPHS_IO_MUX_FUNC << PERIPHS_IO_MUX_FUNC_S)) \
|
||||
| UL((((FUNC & BIT2) << 2) | (FUNC & 0x3)) << PERIPHS_IO_MUX_FUNC_S)); \
|
||||
} while (0)
|
||||
|
||||
//}}
|
||||
|
||||
#endif //_EAGLE_SOC_H_
|
||||
Executable
+2
@@ -0,0 +1,2 @@
|
||||
#undef ESP_SDK_VERSION
|
||||
#define ESP_SDK_VERSION 010502
|
||||
Executable
+918
@@ -0,0 +1,918 @@
|
||||
#ifndef __ESPCONN_H__
|
||||
#define __ESPCONN_H__
|
||||
|
||||
#include <c_types.h>
|
||||
#include <ip_addr.h>
|
||||
|
||||
typedef sint8 err_t;
|
||||
|
||||
typedef void *espconn_handle;
|
||||
|
||||
/**
|
||||
* @brief Connect callback.
|
||||
*
|
||||
* Callback which will be called if successful listening (ESP8266 as TCP server)
|
||||
* or connection (ESP8266 as TCP client) callback, register by espconn_regist_connectcb.
|
||||
*
|
||||
* @attention The pointer "void *arg" may be different in different callbacks, please don't
|
||||
* use this pointer directly to distinguish one from another in multiple connections,
|
||||
* use remote_ip and remote_port in espconn instead.
|
||||
*
|
||||
* @param void *arg : pointer corresponding structure espconn.
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
typedef void (* espconn_connect_callback)(void *arg);
|
||||
|
||||
/**
|
||||
* @brief Reconnect callback.
|
||||
*
|
||||
* Enter this callback when error occurred, TCP connection broke. This callback is
|
||||
* registered by espconn_regist_reconcb.
|
||||
*
|
||||
* @attention The pointer "void *arg" may be different in different callbacks, please don't
|
||||
* use this pointer directly to distinguish one from another in multiple connections,
|
||||
* use remote_ip and remote_port in espconn instead.
|
||||
*
|
||||
* @param void *arg : pointer corresponding structure espconn.
|
||||
* @param sint8 err : error code
|
||||
* - ESCONN_TIMEOUT - Timeout
|
||||
* - ESPCONN_ABRT - TCP connection aborted
|
||||
* - ESPCONN_RST - TCP connection abort
|
||||
* - ESPCONN_CLSD - TCP connection closed
|
||||
* - ESPCONN_CONN - TCP connection
|
||||
* - ESPCONN_HANDSHAKE - TCP SSL handshake fail
|
||||
* - ESPCONN_PROTO_MSG - SSL application invalid
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
typedef void (* espconn_reconnect_callback)(void *arg, sint8 err);
|
||||
|
||||
/* Definitions for error constants. */
|
||||
|
||||
#define ESPCONN_OK 0 /* No error, everything OK. */
|
||||
#define ESPCONN_MEM -1 /* Out of memory error. */
|
||||
#define ESPCONN_TIMEOUT -3 /* Timeout. */
|
||||
#define ESPCONN_RTE -4 /* Routing problem. */
|
||||
#define ESPCONN_INPROGRESS -5 /* Operation in progress */
|
||||
#define ESPCONN_MAXNUM -7 /* Total number exceeds the set maximum*/
|
||||
|
||||
#define ESPCONN_ABRT -8 /* Connection aborted. */
|
||||
#define ESPCONN_RST -9 /* Connection reset. */
|
||||
#define ESPCONN_CLSD -10 /* Connection closed. */
|
||||
#define ESPCONN_CONN -11 /* Not connected. */
|
||||
|
||||
#define ESPCONN_ARG -12 /* Illegal argument. */
|
||||
#define ESPCONN_IF -14 /* UDP send error */
|
||||
#define ESPCONN_ISCONN -15 /* Already connected. */
|
||||
|
||||
#define ESPCONN_HANDSHAKE -28 /* ssl handshake failed */
|
||||
#define ESPCONN_SSL_INVALID_DATA -61 /* ssl application invalid */
|
||||
|
||||
/** Protocol family and type of the espconn */
|
||||
enum espconn_type {
|
||||
ESPCONN_INVALID = 0, /**< invalid type */
|
||||
ESPCONN_TCP = 0x10, /**< TCP */
|
||||
ESPCONN_UDP = 0x20, /**< UDP */
|
||||
};
|
||||
|
||||
/** Current state of the espconn. */
|
||||
enum espconn_state {
|
||||
ESPCONN_NONE, /**< idle state, no connection */
|
||||
ESPCONN_WAIT, /**< ESP8266 is as TCP client, and waiting for connection */
|
||||
ESPCONN_LISTEN, /**< ESP8266 is as TCP server, and waiting for connection */
|
||||
ESPCONN_CONNECT, /**< connected */
|
||||
ESPCONN_WRITE, /**< sending data */
|
||||
ESPCONN_READ, /**< receiving data */
|
||||
ESPCONN_CLOSE /**< connection closed */
|
||||
};
|
||||
|
||||
typedef struct _esp_tcp {
|
||||
int remote_port; /**< remote port of TCP connection */
|
||||
int local_port; /**< ESP8266's local port of TCP connection */
|
||||
uint8 local_ip[4]; /**< local IP of ESP8266 */
|
||||
uint8 remote_ip[4]; /**< remote IP of TCP connection */
|
||||
espconn_connect_callback connect_callback; /**< connected callback */
|
||||
espconn_reconnect_callback reconnect_callback; /**< as error handler, the TCP connection broke unexpectedly */
|
||||
espconn_connect_callback disconnect_callback; /**< disconnected callback */
|
||||
espconn_connect_callback write_finish_fn; /**< data send by espconn_send has wrote into buffer waiting for sending, or has sent successfully */
|
||||
} esp_tcp;
|
||||
|
||||
typedef struct _esp_udp {
|
||||
int remote_port; /**< remote port of UDP transmission */
|
||||
int local_port; /**< ESP8266's local port for UDP transmission */
|
||||
uint8 local_ip[4]; /**< local IP of ESP8266 */
|
||||
uint8 remote_ip[4]; /**< remote IP of UDP transmission */
|
||||
} esp_udp;
|
||||
|
||||
typedef struct _remot_info {
|
||||
enum espconn_state state; /**< state of espconn */
|
||||
int remote_port; /**< remote port */
|
||||
uint8 remote_ip[4]; /**< remote IP address */
|
||||
} remot_info;
|
||||
|
||||
/** A callback prototype to inform about events for a espconn */
|
||||
typedef void (* espconn_recv_callback)(void *arg, char *pdata, unsigned short len);
|
||||
typedef void (* espconn_sent_callback)(void *arg);
|
||||
|
||||
/** A espconn descriptor */
|
||||
struct espconn {
|
||||
enum espconn_type type; /**< type of the espconn (TCP or UDP) */
|
||||
enum espconn_state state; /**< current state of the espconn */
|
||||
union {
|
||||
esp_tcp *tcp;
|
||||
esp_udp *udp;
|
||||
} proto;
|
||||
espconn_recv_callback recv_callback; /**< data received callback */
|
||||
espconn_sent_callback sent_callback; /**< data sent callback */
|
||||
uint8 link_cnt; /**< link count */
|
||||
void *reserve; /**< reserved for user data */
|
||||
};
|
||||
|
||||
enum espconn_option {
|
||||
ESPCONN_START = 0x00, /**< no option, start enum. */
|
||||
ESPCONN_REUSEADDR = 0x01, /**< free memory after TCP disconnection happen, need not wait 2 minutes. */
|
||||
ESPCONN_NODELAY = 0x02, /**< disable nagle algorithm during TCP data transmission, quicken the data transmission. */
|
||||
ESPCONN_COPY = 0x04, /**< enable espconn_regist_write_finish, enter write_finish_callback means that the data espconn_send sending was written into 2920 bytes write-buffer waiting for sending or already sent. */
|
||||
ESPCONN_KEEPALIVE = 0x08, /**< enable TCP keep alive. */
|
||||
ESPCONN_END /**< no option, end enum. */
|
||||
};
|
||||
|
||||
enum espconn_level {
|
||||
ESPCONN_KEEPIDLE, /**< TCP keep-alive interval, unit : second. */
|
||||
ESPCONN_KEEPINTVL, /**< packet interval during TCP keep-alive, unit : second. */
|
||||
ESPCONN_KEEPCNT /**< maximum packet retry count of TCP keep-alive. */
|
||||
};
|
||||
|
||||
enum {
|
||||
ESPCONN_IDLE = 0,
|
||||
ESPCONN_CLIENT,
|
||||
ESPCONN_SERVER,
|
||||
ESPCONN_BOTH,
|
||||
ESPCONN_MAX
|
||||
};
|
||||
|
||||
struct espconn_packet {
|
||||
uint16 sent_length; /* sent length successful*/
|
||||
uint16 snd_buf_size; /* Available buffer size for sending */
|
||||
uint16 snd_queuelen; /* Available buffer space for sending */
|
||||
uint16 total_queuelen; /* total Available buffer space for sending */
|
||||
uint32 packseqno; /* seqno to be sent */
|
||||
uint32 packseq_nxt; /* seqno expected */
|
||||
uint32 packnum;
|
||||
};
|
||||
|
||||
struct mdns_info {
|
||||
char *host_name;
|
||||
char *server_name;
|
||||
uint16 server_port;
|
||||
unsigned long ipAddr;
|
||||
char *txt_data[10];
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Connect to a TCP server (ESP8266 acting as TCP client).
|
||||
*
|
||||
* @attention If espconn_connect fail, returns non-0 value, there is no connection, so it
|
||||
* won't enter any espconn callback.
|
||||
*
|
||||
* @param struct espconn *espconn : the network connection structure, the espconn to
|
||||
* listen to the connection
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_RTE - Routing Problem
|
||||
* - ESPCONN_MEM - Out of memory
|
||||
* - ESPCONN_ISCONN - Already connected
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection
|
||||
* according to structure espconn
|
||||
*/
|
||||
sint8 espconn_connect(struct espconn *espconn);
|
||||
|
||||
/**
|
||||
* @brief Disconnect a TCP connection.
|
||||
*
|
||||
* @attention Don't call this API in any espconn callback. If needed, please use system
|
||||
* task to trigger espconn_disconnect.
|
||||
*
|
||||
* @param struct espconn *espconn : the network connection structure
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection
|
||||
* according to structure espconn
|
||||
*/
|
||||
sint8 espconn_disconnect(struct espconn *espconn);
|
||||
|
||||
/**
|
||||
* @brief Delete a transmission.
|
||||
*
|
||||
* @attention Corresponding creation API :
|
||||
* - TCP: espconn_accept,
|
||||
* - UDP: espconn_create
|
||||
*
|
||||
* @param struct espconn *espconn : the network connection structure
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding network according
|
||||
* to structure espconn
|
||||
*/
|
||||
sint8 espconn_delete(struct espconn *espconn);
|
||||
|
||||
/**
|
||||
* @brief Creates a TCP server (i.e. accepts connections).
|
||||
*
|
||||
* @param struct espconn *espconn : the network connection structure
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_MEM - Out of memory
|
||||
* - ESPCONN_ISCONN - Already connected
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection
|
||||
* according to structure espconn
|
||||
*/
|
||||
sint8 espconn_accept(struct espconn *espconn);
|
||||
|
||||
/**
|
||||
* @brief Create UDP transmission.
|
||||
*
|
||||
* @attention Parameter remote_ip and remote_port need to be set, do not set to be 0.
|
||||
*
|
||||
* @param struct espconn *espconn : the UDP control block structure
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_MEM - Out of memory
|
||||
* - ESPCONN_ISCONN - Already connected
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding UDP transmission
|
||||
* according to structure espconn
|
||||
*/
|
||||
sint8 espconn_create(struct espconn *espconn);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get maximum number of how many TCP connections are allowed.
|
||||
*
|
||||
* @param null
|
||||
*
|
||||
* @return Maximum number of how many TCP connections are allowed.
|
||||
*/
|
||||
uint8 espconn_tcp_get_max_con(void);
|
||||
|
||||
/**
|
||||
* @brief Set the maximum number of how many TCP connection is allowed.
|
||||
*
|
||||
* @param uint8 num : Maximum number of how many TCP connection is allowed.
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection
|
||||
* according to structure espconn
|
||||
*/
|
||||
sint8 espconn_tcp_set_max_con(uint8 num);
|
||||
|
||||
/**
|
||||
* @brief Get the maximum number of TCP clients which are allowed to connect to ESP8266 TCP server.
|
||||
*
|
||||
* @param struct espconn *espconn : the TCP server structure
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according
|
||||
* to structure espconn
|
||||
*/
|
||||
sint8 espconn_tcp_get_max_con_allow(struct espconn *espconn);
|
||||
|
||||
/**
|
||||
* @brief Set the maximum number of TCP clients allowed to connect to ESP8266 TCP server.
|
||||
*
|
||||
* @param struct espconn *espconn : the TCP server structure
|
||||
* @param uint8 num : Maximum number of TCP clients which are allowed
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according
|
||||
* to structure espconn
|
||||
*/
|
||||
sint8 espconn_tcp_set_max_con_allow(struct espconn *espconn, uint8 num);
|
||||
|
||||
/**
|
||||
* @brief Register timeout interval of ESP8266 TCP server.
|
||||
*
|
||||
* @attention 1. If timeout is set to 0, timeout will be disable and ESP8266 TCP server will
|
||||
* not disconnect TCP clients has stopped communication. This usage of timeout=0,
|
||||
* is deprecated.
|
||||
* @attention 2. This timeout interval is not very precise, only as reference.
|
||||
*
|
||||
* @param struct espconn *espconn : the TCP connection structure
|
||||
* @param uint32 interval : timeout interval, unit: second, maximum: 7200 seconds
|
||||
* @param uint8 type_flag : 0, set for all connections; 1, set for a specific connection
|
||||
* - If the type_flag set to be 0, please call this API after espconn_accept, before listened
|
||||
* a TCP connection.
|
||||
* - If the type_flag set to be 1, the first parameter *espconn is the specific connection.
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according
|
||||
* to structure espconn
|
||||
*/
|
||||
sint8 espconn_regist_time(struct espconn *espconn, uint32 interval, uint8 type_flag);
|
||||
|
||||
/**
|
||||
* @brief Get the information about a TCP connection or UDP transmission.
|
||||
*
|
||||
* @param struct espconn *espconn : the network connection structure
|
||||
* @param remot_info **pcon_info : connect to client info
|
||||
* @param uint8 typeflags : 0, regular server; 1, ssl server
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding transmission according to
|
||||
* structure espconn
|
||||
*/
|
||||
sint8 espconn_get_connection_info(struct espconn *pespconn, remot_info **pcon_info, uint8 typeflags);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_get_packet_info
|
||||
* Description : get the packet info with host
|
||||
* Parameters : espconn -- the espconn used to disconnect the connection
|
||||
* infoarg -- the packet info
|
||||
* Returns : the errur code
|
||||
*******************************************************************************/
|
||||
|
||||
sint8 espconn_get_packet_info(struct espconn *espconn, struct espconn_packet* infoarg);
|
||||
|
||||
/**
|
||||
* @brief Register data sent callback which will be called back when data are successfully sent.
|
||||
*
|
||||
* @param struct espconn *espconn : the network connection structure
|
||||
* @param espconn_sent_callback sent_cb : registered callback function which will be called if
|
||||
* the data is successfully sent
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding transmission according
|
||||
* to structure espconn
|
||||
*/
|
||||
sint8 espconn_regist_sentcb(struct espconn *espconn, espconn_sent_callback sent_cb);
|
||||
|
||||
/**
|
||||
* @brief Register a callback which will be called when all sending TCP data is completely
|
||||
* write into write-buffer or sent.
|
||||
*
|
||||
* Need to call espconn_set_opt to enable write-buffer first.
|
||||
*
|
||||
* @attention 1. write-buffer is used to keep TCP data that waiting to be sent, queue number
|
||||
* of the write-buffer is 8 which means that it can keep 8 packets at most.
|
||||
* The size of write-buffer is 2920 bytes.
|
||||
* @attention 2. Users can enable it by using espconn_set_opt.
|
||||
* @attention 3. Users can call espconn_send to send the next packet in write_finish_callback
|
||||
* instead of using espconn_sent_callback.
|
||||
*
|
||||
* @param struct espconn *espconn : the network connection structure
|
||||
* @param espconn_connect_callback write_finish_fn : registered callback function which will
|
||||
* be called if the data is completely write
|
||||
* into write buffer or sent.
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according
|
||||
* to structure espconn
|
||||
*/
|
||||
sint8 espconn_regist_write_finish(struct espconn *espconn, espconn_connect_callback write_finish_fn);
|
||||
|
||||
/**
|
||||
* @brief Send data through network.
|
||||
*
|
||||
* @attention 1. Please call espconn_send after espconn_sent_callback of the pre-packet.
|
||||
* @attention 2. If it is a UDP transmission, it is suggested to set espconn->proto.udp->remote_ip
|
||||
* and remote_port before every calling of espconn_send.
|
||||
*
|
||||
* @param struct espconn *espconn : the network connection structure
|
||||
* @param uint8 *psent : pointer of data
|
||||
* @param uint16 length : data length
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_MEM - Out of memory
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding network transmission
|
||||
* according to structure espconn
|
||||
* - ESPCONN_MAXNUM - buffer of sending data is full
|
||||
* - ESPCONN_IF - send UDP data fail
|
||||
*/
|
||||
sint8 espconn_send(struct espconn *espconn, uint8 *psent, uint16 length);
|
||||
|
||||
/**
|
||||
* @brief Send data through network.
|
||||
*
|
||||
* This API is deprecated, please use espconn_send instead.
|
||||
*
|
||||
* @attention 1. Please call espconn_sent after espconn_sent_callback of the pre-packet.
|
||||
* @attention 2. If it is a UDP transmission, it is suggested to set espconn->proto.udp->remote_ip
|
||||
* and remote_port before every calling of espconn_sent.
|
||||
*
|
||||
* @param struct espconn *espconn : the network connection structure
|
||||
* @param uint8 *psent : pointer of data
|
||||
* @param uint16 length : data length
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_MEM - Out of memory
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding network transmission
|
||||
* according to structure espconn
|
||||
* - ESPCONN_MAXNUM - buffer of sending data is full
|
||||
* - ESPCONN_IF - send UDP data fail
|
||||
*/
|
||||
sint8 espconn_sent(struct espconn *espconn, uint8 *psent, uint16 length);
|
||||
|
||||
/**
|
||||
* @brief Send UDP data.
|
||||
*
|
||||
* @param struct espconn *espconn : the UDP structure
|
||||
* @param uint8 *psent : pointer of data
|
||||
* @param uint16 length : data length
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_MEM - Out of memory
|
||||
* - ESPCONN_MAXNUM - buffer of sending data is full
|
||||
* - ESPCONN_IF - send UDP data fail
|
||||
*/
|
||||
sint16 espconn_sendto(struct espconn *espconn, uint8 *psent, uint16 length);
|
||||
|
||||
/**
|
||||
* @brief Register connection function which will be called back under successful TCP connection.
|
||||
*
|
||||
* @param struct espconn *espconn : the TCP connection structure
|
||||
* @param espconn_connect_callback connect_cb : registered callback function
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according
|
||||
* to structure espconn
|
||||
*/
|
||||
sint8 espconn_regist_connectcb(struct espconn *espconn, espconn_connect_callback connect_cb);
|
||||
|
||||
/**
|
||||
* @brief register data receive function which will be called back when data are received.
|
||||
*
|
||||
* @param struct espconn *espconn : the network transmission structure
|
||||
* @param espconn_recv_callback recv_cb : registered callback function
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according
|
||||
* to structure espconn
|
||||
*/
|
||||
sint8 espconn_regist_recvcb(struct espconn *espconn, espconn_recv_callback recv_cb);
|
||||
|
||||
/**
|
||||
* @brief Register reconnect callback.
|
||||
*
|
||||
* @attention espconn_reconnect_callback is more like a network-broken error handler; it handles
|
||||
* errors that occurs in any phase of the connection.
|
||||
* For instance, if espconn_send fails, espconn_reconnect_callback will be called
|
||||
* because the network is broken.
|
||||
*
|
||||
* @param struct espconn *espconn : the TCP connection structure
|
||||
* @param espconn_reconnect_callback recon_cb : registered callback function
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according
|
||||
* to structure espconn
|
||||
*/
|
||||
sint8 espconn_regist_reconcb(struct espconn *espconn, espconn_reconnect_callback recon_cb);
|
||||
|
||||
/**
|
||||
* @brief Register disconnection function which will be called back under successful TCP
|
||||
* disconnection.
|
||||
*
|
||||
* @param struct espconn *espconn : the TCP connection structure
|
||||
* @param espconn_connect_callback discon_cb : registered callback function
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according
|
||||
* to structure espconn
|
||||
*/
|
||||
sint8 espconn_regist_disconcb(struct espconn *espconn, espconn_connect_callback discon_cb);
|
||||
|
||||
/**
|
||||
* @brief Get an available port for network.
|
||||
*
|
||||
* @param null
|
||||
*
|
||||
* @return Port number.
|
||||
*/
|
||||
uint32 espconn_port(void);
|
||||
|
||||
/**
|
||||
* @brief Set option of TCP connection.
|
||||
*
|
||||
* @attention In general, we need not call this API. If call espconn_set_opt, please call
|
||||
* it in espconn_connect_callback.
|
||||
*
|
||||
* @param struct espconn *espconn : the TCP connection structure
|
||||
* @param uint8 opt : option of TCP connection, refer to enum espconn_option
|
||||
* - bit 0: 1: free memory after TCP disconnection happen need not wait 2 minutes;
|
||||
* - bit 1: 1: disable nagle algorithm during TCP data transmission, quiken the data transmission.
|
||||
* - bit 2: 1: enable espconn_regist_write_finish, enter write finish callback means
|
||||
* the data espconn_send sending was written into 2920 bytes write-buffer
|
||||
* waiting for sending or already sent.
|
||||
* - bit 3: 1: enable TCP keep alive
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according
|
||||
* to structure espconn
|
||||
*/
|
||||
sint8 espconn_set_opt(struct espconn *espconn, uint8 opt);
|
||||
|
||||
/**
|
||||
* @brief Clear option of TCP connection.
|
||||
*
|
||||
* @param struct espconn *espconn : the TCP connection structure
|
||||
* @param uint8 opt : enum espconn_option
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according
|
||||
* to structure espconn
|
||||
*/
|
||||
sint8 espconn_clear_opt(struct espconn *espconn, uint8 opt);
|
||||
|
||||
/**
|
||||
* @brief Set configuration of TCP keep alive.
|
||||
*
|
||||
* @attention In general, we need not call this API. If needed, please call it in
|
||||
* espconn_connect_callback and call espconn_set_opt to enable keep alive first.
|
||||
*
|
||||
* @param struct espconn *espconn : the TCP connection structure
|
||||
* @param uint8 level : To do TCP keep-alive detection every ESPCONN_KEEPIDLE. If there
|
||||
* is no response, retry ESPCONN_KEEPCNT times every ESPCONN_KEEPINTVL.
|
||||
* If still no response, considers it as TCP connection broke, goes
|
||||
* into espconn_reconnect_callback. Notice, keep alive interval is not
|
||||
* precise, only for reference, it depends on priority.
|
||||
* @param void* optarg : value of parameter
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according
|
||||
* to structure espconn
|
||||
*/
|
||||
sint8 espconn_set_keepalive(struct espconn *espconn, uint8 level, void *optarg);
|
||||
|
||||
/**
|
||||
* @brief Get configuration of TCP keep alive.
|
||||
*
|
||||
* @param struct espconn *espconn : the TCP connection structure
|
||||
* @param uint8 level : enum espconn_level
|
||||
* @param void* optarg : value of parameter
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection according
|
||||
* to structure espconn
|
||||
*/
|
||||
sint8 espconn_get_keepalive(struct espconn *espconn, uint8 level, void *optarg);
|
||||
|
||||
/**
|
||||
* @brief Callback which is invoked when a hostname is found.
|
||||
*
|
||||
* @param const char *name : hostname
|
||||
* @param ip_addr_t *ipaddr : IP address of the hostname, or to be NULL if the name could
|
||||
* not be found (or on any other error).
|
||||
* @param void *callback_arg : callback argument.
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
typedef void (*dns_found_callback)(const char *name, ip_addr_t *ipaddr, void *callback_arg);
|
||||
|
||||
/**
|
||||
* @brief DNS function.
|
||||
*
|
||||
* Parse a hostname (string) to an IP address.
|
||||
*
|
||||
* @param struct espconn *pespconn : espconn to parse a hostname.
|
||||
* @param const char *hostname : the hostname.
|
||||
* @param ip_addr_t *addr : IP address.
|
||||
* @param dns_found_callback found : callback of DNS
|
||||
*
|
||||
* @return err_t :
|
||||
* - ESPCONN_OK - succeed
|
||||
* - ESPCONN_INPROGRESS - error code : already connected
|
||||
* - ESPCONN_ARG - error code : illegal argument, can't find network transmission
|
||||
* according to structure espconn
|
||||
*/
|
||||
err_t espconn_gethostbyname(struct espconn *pespconn, const char *hostname, ip_addr_t *addr, dns_found_callback found);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_abort
|
||||
* Description : Forcely abort with host
|
||||
* Parameters : espconn -- the espconn used to connect with the host
|
||||
* Returns : result
|
||||
*******************************************************************************/
|
||||
|
||||
sint8 espconn_abort(struct espconn *espconn);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_encry_connect
|
||||
* Description : The function given as connection
|
||||
* Parameters : espconn -- the espconn used to connect with the host
|
||||
* Returns : none
|
||||
*******************************************************************************/
|
||||
|
||||
sint8 espconn_secure_connect(struct espconn *espconn);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_encry_disconnect
|
||||
* Description : The function given as the disconnection
|
||||
* Parameters : espconn -- the espconn used to disconnect with the host
|
||||
* Returns : none
|
||||
*******************************************************************************/
|
||||
|
||||
sint8 espconn_secure_disconnect(struct espconn *espconn);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_secure_send
|
||||
* Description : sent data for client or server
|
||||
* Parameters : espconn -- espconn to set for client or server
|
||||
* psent -- data to send
|
||||
* length -- length of data to send
|
||||
* Returns : none
|
||||
*******************************************************************************/
|
||||
|
||||
sint8 espconn_secure_send(struct espconn *espconn, uint8 *psent, uint16 length);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_encry_sent
|
||||
* Description : sent data for client or server
|
||||
* Parameters : espconn -- espconn to set for client or server
|
||||
* psent -- data to send
|
||||
* length -- length of data to send
|
||||
* Returns : none
|
||||
*******************************************************************************/
|
||||
|
||||
sint8 espconn_secure_sent(struct espconn *espconn, uint8 *psent, uint16 length);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_secure_set_size
|
||||
* Description : set the buffer size for client or server
|
||||
* Parameters : level -- set for client or server
|
||||
* 1: client,2:server,3:client and server
|
||||
* size -- buffer size
|
||||
* Returns : true or false
|
||||
*******************************************************************************/
|
||||
|
||||
bool espconn_secure_set_size(uint8 level, uint16 size);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_secure_get_size
|
||||
* Description : get buffer size for client or server
|
||||
* Parameters : level -- set for client or server
|
||||
* 1: client,2:server,3:client and server
|
||||
* Returns : buffer size for client or server
|
||||
*******************************************************************************/
|
||||
|
||||
sint16 espconn_secure_get_size(uint8 level);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_secure_ca_enable
|
||||
* Description : enable the certificate authenticate and set the flash sector
|
||||
* as client or server
|
||||
* Parameters : level -- set for client or server
|
||||
* 1: client,2:server,3:client and server
|
||||
* flash_sector -- flash sector for save certificate
|
||||
* Returns : result true or false
|
||||
*******************************************************************************/
|
||||
|
||||
bool espconn_secure_ca_enable(uint8 level, uint8 flash_sector);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_secure_ca_disable
|
||||
* Description : disable the certificate authenticate as client or server
|
||||
* Parameters : level -- set for client or server
|
||||
* 1: client,2:server,3:client and server
|
||||
* Returns : result true or false
|
||||
*******************************************************************************/
|
||||
|
||||
bool espconn_secure_ca_disable(uint8 level);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_secure_cert_req_enable
|
||||
* Description : enable the client certificate authenticate and set the flash sector
|
||||
* as client or server
|
||||
* Parameters : level -- set for client or server
|
||||
* 1: client,2:server,3:client and server
|
||||
* flash_sector -- flash sector for save certificate
|
||||
* Returns : result true or false
|
||||
*******************************************************************************/
|
||||
|
||||
bool espconn_secure_cert_req_enable(uint8 level, uint8 flash_sector);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_secure_ca_disable
|
||||
* Description : disable the client certificate authenticate as client or server
|
||||
* Parameters : level -- set for client or server
|
||||
* 1: client,2:server,3:client and server
|
||||
* Returns : result true or false
|
||||
*******************************************************************************/
|
||||
|
||||
bool espconn_secure_cert_req_disable(uint8 level);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_secure_set_default_certificate
|
||||
* Description : Load the certificates in memory depending on compile-time
|
||||
* and user options.
|
||||
* Parameters : certificate -- Load the certificate
|
||||
* length -- Load the certificate length
|
||||
* Returns : result true or false
|
||||
*******************************************************************************/
|
||||
|
||||
bool espconn_secure_set_default_certificate(const uint8* certificate, uint16 length);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_secure_set_default_private_key
|
||||
* Description : Load the key in memory depending on compile-time
|
||||
* and user options.
|
||||
* Parameters : private_key -- Load the key
|
||||
* length -- Load the key length
|
||||
* Returns : result true or false
|
||||
*******************************************************************************/
|
||||
|
||||
bool espconn_secure_set_default_private_key(const uint8* private_key, uint16 length);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_secure_accept
|
||||
* Description : The function given as the listen
|
||||
* Parameters : espconn -- the espconn used to listen the connection
|
||||
* Returns : result
|
||||
*******************************************************************************/
|
||||
|
||||
sint8 espconn_secure_accept(struct espconn *espconn);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_secure_accepts
|
||||
* Description : delete the secure server host
|
||||
* Parameters : espconn -- the espconn used to listen the connection
|
||||
* Returns : result
|
||||
*******************************************************************************/
|
||||
|
||||
sint8 espconn_secure_delete(struct espconn *espconn);
|
||||
|
||||
/**
|
||||
* @brief Join a multicast group.
|
||||
*
|
||||
* @attention This API can only be called after the ESP8266 station connects to a router.
|
||||
*
|
||||
* @param ip_addr_t *host_ip : IP of UDP host
|
||||
* @param ip_addr_t *multicast_ip : IP of multicast group
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_MEM - Out of memory
|
||||
*/
|
||||
sint8 espconn_igmp_join(ip_addr_t *host_ip, ip_addr_t *multicast_ip);
|
||||
|
||||
/**
|
||||
* @brief Leave a multicast group.
|
||||
*
|
||||
* @attention This API can only be called after the ESP8266 station connects to a router.
|
||||
*
|
||||
* @param ip_addr_t *host_ip : IP of UDP host
|
||||
* @param ip_addr_t *multicast_ip : IP of multicast group
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_MEM - Out of memory
|
||||
*/
|
||||
sint8 espconn_igmp_leave(ip_addr_t *host_ip, ip_addr_t *multicast_ip);
|
||||
|
||||
/**
|
||||
* @brief Puts in a request to block the TCP receive function.
|
||||
*
|
||||
* @attention The function does not act immediately; we recommend calling it while
|
||||
* reserving 5*1460 bytes of memory. This API can be called more than once.
|
||||
*
|
||||
* @param struct espconn *espconn : corresponding TCP connection structure
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection
|
||||
* according to structure espconn.
|
||||
*/
|
||||
sint8 espconn_recv_hold(struct espconn *pespconn);
|
||||
|
||||
/**
|
||||
* @brief Unblock TCP receiving data (i.e. undo espconn_recv_hold).
|
||||
*
|
||||
* @attention This API takes effect immediately.
|
||||
*
|
||||
* @param struct espconn *espconn : corresponding TCP connection structure
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection
|
||||
* according to structure espconn.
|
||||
*/
|
||||
sint8 espconn_recv_unhold(struct espconn *pespconn);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_mdns_init
|
||||
* Description : register a device with mdns
|
||||
* Parameters : ipAddr -- the ip address of device
|
||||
* hostname -- the hostname of device
|
||||
* Returns : none
|
||||
*******************************************************************************/
|
||||
void espconn_mdns_init(struct mdns_info *info);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_mdns_close
|
||||
* Description : close a device with mdns
|
||||
* Parameters : a
|
||||
* Returns : none
|
||||
*******************************************************************************/
|
||||
void espconn_mdns_close(void);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_mdns_server_register
|
||||
* Description : register a device with mdns
|
||||
* Parameters : a
|
||||
* Returns : none
|
||||
*******************************************************************************/
|
||||
void espconn_mdns_server_register(void);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_mdns_server_unregister
|
||||
* Description : unregister a device with mdns
|
||||
* Parameters : a
|
||||
* Returns : none
|
||||
*******************************************************************************/
|
||||
void espconn_mdns_server_unregister(void);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_mdns_get_servername
|
||||
* Description : get server name of device with mdns
|
||||
* Parameters : a
|
||||
* Returns : none
|
||||
******************************************************************************/
|
||||
char* espconn_mdns_get_servername(void);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_mdns_set_servername
|
||||
* Description : set server name of device with mdns
|
||||
* Parameters : a
|
||||
* Returns : none
|
||||
*******************************************************************************/
|
||||
void espconn_mdns_set_servername(const char *name);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_mdns_set_hostname
|
||||
* Description : set host name of device with mdns
|
||||
* Parameters : a
|
||||
* Returns : none
|
||||
*******************************************************************************/
|
||||
void espconn_mdns_set_hostname(char *name);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_mdns_get_hostname
|
||||
* Description : get host name of device with mdns
|
||||
* Parameters : a
|
||||
* Returns : none
|
||||
*******************************************************************************/
|
||||
char* espconn_mdns_get_hostname(void);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_mdns_disable
|
||||
* Description : disable a device with mdns
|
||||
* Parameters : a
|
||||
* Returns : none
|
||||
*******************************************************************************/
|
||||
void espconn_mdns_disable(void);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : espconn_mdns_enable
|
||||
* Description : disable a device with mdns
|
||||
* Parameters : a
|
||||
* Returns : none
|
||||
*******************************************************************************/
|
||||
void espconn_mdns_enable(void);
|
||||
|
||||
/**
|
||||
* @brief Set default DNS server. Two DNS server is allowed to be set.
|
||||
*
|
||||
* @attention Only if ESP8266 DHCP client is disabled (wifi_station_dhcpc_stop),
|
||||
* this API can be used.
|
||||
*
|
||||
* @param char numdns : DNS server ID, 0 or 1
|
||||
* @param ip_addr_t *dnsserver : DNS server IP
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
void espconn_dns_setserver(char numdns, ip_addr_t *dnsserver);
|
||||
|
||||
#endif
|
||||
|
||||
Executable
+55
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (C) 2015 -2018 Espressif System
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __ESPNOW_H__
|
||||
#define __ESPNOW_H__
|
||||
|
||||
#include <c_types.h>
|
||||
|
||||
enum esp_now_role {
|
||||
ESP_NOW_ROLE_IDLE = 0,
|
||||
ESP_NOW_ROLE_CONTROLLER,
|
||||
ESP_NOW_ROLE_SLAVE,
|
||||
ESP_NOW_ROLE_MAX,
|
||||
};
|
||||
|
||||
typedef void (*esp_now_recv_cb_t)(u8 *mac_addr, u8 *data, u8 len);
|
||||
typedef void (*esp_now_send_cb_t)(u8 *mac_addr, u8 status);
|
||||
|
||||
int esp_now_init(void);
|
||||
int esp_now_deinit(void);
|
||||
|
||||
int esp_now_register_send_cb(esp_now_send_cb_t cb);
|
||||
int esp_now_unregister_send_cb(void);
|
||||
|
||||
int esp_now_register_recv_cb(esp_now_recv_cb_t cb);
|
||||
int esp_now_unregister_recv_cb(void);
|
||||
|
||||
int esp_now_send(u8 *da, u8 *data, int len);
|
||||
|
||||
int esp_now_add_peer(u8 *mac_addr, u8 role, u8 channel, u8 *key, u8 key_len);
|
||||
int esp_now_del_peer(u8 *mac_addr);
|
||||
|
||||
int esp_now_set_self_role(u8 role);
|
||||
int esp_now_get_self_role(void);
|
||||
|
||||
int esp_now_set_peer_role(u8 *mac_addr, u8 role);
|
||||
int esp_now_get_peer_role(u8 *mac_addr);
|
||||
|
||||
int esp_now_set_peer_channel(u8 *mac_addr, u8 channel);
|
||||
int esp_now_get_peer_channel(u8 *mac_addr);
|
||||
|
||||
int esp_now_set_peer_key(u8 *mac_addr, u8 *key, u8 key_len);
|
||||
int esp_now_get_peer_key(u8 *mac_addr, u8 *key, u8 *key_len);
|
||||
|
||||
u8 *esp_now_fetch_peer(bool restart);
|
||||
|
||||
int esp_now_is_peer_exist(u8 *mac_addr);
|
||||
|
||||
int esp_now_get_cnt_info(u8 *all_cnt, u8 *encrypt_cnt);
|
||||
|
||||
int esp_now_set_kok(u8 *key, u8 len);
|
||||
|
||||
#endif
|
||||
Executable
+105
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* copyright (c) 2008 - 2011 Espressif System
|
||||
*
|
||||
* Define user specified Event signals and Task priorities here
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _ETS_SYS_H
|
||||
#define _ETS_SYS_H
|
||||
|
||||
#include "c_types.h"
|
||||
#include "eagle_soc.h"
|
||||
|
||||
typedef uint32_t ETSSignal;
|
||||
typedef uint32_t ETSParam;
|
||||
|
||||
typedef struct ETSEventTag ETSEvent;
|
||||
|
||||
struct ETSEventTag {
|
||||
ETSSignal sig;
|
||||
ETSParam par;
|
||||
};
|
||||
|
||||
typedef void (*ETSTask)(ETSEvent *e);
|
||||
|
||||
/* timer related */
|
||||
typedef uint32_t ETSHandle;
|
||||
typedef void ETSTimerFunc(void *timer_arg);
|
||||
|
||||
typedef struct _ETSTIMER_ {
|
||||
struct _ETSTIMER_ *timer_next;
|
||||
uint32_t timer_expire;
|
||||
uint32_t timer_period;
|
||||
ETSTimerFunc *timer_func;
|
||||
void *timer_arg;
|
||||
} ETSTimer;
|
||||
|
||||
/* interrupt related */
|
||||
#define ETS_SDIO_INUM 1
|
||||
#define ETS_SPI_INUM 2
|
||||
#define ETS_GPIO_INUM 4
|
||||
#define ETS_UART_INUM 5
|
||||
#define ETS_UART1_INUM 5
|
||||
#define ETS_FRC_TIMER1_INUM 9 /* use edge*/
|
||||
|
||||
#define ETS_INTR_LOCK() \
|
||||
ets_intr_lock()
|
||||
|
||||
#define ETS_INTR_UNLOCK() \
|
||||
ets_intr_unlock()
|
||||
|
||||
#define ETS_FRC_TIMER1_INTR_ATTACH(func, arg) \
|
||||
ets_isr_attach(ETS_FRC_TIMER1_INUM, (func), (void *)(arg))
|
||||
|
||||
#define ETS_FRC_TIMER1_NMI_INTR_ATTACH(func) \
|
||||
NmiTimSetFunc(func)
|
||||
|
||||
#define ETS_SDIO_INTR_ATTACH(func, arg)\
|
||||
ets_isr_attach(ETS_SDIO_INUM, (func), (void *)(arg))
|
||||
|
||||
#define ETS_GPIO_INTR_ATTACH(func, arg) \
|
||||
ets_isr_attach(ETS_GPIO_INUM, (func), (void *)(arg))
|
||||
|
||||
#define ETS_UART_INTR_ATTACH(func, arg) \
|
||||
ets_isr_attach(ETS_UART_INUM, (func), (void *)(arg))
|
||||
|
||||
#define ETS_SPI_INTR_ATTACH(func, arg) \
|
||||
ets_isr_attach(ETS_SPI_INUM, (func), (void *)(arg))
|
||||
|
||||
#define ETS_INTR_ENABLE(inum) \
|
||||
ets_isr_unmask((1<<inum))
|
||||
|
||||
#define ETS_INTR_DISABLE(inum) \
|
||||
ets_isr_mask((1<<inum))
|
||||
|
||||
#define ETS_UART_INTR_ENABLE() \
|
||||
ETS_INTR_ENABLE(ETS_UART_INUM)
|
||||
|
||||
#define ETS_UART_INTR_DISABLE() \
|
||||
ETS_INTR_DISABLE(ETS_UART_INUM)
|
||||
|
||||
#define ETS_FRC1_INTR_ENABLE() \
|
||||
ETS_INTR_ENABLE(ETS_FRC_TIMER1_INUM)
|
||||
|
||||
#define ETS_FRC1_INTR_DISABLE() \
|
||||
ETS_INTR_DISABLE(ETS_FRC_TIMER1_INUM)
|
||||
|
||||
#define ETS_GPIO_INTR_ENABLE() \
|
||||
ETS_INTR_ENABLE(ETS_GPIO_INUM)
|
||||
|
||||
#define ETS_GPIO_INTR_DISABLE() \
|
||||
ETS_INTR_DISABLE(ETS_GPIO_INUM)
|
||||
|
||||
#define ETS_SPI_INTR_ENABLE() \
|
||||
ETS_INTR_ENABLE(ETS_SPI_INUM)
|
||||
|
||||
#define ETS_SPI_INTR_DISABLE() \
|
||||
ETS_INTR_DISABLE(ETS_SPI_INUM)
|
||||
|
||||
#define ETS_SDIO_INTR_ENABLE() \
|
||||
ETS_INTR_ENABLE(ETS_SDIO_INUM)
|
||||
|
||||
#define ETS_SDIO_INTR_DISABLE() \
|
||||
ETS_INTR_DISABLE(ETS_SDIO_INUM)
|
||||
#endif /* _ETS_SYS_H */
|
||||
Executable
+100
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* copyright (c) Espressif System 2010
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _GPIO_H_
|
||||
#define _GPIO_H_
|
||||
|
||||
#define GPIO_PIN_ADDR(i) (GPIO_PIN0_ADDRESS + i*4)
|
||||
|
||||
#define GPIO_ID_IS_PIN_REGISTER(reg_id) \
|
||||
((reg_id >= GPIO_ID_PIN0) && (reg_id <= GPIO_ID_PIN(GPIO_PIN_COUNT-1)))
|
||||
|
||||
#define GPIO_REGID_TO_PINIDX(reg_id) ((reg_id) - GPIO_ID_PIN0)
|
||||
|
||||
typedef enum {
|
||||
GPIO_PIN_INTR_DISABLE = 0,
|
||||
GPIO_PIN_INTR_POSEDGE = 1,
|
||||
GPIO_PIN_INTR_NEGEDGE = 2,
|
||||
GPIO_PIN_INTR_ANYEDGE = 3,
|
||||
GPIO_PIN_INTR_LOLEVEL = 4,
|
||||
GPIO_PIN_INTR_HILEVEL = 5
|
||||
} GPIO_INT_TYPE;
|
||||
|
||||
#define GPIO_OUTPUT_SET(gpio_no, bit_value) \
|
||||
gpio_output_set((bit_value)<<gpio_no, ((~(bit_value))&0x01)<<gpio_no, 1<<gpio_no,0)
|
||||
#define GPIO_DIS_OUTPUT(gpio_no) gpio_output_set(0,0,0, 1<<gpio_no)
|
||||
#define GPIO_INPUT_GET(gpio_no) ((gpio_input_get()>>gpio_no)&BIT0)
|
||||
|
||||
/* GPIO interrupt handler, registered through gpio_intr_handler_register */
|
||||
typedef void (* gpio_intr_handler_fn_t)(uint32 intr_mask, void *arg);
|
||||
|
||||
|
||||
/*
|
||||
* Initialize GPIO. This includes reading the GPIO Configuration DataSet
|
||||
* to initialize "output enables" and pin configurations for each gpio pin.
|
||||
* Must be called once during startup.
|
||||
*/
|
||||
void gpio_init(void);
|
||||
|
||||
/*
|
||||
* Change GPIO pin output by setting, clearing, or disabling pins.
|
||||
* In general, it is expected that a bit will be set in at most one
|
||||
* of these masks. If a bit is clear in all masks, the output state
|
||||
* remains unchanged.
|
||||
*
|
||||
* There is no particular ordering guaranteed; so if the order of
|
||||
* writes is significant, calling code should divide a single call
|
||||
* into multiple calls.
|
||||
*/
|
||||
void gpio_output_set(uint32 set_mask,
|
||||
uint32 clear_mask,
|
||||
uint32 enable_mask,
|
||||
uint32 disable_mask);
|
||||
|
||||
/*
|
||||
* Sample the value of GPIO input pins and returns a bitmask.
|
||||
*/
|
||||
uint32 gpio_input_get(void);
|
||||
|
||||
/*
|
||||
* Set the specified GPIO register to the specified value.
|
||||
* This is a very general and powerful interface that is not
|
||||
* expected to be used during normal operation. It is intended
|
||||
* mainly for debug, or for unusual requirements.
|
||||
*/
|
||||
void gpio_register_set(uint32 reg_id, uint32 value);
|
||||
|
||||
/* Get the current value of the specified GPIO register. */
|
||||
uint32 gpio_register_get(uint32 reg_id);
|
||||
|
||||
/*
|
||||
* Register an application-specific interrupt handler for GPIO pin
|
||||
* interrupts. Once the interrupt handler is called, it will not
|
||||
* be called again until after a call to gpio_intr_ack. Any GPIO
|
||||
* interrupts that occur during the interim are masked.
|
||||
*
|
||||
* The application-specific handler is called with a mask of
|
||||
* pending GPIO interrupts. After processing pin interrupts, the
|
||||
* application-specific handler may wish to use gpio_intr_pending
|
||||
* to check for any additional pending interrupts before it returns.
|
||||
*/
|
||||
void gpio_intr_handler_register(gpio_intr_handler_fn_t fn, void *arg);
|
||||
|
||||
/* Determine which GPIO interrupts are pending. */
|
||||
uint32 gpio_intr_pending(void);
|
||||
|
||||
/*
|
||||
* Acknowledge GPIO interrupts.
|
||||
* Intended to be called from the gpio_intr_handler_fn.
|
||||
*/
|
||||
void gpio_intr_ack(uint32 ack_mask);
|
||||
|
||||
void gpio_pin_wakeup_enable(uint32 i, GPIO_INT_TYPE intr_state);
|
||||
|
||||
void gpio_pin_wakeup_disable();
|
||||
|
||||
void gpio_pin_intr_state_set(uint32 i, GPIO_INT_TYPE intr_state);
|
||||
|
||||
#endif // _GPIO_H_
|
||||
Executable
+63
@@ -0,0 +1,63 @@
|
||||
#ifndef __IP_ADDR_H__
|
||||
#define __IP_ADDR_H__
|
||||
|
||||
#include "c_types.h"
|
||||
|
||||
struct ip_addr {
|
||||
uint32 addr;
|
||||
};
|
||||
|
||||
typedef struct ip_addr ip_addr_t;
|
||||
|
||||
struct ip_info {
|
||||
struct ip_addr ip;
|
||||
struct ip_addr netmask;
|
||||
struct ip_addr gw;
|
||||
};
|
||||
|
||||
/**
|
||||
* Determine if two address are on the same network.
|
||||
*
|
||||
* @arg addr1 IP address 1
|
||||
* @arg addr2 IP address 2
|
||||
* @arg mask network identifier mask
|
||||
* @return !0 if the network identifiers of both address match
|
||||
*/
|
||||
#define ip_addr_netcmp(addr1, addr2, mask) (((addr1)->addr & \
|
||||
(mask)->addr) == \
|
||||
((addr2)->addr & \
|
||||
(mask)->addr))
|
||||
|
||||
/** Set an IP address given by the four byte-parts.
|
||||
Little-endian version that prevents the use of htonl. */
|
||||
#define IP4_ADDR(ipaddr, a,b,c,d) \
|
||||
(ipaddr)->addr = ((uint32)((d) & 0xff) << 24) | \
|
||||
((uint32)((c) & 0xff) << 16) | \
|
||||
((uint32)((b) & 0xff) << 8) | \
|
||||
(uint32)((a) & 0xff)
|
||||
|
||||
#define ip4_addr1(ipaddr) (((uint8*)(ipaddr))[0])
|
||||
#define ip4_addr2(ipaddr) (((uint8*)(ipaddr))[1])
|
||||
#define ip4_addr3(ipaddr) (((uint8*)(ipaddr))[2])
|
||||
#define ip4_addr4(ipaddr) (((uint8*)(ipaddr))[3])
|
||||
|
||||
#define ip4_addr1_16(ipaddr) ((uint16)ip4_addr1(ipaddr))
|
||||
#define ip4_addr2_16(ipaddr) ((uint16)ip4_addr2(ipaddr))
|
||||
#define ip4_addr3_16(ipaddr) ((uint16)ip4_addr3(ipaddr))
|
||||
#define ip4_addr4_16(ipaddr) ((uint16)ip4_addr4(ipaddr))
|
||||
|
||||
|
||||
/** 255.255.255.255 */
|
||||
#define IPADDR_NONE ((uint32)0xffffffffUL)
|
||||
/** 0.0.0.0 */
|
||||
#define IPADDR_ANY ((uint32)0x00000000UL)
|
||||
uint32 ipaddr_addr(const char *cp);
|
||||
|
||||
#define IP2STR(ipaddr) ip4_addr1_16(ipaddr), \
|
||||
ip4_addr2_16(ipaddr), \
|
||||
ip4_addr3_16(ipaddr), \
|
||||
ip4_addr4_16(ipaddr)
|
||||
|
||||
#define IPSTR "%d.%d.%d.%d"
|
||||
|
||||
#endif /* __IP_ADDR_H__ */
|
||||
Executable
+70
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (c) 2011-2012, Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* A few JSON defines used for parsing and generating JSON.
|
||||
* \author
|
||||
* Niclas Finne <nfi@sics.se>
|
||||
* Joakim Eriksson <joakime@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __JSON_H__
|
||||
#define __JSON_H__
|
||||
|
||||
#define JSON_TYPE_ARRAY '['
|
||||
#define JSON_TYPE_OBJECT '{'
|
||||
#define JSON_TYPE_PAIR ':'
|
||||
#define JSON_TYPE_PAIR_NAME 'N' /* for N:V pairs */
|
||||
#define JSON_TYPE_STRING '"'
|
||||
#define JSON_TYPE_INT 'I'
|
||||
#define JSON_TYPE_NUMBER '0'
|
||||
#define JSON_TYPE_ERROR 0
|
||||
|
||||
/* how should we handle null vs false - both can be 0? */
|
||||
#define JSON_TYPE_NULL 'n'
|
||||
#define JSON_TYPE_TRUE 't'
|
||||
#define JSON_TYPE_FALSE 'f'
|
||||
|
||||
#define JSON_TYPE_CALLBACK 'C'
|
||||
|
||||
enum {
|
||||
JSON_ERROR_OK,
|
||||
JSON_ERROR_SYNTAX,
|
||||
JSON_ERROR_UNEXPECTED_ARRAY,
|
||||
JSON_ERROR_UNEXPECTED_END_OF_ARRAY,
|
||||
JSON_ERROR_UNEXPECTED_OBJECT,
|
||||
JSON_ERROR_UNEXPECTED_STRING
|
||||
};
|
||||
|
||||
#define JSON_CONTENT_TYPE "application/json"
|
||||
|
||||
#endif /* __JSON_H__ */
|
||||
Executable
+94
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Copyright (c) 2011-2012, Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*/
|
||||
|
||||
#ifndef __JSONPARSE_H__
|
||||
#define __JSONPARSE_H__
|
||||
|
||||
#include "c_types.h"
|
||||
#include "json/json.h"
|
||||
|
||||
#ifdef JSONPARSE_CONF_MAX_DEPTH
|
||||
#define JSONPARSE_MAX_DEPTH JSONPARSE_CONF_MAX_DEPTH
|
||||
#else
|
||||
#define JSONPARSE_MAX_DEPTH 10
|
||||
#endif
|
||||
|
||||
struct jsonparse_state {
|
||||
const char *json;
|
||||
int pos;
|
||||
int len;
|
||||
int depth;
|
||||
/* for handling atomic values */
|
||||
int vstart;
|
||||
int vlen;
|
||||
char vtype;
|
||||
char error;
|
||||
char stack[JSONPARSE_MAX_DEPTH];
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Initialize a JSON parser state.
|
||||
* \param state A pointer to a JSON parser state
|
||||
* \param json The string to parse as JSON
|
||||
* \param len The length of the string to parse
|
||||
*
|
||||
* This function initializes a JSON parser state for
|
||||
* parsing a string as JSON.
|
||||
*/
|
||||
void jsonparse_setup(struct jsonparse_state *state, const char *json,
|
||||
int len);
|
||||
|
||||
/* move to next JSON element */
|
||||
int jsonparse_next(struct jsonparse_state *state);
|
||||
|
||||
/* copy the current JSON value into the specified buffer */
|
||||
int jsonparse_copy_value(struct jsonparse_state *state, char *buf,
|
||||
int buf_size);
|
||||
|
||||
/* get the current JSON value parsed as an int */
|
||||
int jsonparse_get_value_as_int(struct jsonparse_state *state);
|
||||
|
||||
/* get the current JSON value parsed as a long */
|
||||
long jsonparse_get_value_as_long(struct jsonparse_state *state);
|
||||
|
||||
/* get the current JSON value parsed as a unsigned long */
|
||||
unsigned long jsonparse_get_value_as_ulong(struct jsonparse_state *state);
|
||||
|
||||
/* get the length of the current JSON value */
|
||||
int jsonparse_get_len(struct jsonparse_state *state);
|
||||
|
||||
/* get the type of the current JSON value */
|
||||
int jsonparse_get_type(struct jsonparse_state *state);
|
||||
|
||||
/* compare the JSON value with the specified string */
|
||||
int jsonparse_strcmp_value(struct jsonparse_state *state, const char *str);
|
||||
|
||||
#endif /* __JSONPARSE_H__ */
|
||||
Executable
+145
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
* Copyright (c) 2011-2012, Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* JSON output generation
|
||||
* \author
|
||||
* Niclas Finne <nfi@sics.se>
|
||||
* Joakim Eriksson <joakime@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __JSONTREE_H__
|
||||
#define __JSONTREE_H__
|
||||
|
||||
#include "c_types.h"
|
||||
#include "json/json.h"
|
||||
|
||||
#ifdef JSONTREE_CONF_MAX_DEPTH
|
||||
#define JSONTREE_MAX_DEPTH JSONTREE_CONF_MAX_DEPTH
|
||||
#else
|
||||
#define JSONTREE_MAX_DEPTH 10
|
||||
#endif /* JSONTREE_CONF_MAX_DEPTH */
|
||||
|
||||
struct jsontree_context {
|
||||
struct jsontree_value *values[JSONTREE_MAX_DEPTH];
|
||||
uint16_t index[JSONTREE_MAX_DEPTH];
|
||||
int (* putchar)(int);
|
||||
uint8_t depth;
|
||||
uint8_t path;
|
||||
int callback_state;
|
||||
};
|
||||
|
||||
struct jsontree_value {
|
||||
uint8_t type;
|
||||
/* followed by a value */
|
||||
};
|
||||
|
||||
struct jsontree_string {
|
||||
uint8_t type;
|
||||
const char *value;
|
||||
};
|
||||
|
||||
struct jsontree_int {
|
||||
uint8_t type;
|
||||
int value;
|
||||
};
|
||||
|
||||
/* NOTE: the jsontree_callback set will receive a jsonparse state */
|
||||
struct jsonparse_state;
|
||||
struct jsontree_callback {
|
||||
uint8_t type;
|
||||
int (* output)(struct jsontree_context *js_ctx);
|
||||
int (* set)(struct jsontree_context *js_ctx, struct jsonparse_state *parser);
|
||||
};
|
||||
|
||||
struct jsontree_pair {
|
||||
const char *name;
|
||||
struct jsontree_value *value;
|
||||
};
|
||||
|
||||
struct jsontree_object {
|
||||
uint8_t type;
|
||||
uint8_t count;
|
||||
struct jsontree_pair *pairs;
|
||||
};
|
||||
|
||||
struct jsontree_array {
|
||||
uint8_t type;
|
||||
uint8_t count;
|
||||
struct jsontree_value **values;
|
||||
};
|
||||
|
||||
#define JSONTREE_STRING(text) {JSON_TYPE_STRING, (text)}
|
||||
#define JSONTREE_PAIR(name, value) {(name), (struct jsontree_value *)(value)}
|
||||
#define JSONTREE_CALLBACK(output, set) {JSON_TYPE_CALLBACK, (output), (set)}
|
||||
|
||||
#define JSONTREE_OBJECT(name, ...) \
|
||||
static struct jsontree_pair jsontree_pair_##name[] = {__VA_ARGS__}; \
|
||||
static struct jsontree_object name = { \
|
||||
JSON_TYPE_OBJECT, \
|
||||
sizeof(jsontree_pair_##name)/sizeof(struct jsontree_pair), \
|
||||
jsontree_pair_##name }
|
||||
|
||||
#define JSONTREE_PAIR_ARRAY(value) (struct jsontree_value *)(value)
|
||||
#define JSONTREE_ARRAY(name, ...) \
|
||||
static struct jsontree_value* jsontree_value_##name[] = {__VA_ARGS__}; \
|
||||
static struct jsontree_array name = { \
|
||||
JSON_TYPE_ARRAY, \
|
||||
sizeof(jsontree_value_##name)/sizeof(struct jsontree_value*), \
|
||||
jsontree_value_##name }
|
||||
|
||||
#define JSONTREE_OBJECT_EXT(name, ...) \
|
||||
static struct jsontree_pair jsontree_pair_##name[] = {__VA_ARGS__}; \
|
||||
struct jsontree_object name = { \
|
||||
JSON_TYPE_OBJECT, \
|
||||
sizeof(jsontree_pair_##name)/sizeof(struct jsontree_pair), \
|
||||
jsontree_pair_##name }
|
||||
|
||||
void jsontree_setup(struct jsontree_context *js_ctx,
|
||||
struct jsontree_value *root, int (* putchar)(int));
|
||||
void jsontree_reset(struct jsontree_context *js_ctx);
|
||||
|
||||
const char *jsontree_path_name(const struct jsontree_context *js_ctx,
|
||||
int depth);
|
||||
|
||||
void jsontree_write_int(const struct jsontree_context *js_ctx, int value);
|
||||
void jsontree_write_int_array(const struct jsontree_context *js_ctx, const int *text, uint32 length);
|
||||
|
||||
void jsontree_write_atom(const struct jsontree_context *js_ctx,
|
||||
const char *text);
|
||||
void jsontree_write_string(const struct jsontree_context *js_ctx,
|
||||
const char *text);
|
||||
int jsontree_print_next(struct jsontree_context *js_ctx);
|
||||
struct jsontree_value *jsontree_find_next(struct jsontree_context *js_ctx,
|
||||
int type);
|
||||
|
||||
#endif /* __JSONTREE_H__ */
|
||||
Executable
+57
@@ -0,0 +1,57 @@
|
||||
#ifndef __MEM_H__
|
||||
#define __MEM_H__
|
||||
|
||||
/* Note: check_memleak_debug_enable is a weak function inside SDK.
|
||||
* please copy following codes to user_main.c.
|
||||
#include "mem.h"
|
||||
|
||||
bool ICACHE_FLASH_ATTR check_memleak_debug_enable(void)
|
||||
{
|
||||
return MEMLEAK_DEBUG_ENABLE;
|
||||
}
|
||||
*/
|
||||
|
||||
#ifndef MEMLEAK_DEBUG
|
||||
#define MEMLEAK_DEBUG_ENABLE 0
|
||||
#define os_free(s) vPortFree(s, "", 0)
|
||||
#define os_malloc(s) pvPortMalloc(s, "", 0)
|
||||
#define os_calloc(s) pvPortCalloc(s, "", 0);
|
||||
#define os_realloc(p, s) pvPortRealloc(p, s, "", 0)
|
||||
#define os_zalloc(s) pvPortZalloc(s, "", 0)
|
||||
#else
|
||||
#define MEMLEAK_DEBUG_ENABLE 1
|
||||
|
||||
#define os_free(s) \
|
||||
do{\
|
||||
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__; \
|
||||
vPortFree(s, mem_debug_file, __LINE__);\
|
||||
}while(0)
|
||||
|
||||
#define os_malloc(s) \
|
||||
({ \
|
||||
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__; \
|
||||
pvPortMalloc(s, mem_debug_file, __LINE__); \
|
||||
})
|
||||
|
||||
#define os_calloc(s) \
|
||||
({ \
|
||||
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__; \
|
||||
pvPortCalloc(s, mem_debug_file, __LINE__); \
|
||||
})
|
||||
|
||||
#define os_realloc(p, s) \
|
||||
({ \
|
||||
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__; \
|
||||
pvPortRealloc(p, s, mem_debug_file, __LINE__); \
|
||||
})
|
||||
|
||||
#define os_zalloc(s) \
|
||||
({ \
|
||||
static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__; \
|
||||
pvPortZalloc(s, mem_debug_file, __LINE__); \
|
||||
})
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Executable
+341
@@ -0,0 +1,341 @@
|
||||
/*
|
||||
* ESPRSSIF MIT License
|
||||
*
|
||||
* Copyright (c) 2015 <ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD>
|
||||
*
|
||||
* 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 __LWIP_API_MESH_H__
|
||||
#define __LWIP_API_MESH_H__
|
||||
|
||||
#include "ip_addr.h"
|
||||
#include "user_interface.h"
|
||||
#include "espconn.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ESP_MESH_GROUP_ID_LEN (6)
|
||||
|
||||
typedef void (* espconn_mesh_callback)();
|
||||
typedef void (* espconn_mesh_scan_callback)(void *arg, int8_t status);
|
||||
|
||||
enum mesh_type {
|
||||
MESH_CLOSE = 0,
|
||||
MESH_LOCAL,
|
||||
MESH_ONLINE,
|
||||
MESH_NONE = 0xFF
|
||||
};
|
||||
/** \defgroup Mesh_APIs Mesh APIs
|
||||
* @brief Mesh APIs
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/** @addtogroup Mesh_APIs
|
||||
* @{
|
||||
*/
|
||||
|
||||
enum mesh_status {
|
||||
MESH_DISABLE = 0,
|
||||
MESH_WIFI_CONN,
|
||||
MESH_NET_CONN,
|
||||
MESH_LOCAL_AVAIL,
|
||||
MESH_ONLINE_AVAIL
|
||||
};
|
||||
|
||||
enum mesh_node_type {
|
||||
MESH_NODE_PARENT = 0,
|
||||
MESH_NODE_CHILD,
|
||||
MESH_NODE_ALL
|
||||
};
|
||||
|
||||
struct mesh_scan_para_type {
|
||||
espconn_mesh_scan_callback usr_scan_cb; // scan done callback
|
||||
uint8_t grp_id[ESP_MESH_GROUP_ID_LEN]; // group id
|
||||
bool grp_set; // group set
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief Check whether the IP address is mesh local IP address or not.
|
||||
*
|
||||
* @attention 1. The range of mesh local IP address is 2.255.255.* ~ max_hop.255.255.*.
|
||||
* @attention 2. IP pointer should not be NULL. If the IP pointer is NULL, it will return false.
|
||||
*
|
||||
* @param struct ip_addr *ip : IP address
|
||||
*
|
||||
* @return true : the IP address is mesh local IP address
|
||||
* @return false : the IP address is not mesh local IP address
|
||||
*/
|
||||
bool espconn_mesh_local_addr(struct ip_addr *ip);
|
||||
|
||||
/**
|
||||
* @brief Get the information of router used by mesh network.
|
||||
*
|
||||
* @attention 1. The function should be called after mesh_enable_done
|
||||
*
|
||||
* @param struct station_config *router: router inforamtion
|
||||
*
|
||||
* @return true : succeed
|
||||
* @return false : fail
|
||||
*/
|
||||
bool espconn_mesh_get_router(struct station_config *router);
|
||||
|
||||
/**
|
||||
* @brief Set the information of router used by mesh network.
|
||||
*
|
||||
* @attention The function must be called before espconn_mesh_enable.
|
||||
*
|
||||
* @param struct station_config *router: router information.
|
||||
* user should initialize the ssid and password.
|
||||
*
|
||||
* @return true : succeed
|
||||
* @return false : fail
|
||||
*/
|
||||
bool espconn_mesh_set_router(struct station_config *router);
|
||||
|
||||
/**
|
||||
* @brief Set server setup by user.
|
||||
*
|
||||
* @attention If users wants to use themself server, they use the function.
|
||||
* but the function must be called before espconn_mesh_enable.
|
||||
* at the same time, users need to implement the server.
|
||||
*
|
||||
* @param struct ip_addr *ip : ip address of server.
|
||||
* @param uint16_t port : port used by server.
|
||||
*
|
||||
* @return true : succeed
|
||||
* @return false : fail
|
||||
*/
|
||||
bool espconn_mesh_server_init(struct ip_addr *ip, uint16_t port);
|
||||
|
||||
/**
|
||||
* @brief Get the information of mesh node.
|
||||
*
|
||||
* @param enum mesh_node_type typ : mesh node type.
|
||||
* @param uint8_t **info : the information will be saved in *info.
|
||||
* @param uint8_t *count : the node count in *info.
|
||||
*
|
||||
* @return true : succeed
|
||||
* @return false : fail
|
||||
*/
|
||||
bool espconn_mesh_get_node_info(enum mesh_node_type type,
|
||||
uint8_t **info, uint8_t *count);
|
||||
|
||||
/**
|
||||
* @brief Set WiFi cryption algrithm and password for mesh node.
|
||||
*
|
||||
* @attention The function must be called before espconn_mesh_enable.
|
||||
*
|
||||
* @param AUTH_MODE mode : cryption algrithm (WPA/WAP2/WPA_WPA2).
|
||||
* @param uint8_t *passwd : password of WiFi.
|
||||
* @param uint8_t passwd_len : length of password (8 <= passwd_len <= 64).
|
||||
*
|
||||
* @return true : succeed
|
||||
* @return false : fail
|
||||
*/
|
||||
bool espconn_mesh_encrypt_init(AUTH_MODE mode, uint8_t *passwd, uint8_t passwd_len);
|
||||
/**
|
||||
* @brief Set prefix of SSID for mesh node.
|
||||
*
|
||||
* @attention The function must be called before espconn_mesh_enable.
|
||||
*
|
||||
* @param uint8_t *prefix : prefix of SSID.
|
||||
* @param uint8_t prefix_len : length of prefix (0 < passwd_len <= 22).
|
||||
*
|
||||
* @return true : succeed
|
||||
* @return false : fail
|
||||
*/
|
||||
bool espconn_mesh_set_ssid_prefix(uint8_t *prefix, uint8_t prefix_len);
|
||||
|
||||
/**
|
||||
* @brief Set max hop for mesh network.
|
||||
*
|
||||
* @attention The function must be called before espconn_mesh_enable.
|
||||
*
|
||||
* @param uint8_t max_hops : max hop of mesh network (1 <= max_hops < 10, 4 is recommended).
|
||||
*
|
||||
* @return true : succeed
|
||||
* @return false : fail
|
||||
*/
|
||||
bool espconn_mesh_set_max_hops(uint8_t max_hops);
|
||||
|
||||
/**
|
||||
* @brief Set group ID of mesh node.
|
||||
*
|
||||
* @attention The function must be called before espconn_mesh_enable.
|
||||
*
|
||||
* @param uint8_t *grp_id : group ID.
|
||||
* @param uint16_t gid_len: length of group ID, now gid_len = 6.
|
||||
*
|
||||
* @return true : succeed
|
||||
* @return false : fail
|
||||
*/
|
||||
bool espconn_mesh_group_id_init(uint8_t *grp_id, uint16_t gid_len);
|
||||
|
||||
/**
|
||||
* @brief Set the curent device type.
|
||||
*
|
||||
* @param uint8_t dev_type : device type of mesh node
|
||||
*
|
||||
* @return true : succeed
|
||||
* @return false : fail
|
||||
*/
|
||||
bool espconn_mesh_set_dev_type(uint8_t dev_type);
|
||||
/**
|
||||
* @brief Get the curent device type.
|
||||
*
|
||||
* @param none
|
||||
*
|
||||
* @return device type
|
||||
*/
|
||||
uint8_t espconn_mesh_get_dev_type();
|
||||
|
||||
/**
|
||||
* @brief Try to establish mesh connection to server.
|
||||
*
|
||||
* @attention If espconn_mesh_connect fail, returns non-0 value, there is no connection, so it
|
||||
* won't enter any espconn callback.
|
||||
*
|
||||
* @param struct espconn *usr_esp : the network connection structure, the usr_esp to
|
||||
* listen to the connection
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_RTE - Routing Problem
|
||||
* - ESPCONN_MEM - Out of memory
|
||||
* - ESPCONN_ISCONN - Already connected
|
||||
* - ESPCONN_ARG - Illegal argument, can't find the corresponding connection
|
||||
* according to structure espconn
|
||||
*/
|
||||
int8_t espconn_mesh_connect(struct espconn *usr_esp);
|
||||
|
||||
/**
|
||||
* @brief Disconnect a mesh connection.
|
||||
*
|
||||
* @attention Do not call this API in any espconn callback. If needed, please use system
|
||||
* task to trigger espconn_mesh_disconnect.
|
||||
*
|
||||
* @param struct espconn *usr_esp : the network connection structure
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding TCP connection
|
||||
* according to structure espconn
|
||||
*/
|
||||
|
||||
int8_t espconn_mesh_disconnect(struct espconn *usr_esp);
|
||||
|
||||
/**
|
||||
* @brief Get current mesh status.
|
||||
*
|
||||
* @param null
|
||||
*
|
||||
* @return the current mesh status, please refer to enum mesh_status.
|
||||
*/
|
||||
int8_t espconn_mesh_get_status();
|
||||
|
||||
/**
|
||||
* @brief Send data through mesh network.
|
||||
*
|
||||
* @attention Please call espconn_mesh_sent after espconn_sent_callback of the pre-packet.
|
||||
*
|
||||
* @param struct espconn *usr_esp : the network connection structure
|
||||
* @param uint8 *pdata : pointer of data
|
||||
* @param uint16 len : data length
|
||||
*
|
||||
* @return 0 : succeed
|
||||
* @return Non-0 : error code
|
||||
* - ESPCONN_MEM - out of memory
|
||||
* - ESPCONN_ARG - illegal argument, can't find the corresponding network transmission
|
||||
* according to structure espconn
|
||||
* - ESPCONN_MAXNUM - buffer of sending data is full
|
||||
* - ESPCONN_IF - send UDP data fail
|
||||
*/
|
||||
int8_t espconn_mesh_sent(struct espconn *usr_esp, uint8 *pdata, uint16 len);
|
||||
|
||||
/**
|
||||
* @brief Get max hop of mesh network.
|
||||
*
|
||||
* @param null.
|
||||
*
|
||||
* @return the current max hop of mesh
|
||||
*/
|
||||
uint8_t espconn_mesh_get_max_hops();
|
||||
|
||||
/**
|
||||
* @brief To enable mesh network.
|
||||
*
|
||||
* @attention 1. the function should be called in user_init.
|
||||
* @attention 2. if mesh node can not scan the mesh AP, it will be isolate node without trigger enable_cb.
|
||||
* user can use espconn_mesh_get_status to get current status of node.
|
||||
* @attention 3. if user try to enable online mesh, but node fails to establish mesh connection
|
||||
* the node will work with local mesh.
|
||||
*
|
||||
* @param espconn_mesh_callback enable_cb : callback function of mesh-enable
|
||||
* @param enum mesh_type type : type of mesh, local or online.
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
void espconn_mesh_enable(espconn_mesh_callback enable_cb, enum mesh_type type);
|
||||
|
||||
/**
|
||||
* @brief To disable mesh network.
|
||||
*
|
||||
* @attention When mesh network is disabed, the system will trigger disable_cb.
|
||||
*
|
||||
* @param espconn_mesh_callback disable_cb : callback function of mesh-disable
|
||||
* @param enum mesh_type type : type of mesh, local or online.
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
void espconn_mesh_disable(espconn_mesh_callback disable_cb);
|
||||
|
||||
/**
|
||||
* @brief To print version of mesh.
|
||||
*
|
||||
* @param null
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
void espconn_mesh_print_ver();
|
||||
|
||||
/**
|
||||
* @brief To get AP around node.
|
||||
*
|
||||
* @attention User can get normal AP or mesh AP using the function.
|
||||
* If user plans to get normal AP, he/she needs to clear grp_set flag in para.
|
||||
* If user plans to get mesh AP, he/she needs to set grp_set and grp_id;
|
||||
*
|
||||
* @param struct mesh_scan_para_type *para : callback function of mesh-disable
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
void espconn_mesh_scan(struct mesh_scan_para_type *para);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* copyright (c) Espressif System 2010
|
||||
*
|
||||
* mapping to ETS structures
|
||||
*
|
||||
*/
|
||||
#ifndef _OS_TYPES_H_
|
||||
#define _OS_TYPES_H_
|
||||
|
||||
#include "ets_sys.h"
|
||||
|
||||
#define os_signal_t ETSSignal
|
||||
#define os_param_t ETSParam
|
||||
#define os_event_t ETSEvent
|
||||
#define os_task_t ETSTask
|
||||
#define os_timer_t ETSTimer
|
||||
#define os_timer_func_t ETSTimerFunc
|
||||
|
||||
#endif
|
||||
Executable
+50
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2010 Espressif System
|
||||
*/
|
||||
|
||||
#ifndef _OSAPI_H_
|
||||
#define _OSAPI_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "user_config.h"
|
||||
|
||||
#define os_bzero ets_bzero
|
||||
#define os_delay_us ets_delay_us
|
||||
#define os_install_putc1 ets_install_putc1
|
||||
|
||||
#define os_memcmp ets_memcmp
|
||||
#define os_memcpy ets_memcpy
|
||||
#define os_memmove ets_memmove
|
||||
#define os_memset ets_memset
|
||||
#define os_strcat strcat
|
||||
#define os_strchr strchr
|
||||
#define os_strcmp ets_strcmp
|
||||
#define os_strcpy ets_strcpy
|
||||
#define os_strlen ets_strlen
|
||||
#define os_strncmp ets_strncmp
|
||||
#define os_strncpy ets_strncpy
|
||||
#define os_strstr ets_strstr
|
||||
#ifdef USE_US_TIMER
|
||||
#define os_timer_arm_us(a, b, c) ets_timer_arm_new(a, b, c, 0)
|
||||
#endif
|
||||
#define os_timer_arm(timer, time_ms, repeat) ets_timer_arm_new(timer, time_ms, repeat, 1)
|
||||
#define os_timer_disarm ets_timer_disarm
|
||||
#define os_timer_setfn ets_timer_setfn
|
||||
|
||||
#define os_sprintf ets_sprintf
|
||||
#define os_snprintf ets_snprintf
|
||||
|
||||
#ifdef USE_OPTIMIZE_PRINTF
|
||||
#define os_printf(fmt, ...) do { \
|
||||
static const char flash_str[] ICACHE_RODATA_ATTR STORE_ATTR = fmt; \
|
||||
os_printf_plus(flash_str, ##__VA_ARGS__); \
|
||||
} while(0)
|
||||
#else
|
||||
#define os_printf os_printf_plus
|
||||
#endif
|
||||
|
||||
unsigned long os_random(void);
|
||||
int os_get_random(unsigned char *buf, size_t len);
|
||||
|
||||
#endif
|
||||
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#ifndef __PING_H__
|
||||
#define __PING_H__
|
||||
|
||||
#include <c_types.h>
|
||||
|
||||
|
||||
typedef void (* ping_recv_function)(void* arg, void *pdata);
|
||||
typedef void (* ping_sent_function)(void* arg, void *pdata);
|
||||
|
||||
struct ping_option{
|
||||
uint32 count;
|
||||
uint32 ip;
|
||||
uint32 coarse_time;
|
||||
ping_recv_function recv_function;
|
||||
ping_sent_function sent_function;
|
||||
void* reverse;
|
||||
};
|
||||
|
||||
struct ping_resp{
|
||||
uint32 total_count;
|
||||
uint32 resp_time;
|
||||
uint32 seqno;
|
||||
uint32 timeout_count;
|
||||
uint32 bytes;
|
||||
uint32 total_bytes;
|
||||
uint32 total_time;
|
||||
sint8 ping_err;
|
||||
};
|
||||
|
||||
bool ping_start(struct ping_option *ping_opt);
|
||||
bool ping_regist_recv(struct ping_option *ping_opt, ping_recv_function ping_recv);
|
||||
bool ping_regist_sent(struct ping_option *ping_opt, ping_sent_function ping_sent);
|
||||
|
||||
#endif /* __PING_H__ */
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#ifndef __PWM_H__
|
||||
#define __PWM_H__
|
||||
|
||||
/*pwm.h: function and macro definition of PWM API , driver level */
|
||||
/*user_light.h: user interface for light API, user level*/
|
||||
/*user_light_adj: API for color changing and lighting effects, user level*/
|
||||
|
||||
|
||||
/*NOTE!! : DO NOT CHANGE THIS FILE*/
|
||||
|
||||
/*SUPPORT UP TO 8 PWM CHANNEL*/
|
||||
#define PWM_CHANNEL_NUM_MAX 8
|
||||
|
||||
struct pwm_param {
|
||||
uint32 period;
|
||||
uint32 freq;
|
||||
uint32 duty[PWM_CHANNEL_NUM_MAX]; //PWM_CHANNEL<=8
|
||||
};
|
||||
|
||||
|
||||
/* pwm_init should be called only once, for now */
|
||||
void pwm_init(uint32 period, uint32 *duty,uint32 pwm_channel_num,uint32 (*pin_info_list)[3]);
|
||||
void pwm_start(void);
|
||||
|
||||
void pwm_set_duty(uint32 duty, uint8 channel);
|
||||
uint32 pwm_get_duty(uint8 channel);
|
||||
void pwm_set_period(uint32 period);
|
||||
uint32 pwm_get_period(void);
|
||||
|
||||
uint32 get_pwm_version(void);
|
||||
void set_pwm_debug_en(uint8 print_en);
|
||||
|
||||
#endif
|
||||
|
||||
Executable
+204
@@ -0,0 +1,204 @@
|
||||
#ifndef _SYS_QUEUE_H_
|
||||
#define _SYS_QUEUE_H_
|
||||
|
||||
#define QMD_SAVELINK(name, link)
|
||||
#define TRASHIT(x)
|
||||
|
||||
/*
|
||||
* Singly-linked List declarations.
|
||||
*/
|
||||
#define SLIST_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *slh_first; /* first element */ \
|
||||
}
|
||||
|
||||
#define SLIST_HEAD_INITIALIZER(head) \
|
||||
{ NULL }
|
||||
|
||||
#define SLIST_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *sle_next; /* next element */ \
|
||||
}
|
||||
|
||||
/*
|
||||
* Singly-linked List functions.
|
||||
*/
|
||||
#define SLIST_EMPTY(head) ((head)->slh_first == NULL)
|
||||
|
||||
#define SLIST_FIRST(head) ((head)->slh_first)
|
||||
|
||||
#define SLIST_FOREACH(var, head, field) \
|
||||
for ((var) = SLIST_FIRST((head)); \
|
||||
(var); \
|
||||
(var) = SLIST_NEXT((var), field))
|
||||
|
||||
#define SLIST_FOREACH_SAFE(var, head, field, tvar) \
|
||||
for ((var) = SLIST_FIRST((head)); \
|
||||
(var) && ((tvar) = SLIST_NEXT((var), field), 1); \
|
||||
(var) = (tvar))
|
||||
|
||||
#define SLIST_FOREACH_PREVPTR(var, varp, head, field) \
|
||||
for ((varp) = &SLIST_FIRST((head)); \
|
||||
((var) = *(varp)) != NULL; \
|
||||
(varp) = &SLIST_NEXT((var), field))
|
||||
|
||||
#define SLIST_INIT(head) do { \
|
||||
SLIST_FIRST((head)) = NULL; \
|
||||
} while (0)
|
||||
|
||||
#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \
|
||||
SLIST_NEXT((elm), field) = SLIST_NEXT((slistelm), field); \
|
||||
SLIST_NEXT((slistelm), field) = (elm); \
|
||||
} while (0)
|
||||
|
||||
#define SLIST_INSERT_HEAD(head, elm, field) do { \
|
||||
SLIST_NEXT((elm), field) = SLIST_FIRST((head)); \
|
||||
SLIST_FIRST((head)) = (elm); \
|
||||
} while (0)
|
||||
|
||||
#define SLIST_NEXT(elm, field) ((elm)->field.sle_next)
|
||||
|
||||
#define SLIST_REMOVE(head, elm, type, field) do { \
|
||||
QMD_SAVELINK(oldnext, (elm)->field.sle_next); \
|
||||
if (SLIST_FIRST((head)) == (elm)) { \
|
||||
SLIST_REMOVE_HEAD((head), field); \
|
||||
} \
|
||||
else { \
|
||||
struct type *curelm = SLIST_FIRST((head)); \
|
||||
while (SLIST_NEXT(curelm, field) != (elm)) \
|
||||
curelm = SLIST_NEXT(curelm, field); \
|
||||
SLIST_REMOVE_AFTER(curelm, field); \
|
||||
} \
|
||||
TRASHIT(*oldnext); \
|
||||
} while (0)
|
||||
|
||||
#define SLIST_REMOVE_AFTER(elm, field) do { \
|
||||
SLIST_NEXT(elm, field) = \
|
||||
SLIST_NEXT(SLIST_NEXT(elm, field), field); \
|
||||
} while (0)
|
||||
|
||||
#define SLIST_REMOVE_HEAD(head, field) do { \
|
||||
SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Singly-linked Tail queue declarations.
|
||||
*/
|
||||
#define STAILQ_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *stqh_first;/* first element */ \
|
||||
struct type **stqh_last;/* addr of last next element */ \
|
||||
}
|
||||
|
||||
#define STAILQ_HEAD_INITIALIZER(head) \
|
||||
{ NULL, &(head).stqh_first }
|
||||
|
||||
#define STAILQ_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *stqe_next; /* next element */ \
|
||||
}
|
||||
|
||||
/*
|
||||
* Singly-linked Tail queue functions.
|
||||
*/
|
||||
#define STAILQ_CONCAT(head1, head2) do { \
|
||||
if (!STAILQ_EMPTY((head2))) { \
|
||||
*(head1)->stqh_last = (head2)->stqh_first; \
|
||||
(head1)->stqh_last = (head2)->stqh_last; \
|
||||
STAILQ_INIT((head2)); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL)
|
||||
|
||||
#define STAILQ_FIRST(head) ((head)->stqh_first)
|
||||
|
||||
#define STAILQ_FOREACH(var, head, field) \
|
||||
for((var) = STAILQ_FIRST((head)); \
|
||||
(var); \
|
||||
(var) = STAILQ_NEXT((var), field))
|
||||
|
||||
|
||||
#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \
|
||||
for ((var) = STAILQ_FIRST((head)); \
|
||||
(var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
|
||||
(var) = (tvar))
|
||||
|
||||
#define STAILQ_INIT(head) do { \
|
||||
STAILQ_FIRST((head)) = NULL; \
|
||||
(head)->stqh_last = &STAILQ_FIRST((head)); \
|
||||
} while (0)
|
||||
|
||||
#define STAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \
|
||||
if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((tqelm), field)) == NULL)\
|
||||
(head)->stqh_last = &STAILQ_NEXT((elm), field); \
|
||||
STAILQ_NEXT((tqelm), field) = (elm); \
|
||||
} while (0)
|
||||
|
||||
#define STAILQ_INSERT_HEAD(head, elm, field) do { \
|
||||
if ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL) \
|
||||
(head)->stqh_last = &STAILQ_NEXT((elm), field); \
|
||||
STAILQ_FIRST((head)) = (elm); \
|
||||
} while (0)
|
||||
|
||||
#define STAILQ_INSERT_TAIL(head, elm, field) do { \
|
||||
STAILQ_NEXT((elm), field) = NULL; \
|
||||
*(head)->stqh_last = (elm); \
|
||||
(head)->stqh_last = &STAILQ_NEXT((elm), field); \
|
||||
} while (0)
|
||||
|
||||
#define STAILQ_LAST(head, type, field) \
|
||||
(STAILQ_EMPTY((head)) ? \
|
||||
NULL : \
|
||||
((struct type *)(void *) \
|
||||
((char *)((head)->stqh_last) - __offsetof(struct type, field))))
|
||||
|
||||
#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
|
||||
|
||||
#define STAILQ_REMOVE(head, elm, type, field) do { \
|
||||
QMD_SAVELINK(oldnext, (elm)->field.stqe_next); \
|
||||
if (STAILQ_FIRST((head)) == (elm)) { \
|
||||
STAILQ_REMOVE_HEAD((head), field); \
|
||||
} \
|
||||
else { \
|
||||
struct type *curelm = STAILQ_FIRST((head)); \
|
||||
while (STAILQ_NEXT(curelm, field) != (elm)) \
|
||||
curelm = STAILQ_NEXT(curelm, field); \
|
||||
STAILQ_REMOVE_AFTER(head, curelm, field); \
|
||||
} \
|
||||
TRASHIT(*oldnext); \
|
||||
} while (0)
|
||||
|
||||
#define STAILQ_REMOVE_HEAD(head, field) do { \
|
||||
if ((STAILQ_FIRST((head)) = \
|
||||
STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL) \
|
||||
(head)->stqh_last = &STAILQ_FIRST((head)); \
|
||||
} while (0)
|
||||
|
||||
#define STAILQ_REMOVE_AFTER(head, elm, field) do { \
|
||||
if ((STAILQ_NEXT(elm, field) = \
|
||||
STAILQ_NEXT(STAILQ_NEXT(elm, field), field)) == NULL) \
|
||||
(head)->stqh_last = &STAILQ_NEXT((elm), field); \
|
||||
} while (0)
|
||||
|
||||
#define STAILQ_SWAP(head1, head2, type) do { \
|
||||
struct type *swap_first = STAILQ_FIRST(head1); \
|
||||
struct type **swap_last = (head1)->stqh_last; \
|
||||
STAILQ_FIRST(head1) = STAILQ_FIRST(head2); \
|
||||
(head1)->stqh_last = (head2)->stqh_last; \
|
||||
STAILQ_FIRST(head2) = swap_first; \
|
||||
(head2)->stqh_last = swap_last; \
|
||||
if (STAILQ_EMPTY(head1)) \
|
||||
(head1)->stqh_last = &STAILQ_FIRST(head1); \
|
||||
if (STAILQ_EMPTY(head2)) \
|
||||
(head2)->stqh_last = &STAILQ_FIRST(head2); \
|
||||
} while (0)
|
||||
|
||||
#define STAILQ_INSERT_CHAIN_HEAD(head, elm_chead, elm_ctail, field) do { \
|
||||
if ((STAILQ_NEXT(elm_ctail, field) = STAILQ_FIRST(head)) == NULL ) { \
|
||||
(head)->stqh_last = &STAILQ_NEXT(elm_ctail, field); \
|
||||
} \
|
||||
STAILQ_FIRST(head) = (elm_chead); \
|
||||
} while (0)
|
||||
|
||||
#endif /* !_SYS_QUEUE_H_ */
|
||||
Executable
+283
@@ -0,0 +1,283 @@
|
||||
//Generated at 2012-10-23 19:55:03
|
||||
/*
|
||||
* Copyright (c) 2010 - 2011 Espressif System
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SLC_REGISTER_H_
|
||||
#define SLC_REGISTER_H_
|
||||
|
||||
#define REG_SLC_BASE 0x60000B00
|
||||
//version value:32'h091700
|
||||
|
||||
#define SLC_CONF0 (REG_SLC_BASE + 0x0)
|
||||
#ifndef ESP_MAC_5
|
||||
#define SLC_MODE 0x00000003
|
||||
#define SLC_MODE_S 12
|
||||
#endif
|
||||
#define SLC_DATA_BURST_EN (BIT(9))
|
||||
#define SLC_DSCR_BURST_EN (BIT(8))
|
||||
#define SLC_RX_NO_RESTART_CLR (BIT(7))
|
||||
#define SLC_RX_AUTO_WRBACK (BIT(6))
|
||||
#define SLC_RX_LOOP_TEST (BIT(5))
|
||||
#define SLC_TX_LOOP_TEST (BIT(4))
|
||||
#define SLC_AHBM_RST (BIT(3))
|
||||
#define SLC_AHBM_FIFO_RST (BIT(2))
|
||||
#define SLC_RXLINK_RST (BIT(1))
|
||||
#define SLC_TXLINK_RST (BIT(0))
|
||||
|
||||
#define SLC_INT_RAW (REG_SLC_BASE + 0x4)
|
||||
#define SLC_TX_DSCR_EMPTY_INT_RAW (BIT(21))
|
||||
#define SLC_RX_DSCR_ERR_INT_RAW (BIT(20))
|
||||
#define SLC_TX_DSCR_ERR_INT_RAW (BIT(19))
|
||||
#define SLC_TOHOST_INT_RAW (BIT(18))
|
||||
#define SLC_RX_EOF_INT_RAW (BIT(17))
|
||||
#define SLC_RX_DONE_INT_RAW (BIT(16))
|
||||
#define SLC_TX_EOF_INT_RAW (BIT(15))
|
||||
#define SLC_TX_DONE_INT_RAW (BIT(14))
|
||||
#define SLC_TOKEN1_1TO0_INT_RAW (BIT(13))
|
||||
#define SLC_TOKEN0_1TO0_INT_RAW (BIT(12))
|
||||
#define SLC_TX_OVF_INT_RAW (BIT(11))
|
||||
#define SLC_RX_UDF_INT_RAW (BIT(10))
|
||||
#define SLC_TX_START_INT_RAW (BIT(9))
|
||||
#define SLC_RX_START_INT_RAW (BIT(8))
|
||||
#define SLC_FRHOST_BIT7_INT_RAW (BIT(7))
|
||||
#define SLC_FRHOST_BIT6_INT_RAW (BIT(6))
|
||||
#define SLC_FRHOST_BIT5_INT_RAW (BIT(5))
|
||||
#define SLC_FRHOST_BIT4_INT_RAW (BIT(4))
|
||||
#define SLC_FRHOST_BIT3_INT_RAW (BIT(3))
|
||||
#define SLC_FRHOST_BIT2_INT_RAW (BIT(2))
|
||||
#define SLC_FRHOST_BIT1_INT_RAW (BIT(1))
|
||||
#define SLC_FRHOST_BIT0_INT_RAW (BIT(0))
|
||||
|
||||
#define SLC_INT_STATUS (REG_SLC_BASE + 0x8)
|
||||
#define SLC_TX_DSCR_EMPTY_INT_ST (BIT(21))
|
||||
#define SLC_RX_DSCR_ERR_INT_ST (BIT(20))
|
||||
#define SLC_TX_DSCR_ERR_INT_ST (BIT(19))
|
||||
#define SLC_TOHOST_INT_ST (BIT(18))
|
||||
#define SLC_RX_EOF_INT_ST (BIT(17))
|
||||
#define SLC_RX_DONE_INT_ST (BIT(16))
|
||||
#define SLC_TX_EOF_INT_ST (BIT(15))
|
||||
#define SLC_TX_DONE_INT_ST (BIT(14))
|
||||
#define SLC_TOKEN1_1TO0_INT_ST (BIT(13))
|
||||
#define SLC_TOKEN0_1TO0_INT_ST (BIT(12))
|
||||
#define SLC_TX_OVF_INT_ST (BIT(11))
|
||||
#define SLC_RX_UDF_INT_ST (BIT(10))
|
||||
#define SLC_TX_START_INT_ST (BIT(9))
|
||||
#define SLC_RX_START_INT_ST (BIT(8))
|
||||
#define SLC_FRHOST_BIT7_INT_ST (BIT(7))
|
||||
#define SLC_FRHOST_BIT6_INT_ST (BIT(6))
|
||||
#define SLC_FRHOST_BIT5_INT_ST (BIT(5))
|
||||
#define SLC_FRHOST_BIT4_INT_ST (BIT(4))
|
||||
#define SLC_FRHOST_BIT3_INT_ST (BIT(3))
|
||||
#define SLC_FRHOST_BIT2_INT_ST (BIT(2))
|
||||
#define SLC_FRHOST_BIT1_INT_ST (BIT(1))
|
||||
#define SLC_FRHOST_BIT0_INT_ST (BIT(0))
|
||||
|
||||
#define SLC_INT_ENA (REG_SLC_BASE + 0xC)
|
||||
#define SLC_TX_DSCR_EMPTY_INT_ENA (BIT(21))
|
||||
#define SLC_RX_DSCR_ERR_INT_ENA (BIT(20))
|
||||
#define SLC_TX_DSCR_ERR_INT_ENA (BIT(19))
|
||||
#define SLC_TOHOST_INT_ENA (BIT(18))
|
||||
#define SLC_RX_EOF_INT_ENA (BIT(17))
|
||||
#define SLC_RX_DONE_INT_ENA (BIT(16))
|
||||
#define SLC_TX_EOF_INT_ENA (BIT(15))
|
||||
#define SLC_TX_DONE_INT_ENA (BIT(14))
|
||||
#define SLC_TOKEN1_1TO0_INT_ENA (BIT(13))
|
||||
#define SLC_TOKEN0_1TO0_INT_ENA (BIT(12))
|
||||
#define SLC_TX_OVF_INT_ENA (BIT(11))
|
||||
#define SLC_RX_UDF_INT_ENA (BIT(10))
|
||||
#define SLC_TX_START_INT_ENA (BIT(9))
|
||||
#define SLC_RX_START_INT_ENA (BIT(8))
|
||||
#define SLC_FRHOST_BIT7_INT_ENA (BIT(7))
|
||||
#define SLC_FRHOST_BIT6_INT_ENA (BIT(6))
|
||||
#define SLC_FRHOST_BIT5_INT_ENA (BIT(5))
|
||||
#define SLC_FRHOST_BIT4_INT_ENA (BIT(4))
|
||||
#define SLC_FRHOST_BIT3_INT_ENA (BIT(3))
|
||||
#define SLC_FRHOST_BIT2_INT_ENA (BIT(2))
|
||||
#define SLC_FRHOST_BIT1_INT_ENA (BIT(1))
|
||||
#define SLC_FRHOST_BIT0_INT_ENA (BIT(0))
|
||||
|
||||
#define SLC_FRHOST_BIT_INT_ENA_ALL 0xff
|
||||
|
||||
#define SLC_INT_CLR (REG_SLC_BASE + 0x10)
|
||||
#define SLC_TX_DSCR_EMPTY_INT_CLR (BIT(21))
|
||||
#define SLC_RX_DSCR_ERR_INT_CLR (BIT(20))
|
||||
#define SLC_TX_DSCR_ERR_INT_CLR (BIT(19))
|
||||
#define SLC_TOHOST_INT_CLR (BIT(18))
|
||||
#define SLC_RX_EOF_INT_CLR (BIT(17))
|
||||
#define SLC_RX_DONE_INT_CLR (BIT(16))
|
||||
#define SLC_TX_EOF_INT_CLR (BIT(15))
|
||||
#define SLC_TX_DONE_INT_CLR (BIT(14))
|
||||
#define SLC_TOKEN1_1TO0_INT_CLR (BIT(13))
|
||||
#define SLC_TOKEN0_1TO0_INT_CLR (BIT(12))
|
||||
#define SLC_TX_OVF_INT_CLR (BIT(11))
|
||||
#define SLC_RX_UDF_INT_CLR (BIT(10))
|
||||
#define SLC_TX_START_INT_CLR (BIT(9))
|
||||
#define SLC_RX_START_INT_CLR (BIT(8))
|
||||
#define SLC_FRHOST_BIT7_INT_CLR (BIT(7))
|
||||
#define SLC_FRHOST_BIT6_INT_CLR (BIT(6))
|
||||
#define SLC_FRHOST_BIT5_INT_CLR (BIT(5))
|
||||
#define SLC_FRHOST_BIT4_INT_CLR (BIT(4))
|
||||
#define SLC_FRHOST_BIT3_INT_CLR (BIT(3))
|
||||
#define SLC_FRHOST_BIT2_INT_CLR (BIT(2))
|
||||
#define SLC_FRHOST_BIT1_INT_CLR (BIT(1))
|
||||
#define SLC_FRHOST_BIT0_INT_CLR (BIT(0))
|
||||
|
||||
#define SLC_RX_STATUS (REG_SLC_BASE + 0x14)
|
||||
#define SLC_RX_EMPTY (BIT(1))
|
||||
#define SLC_RX_FULL (BIT(0))
|
||||
|
||||
#define SLC_RX_FIFO_PUSH (REG_SLC_BASE + 0x18)
|
||||
#define SLC_RXFIFO_PUSH (BIT(16))
|
||||
#define SLC_RXFIFO_WDATA 0x000001FF
|
||||
#define SLC_RXFIFO_WDATA_S 0
|
||||
|
||||
#define SLC_TX_STATUS (REG_SLC_BASE + 0x1C)
|
||||
#define SLC_TX_EMPTY (BIT(1))
|
||||
#define SLC_TX_FULL (BIT(0))
|
||||
|
||||
#define SLC_TX_FIFO_POP (REG_SLC_BASE + 0x20)
|
||||
#define SLC_TXFIFO_POP (BIT(16))
|
||||
#define SLC_TXFIFO_RDATA 0x000007FF
|
||||
#define SLC_TXFIFO_RDATA_S 0
|
||||
|
||||
#define SLC_RX_LINK (REG_SLC_BASE + 0x24)
|
||||
#define SLC_RXLINK_PARK (BIT(31))
|
||||
#define SLC_RXLINK_RESTART (BIT(30))
|
||||
#define SLC_RXLINK_START (BIT(29))
|
||||
#define SLC_RXLINK_STOP (BIT(28))
|
||||
#define SLC_RXLINK_DESCADDR_MASK 0x000FFFFF
|
||||
#define SLC_RXLINK_ADDR_S 0
|
||||
|
||||
#define SLC_TX_LINK (REG_SLC_BASE + 0x28)
|
||||
#define SLC_TXLINK_PARK (BIT(31))
|
||||
#define SLC_TXLINK_RESTART (BIT(30))
|
||||
#define SLC_TXLINK_START (BIT(29))
|
||||
#define SLC_TXLINK_STOP (BIT(28))
|
||||
#define SLC_TXLINK_DESCADDR_MASK 0x000FFFFF
|
||||
#define SLC_TXLINK_ADDR_S 0
|
||||
|
||||
#define SLC_INTVEC_TOHOST (REG_SLC_BASE + 0x2C)
|
||||
#define SLC_TOHOST_INTVEC 0x000000FF
|
||||
#define SLC_TOHOST_INTVEC_S 0
|
||||
|
||||
#define SLC_TOKEN0 (REG_SLC_BASE + 0x30)
|
||||
#define SLC_TOKEN0_MASK 0x00000FFF
|
||||
#define SLC_TOKEN0_S 16
|
||||
#define SLC_TOKEN0_LOCAL_INC_MORE (BIT(14))
|
||||
#define SLC_TOKEN0_LOCAL_INC (BIT(13))
|
||||
#define SLC_TOKEN0_LOCAL_WR (BIT(12))
|
||||
#define SLC_TOKEN0_LOCAL_WDATA_MASK 0x00000FFF
|
||||
#define SLC_TOKEN0_LOCAL_WDATA_S 0
|
||||
|
||||
#define SLC_TOKEN1 (REG_SLC_BASE + 0x34)
|
||||
#define SLC_TOKEN1_MASK 0x00000FFF
|
||||
#define SLC_TOKEN1_S 16
|
||||
#define SLC_TOKEN1_LOCAL_INC_MORE (BIT(14))
|
||||
#define SLC_TOKEN1_LOCAL_INC (BIT(13))
|
||||
#define SLC_TOKEN1_LOCAL_WR (BIT(12))
|
||||
#define SLC_TOKEN1_LOCAL_WDATA 0x00000FFF
|
||||
#define SLC_TOKEN1_LOCAL_WDATA_S 0
|
||||
|
||||
#define SLC_CONF1 (REG_SLC_BASE + 0x38)
|
||||
#define SLC_STATE0 (REG_SLC_BASE + 0x3C)
|
||||
#define SLC_STATE1 (REG_SLC_BASE + 0x40)
|
||||
|
||||
#define SLC_BRIDGE_CONF (REG_SLC_BASE + 0x44)
|
||||
#ifndef ESP_MAC_5
|
||||
#define SLC_TX_PUSH_IDLE_NUM 0x0000FFFF
|
||||
#define SLC_TX_PUSH_IDLE_NUM_S 16
|
||||
#define SLC_TX_DUMMY_MODE (BIT(12))
|
||||
#endif
|
||||
#define SLC_FIFO_MAP_ENA 0x0000000F
|
||||
#define SLC_FIFO_MAP_ENA_S 8
|
||||
#define SLC_TXEOF_ENA 0x0000003F
|
||||
#define SLC_TXEOF_ENA_S 0
|
||||
|
||||
#define SLC_RX_EOF_DES_ADDR (REG_SLC_BASE + 0x48)
|
||||
#define SLC_TX_EOF_DES_ADDR (REG_SLC_BASE + 0x4C)
|
||||
#define SLC_FROM_HOST_LAST_DESC SLC_TX_EOF_DES_ADDR
|
||||
#define SLC_TO_HOST_LAST_DESC SLC_RX_EOF_DES_ADDR
|
||||
|
||||
#define SLC_RX_EOF_BFR_DES_ADDR (REG_SLC_BASE + 0x50)
|
||||
#define SLC_AHB_TEST (REG_SLC_BASE + 0x54)
|
||||
#define SLC_AHB_TESTADDR 0x00000003
|
||||
#define SLC_AHB_TESTADDR_S 4
|
||||
#define SLC_AHB_TESTMODE 0x00000007
|
||||
#define SLC_AHB_TESTMODE_S 0
|
||||
|
||||
#define SLC_SDIO_ST (REG_SLC_BASE + 0x58)
|
||||
#define SLC_BUS_ST 0x00000007
|
||||
#define SLC_BUS_ST_S 12
|
||||
#define SLC_SDIO_WAKEUP (BIT(8))
|
||||
#define SLC_FUNC_ST 0x0000000F
|
||||
#define SLC_FUNC_ST_S 4
|
||||
#define SLC_CMD_ST 0x00000007
|
||||
#define SLC_CMD_ST_S 0
|
||||
|
||||
#define SLC_RX_DSCR_CONF (REG_SLC_BASE + 0x5C)
|
||||
#ifdef ESP_MAC_5
|
||||
#define SLC_INFOR_NO_REPLACE (BIT(9))
|
||||
#define SLC_TOKEN_NO_REPLACE (BIT(8))
|
||||
#define SLC_POP_IDLE_CNT 0x000000FF
|
||||
#else
|
||||
#define SLC_RX_FILL_EN (BIT(20))
|
||||
#define SLC_RX_EOF_MODE (BIT(19))
|
||||
#define SLC_RX_FILL_MODE (BIT(18))
|
||||
#define SLC_INFOR_NO_REPLACE (BIT(17))
|
||||
#define SLC_TOKEN_NO_REPLACE (BIT(16))
|
||||
#define SLC_POP_IDLE_CNT 0x0000FFFF
|
||||
#endif
|
||||
#define SLC_POP_IDLE_CNT_S 0
|
||||
|
||||
#define SLC_TXLINK_DSCR (REG_SLC_BASE + 0x60)
|
||||
#define SLC_TXLINK_DSCR_BF0 (REG_SLC_BASE + 0x64)
|
||||
#define SLC_TXLINK_DSCR_BF1 (REG_SLC_BASE + 0x68)
|
||||
#define SLC_RXLINK_DSCR (REG_SLC_BASE + 0x6C)
|
||||
#define SLC_RXLINK_DSCR_BF0 (REG_SLC_BASE + 0x70)
|
||||
#define SLC_RXLINK_DSCR_BF1 (REG_SLC_BASE + 0x74)
|
||||
#define SLC_DATE (REG_SLC_BASE + 0x78)
|
||||
#define SLC_ID (REG_SLC_BASE + 0x7C)
|
||||
|
||||
#define SLC_HOST_CONF_W0 (REG_SLC_BASE + 0x80 + 0x14)
|
||||
#define SLC_HOST_CONF_W1 (REG_SLC_BASE + 0x80 + 0x18)
|
||||
#define SLC_HOST_CONF_W2 (REG_SLC_BASE + 0x80 + 0x20)
|
||||
#define SLC_HOST_CONF_W3 (REG_SLC_BASE + 0x80 + 0x24)
|
||||
#define SLC_HOST_CONF_W4 (REG_SLC_BASE + 0x80 + 0x28)
|
||||
|
||||
#define SLC_HOST_INTR_ST (REG_SLC_BASE + 0x80 + 0x1c)
|
||||
#define SLC_HOST_INTR_CLR (REG_SLC_BASE + 0x80 + 0x30)
|
||||
#define SLC_HOST_INTR_SOF_BIT (BIT(12))
|
||||
|
||||
#define SLC_HOST_INTR_ENA (REG_SLC_BASE + 0x80 + 0x34)
|
||||
#define SLC_RX_NEW_PACKET_INT_ENA (BIT23)
|
||||
#define SLC_HOST_TOHOST_BIT0_INT_ENA (BIT0)
|
||||
#define SLC_HOST_CONF_W5 (REG_SLC_BASE + 0x80 + 0x3C)
|
||||
#define SLC_HOST_INTR_RAW (REG_SLC_BASE + 0x80 + 0x8)
|
||||
#define SLC_HOST_INTR_ENA_BIT (BIT(23))
|
||||
//[15:12]: 0x3ff9xxxx -- 0b01 from_host
|
||||
// 0x3ffaxxxx -- 0b10 general
|
||||
// 0x3ffbxxxx -- 0b11 to_host
|
||||
#define SLC_DATA_ADDR_CLEAR_MASK (~(0xf<<12))
|
||||
#define SLC_FROM_HOST_ADDR_MASK (0x1<<12)
|
||||
#define SLC_TO_HOST_ADDR_MASK (0x3<<12)
|
||||
|
||||
#define SLC_SET_FROM_HOST_ADDR_MASK(v) do { \
|
||||
(v) &= SLC_DATA_ADDR_CLEAR_MASK; \
|
||||
(v) |= SLC_FROM_HOST_ADDR_MASK; \
|
||||
} while(0);
|
||||
|
||||
#define SLC_SET_TO_HOST_ADDR_MASK(v) do { \
|
||||
(v) &= SLC_DATA_ADDR_CLEAR_MASK; \
|
||||
(v) |= SLC_TO_HOST_ADDR_MASK; \
|
||||
} while(0);
|
||||
|
||||
|
||||
#define SLC_TX_DESC_DEBUG_REG 0x3ff0002c //[15:0] set to 0xcccc
|
||||
|
||||
#define SLC_INTEREST_EVENT (SLC_TX_EOF_INT_ENA | SLC_RX_EOF_INT_ENA | SLC_RX_UDF_INT_ENA | SLC_TX_DSCR_ERR_INT_ENA)
|
||||
#define TRIG_TOHOST_INT() SET_PERI_REG_MASK(SLC_INTVEC_TOHOST , BIT0); CLEAR_PERI_REG_MASK(SLC_INTVEC_TOHOST , BIT0)
|
||||
|
||||
|
||||
#endif // SLC_REGISTER_H_INCLUDED
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (C) 2015 -2018 Espressif System
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __SMARTCONFIG_H__
|
||||
#define __SMARTCONFIG_H__
|
||||
|
||||
typedef enum {
|
||||
SC_STATUS_WAIT = 0,
|
||||
SC_STATUS_FIND_CHANNEL,
|
||||
SC_STATUS_GETTING_SSID_PSWD,
|
||||
SC_STATUS_LINK,
|
||||
SC_STATUS_LINK_OVER,
|
||||
} sc_status;
|
||||
|
||||
typedef enum {
|
||||
SC_TYPE_ESPTOUCH = 0,
|
||||
SC_TYPE_AIRKISS,
|
||||
SC_TYPE_ESPTOUCH_AIRKISS,
|
||||
} sc_type;
|
||||
|
||||
typedef void (*sc_callback_t)(sc_status status, void *pdata);
|
||||
|
||||
const char *smartconfig_get_version(void);
|
||||
bool smartconfig_start(sc_callback_t cb, ...);
|
||||
bool smartconfig_stop(void);
|
||||
bool esptouch_set_timeout(uint8 time_s); //15s~255s, offset:45s
|
||||
bool smartconfig_set_type(sc_type type);
|
||||
|
||||
#endif
|
||||
Executable
+68
@@ -0,0 +1,68 @@
|
||||
#ifndef __SNTP_H__
|
||||
#define __SNTP_H__
|
||||
|
||||
#include "os_type.h"
|
||||
#ifdef LWIP_OPEN_SRC
|
||||
#include "lwip/ip_addr.h"
|
||||
#else
|
||||
#include "ip_addr.h"
|
||||
#endif
|
||||
/**
|
||||
* get the seconds since Jan 01, 1970, 00:00 (GMT + 8)
|
||||
*/
|
||||
uint32 sntp_get_current_timestamp();
|
||||
/**
|
||||
* get real time (GTM + 8 time zone)
|
||||
*/
|
||||
char* sntp_get_real_time(long t);
|
||||
/**
|
||||
* SNTP get time_zone default GMT + 8
|
||||
*/
|
||||
sint8 sntp_get_timezone(void);
|
||||
/**
|
||||
* SNTP set time_zone (default GMT + 8)
|
||||
*/
|
||||
bool sntp_set_timezone(sint8 timezone);
|
||||
/**
|
||||
* Initialize this module.
|
||||
* Send out request instantly or after SNTP_STARTUP_DELAY(_FUNC).
|
||||
*/
|
||||
void sntp_init(void);
|
||||
/**
|
||||
* Stop this module.
|
||||
*/
|
||||
void sntp_stop(void);
|
||||
/**
|
||||
* Initialize one of the NTP servers by IP address
|
||||
*
|
||||
* @param numdns the index of the NTP server to set must be < SNTP_MAX_SERVERS
|
||||
* @param dnsserver IP address of the NTP server to set
|
||||
*/
|
||||
void sntp_setserver(unsigned char idx, ip_addr_t *addr);
|
||||
/**
|
||||
* Obtain one of the currently configured by IP address (or DHCP) NTP servers
|
||||
*
|
||||
* @param numdns the index of the NTP server
|
||||
* @return IP address of the indexed NTP server or "ip_addr_any" if the NTP
|
||||
* server has not been configured by address (or at all).
|
||||
*/
|
||||
ip_addr_t sntp_getserver(unsigned char idx);
|
||||
/**
|
||||
* Initialize one of the NTP servers by name
|
||||
*
|
||||
* @param numdns the index of the NTP server to set must be < SNTP_MAX_SERVERS,now sdk support SNTP_MAX_SERVERS = 3
|
||||
* @param dnsserver DNS name of the NTP server to set, to be resolved at contact time
|
||||
*/
|
||||
void sntp_setservername(unsigned char idx, char *server);
|
||||
/**
|
||||
* Obtain one of the currently configured by name NTP servers.
|
||||
*
|
||||
* @param numdns the index of the NTP server
|
||||
* @return IP address of the indexed NTP server or NULL if the NTP
|
||||
* server has not been configured by name (or at all)
|
||||
*/
|
||||
char *sntp_getservername(unsigned char idx);
|
||||
|
||||
#define sntp_servermode_dhcp(x)
|
||||
|
||||
#endif
|
||||
Executable
+41
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* copyright (c) Espressif System 2010
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SPI_FLASH_H
|
||||
#define SPI_FLASH_H
|
||||
|
||||
#include <c_types.h>
|
||||
|
||||
typedef enum {
|
||||
SPI_FLASH_RESULT_OK,
|
||||
SPI_FLASH_RESULT_ERR,
|
||||
SPI_FLASH_RESULT_TIMEOUT
|
||||
} SpiFlashOpResult;
|
||||
|
||||
typedef struct{
|
||||
uint32 deviceId;
|
||||
uint32 chip_size; // chip size in byte
|
||||
uint32 block_size;
|
||||
uint32 sector_size;
|
||||
uint32 page_size;
|
||||
uint32 status_mask;
|
||||
} SpiFlashChip;
|
||||
|
||||
#define SPI_FLASH_SEC_SIZE 4096
|
||||
|
||||
uint32 spi_flash_get_id(void);
|
||||
SpiFlashOpResult spi_flash_erase_sector(uint16 sec);
|
||||
SpiFlashOpResult spi_flash_write(uint32 des_addr, uint32 *src_addr, uint32 size);
|
||||
SpiFlashOpResult spi_flash_read(uint32 src_addr, uint32 *des_addr, uint32 size);
|
||||
|
||||
typedef SpiFlashOpResult (* user_spi_flash_read)(
|
||||
SpiFlashChip *spi,
|
||||
uint32 src_addr,
|
||||
uint32 *des_addr,
|
||||
uint32 size);
|
||||
|
||||
void spi_flash_set_read_func(user_spi_flash_read read);
|
||||
|
||||
#endif
|
||||
Executable
+202
@@ -0,0 +1,202 @@
|
||||
/*
|
||||
* Copyright (c) 2010 - 2011 Espressif System
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SPI_REGISTER_H_INCLUDED
|
||||
#define SPI_REGISTER_H_INCLUDED
|
||||
|
||||
#define REG_SPI_BASE(i) (0x60000200-i*0x100)
|
||||
#define SPI_CMD(i) (REG_SPI_BASE(i) + 0x0)
|
||||
|
||||
#define SPI_FLASH_READ BIT31
|
||||
#define SPI_FLASH_WREN BIT30
|
||||
#define SPI_FLASH_WRDI BIT29
|
||||
#define SPI_FLASH_RDID BIT28
|
||||
#define SPI_FLASH_RDSR BIT27
|
||||
#define SPI_FLASH_WRSR BIT26
|
||||
#define SPI_FLASH_PP BIT25
|
||||
#define SPI_FLASH_SE BIT24
|
||||
#define SPI_FLASH_BE BIT23
|
||||
#define SPI_FLASH_CE BIT22
|
||||
#define SPI_FLASH_RES BIT20
|
||||
|
||||
#define SPI_USR (BIT(18))
|
||||
|
||||
#define SPI_ADDR(i) (REG_SPI_BASE(i) + 0x4)
|
||||
|
||||
#define SPI_CTRL(i) (REG_SPI_BASE(i) + 0x8)
|
||||
#define SPI_WR_BIT_ORDER (BIT(26))
|
||||
#define SPI_RD_BIT_ORDER (BIT(25))
|
||||
#define SPI_QIO_MODE (BIT(24))
|
||||
#define SPI_DIO_MODE (BIT(23))
|
||||
#define SPI_QOUT_MODE (BIT(20))
|
||||
#define SPI_DOUT_MODE (BIT(14))
|
||||
#define SPI_FASTRD_MODE (BIT(13))
|
||||
|
||||
#define SPI_CTRL1(i) (REG_SPI_BASE(i) + 0xc)
|
||||
#define SPI_CS_HOLD_DELAY 0xf
|
||||
#define SPI_CS_HOLD_DELAY_S 28
|
||||
#define SPI_CS_HOLD_DELAY_RES 0xfff
|
||||
#define SPI_CS_HOLD_DELAY_RES_S 16
|
||||
|
||||
|
||||
#define SPI_RD_STATUS(i) (REG_SPI_BASE(i) + 0x10)
|
||||
|
||||
#define SPI_CTRL2(i) (REG_SPI_BASE(i) + 0x14)
|
||||
|
||||
#define SPI_CS_DELAY_NUM 0x0000000F
|
||||
#define SPI_CS_DELAY_NUM_S 28
|
||||
#define SPI_CS_DELAY_MODE 0x00000003
|
||||
#define SPI_CS_DELAY_MODE_S 26
|
||||
#define SPI_MOSI_DELAY_NUM 0x00000007
|
||||
#define SPI_MOSI_DELAY_NUM_S 23
|
||||
#define SPI_MOSI_DELAY_MODE 0x00000003
|
||||
#define SPI_MOSI_DELAY_MODE_S 21
|
||||
#define SPI_MISO_DELAY_NUM 0x00000007
|
||||
#define SPI_MISO_DELAY_NUM_S 18
|
||||
#define SPI_MISO_DELAY_MODE 0x00000003
|
||||
#define SPI_MISO_DELAY_MODE_S 16
|
||||
#define SPI_CLOCK(i) (REG_SPI_BASE(i) + 0x18)
|
||||
#define SPI_CLK_EQU_SYSCLK (BIT(31))
|
||||
#define SPI_CLKDIV_PRE 0x00001FFF
|
||||
#define SPI_CLKDIV_PRE_S 18
|
||||
#define SPI_CLKCNT_N 0x0000003F
|
||||
#define SPI_CLKCNT_N_S 12
|
||||
#define SPI_CLKCNT_H 0x0000003F
|
||||
#define SPI_CLKCNT_H_S 6
|
||||
#define SPI_CLKCNT_L 0x0000003F
|
||||
#define SPI_CLKCNT_L_S 0
|
||||
|
||||
#define SPI_USER(i) (REG_SPI_BASE(i) + 0x1C)
|
||||
#define SPI_USR_COMMAND (BIT(31))
|
||||
#define SPI_USR_ADDR (BIT(30))
|
||||
#define SPI_USR_DUMMY (BIT(29))
|
||||
#define SPI_USR_MISO (BIT(28))
|
||||
#define SPI_USR_MOSI (BIT(27))
|
||||
|
||||
#define SPI_USR_MOSI_HIGHPART (BIT(25))
|
||||
#define SPI_USR_MISO_HIGHPART (BIT(24))
|
||||
|
||||
|
||||
#define SPI_SIO (BIT(16))
|
||||
#define SPI_FWRITE_QIO (BIT(15))
|
||||
#define SPI_FWRITE_DIO (BIT(14))
|
||||
#define SPI_FWRITE_QUAD (BIT(13))
|
||||
#define SPI_FWRITE_DUAL (BIT(12))
|
||||
#define SPI_WR_BYTE_ORDER (BIT(11))
|
||||
#define SPI_RD_BYTE_ORDER (BIT(10))
|
||||
#define SPI_CK_OUT_EDGE (BIT(7))
|
||||
#define SPI_CK_I_EDGE (BIT(6))
|
||||
#define SPI_CS_SETUP (BIT(5))
|
||||
#define SPI_CS_HOLD (BIT(4))
|
||||
#define SPI_FLASH_MODE (BIT(2))
|
||||
|
||||
#define SPI_USER1(i) (REG_SPI_BASE(i) + 0x20)
|
||||
#define SPI_USR_ADDR_BITLEN 0x0000003F
|
||||
#define SPI_USR_ADDR_BITLEN_S 26
|
||||
#define SPI_USR_MOSI_BITLEN 0x000001FF
|
||||
#define SPI_USR_MOSI_BITLEN_S 17
|
||||
#define SPI_USR_MISO_BITLEN 0x000001FF
|
||||
#define SPI_USR_MISO_BITLEN_S 8
|
||||
|
||||
#define SPI_USR_DUMMY_CYCLELEN 0x000000FF
|
||||
#define SPI_USR_DUMMY_CYCLELEN_S 0
|
||||
|
||||
#define SPI_USER2(i) (REG_SPI_BASE(i) + 0x24)
|
||||
#define SPI_USR_COMMAND_BITLEN 0x0000000F
|
||||
#define SPI_USR_COMMAND_BITLEN_S 28
|
||||
#define SPI_USR_COMMAND_VALUE 0x0000FFFF
|
||||
#define SPI_USR_COMMAND_VALUE_S 0
|
||||
|
||||
#define SPI_WR_STATUS(i) (REG_SPI_BASE(i) + 0x28)
|
||||
#define SPI_PIN(i) (REG_SPI_BASE(i) + 0x2C)
|
||||
#define SPI_CS2_DIS (BIT(2))
|
||||
#define SPI_CS1_DIS (BIT(1))
|
||||
#define SPI_CS0_DIS (BIT(0))
|
||||
|
||||
#define SPI_SLAVE(i) (REG_SPI_BASE(i) + 0x30)
|
||||
#define SPI_SYNC_RESET (BIT(31))
|
||||
#define SPI_SLAVE_MODE (BIT(30))
|
||||
#define SPI_SLV_WR_RD_BUF_EN (BIT(29))
|
||||
#define SPI_SLV_WR_RD_STA_EN (BIT(28))
|
||||
#define SPI_SLV_CMD_DEFINE (BIT(27))
|
||||
#define SPI_TRANS_CNT 0x0000000F
|
||||
#define SPI_TRANS_CNT_S 23
|
||||
#define SPI_TRANS_DONE_EN (BIT(9))
|
||||
#define SPI_SLV_WR_STA_DONE_EN (BIT(8))
|
||||
#define SPI_SLV_RD_STA_DONE_EN (BIT(7))
|
||||
#define SPI_SLV_WR_BUF_DONE_EN (BIT(6))
|
||||
#define SPI_SLV_RD_BUF_DONE_EN (BIT(5))
|
||||
|
||||
|
||||
|
||||
#define SLV_SPI_INT_EN 0x0000001f
|
||||
#define SLV_SPI_INT_EN_S 5
|
||||
|
||||
#define SPI_TRANS_DONE (BIT(4))
|
||||
#define SPI_SLV_WR_STA_DONE (BIT(3))
|
||||
#define SPI_SLV_RD_STA_DONE (BIT(2))
|
||||
#define SPI_SLV_WR_BUF_DONE (BIT(1))
|
||||
#define SPI_SLV_RD_BUF_DONE (BIT(0))
|
||||
|
||||
#define SPI_SLAVE1(i) (REG_SPI_BASE(i) + 0x34)
|
||||
#define SPI_SLV_STATUS_BITLEN 0x0000001F
|
||||
#define SPI_SLV_STATUS_BITLEN_S 27
|
||||
#define SPI_SLV_BUF_BITLEN 0x000001FF
|
||||
#define SPI_SLV_BUF_BITLEN_S 16
|
||||
#define SPI_SLV_RD_ADDR_BITLEN 0x0000003F
|
||||
#define SPI_SLV_RD_ADDR_BITLEN_S 10
|
||||
#define SPI_SLV_WR_ADDR_BITLEN 0x0000003F
|
||||
#define SPI_SLV_WR_ADDR_BITLEN_S 4
|
||||
|
||||
#define SPI_SLV_WRSTA_DUMMY_EN (BIT(3))
|
||||
#define SPI_SLV_RDSTA_DUMMY_EN (BIT(2))
|
||||
#define SPI_SLV_WRBUF_DUMMY_EN (BIT(1))
|
||||
#define SPI_SLV_RDBUF_DUMMY_EN (BIT(0))
|
||||
|
||||
|
||||
|
||||
#define SPI_SLAVE2(i) (REG_SPI_BASE(i) + 0x38)
|
||||
#define SPI_SLV_WRBUF_DUMMY_CYCLELEN 0X000000FF
|
||||
#define SPI_SLV_WRBUF_DUMMY_CYCLELEN_S 24
|
||||
#define SPI_SLV_RDBUF_DUMMY_CYCLELEN 0X000000FF
|
||||
#define SPI_SLV_RDBUF_DUMMY_CYCLELEN_S 16
|
||||
#define SPI_SLV_WRSTR_DUMMY_CYCLELEN 0X000000FF
|
||||
#define SPI_SLV_WRSTR_DUMMY_CYCLELEN_S 8
|
||||
#define SPI_SLV_RDSTR_DUMMY_CYCLELEN 0x000000FF
|
||||
#define SPI_SLV_RDSTR_DUMMY_CYCLELEN_S 0
|
||||
|
||||
#define SPI_SLAVE3(i) (REG_SPI_BASE(i) + 0x3C)
|
||||
#define SPI_SLV_WRSTA_CMD_VALUE 0x000000FF
|
||||
#define SPI_SLV_WRSTA_CMD_VALUE_S 24
|
||||
#define SPI_SLV_RDSTA_CMD_VALUE 0x000000FF
|
||||
#define SPI_SLV_RDSTA_CMD_VALUE_S 16
|
||||
#define SPI_SLV_WRBUF_CMD_VALUE 0x000000FF
|
||||
#define SPI_SLV_WRBUF_CMD_VALUE_S 8
|
||||
#define SPI_SLV_RDBUF_CMD_VALUE 0x000000FF
|
||||
#define SPI_SLV_RDBUF_CMD_VALUE_S 0
|
||||
|
||||
#define SPI_W0(i) (REG_SPI_BASE(i) +0x40)
|
||||
#define SPI_W1(i) (REG_SPI_BASE(i) +0x44)
|
||||
#define SPI_W2(i) (REG_SPI_BASE(i) +0x48)
|
||||
#define SPI_W3(i) (REG_SPI_BASE(i) +0x4C)
|
||||
#define SPI_W4(i) (REG_SPI_BASE(i) +0x50)
|
||||
#define SPI_W5(i) (REG_SPI_BASE(i) +0x54)
|
||||
#define SPI_W6(i) (REG_SPI_BASE(i) +0x58)
|
||||
#define SPI_W7(i) (REG_SPI_BASE(i) +0x5C)
|
||||
#define SPI_W8(i) (REG_SPI_BASE(i) +0x60)
|
||||
#define SPI_W9(i) (REG_SPI_BASE(i) +0x64)
|
||||
#define SPI_W10(i) (REG_SPI_BASE(i) +0x68)
|
||||
#define SPI_W11(i) (REG_SPI_BASE(i) +0x6C)
|
||||
#define SPI_W12(i) (REG_SPI_BASE(i) +0x70)
|
||||
#define SPI_W13(i) (REG_SPI_BASE(i) +0x74)
|
||||
#define SPI_W14(i) (REG_SPI_BASE(i) +0x78)
|
||||
#define SPI_W15(i) (REG_SPI_BASE(i) +0x7C)
|
||||
|
||||
#define SPI_EXT2(i) (REG_SPI_BASE(i) + 0xF8)
|
||||
|
||||
#define SPI_EXT3(i) (REG_SPI_BASE(i) + 0xFC)
|
||||
#define SPI_INT_HOLD_ENA 0x00000003
|
||||
#define SPI_INT_HOLD_ENA_S 0
|
||||
#endif // SPI_REGISTER_H_INCLUDED
|
||||
Executable
+163
@@ -0,0 +1,163 @@
|
||||
/*
|
||||
* File : uart_register.h
|
||||
* Copyright (C) 2013 - 2016, Espressif Systems
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of version 3 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2010 - 2011 Espressif System
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef UART_REGISTER_H_
|
||||
#define UART_REGISTER_H_
|
||||
|
||||
#include "c_types.h"
|
||||
|
||||
#define UART_FIFO_LEN 128 //define the tx fifo length
|
||||
|
||||
#define REG_UART_BASE(i) (0x60000000 + (i)*0xf00)
|
||||
//version value:32'h062000
|
||||
|
||||
#define UART_FIFO(i) (REG_UART_BASE(i) + 0x0)
|
||||
#define UART_RXFIFO_RD_BYTE 0x000000FF
|
||||
#define UART_RXFIFO_RD_BYTE_S 0
|
||||
|
||||
#define UART_INT_RAW(i) (REG_UART_BASE(i) + 0x4)
|
||||
#define UART_RXFIFO_TOUT_INT_RAW (BIT(8))
|
||||
#define UART_BRK_DET_INT_RAW (BIT(7))
|
||||
#define UART_CTS_CHG_INT_RAW (BIT(6))
|
||||
#define UART_DSR_CHG_INT_RAW (BIT(5))
|
||||
#define UART_RXFIFO_OVF_INT_RAW (BIT(4))
|
||||
#define UART_FRM_ERR_INT_RAW (BIT(3))
|
||||
#define UART_PARITY_ERR_INT_RAW (BIT(2))
|
||||
#define UART_TXFIFO_EMPTY_INT_RAW (BIT(1))
|
||||
#define UART_RXFIFO_FULL_INT_RAW (BIT(0))
|
||||
|
||||
#define UART_INT_ST(i) (REG_UART_BASE(i) + 0x8)
|
||||
#define UART_RXFIFO_TOUT_INT_ST (BIT(8))
|
||||
#define UART_BRK_DET_INT_ST (BIT(7))
|
||||
#define UART_CTS_CHG_INT_ST (BIT(6))
|
||||
#define UART_DSR_CHG_INT_ST (BIT(5))
|
||||
#define UART_RXFIFO_OVF_INT_ST (BIT(4))
|
||||
#define UART_FRM_ERR_INT_ST (BIT(3))
|
||||
#define UART_PARITY_ERR_INT_ST (BIT(2))
|
||||
#define UART_TXFIFO_EMPTY_INT_ST (BIT(1))
|
||||
#define UART_RXFIFO_FULL_INT_ST (BIT(0))
|
||||
|
||||
#define UART_INT_ENA(i) (REG_UART_BASE(i) + 0xC)
|
||||
#define UART_RXFIFO_TOUT_INT_ENA (BIT(8))
|
||||
#define UART_BRK_DET_INT_ENA (BIT(7))
|
||||
#define UART_CTS_CHG_INT_ENA (BIT(6))
|
||||
#define UART_DSR_CHG_INT_ENA (BIT(5))
|
||||
#define UART_RXFIFO_OVF_INT_ENA (BIT(4))
|
||||
#define UART_FRM_ERR_INT_ENA (BIT(3))
|
||||
#define UART_PARITY_ERR_INT_ENA (BIT(2))
|
||||
#define UART_TXFIFO_EMPTY_INT_ENA (BIT(1))
|
||||
#define UART_RXFIFO_FULL_INT_ENA (BIT(0))
|
||||
|
||||
#define UART_INT_CLR(i) (REG_UART_BASE(i) + 0x10)
|
||||
#define UART_RXFIFO_TOUT_INT_CLR (BIT(8))
|
||||
#define UART_BRK_DET_INT_CLR (BIT(7))
|
||||
#define UART_CTS_CHG_INT_CLR (BIT(6))
|
||||
#define UART_DSR_CHG_INT_CLR (BIT(5))
|
||||
#define UART_RXFIFO_OVF_INT_CLR (BIT(4))
|
||||
#define UART_FRM_ERR_INT_CLR (BIT(3))
|
||||
#define UART_PARITY_ERR_INT_CLR (BIT(2))
|
||||
#define UART_TXFIFO_EMPTY_INT_CLR (BIT(1))
|
||||
#define UART_RXFIFO_FULL_INT_CLR (BIT(0))
|
||||
|
||||
#define UART_CLKDIV(i) (REG_UART_BASE(i) + 0x14)
|
||||
#define UART_CLKDIV_CNT 0x000FFFFF
|
||||
#define UART_CLKDIV_S 0
|
||||
|
||||
#define UART_AUTOBAUD(i) (REG_UART_BASE(i) + 0x18)
|
||||
#define UART_GLITCH_FILT 0x000000FF
|
||||
#define UART_GLITCH_FILT_S 8
|
||||
#define UART_AUTOBAUD_EN (BIT(0))
|
||||
|
||||
#define UART_STATUS(i) (REG_UART_BASE(i) + 0x1C)
|
||||
#define UART_TXD (BIT(31))
|
||||
#define UART_RTSN (BIT(30))
|
||||
#define UART_DTRN (BIT(29))
|
||||
#define UART_TXFIFO_CNT 0x000000FF
|
||||
#define UART_TXFIFO_CNT_S 16
|
||||
#define UART_RXD (BIT(15))
|
||||
#define UART_CTSN (BIT(14))
|
||||
#define UART_DSRN (BIT(13))
|
||||
#define UART_RXFIFO_CNT 0x000000FF
|
||||
#define UART_RXFIFO_CNT_S 0
|
||||
|
||||
#define UART_CONF0(i) (REG_UART_BASE(i) + 0x20)
|
||||
#define UART_DTR_INV (BIT(24))
|
||||
#define UART_RTS_INV (BIT(23))
|
||||
#define UART_TXD_INV (BIT(22))
|
||||
#define UART_DSR_INV (BIT(21))
|
||||
#define UART_CTS_INV (BIT(20))
|
||||
#define UART_RXD_INV (BIT(19))
|
||||
|
||||
#define UART_LINE_INV_MASK UL(0x3f << 19)
|
||||
|
||||
#define UART_TXFIFO_RST (BIT(18))
|
||||
#define UART_RXFIFO_RST (BIT(17))
|
||||
#define UART_IRDA_EN (BIT(16))
|
||||
#define UART_TX_FLOW_EN (BIT(15))
|
||||
#define UART_LOOPBACK (BIT(14))
|
||||
#define UART_IRDA_RX_INV (BIT(13))
|
||||
#define UART_IRDA_TX_INV (BIT(12))
|
||||
#define UART_IRDA_WCTL (BIT(11))
|
||||
#define UART_IRDA_TX_EN (BIT(10))
|
||||
#define UART_IRDA_DPLX (BIT(9))
|
||||
#define UART_TXD_BRK (BIT(8))
|
||||
#define UART_SW_DTR (BIT(7))
|
||||
#define UART_SW_RTS (BIT(6))
|
||||
#define UART_STOP_BIT_NUM 0x00000003
|
||||
#define UART_STOP_BIT_NUM_S 4
|
||||
#define UART_BIT_NUM 0x00000003
|
||||
#define UART_BIT_NUM_S 2
|
||||
#define UART_PARITY_EN (BIT(1))
|
||||
#define UART_PARITY_EN_M 0x00000001
|
||||
#define UART_PARITY_EN_S 1
|
||||
#define UART_PARITY (BIT(0))
|
||||
#define UART_PARITY_M 0x00000001
|
||||
#define UART_PARITY_S 0
|
||||
|
||||
#define UART_CONF1(i) (REG_UART_BASE(i) + 0x24)
|
||||
#define UART_RX_TOUT_EN (BIT(31))
|
||||
#define UART_RX_TOUT_THRHD 0x0000007F
|
||||
#define UART_RX_TOUT_THRHD_S 24
|
||||
#define UART_RX_FLOW_EN (BIT(23))
|
||||
#define UART_RX_FLOW_THRHD 0x0000007F
|
||||
#define UART_RX_FLOW_THRHD_S 16
|
||||
#define UART_TXFIFO_EMPTY_THRHD 0x0000007F
|
||||
#define UART_TXFIFO_EMPTY_THRHD_S 8
|
||||
#define UART_RXFIFO_FULL_THRHD 0x0000007F
|
||||
#define UART_RXFIFO_FULL_THRHD_S 0
|
||||
|
||||
#define UART_LOWPULSE(i) (REG_UART_BASE(i) + 0x28)
|
||||
#define UART_LOWPULSE_MIN_CNT 0x000FFFFF
|
||||
#define UART_LOWPULSE_MIN_CNT_S 0
|
||||
|
||||
#define UART_HIGHPULSE(i) (REG_UART_BASE(i) + 0x2C)
|
||||
#define UART_HIGHPULSE_MIN_CNT 0x000FFFFF
|
||||
#define UART_HIGHPULSE_MIN_CNT_S 0
|
||||
|
||||
#define UART_PULSE_NUM(i) (REG_UART_BASE(i) + 0x30)
|
||||
#define UART_PULSE_NUM_CNT 0x0003FF
|
||||
#define UART_PULSE_NUM_CNT_S 0
|
||||
|
||||
#define UART_DATE(i) (REG_UART_BASE(i) + 0x78)
|
||||
#define UART_ID(i) (REG_UART_BASE(i) + 0x7C)
|
||||
|
||||
#endif // UART_REGISTER_H_INCLUDED
|
||||
|
||||
Executable
+52
@@ -0,0 +1,52 @@
|
||||
#ifndef __UPGRADE_H__
|
||||
#define __UPGRADE_H__
|
||||
|
||||
#include <c_types.h>
|
||||
|
||||
#define SPI_FLASH_SEC_SIZE 4096
|
||||
#define LIMIT_ERASE_SIZE 0x10000
|
||||
|
||||
#define USER_BIN1 0x00
|
||||
#define USER_BIN2 0x01
|
||||
|
||||
#define UPGRADE_FLAG_IDLE 0x00
|
||||
#define UPGRADE_FLAG_START 0x01
|
||||
#define UPGRADE_FLAG_FINISH 0x02
|
||||
|
||||
#define UPGRADE_FW_BIN1 0x00
|
||||
#define UPGRADE_FW_BIN2 0x01
|
||||
|
||||
typedef void (*upgrade_states_check_callback)(void * arg);
|
||||
|
||||
//#define UPGRADE_SSL_ENABLE
|
||||
|
||||
struct upgrade_server_info {
|
||||
uint8 ip[4];
|
||||
uint16 port;
|
||||
|
||||
uint8 upgrade_flag;
|
||||
|
||||
uint8 pre_version[16];
|
||||
uint8 upgrade_version[16];
|
||||
|
||||
uint32 check_times;
|
||||
uint8 *url;
|
||||
|
||||
upgrade_states_check_callback check_cb;
|
||||
struct espconn *pespconn;
|
||||
};
|
||||
|
||||
#define UPGRADE_FLAG_IDLE 0x00
|
||||
#define UPGRADE_FLAG_START 0x01
|
||||
#define UPGRADE_FLAG_FINISH 0x02
|
||||
|
||||
void system_upgrade_init();
|
||||
void system_upgrade_deinit();
|
||||
bool system_upgrade(uint8 *data, uint16 len);
|
||||
|
||||
#ifdef UPGRADE_SSL_ENABLE
|
||||
bool system_upgrade_start_ssl(struct upgrade_server_info *server); // not supported now
|
||||
#else
|
||||
bool system_upgrade_start(struct upgrade_server_info *server);
|
||||
#endif
|
||||
#endif
|
||||
Executable
+2029
File diff suppressed because it is too large
Load Diff
Executable
+211
@@ -0,0 +1,211 @@
|
||||
/* This linker script generated from xt-genldscripts.tpp for LSP . */
|
||||
/* Linker Script for ld -N */
|
||||
MEMORY
|
||||
{
|
||||
dport0_0_seg : org = 0x3FF00000, len = 0x10
|
||||
dram0_0_seg : org = 0x3FFE8000, len = 0x14000
|
||||
iram1_0_seg : org = 0x40100000, len = 0x8000
|
||||
irom0_0_seg : org = 0x40240000, len = 0x3C000
|
||||
}
|
||||
|
||||
PHDRS
|
||||
{
|
||||
dport0_0_phdr PT_LOAD;
|
||||
dram0_0_phdr PT_LOAD;
|
||||
dram0_0_bss_phdr PT_LOAD;
|
||||
iram1_0_phdr PT_LOAD;
|
||||
irom0_0_phdr PT_LOAD;
|
||||
}
|
||||
|
||||
|
||||
/* Default entry point: */
|
||||
ENTRY(call_user_start)
|
||||
EXTERN(_DebugExceptionVector)
|
||||
EXTERN(_DoubleExceptionVector)
|
||||
EXTERN(_KernelExceptionVector)
|
||||
EXTERN(_NMIExceptionVector)
|
||||
EXTERN(_UserExceptionVector)
|
||||
PROVIDE(_memmap_vecbase_reset = 0x40000000);
|
||||
/* Various memory-map dependent cache attribute settings: */
|
||||
_memmap_cacheattr_wb_base = 0x00000110;
|
||||
_memmap_cacheattr_wt_base = 0x00000110;
|
||||
_memmap_cacheattr_bp_base = 0x00000220;
|
||||
_memmap_cacheattr_unused_mask = 0xFFFFF00F;
|
||||
_memmap_cacheattr_wb_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_wba_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_wbna_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_wt_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_bp_trapnull = 0x2222222F;
|
||||
_memmap_cacheattr_wb_strict = 0xFFFFF11F;
|
||||
_memmap_cacheattr_wt_strict = 0xFFFFF11F;
|
||||
_memmap_cacheattr_bp_strict = 0xFFFFF22F;
|
||||
_memmap_cacheattr_wb_allvalid = 0x22222112;
|
||||
_memmap_cacheattr_wt_allvalid = 0x22222112;
|
||||
_memmap_cacheattr_bp_allvalid = 0x22222222;
|
||||
PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wb_trapnull);
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
|
||||
.dport0.rodata : ALIGN(4)
|
||||
{
|
||||
_dport0_rodata_start = ABSOLUTE(.);
|
||||
*(.dport0.rodata)
|
||||
*(.dport.rodata)
|
||||
_dport0_rodata_end = ABSOLUTE(.);
|
||||
} >dport0_0_seg :dport0_0_phdr
|
||||
|
||||
.dport0.literal : ALIGN(4)
|
||||
{
|
||||
_dport0_literal_start = ABSOLUTE(.);
|
||||
*(.dport0.literal)
|
||||
*(.dport.literal)
|
||||
_dport0_literal_end = ABSOLUTE(.);
|
||||
} >dport0_0_seg :dport0_0_phdr
|
||||
|
||||
.dport0.data : ALIGN(4)
|
||||
{
|
||||
_dport0_data_start = ABSOLUTE(.);
|
||||
*(.dport0.data)
|
||||
*(.dport.data)
|
||||
_dport0_data_end = ABSOLUTE(.);
|
||||
} >dport0_0_seg :dport0_0_phdr
|
||||
|
||||
.data : ALIGN(4)
|
||||
{
|
||||
_data_start = ABSOLUTE(.);
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
*(.data1)
|
||||
*(.sdata)
|
||||
*(.sdata.*)
|
||||
*(.gnu.linkonce.s.*)
|
||||
*(.sdata2)
|
||||
*(.sdata2.*)
|
||||
*(.gnu.linkonce.s2.*)
|
||||
*(.jcr)
|
||||
_data_end = ABSOLUTE(.);
|
||||
} >dram0_0_seg :dram0_0_phdr
|
||||
|
||||
.rodata : ALIGN(4)
|
||||
{
|
||||
_rodata_start = ABSOLUTE(.);
|
||||
*(.sdk.version)
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
*(.gnu.linkonce.r.*)
|
||||
*(.rodata1)
|
||||
__XT_EXCEPTION_TABLE__ = ABSOLUTE(.);
|
||||
*(.xt_except_table)
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.e.*)
|
||||
*(.gnu.version_r)
|
||||
*(.eh_frame)
|
||||
/* C++ constructor and destructor tables, properly ordered: */
|
||||
KEEP (*crtbegin.o(.ctors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*(.ctors))
|
||||
KEEP (*crtbegin.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*(.dtors))
|
||||
/* C++ exception handlers table: */
|
||||
__XT_EXCEPTION_DESCS__ = ABSOLUTE(.);
|
||||
*(.xt_except_desc)
|
||||
*(.gnu.linkonce.h.*)
|
||||
__XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
|
||||
*(.xt_except_desc_end)
|
||||
*(.dynamic)
|
||||
*(.gnu.version_d)
|
||||
. = ALIGN(4); /* this table MUST be 4-byte aligned */
|
||||
_bss_table_start = ABSOLUTE(.);
|
||||
LONG(_bss_start)
|
||||
LONG(_bss_end)
|
||||
_bss_table_end = ABSOLUTE(.);
|
||||
_rodata_end = ABSOLUTE(.);
|
||||
} >dram0_0_seg :dram0_0_phdr
|
||||
|
||||
.bss ALIGN(8) (NOLOAD) : ALIGN(4)
|
||||
{
|
||||
. = ALIGN (8);
|
||||
_bss_start = ABSOLUTE(.);
|
||||
*(.dynsbss)
|
||||
*(.sbss)
|
||||
*(.sbss.*)
|
||||
*(.gnu.linkonce.sb.*)
|
||||
*(.scommon)
|
||||
*(.sbss2)
|
||||
*(.sbss2.*)
|
||||
*(.gnu.linkonce.sb2.*)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(.bss.*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
. = ALIGN (8);
|
||||
_bss_end = ABSOLUTE(.);
|
||||
_heap_start = ABSOLUTE(.);
|
||||
/* _stack_sentry = ALIGN(0x8); */
|
||||
} >dram0_0_seg :dram0_0_bss_phdr
|
||||
/* __stack = 0x3ffc8000; */
|
||||
|
||||
.text : ALIGN(4)
|
||||
{
|
||||
_stext = .;
|
||||
_text_start = ABSOLUTE(.);
|
||||
*(.UserEnter.text)
|
||||
. = ALIGN(16);
|
||||
*(.DebugExceptionVector.text)
|
||||
. = ALIGN(16);
|
||||
*(.NMIExceptionVector.text)
|
||||
. = ALIGN(16);
|
||||
*(.KernelExceptionVector.text)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
. = ALIGN(16);
|
||||
*(.UserExceptionVector.text)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
. = ALIGN(16);
|
||||
*(.DoubleExceptionVector.text)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
. = ALIGN (16);
|
||||
*(.entry.text)
|
||||
*(.init.literal)
|
||||
*(.init)
|
||||
*(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
|
||||
*(.fini.literal)
|
||||
*(.fini)
|
||||
*(.gnu.version)
|
||||
_text_end = ABSOLUTE(.);
|
||||
_etext = .;
|
||||
} >iram1_0_seg :iram1_0_phdr
|
||||
|
||||
.lit4 : ALIGN(4)
|
||||
{
|
||||
_lit4_start = ABSOLUTE(.);
|
||||
*(*.lit4)
|
||||
*(.lit4.*)
|
||||
*(.gnu.linkonce.lit4.*)
|
||||
_lit4_end = ABSOLUTE(.);
|
||||
} >iram1_0_seg :iram1_0_phdr
|
||||
|
||||
.irom0.text : ALIGN(4)
|
||||
{
|
||||
_irom0_text_start = ABSOLUTE(.);
|
||||
*(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text)
|
||||
_irom0_text_end = ABSOLUTE(.);
|
||||
} >irom0_0_seg :irom0_0_phdr
|
||||
}
|
||||
|
||||
/* get ROM code address */
|
||||
INCLUDE "../ld/eagle.rom.addr.v6.ld"
|
||||
+211
@@ -0,0 +1,211 @@
|
||||
/* This linker script generated from xt-genldscripts.tpp for LSP . */
|
||||
/* Linker Script for ld -N */
|
||||
MEMORY
|
||||
{
|
||||
dport0_0_seg : org = 0x3FF00000, len = 0x10
|
||||
dram0_0_seg : org = 0x3FFE8000, len = 0x14000
|
||||
iram1_0_seg : org = 0x40100000, len = 0x8000
|
||||
irom0_0_seg : org = 0x40201010, len = 0x6B000
|
||||
}
|
||||
|
||||
PHDRS
|
||||
{
|
||||
dport0_0_phdr PT_LOAD;
|
||||
dram0_0_phdr PT_LOAD;
|
||||
dram0_0_bss_phdr PT_LOAD;
|
||||
iram1_0_phdr PT_LOAD;
|
||||
irom0_0_phdr PT_LOAD;
|
||||
}
|
||||
|
||||
|
||||
/* Default entry point: */
|
||||
ENTRY(call_user_start)
|
||||
EXTERN(_DebugExceptionVector)
|
||||
EXTERN(_DoubleExceptionVector)
|
||||
EXTERN(_KernelExceptionVector)
|
||||
EXTERN(_NMIExceptionVector)
|
||||
EXTERN(_UserExceptionVector)
|
||||
PROVIDE(_memmap_vecbase_reset = 0x40000000);
|
||||
/* Various memory-map dependent cache attribute settings: */
|
||||
_memmap_cacheattr_wb_base = 0x00000110;
|
||||
_memmap_cacheattr_wt_base = 0x00000110;
|
||||
_memmap_cacheattr_bp_base = 0x00000220;
|
||||
_memmap_cacheattr_unused_mask = 0xFFFFF00F;
|
||||
_memmap_cacheattr_wb_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_wba_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_wbna_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_wt_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_bp_trapnull = 0x2222222F;
|
||||
_memmap_cacheattr_wb_strict = 0xFFFFF11F;
|
||||
_memmap_cacheattr_wt_strict = 0xFFFFF11F;
|
||||
_memmap_cacheattr_bp_strict = 0xFFFFF22F;
|
||||
_memmap_cacheattr_wb_allvalid = 0x22222112;
|
||||
_memmap_cacheattr_wt_allvalid = 0x22222112;
|
||||
_memmap_cacheattr_bp_allvalid = 0x22222222;
|
||||
PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wb_trapnull);
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
|
||||
.dport0.rodata : ALIGN(4)
|
||||
{
|
||||
_dport0_rodata_start = ABSOLUTE(.);
|
||||
*(.dport0.rodata)
|
||||
*(.dport.rodata)
|
||||
_dport0_rodata_end = ABSOLUTE(.);
|
||||
} >dport0_0_seg :dport0_0_phdr
|
||||
|
||||
.dport0.literal : ALIGN(4)
|
||||
{
|
||||
_dport0_literal_start = ABSOLUTE(.);
|
||||
*(.dport0.literal)
|
||||
*(.dport.literal)
|
||||
_dport0_literal_end = ABSOLUTE(.);
|
||||
} >dport0_0_seg :dport0_0_phdr
|
||||
|
||||
.dport0.data : ALIGN(4)
|
||||
{
|
||||
_dport0_data_start = ABSOLUTE(.);
|
||||
*(.dport0.data)
|
||||
*(.dport.data)
|
||||
_dport0_data_end = ABSOLUTE(.);
|
||||
} >dport0_0_seg :dport0_0_phdr
|
||||
|
||||
.data : ALIGN(4)
|
||||
{
|
||||
_data_start = ABSOLUTE(.);
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
*(.data1)
|
||||
*(.sdata)
|
||||
*(.sdata.*)
|
||||
*(.gnu.linkonce.s.*)
|
||||
*(.sdata2)
|
||||
*(.sdata2.*)
|
||||
*(.gnu.linkonce.s2.*)
|
||||
*(.jcr)
|
||||
_data_end = ABSOLUTE(.);
|
||||
} >dram0_0_seg :dram0_0_phdr
|
||||
|
||||
.rodata : ALIGN(4)
|
||||
{
|
||||
_rodata_start = ABSOLUTE(.);
|
||||
*(.sdk.version)
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
*(.gnu.linkonce.r.*)
|
||||
*(.rodata1)
|
||||
__XT_EXCEPTION_TABLE__ = ABSOLUTE(.);
|
||||
*(.xt_except_table)
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.e.*)
|
||||
*(.gnu.version_r)
|
||||
*(.eh_frame)
|
||||
/* C++ constructor and destructor tables, properly ordered: */
|
||||
KEEP (*crtbegin.o(.ctors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*(.ctors))
|
||||
KEEP (*crtbegin.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*(.dtors))
|
||||
/* C++ exception handlers table: */
|
||||
__XT_EXCEPTION_DESCS__ = ABSOLUTE(.);
|
||||
*(.xt_except_desc)
|
||||
*(.gnu.linkonce.h.*)
|
||||
__XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
|
||||
*(.xt_except_desc_end)
|
||||
*(.dynamic)
|
||||
*(.gnu.version_d)
|
||||
. = ALIGN(4); /* this table MUST be 4-byte aligned */
|
||||
_bss_table_start = ABSOLUTE(.);
|
||||
LONG(_bss_start)
|
||||
LONG(_bss_end)
|
||||
_bss_table_end = ABSOLUTE(.);
|
||||
_rodata_end = ABSOLUTE(.);
|
||||
} >dram0_0_seg :dram0_0_phdr
|
||||
|
||||
.bss ALIGN(8) (NOLOAD) : ALIGN(4)
|
||||
{
|
||||
. = ALIGN (8);
|
||||
_bss_start = ABSOLUTE(.);
|
||||
*(.dynsbss)
|
||||
*(.sbss)
|
||||
*(.sbss.*)
|
||||
*(.gnu.linkonce.sb.*)
|
||||
*(.scommon)
|
||||
*(.sbss2)
|
||||
*(.sbss2.*)
|
||||
*(.gnu.linkonce.sb2.*)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(.bss.*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
. = ALIGN (8);
|
||||
_bss_end = ABSOLUTE(.);
|
||||
_heap_start = ABSOLUTE(.);
|
||||
/* _stack_sentry = ALIGN(0x8); */
|
||||
} >dram0_0_seg :dram0_0_bss_phdr
|
||||
/* __stack = 0x3ffc8000; */
|
||||
|
||||
.text : ALIGN(4)
|
||||
{
|
||||
_stext = .;
|
||||
_text_start = ABSOLUTE(.);
|
||||
*(.UserEnter.text)
|
||||
. = ALIGN(16);
|
||||
*(.DebugExceptionVector.text)
|
||||
. = ALIGN(16);
|
||||
*(.NMIExceptionVector.text)
|
||||
. = ALIGN(16);
|
||||
*(.KernelExceptionVector.text)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
. = ALIGN(16);
|
||||
*(.UserExceptionVector.text)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
. = ALIGN(16);
|
||||
*(.DoubleExceptionVector.text)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
. = ALIGN (16);
|
||||
*(.entry.text)
|
||||
*(.init.literal)
|
||||
*(.init)
|
||||
*(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
|
||||
*(.fini.literal)
|
||||
*(.fini)
|
||||
*(.gnu.version)
|
||||
_text_end = ABSOLUTE(.);
|
||||
_etext = .;
|
||||
} >iram1_0_seg :iram1_0_phdr
|
||||
|
||||
.lit4 : ALIGN(4)
|
||||
{
|
||||
_lit4_start = ABSOLUTE(.);
|
||||
*(*.lit4)
|
||||
*(.lit4.*)
|
||||
*(.gnu.linkonce.lit4.*)
|
||||
_lit4_end = ABSOLUTE(.);
|
||||
} >iram1_0_seg :iram1_0_phdr
|
||||
|
||||
.irom0.text : ALIGN(4)
|
||||
{
|
||||
_irom0_text_start = ABSOLUTE(.);
|
||||
*(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text)
|
||||
_irom0_text_end = ABSOLUTE(.);
|
||||
} >irom0_0_seg :irom0_0_phdr
|
||||
}
|
||||
|
||||
/* get ROM code address */
|
||||
INCLUDE "../ld/eagle.rom.addr.v6.ld"
|
||||
+211
@@ -0,0 +1,211 @@
|
||||
/* This linker script generated from xt-genldscripts.tpp for LSP . */
|
||||
/* Linker Script for ld -N */
|
||||
MEMORY
|
||||
{
|
||||
dport0_0_seg : org = 0x3FF00000, len = 0x10
|
||||
dram0_0_seg : org = 0x3FFE8000, len = 0x14000
|
||||
iram1_0_seg : org = 0x40100000, len = 0x8000
|
||||
irom0_0_seg : org = 0x40281010, len = 0x6B000
|
||||
}
|
||||
|
||||
PHDRS
|
||||
{
|
||||
dport0_0_phdr PT_LOAD;
|
||||
dram0_0_phdr PT_LOAD;
|
||||
dram0_0_bss_phdr PT_LOAD;
|
||||
iram1_0_phdr PT_LOAD;
|
||||
irom0_0_phdr PT_LOAD;
|
||||
}
|
||||
|
||||
|
||||
/* Default entry point: */
|
||||
ENTRY(call_user_start)
|
||||
EXTERN(_DebugExceptionVector)
|
||||
EXTERN(_DoubleExceptionVector)
|
||||
EXTERN(_KernelExceptionVector)
|
||||
EXTERN(_NMIExceptionVector)
|
||||
EXTERN(_UserExceptionVector)
|
||||
PROVIDE(_memmap_vecbase_reset = 0x40000000);
|
||||
/* Various memory-map dependent cache attribute settings: */
|
||||
_memmap_cacheattr_wb_base = 0x00000110;
|
||||
_memmap_cacheattr_wt_base = 0x00000110;
|
||||
_memmap_cacheattr_bp_base = 0x00000220;
|
||||
_memmap_cacheattr_unused_mask = 0xFFFFF00F;
|
||||
_memmap_cacheattr_wb_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_wba_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_wbna_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_wt_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_bp_trapnull = 0x2222222F;
|
||||
_memmap_cacheattr_wb_strict = 0xFFFFF11F;
|
||||
_memmap_cacheattr_wt_strict = 0xFFFFF11F;
|
||||
_memmap_cacheattr_bp_strict = 0xFFFFF22F;
|
||||
_memmap_cacheattr_wb_allvalid = 0x22222112;
|
||||
_memmap_cacheattr_wt_allvalid = 0x22222112;
|
||||
_memmap_cacheattr_bp_allvalid = 0x22222222;
|
||||
PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wb_trapnull);
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
|
||||
.dport0.rodata : ALIGN(4)
|
||||
{
|
||||
_dport0_rodata_start = ABSOLUTE(.);
|
||||
*(.dport0.rodata)
|
||||
*(.dport.rodata)
|
||||
_dport0_rodata_end = ABSOLUTE(.);
|
||||
} >dport0_0_seg :dport0_0_phdr
|
||||
|
||||
.dport0.literal : ALIGN(4)
|
||||
{
|
||||
_dport0_literal_start = ABSOLUTE(.);
|
||||
*(.dport0.literal)
|
||||
*(.dport.literal)
|
||||
_dport0_literal_end = ABSOLUTE(.);
|
||||
} >dport0_0_seg :dport0_0_phdr
|
||||
|
||||
.dport0.data : ALIGN(4)
|
||||
{
|
||||
_dport0_data_start = ABSOLUTE(.);
|
||||
*(.dport0.data)
|
||||
*(.dport.data)
|
||||
_dport0_data_end = ABSOLUTE(.);
|
||||
} >dport0_0_seg :dport0_0_phdr
|
||||
|
||||
.data : ALIGN(4)
|
||||
{
|
||||
_data_start = ABSOLUTE(.);
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
*(.data1)
|
||||
*(.sdata)
|
||||
*(.sdata.*)
|
||||
*(.gnu.linkonce.s.*)
|
||||
*(.sdata2)
|
||||
*(.sdata2.*)
|
||||
*(.gnu.linkonce.s2.*)
|
||||
*(.jcr)
|
||||
_data_end = ABSOLUTE(.);
|
||||
} >dram0_0_seg :dram0_0_phdr
|
||||
|
||||
.rodata : ALIGN(4)
|
||||
{
|
||||
_rodata_start = ABSOLUTE(.);
|
||||
*(.sdk.version)
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
*(.gnu.linkonce.r.*)
|
||||
*(.rodata1)
|
||||
__XT_EXCEPTION_TABLE__ = ABSOLUTE(.);
|
||||
*(.xt_except_table)
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.e.*)
|
||||
*(.gnu.version_r)
|
||||
*(.eh_frame)
|
||||
/* C++ constructor and destructor tables, properly ordered: */
|
||||
KEEP (*crtbegin.o(.ctors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*(.ctors))
|
||||
KEEP (*crtbegin.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*(.dtors))
|
||||
/* C++ exception handlers table: */
|
||||
__XT_EXCEPTION_DESCS__ = ABSOLUTE(.);
|
||||
*(.xt_except_desc)
|
||||
*(.gnu.linkonce.h.*)
|
||||
__XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
|
||||
*(.xt_except_desc_end)
|
||||
*(.dynamic)
|
||||
*(.gnu.version_d)
|
||||
. = ALIGN(4); /* this table MUST be 4-byte aligned */
|
||||
_bss_table_start = ABSOLUTE(.);
|
||||
LONG(_bss_start)
|
||||
LONG(_bss_end)
|
||||
_bss_table_end = ABSOLUTE(.);
|
||||
_rodata_end = ABSOLUTE(.);
|
||||
} >dram0_0_seg :dram0_0_phdr
|
||||
|
||||
.bss ALIGN(8) (NOLOAD) : ALIGN(4)
|
||||
{
|
||||
. = ALIGN (8);
|
||||
_bss_start = ABSOLUTE(.);
|
||||
*(.dynsbss)
|
||||
*(.sbss)
|
||||
*(.sbss.*)
|
||||
*(.gnu.linkonce.sb.*)
|
||||
*(.scommon)
|
||||
*(.sbss2)
|
||||
*(.sbss2.*)
|
||||
*(.gnu.linkonce.sb2.*)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(.bss.*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
. = ALIGN (8);
|
||||
_bss_end = ABSOLUTE(.);
|
||||
_heap_start = ABSOLUTE(.);
|
||||
/* _stack_sentry = ALIGN(0x8); */
|
||||
} >dram0_0_seg :dram0_0_bss_phdr
|
||||
/* __stack = 0x3ffc8000; */
|
||||
|
||||
.text : ALIGN(4)
|
||||
{
|
||||
_stext = .;
|
||||
_text_start = ABSOLUTE(.);
|
||||
*(.UserEnter.text)
|
||||
. = ALIGN(16);
|
||||
*(.DebugExceptionVector.text)
|
||||
. = ALIGN(16);
|
||||
*(.NMIExceptionVector.text)
|
||||
. = ALIGN(16);
|
||||
*(.KernelExceptionVector.text)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
. = ALIGN(16);
|
||||
*(.UserExceptionVector.text)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
. = ALIGN(16);
|
||||
*(.DoubleExceptionVector.text)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
. = ALIGN (16);
|
||||
*(.entry.text)
|
||||
*(.init.literal)
|
||||
*(.init)
|
||||
*(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
|
||||
*(.fini.literal)
|
||||
*(.fini)
|
||||
*(.gnu.version)
|
||||
_text_end = ABSOLUTE(.);
|
||||
_etext = .;
|
||||
} >iram1_0_seg :iram1_0_phdr
|
||||
|
||||
.lit4 : ALIGN(4)
|
||||
{
|
||||
_lit4_start = ABSOLUTE(.);
|
||||
*(*.lit4)
|
||||
*(.lit4.*)
|
||||
*(.gnu.linkonce.lit4.*)
|
||||
_lit4_end = ABSOLUTE(.);
|
||||
} >iram1_0_seg :iram1_0_phdr
|
||||
|
||||
.irom0.text : ALIGN(4)
|
||||
{
|
||||
_irom0_text_start = ABSOLUTE(.);
|
||||
*(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text)
|
||||
_irom0_text_end = ABSOLUTE(.);
|
||||
} >irom0_0_seg :irom0_0_phdr
|
||||
}
|
||||
|
||||
/* get ROM code address */
|
||||
INCLUDE "../ld/eagle.rom.addr.v6.ld"
|
||||
+211
@@ -0,0 +1,211 @@
|
||||
/* This linker script generated from xt-genldscripts.tpp for LSP . */
|
||||
/* Linker Script for ld -N */
|
||||
MEMORY
|
||||
{
|
||||
dport0_0_seg : org = 0x3FF00000, len = 0x10
|
||||
dram0_0_seg : org = 0x3FFE8000, len = 0x14000
|
||||
iram1_0_seg : org = 0x40100000, len = 0x8000
|
||||
irom0_0_seg : org = 0x40201010, len = 0xE0000
|
||||
}
|
||||
|
||||
PHDRS
|
||||
{
|
||||
dport0_0_phdr PT_LOAD;
|
||||
dram0_0_phdr PT_LOAD;
|
||||
dram0_0_bss_phdr PT_LOAD;
|
||||
iram1_0_phdr PT_LOAD;
|
||||
irom0_0_phdr PT_LOAD;
|
||||
}
|
||||
|
||||
|
||||
/* Default entry point: */
|
||||
ENTRY(call_user_start)
|
||||
EXTERN(_DebugExceptionVector)
|
||||
EXTERN(_DoubleExceptionVector)
|
||||
EXTERN(_KernelExceptionVector)
|
||||
EXTERN(_NMIExceptionVector)
|
||||
EXTERN(_UserExceptionVector)
|
||||
PROVIDE(_memmap_vecbase_reset = 0x40000000);
|
||||
/* Various memory-map dependent cache attribute settings: */
|
||||
_memmap_cacheattr_wb_base = 0x00000110;
|
||||
_memmap_cacheattr_wt_base = 0x00000110;
|
||||
_memmap_cacheattr_bp_base = 0x00000220;
|
||||
_memmap_cacheattr_unused_mask = 0xFFFFF00F;
|
||||
_memmap_cacheattr_wb_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_wba_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_wbna_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_wt_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_bp_trapnull = 0x2222222F;
|
||||
_memmap_cacheattr_wb_strict = 0xFFFFF11F;
|
||||
_memmap_cacheattr_wt_strict = 0xFFFFF11F;
|
||||
_memmap_cacheattr_bp_strict = 0xFFFFF22F;
|
||||
_memmap_cacheattr_wb_allvalid = 0x22222112;
|
||||
_memmap_cacheattr_wt_allvalid = 0x22222112;
|
||||
_memmap_cacheattr_bp_allvalid = 0x22222222;
|
||||
PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wb_trapnull);
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
|
||||
.dport0.rodata : ALIGN(4)
|
||||
{
|
||||
_dport0_rodata_start = ABSOLUTE(.);
|
||||
*(.dport0.rodata)
|
||||
*(.dport.rodata)
|
||||
_dport0_rodata_end = ABSOLUTE(.);
|
||||
} >dport0_0_seg :dport0_0_phdr
|
||||
|
||||
.dport0.literal : ALIGN(4)
|
||||
{
|
||||
_dport0_literal_start = ABSOLUTE(.);
|
||||
*(.dport0.literal)
|
||||
*(.dport.literal)
|
||||
_dport0_literal_end = ABSOLUTE(.);
|
||||
} >dport0_0_seg :dport0_0_phdr
|
||||
|
||||
.dport0.data : ALIGN(4)
|
||||
{
|
||||
_dport0_data_start = ABSOLUTE(.);
|
||||
*(.dport0.data)
|
||||
*(.dport.data)
|
||||
_dport0_data_end = ABSOLUTE(.);
|
||||
} >dport0_0_seg :dport0_0_phdr
|
||||
|
||||
.data : ALIGN(4)
|
||||
{
|
||||
_data_start = ABSOLUTE(.);
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
*(.data1)
|
||||
*(.sdata)
|
||||
*(.sdata.*)
|
||||
*(.gnu.linkonce.s.*)
|
||||
*(.sdata2)
|
||||
*(.sdata2.*)
|
||||
*(.gnu.linkonce.s2.*)
|
||||
*(.jcr)
|
||||
_data_end = ABSOLUTE(.);
|
||||
} >dram0_0_seg :dram0_0_phdr
|
||||
|
||||
.rodata : ALIGN(4)
|
||||
{
|
||||
_rodata_start = ABSOLUTE(.);
|
||||
*(.sdk.version)
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
*(.gnu.linkonce.r.*)
|
||||
*(.rodata1)
|
||||
__XT_EXCEPTION_TABLE__ = ABSOLUTE(.);
|
||||
*(.xt_except_table)
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.e.*)
|
||||
*(.gnu.version_r)
|
||||
*(.eh_frame)
|
||||
/* C++ constructor and destructor tables, properly ordered: */
|
||||
KEEP (*crtbegin.o(.ctors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*(.ctors))
|
||||
KEEP (*crtbegin.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*(.dtors))
|
||||
/* C++ exception handlers table: */
|
||||
__XT_EXCEPTION_DESCS__ = ABSOLUTE(.);
|
||||
*(.xt_except_desc)
|
||||
*(.gnu.linkonce.h.*)
|
||||
__XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
|
||||
*(.xt_except_desc_end)
|
||||
*(.dynamic)
|
||||
*(.gnu.version_d)
|
||||
. = ALIGN(4); /* this table MUST be 4-byte aligned */
|
||||
_bss_table_start = ABSOLUTE(.);
|
||||
LONG(_bss_start)
|
||||
LONG(_bss_end)
|
||||
_bss_table_end = ABSOLUTE(.);
|
||||
_rodata_end = ABSOLUTE(.);
|
||||
} >dram0_0_seg :dram0_0_phdr
|
||||
|
||||
.bss ALIGN(8) (NOLOAD) : ALIGN(4)
|
||||
{
|
||||
. = ALIGN (8);
|
||||
_bss_start = ABSOLUTE(.);
|
||||
*(.dynsbss)
|
||||
*(.sbss)
|
||||
*(.sbss.*)
|
||||
*(.gnu.linkonce.sb.*)
|
||||
*(.scommon)
|
||||
*(.sbss2)
|
||||
*(.sbss2.*)
|
||||
*(.gnu.linkonce.sb2.*)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(.bss.*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
. = ALIGN (8);
|
||||
_bss_end = ABSOLUTE(.);
|
||||
_heap_start = ABSOLUTE(.);
|
||||
/* _stack_sentry = ALIGN(0x8); */
|
||||
} >dram0_0_seg :dram0_0_bss_phdr
|
||||
/* __stack = 0x3ffc8000; */
|
||||
|
||||
.text : ALIGN(4)
|
||||
{
|
||||
_stext = .;
|
||||
_text_start = ABSOLUTE(.);
|
||||
*(.UserEnter.text)
|
||||
. = ALIGN(16);
|
||||
*(.DebugExceptionVector.text)
|
||||
. = ALIGN(16);
|
||||
*(.NMIExceptionVector.text)
|
||||
. = ALIGN(16);
|
||||
*(.KernelExceptionVector.text)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
. = ALIGN(16);
|
||||
*(.UserExceptionVector.text)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
. = ALIGN(16);
|
||||
*(.DoubleExceptionVector.text)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
. = ALIGN (16);
|
||||
*(.entry.text)
|
||||
*(.init.literal)
|
||||
*(.init)
|
||||
*(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
|
||||
*(.fini.literal)
|
||||
*(.fini)
|
||||
*(.gnu.version)
|
||||
_text_end = ABSOLUTE(.);
|
||||
_etext = .;
|
||||
} >iram1_0_seg :iram1_0_phdr
|
||||
|
||||
.lit4 : ALIGN(4)
|
||||
{
|
||||
_lit4_start = ABSOLUTE(.);
|
||||
*(*.lit4)
|
||||
*(.lit4.*)
|
||||
*(.gnu.linkonce.lit4.*)
|
||||
_lit4_end = ABSOLUTE(.);
|
||||
} >iram1_0_seg :iram1_0_phdr
|
||||
|
||||
.irom0.text : ALIGN(4)
|
||||
{
|
||||
_irom0_text_start = ABSOLUTE(.);
|
||||
*(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text)
|
||||
_irom0_text_end = ABSOLUTE(.);
|
||||
} >irom0_0_seg :irom0_0_phdr
|
||||
}
|
||||
|
||||
/* get ROM code address */
|
||||
INCLUDE "../ld/eagle.rom.addr.v6.ld"
|
||||
+211
@@ -0,0 +1,211 @@
|
||||
/* This linker script generated from xt-genldscripts.tpp for LSP . */
|
||||
/* Linker Script for ld -N */
|
||||
MEMORY
|
||||
{
|
||||
dport0_0_seg : org = 0x3FF00000, len = 0x10
|
||||
dram0_0_seg : org = 0x3FFE8000, len = 0x14000
|
||||
iram1_0_seg : org = 0x40100000, len = 0x8000
|
||||
irom0_0_seg : org = 0x40201010, len = 0x2B000
|
||||
}
|
||||
|
||||
PHDRS
|
||||
{
|
||||
dport0_0_phdr PT_LOAD;
|
||||
dram0_0_phdr PT_LOAD;
|
||||
dram0_0_bss_phdr PT_LOAD;
|
||||
iram1_0_phdr PT_LOAD;
|
||||
irom0_0_phdr PT_LOAD;
|
||||
}
|
||||
|
||||
|
||||
/* Default entry point: */
|
||||
ENTRY(call_user_start)
|
||||
EXTERN(_DebugExceptionVector)
|
||||
EXTERN(_DoubleExceptionVector)
|
||||
EXTERN(_KernelExceptionVector)
|
||||
EXTERN(_NMIExceptionVector)
|
||||
EXTERN(_UserExceptionVector)
|
||||
PROVIDE(_memmap_vecbase_reset = 0x40000000);
|
||||
/* Various memory-map dependent cache attribute settings: */
|
||||
_memmap_cacheattr_wb_base = 0x00000110;
|
||||
_memmap_cacheattr_wt_base = 0x00000110;
|
||||
_memmap_cacheattr_bp_base = 0x00000220;
|
||||
_memmap_cacheattr_unused_mask = 0xFFFFF00F;
|
||||
_memmap_cacheattr_wb_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_wba_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_wbna_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_wt_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_bp_trapnull = 0x2222222F;
|
||||
_memmap_cacheattr_wb_strict = 0xFFFFF11F;
|
||||
_memmap_cacheattr_wt_strict = 0xFFFFF11F;
|
||||
_memmap_cacheattr_bp_strict = 0xFFFFF22F;
|
||||
_memmap_cacheattr_wb_allvalid = 0x22222112;
|
||||
_memmap_cacheattr_wt_allvalid = 0x22222112;
|
||||
_memmap_cacheattr_bp_allvalid = 0x22222222;
|
||||
PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wb_trapnull);
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
|
||||
.dport0.rodata : ALIGN(4)
|
||||
{
|
||||
_dport0_rodata_start = ABSOLUTE(.);
|
||||
*(.dport0.rodata)
|
||||
*(.dport.rodata)
|
||||
_dport0_rodata_end = ABSOLUTE(.);
|
||||
} >dport0_0_seg :dport0_0_phdr
|
||||
|
||||
.dport0.literal : ALIGN(4)
|
||||
{
|
||||
_dport0_literal_start = ABSOLUTE(.);
|
||||
*(.dport0.literal)
|
||||
*(.dport.literal)
|
||||
_dport0_literal_end = ABSOLUTE(.);
|
||||
} >dport0_0_seg :dport0_0_phdr
|
||||
|
||||
.dport0.data : ALIGN(4)
|
||||
{
|
||||
_dport0_data_start = ABSOLUTE(.);
|
||||
*(.dport0.data)
|
||||
*(.dport.data)
|
||||
_dport0_data_end = ABSOLUTE(.);
|
||||
} >dport0_0_seg :dport0_0_phdr
|
||||
|
||||
.data : ALIGN(4)
|
||||
{
|
||||
_data_start = ABSOLUTE(.);
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
*(.data1)
|
||||
*(.sdata)
|
||||
*(.sdata.*)
|
||||
*(.gnu.linkonce.s.*)
|
||||
*(.sdata2)
|
||||
*(.sdata2.*)
|
||||
*(.gnu.linkonce.s2.*)
|
||||
*(.jcr)
|
||||
_data_end = ABSOLUTE(.);
|
||||
} >dram0_0_seg :dram0_0_phdr
|
||||
|
||||
.rodata : ALIGN(4)
|
||||
{
|
||||
_rodata_start = ABSOLUTE(.);
|
||||
*(.sdk.version)
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
*(.gnu.linkonce.r.*)
|
||||
*(.rodata1)
|
||||
__XT_EXCEPTION_TABLE__ = ABSOLUTE(.);
|
||||
*(.xt_except_table)
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.e.*)
|
||||
*(.gnu.version_r)
|
||||
*(.eh_frame)
|
||||
/* C++ constructor and destructor tables, properly ordered: */
|
||||
KEEP (*crtbegin.o(.ctors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*(.ctors))
|
||||
KEEP (*crtbegin.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*(.dtors))
|
||||
/* C++ exception handlers table: */
|
||||
__XT_EXCEPTION_DESCS__ = ABSOLUTE(.);
|
||||
*(.xt_except_desc)
|
||||
*(.gnu.linkonce.h.*)
|
||||
__XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
|
||||
*(.xt_except_desc_end)
|
||||
*(.dynamic)
|
||||
*(.gnu.version_d)
|
||||
. = ALIGN(4); /* this table MUST be 4-byte aligned */
|
||||
_bss_table_start = ABSOLUTE(.);
|
||||
LONG(_bss_start)
|
||||
LONG(_bss_end)
|
||||
_bss_table_end = ABSOLUTE(.);
|
||||
_rodata_end = ABSOLUTE(.);
|
||||
} >dram0_0_seg :dram0_0_phdr
|
||||
|
||||
.bss ALIGN(8) (NOLOAD) : ALIGN(4)
|
||||
{
|
||||
. = ALIGN (8);
|
||||
_bss_start = ABSOLUTE(.);
|
||||
*(.dynsbss)
|
||||
*(.sbss)
|
||||
*(.sbss.*)
|
||||
*(.gnu.linkonce.sb.*)
|
||||
*(.scommon)
|
||||
*(.sbss2)
|
||||
*(.sbss2.*)
|
||||
*(.gnu.linkonce.sb2.*)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(.bss.*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
. = ALIGN (8);
|
||||
_bss_end = ABSOLUTE(.);
|
||||
_heap_start = ABSOLUTE(.);
|
||||
/* _stack_sentry = ALIGN(0x8); */
|
||||
} >dram0_0_seg :dram0_0_bss_phdr
|
||||
/* __stack = 0x3ffc8000; */
|
||||
|
||||
.text : ALIGN(4)
|
||||
{
|
||||
_stext = .;
|
||||
_text_start = ABSOLUTE(.);
|
||||
*(.UserEnter.text)
|
||||
. = ALIGN(16);
|
||||
*(.DebugExceptionVector.text)
|
||||
. = ALIGN(16);
|
||||
*(.NMIExceptionVector.text)
|
||||
. = ALIGN(16);
|
||||
*(.KernelExceptionVector.text)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
. = ALIGN(16);
|
||||
*(.UserExceptionVector.text)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
. = ALIGN(16);
|
||||
*(.DoubleExceptionVector.text)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
. = ALIGN (16);
|
||||
*(.entry.text)
|
||||
*(.init.literal)
|
||||
*(.init)
|
||||
*(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
|
||||
*(.fini.literal)
|
||||
*(.fini)
|
||||
*(.gnu.version)
|
||||
_text_end = ABSOLUTE(.);
|
||||
_etext = .;
|
||||
} >iram1_0_seg :iram1_0_phdr
|
||||
|
||||
.lit4 : ALIGN(4)
|
||||
{
|
||||
_lit4_start = ABSOLUTE(.);
|
||||
*(*.lit4)
|
||||
*(.lit4.*)
|
||||
*(.gnu.linkonce.lit4.*)
|
||||
_lit4_end = ABSOLUTE(.);
|
||||
} >iram1_0_seg :iram1_0_phdr
|
||||
|
||||
.irom0.text : ALIGN(4)
|
||||
{
|
||||
_irom0_text_start = ABSOLUTE(.);
|
||||
*(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text)
|
||||
_irom0_text_end = ABSOLUTE(.);
|
||||
} >irom0_0_seg :irom0_0_phdr
|
||||
}
|
||||
|
||||
/* get ROM code address */
|
||||
INCLUDE "../ld/eagle.rom.addr.v6.ld"
|
||||
+211
@@ -0,0 +1,211 @@
|
||||
/* This linker script generated from xt-genldscripts.tpp for LSP . */
|
||||
/* Linker Script for ld -N */
|
||||
MEMORY
|
||||
{
|
||||
dport0_0_seg : org = 0x3FF00000, len = 0x10
|
||||
dram0_0_seg : org = 0x3FFE8000, len = 0x14000
|
||||
iram1_0_seg : org = 0x40100000, len = 0x8000
|
||||
irom0_0_seg : org = 0x40241010, len = 0x2B000
|
||||
}
|
||||
|
||||
PHDRS
|
||||
{
|
||||
dport0_0_phdr PT_LOAD;
|
||||
dram0_0_phdr PT_LOAD;
|
||||
dram0_0_bss_phdr PT_LOAD;
|
||||
iram1_0_phdr PT_LOAD;
|
||||
irom0_0_phdr PT_LOAD;
|
||||
}
|
||||
|
||||
|
||||
/* Default entry point: */
|
||||
ENTRY(call_user_start)
|
||||
EXTERN(_DebugExceptionVector)
|
||||
EXTERN(_DoubleExceptionVector)
|
||||
EXTERN(_KernelExceptionVector)
|
||||
EXTERN(_NMIExceptionVector)
|
||||
EXTERN(_UserExceptionVector)
|
||||
PROVIDE(_memmap_vecbase_reset = 0x40000000);
|
||||
/* Various memory-map dependent cache attribute settings: */
|
||||
_memmap_cacheattr_wb_base = 0x00000110;
|
||||
_memmap_cacheattr_wt_base = 0x00000110;
|
||||
_memmap_cacheattr_bp_base = 0x00000220;
|
||||
_memmap_cacheattr_unused_mask = 0xFFFFF00F;
|
||||
_memmap_cacheattr_wb_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_wba_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_wbna_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_wt_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_bp_trapnull = 0x2222222F;
|
||||
_memmap_cacheattr_wb_strict = 0xFFFFF11F;
|
||||
_memmap_cacheattr_wt_strict = 0xFFFFF11F;
|
||||
_memmap_cacheattr_bp_strict = 0xFFFFF22F;
|
||||
_memmap_cacheattr_wb_allvalid = 0x22222112;
|
||||
_memmap_cacheattr_wt_allvalid = 0x22222112;
|
||||
_memmap_cacheattr_bp_allvalid = 0x22222222;
|
||||
PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wb_trapnull);
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
|
||||
.dport0.rodata : ALIGN(4)
|
||||
{
|
||||
_dport0_rodata_start = ABSOLUTE(.);
|
||||
*(.dport0.rodata)
|
||||
*(.dport.rodata)
|
||||
_dport0_rodata_end = ABSOLUTE(.);
|
||||
} >dport0_0_seg :dport0_0_phdr
|
||||
|
||||
.dport0.literal : ALIGN(4)
|
||||
{
|
||||
_dport0_literal_start = ABSOLUTE(.);
|
||||
*(.dport0.literal)
|
||||
*(.dport.literal)
|
||||
_dport0_literal_end = ABSOLUTE(.);
|
||||
} >dport0_0_seg :dport0_0_phdr
|
||||
|
||||
.dport0.data : ALIGN(4)
|
||||
{
|
||||
_dport0_data_start = ABSOLUTE(.);
|
||||
*(.dport0.data)
|
||||
*(.dport.data)
|
||||
_dport0_data_end = ABSOLUTE(.);
|
||||
} >dport0_0_seg :dport0_0_phdr
|
||||
|
||||
.data : ALIGN(4)
|
||||
{
|
||||
_data_start = ABSOLUTE(.);
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
*(.data1)
|
||||
*(.sdata)
|
||||
*(.sdata.*)
|
||||
*(.gnu.linkonce.s.*)
|
||||
*(.sdata2)
|
||||
*(.sdata2.*)
|
||||
*(.gnu.linkonce.s2.*)
|
||||
*(.jcr)
|
||||
_data_end = ABSOLUTE(.);
|
||||
} >dram0_0_seg :dram0_0_phdr
|
||||
|
||||
.rodata : ALIGN(4)
|
||||
{
|
||||
_rodata_start = ABSOLUTE(.);
|
||||
*(.sdk.version)
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
*(.gnu.linkonce.r.*)
|
||||
*(.rodata1)
|
||||
__XT_EXCEPTION_TABLE__ = ABSOLUTE(.);
|
||||
*(.xt_except_table)
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.e.*)
|
||||
*(.gnu.version_r)
|
||||
*(.eh_frame)
|
||||
/* C++ constructor and destructor tables, properly ordered: */
|
||||
KEEP (*crtbegin.o(.ctors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*(.ctors))
|
||||
KEEP (*crtbegin.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*(.dtors))
|
||||
/* C++ exception handlers table: */
|
||||
__XT_EXCEPTION_DESCS__ = ABSOLUTE(.);
|
||||
*(.xt_except_desc)
|
||||
*(.gnu.linkonce.h.*)
|
||||
__XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
|
||||
*(.xt_except_desc_end)
|
||||
*(.dynamic)
|
||||
*(.gnu.version_d)
|
||||
. = ALIGN(4); /* this table MUST be 4-byte aligned */
|
||||
_bss_table_start = ABSOLUTE(.);
|
||||
LONG(_bss_start)
|
||||
LONG(_bss_end)
|
||||
_bss_table_end = ABSOLUTE(.);
|
||||
_rodata_end = ABSOLUTE(.);
|
||||
} >dram0_0_seg :dram0_0_phdr
|
||||
|
||||
.bss ALIGN(8) (NOLOAD) : ALIGN(4)
|
||||
{
|
||||
. = ALIGN (8);
|
||||
_bss_start = ABSOLUTE(.);
|
||||
*(.dynsbss)
|
||||
*(.sbss)
|
||||
*(.sbss.*)
|
||||
*(.gnu.linkonce.sb.*)
|
||||
*(.scommon)
|
||||
*(.sbss2)
|
||||
*(.sbss2.*)
|
||||
*(.gnu.linkonce.sb2.*)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(.bss.*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
. = ALIGN (8);
|
||||
_bss_end = ABSOLUTE(.);
|
||||
_heap_start = ABSOLUTE(.);
|
||||
/* _stack_sentry = ALIGN(0x8); */
|
||||
} >dram0_0_seg :dram0_0_bss_phdr
|
||||
/* __stack = 0x3ffc8000; */
|
||||
|
||||
.text : ALIGN(4)
|
||||
{
|
||||
_stext = .;
|
||||
_text_start = ABSOLUTE(.);
|
||||
*(.UserEnter.text)
|
||||
. = ALIGN(16);
|
||||
*(.DebugExceptionVector.text)
|
||||
. = ALIGN(16);
|
||||
*(.NMIExceptionVector.text)
|
||||
. = ALIGN(16);
|
||||
*(.KernelExceptionVector.text)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
. = ALIGN(16);
|
||||
*(.UserExceptionVector.text)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
. = ALIGN(16);
|
||||
*(.DoubleExceptionVector.text)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
. = ALIGN (16);
|
||||
*(.entry.text)
|
||||
*(.init.literal)
|
||||
*(.init)
|
||||
*(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
|
||||
*(.fini.literal)
|
||||
*(.fini)
|
||||
*(.gnu.version)
|
||||
_text_end = ABSOLUTE(.);
|
||||
_etext = .;
|
||||
} >iram1_0_seg :iram1_0_phdr
|
||||
|
||||
.lit4 : ALIGN(4)
|
||||
{
|
||||
_lit4_start = ABSOLUTE(.);
|
||||
*(*.lit4)
|
||||
*(.lit4.*)
|
||||
*(.gnu.linkonce.lit4.*)
|
||||
_lit4_end = ABSOLUTE(.);
|
||||
} >iram1_0_seg :iram1_0_phdr
|
||||
|
||||
.irom0.text : ALIGN(4)
|
||||
{
|
||||
_irom0_text_start = ABSOLUTE(.);
|
||||
*(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text)
|
||||
_irom0_text_end = ABSOLUTE(.);
|
||||
} >irom0_0_seg :irom0_0_phdr
|
||||
}
|
||||
|
||||
/* get ROM code address */
|
||||
INCLUDE "../ld/eagle.rom.addr.v6.ld"
|
||||
+211
@@ -0,0 +1,211 @@
|
||||
/* This linker script generated from xt-genldscripts.tpp for LSP . */
|
||||
/* Linker Script for ld -N */
|
||||
MEMORY
|
||||
{
|
||||
dport0_0_seg : org = 0x3FF00000, len = 0x10
|
||||
dram0_0_seg : org = 0x3FFE8000, len = 0x14000
|
||||
iram1_0_seg : org = 0x40100000, len = 0x8000
|
||||
irom0_0_seg : org = 0x40211000, len = 0x6B000
|
||||
}
|
||||
|
||||
PHDRS
|
||||
{
|
||||
dport0_0_phdr PT_LOAD;
|
||||
dram0_0_phdr PT_LOAD;
|
||||
dram0_0_bss_phdr PT_LOAD;
|
||||
iram1_0_phdr PT_LOAD;
|
||||
irom0_0_phdr PT_LOAD;
|
||||
}
|
||||
|
||||
|
||||
/* Default entry point: */
|
||||
ENTRY(call_user_start)
|
||||
EXTERN(_DebugExceptionVector)
|
||||
EXTERN(_DoubleExceptionVector)
|
||||
EXTERN(_KernelExceptionVector)
|
||||
EXTERN(_NMIExceptionVector)
|
||||
EXTERN(_UserExceptionVector)
|
||||
PROVIDE(_memmap_vecbase_reset = 0x40000000);
|
||||
/* Various memory-map dependent cache attribute settings: */
|
||||
_memmap_cacheattr_wb_base = 0x00000110;
|
||||
_memmap_cacheattr_wt_base = 0x00000110;
|
||||
_memmap_cacheattr_bp_base = 0x00000220;
|
||||
_memmap_cacheattr_unused_mask = 0xFFFFF00F;
|
||||
_memmap_cacheattr_wb_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_wba_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_wbna_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_wt_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_bp_trapnull = 0x2222222F;
|
||||
_memmap_cacheattr_wb_strict = 0xFFFFF11F;
|
||||
_memmap_cacheattr_wt_strict = 0xFFFFF11F;
|
||||
_memmap_cacheattr_bp_strict = 0xFFFFF22F;
|
||||
_memmap_cacheattr_wb_allvalid = 0x22222112;
|
||||
_memmap_cacheattr_wt_allvalid = 0x22222112;
|
||||
_memmap_cacheattr_bp_allvalid = 0x22222222;
|
||||
PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wb_trapnull);
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
|
||||
.dport0.rodata : ALIGN(4)
|
||||
{
|
||||
_dport0_rodata_start = ABSOLUTE(.);
|
||||
*(.dport0.rodata)
|
||||
*(.dport.rodata)
|
||||
_dport0_rodata_end = ABSOLUTE(.);
|
||||
} >dport0_0_seg :dport0_0_phdr
|
||||
|
||||
.dport0.literal : ALIGN(4)
|
||||
{
|
||||
_dport0_literal_start = ABSOLUTE(.);
|
||||
*(.dport0.literal)
|
||||
*(.dport.literal)
|
||||
_dport0_literal_end = ABSOLUTE(.);
|
||||
} >dport0_0_seg :dport0_0_phdr
|
||||
|
||||
.dport0.data : ALIGN(4)
|
||||
{
|
||||
_dport0_data_start = ABSOLUTE(.);
|
||||
*(.dport0.data)
|
||||
*(.dport.data)
|
||||
_dport0_data_end = ABSOLUTE(.);
|
||||
} >dport0_0_seg :dport0_0_phdr
|
||||
|
||||
.data : ALIGN(4)
|
||||
{
|
||||
_data_start = ABSOLUTE(.);
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
*(.data1)
|
||||
*(.sdata)
|
||||
*(.sdata.*)
|
||||
*(.gnu.linkonce.s.*)
|
||||
*(.sdata2)
|
||||
*(.sdata2.*)
|
||||
*(.gnu.linkonce.s2.*)
|
||||
*(.jcr)
|
||||
_data_end = ABSOLUTE(.);
|
||||
} >dram0_0_seg :dram0_0_phdr
|
||||
|
||||
.rodata : ALIGN(4)
|
||||
{
|
||||
_rodata_start = ABSOLUTE(.);
|
||||
*(.sdk.version)
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
*(.gnu.linkonce.r.*)
|
||||
*(.rodata1)
|
||||
__XT_EXCEPTION_TABLE__ = ABSOLUTE(.);
|
||||
*(.xt_except_table)
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.e.*)
|
||||
*(.gnu.version_r)
|
||||
*(.eh_frame)
|
||||
/* C++ constructor and destructor tables, properly ordered: */
|
||||
KEEP (*crtbegin.o(.ctors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*(.ctors))
|
||||
KEEP (*crtbegin.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*(.dtors))
|
||||
/* C++ exception handlers table: */
|
||||
__XT_EXCEPTION_DESCS__ = ABSOLUTE(.);
|
||||
*(.xt_except_desc)
|
||||
*(.gnu.linkonce.h.*)
|
||||
__XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
|
||||
*(.xt_except_desc_end)
|
||||
*(.dynamic)
|
||||
*(.gnu.version_d)
|
||||
. = ALIGN(4); /* this table MUST be 4-byte aligned */
|
||||
_bss_table_start = ABSOLUTE(.);
|
||||
LONG(_bss_start)
|
||||
LONG(_bss_end)
|
||||
_bss_table_end = ABSOLUTE(.);
|
||||
_rodata_end = ABSOLUTE(.);
|
||||
} >dram0_0_seg :dram0_0_phdr
|
||||
|
||||
.bss ALIGN(8) (NOLOAD) : ALIGN(4)
|
||||
{
|
||||
. = ALIGN (8);
|
||||
_bss_start = ABSOLUTE(.);
|
||||
*(.dynsbss)
|
||||
*(.sbss)
|
||||
*(.sbss.*)
|
||||
*(.gnu.linkonce.sb.*)
|
||||
*(.scommon)
|
||||
*(.sbss2)
|
||||
*(.sbss2.*)
|
||||
*(.gnu.linkonce.sb2.*)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(.bss.*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
. = ALIGN (8);
|
||||
_bss_end = ABSOLUTE(.);
|
||||
_heap_start = ABSOLUTE(.);
|
||||
/* _stack_sentry = ALIGN(0x8); */
|
||||
} >dram0_0_seg :dram0_0_bss_phdr
|
||||
/* __stack = 0x3ffc8000; */
|
||||
|
||||
.text : ALIGN(4)
|
||||
{
|
||||
_stext = .;
|
||||
_text_start = ABSOLUTE(.);
|
||||
*(.UserEnter.text)
|
||||
. = ALIGN(16);
|
||||
*(.DebugExceptionVector.text)
|
||||
. = ALIGN(16);
|
||||
*(.NMIExceptionVector.text)
|
||||
. = ALIGN(16);
|
||||
*(.KernelExceptionVector.text)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
. = ALIGN(16);
|
||||
*(.UserExceptionVector.text)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
. = ALIGN(16);
|
||||
*(.DoubleExceptionVector.text)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
. = ALIGN (16);
|
||||
*(.entry.text)
|
||||
*(.init.literal)
|
||||
*(.init)
|
||||
*(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
|
||||
*(.fini.literal)
|
||||
*(.fini)
|
||||
*(.gnu.version)
|
||||
_text_end = ABSOLUTE(.);
|
||||
_etext = .;
|
||||
} >iram1_0_seg :iram1_0_phdr
|
||||
|
||||
.lit4 : ALIGN(4)
|
||||
{
|
||||
_lit4_start = ABSOLUTE(.);
|
||||
*(*.lit4)
|
||||
*(.lit4.*)
|
||||
*(.gnu.linkonce.lit4.*)
|
||||
_lit4_end = ABSOLUTE(.);
|
||||
} >iram1_0_seg :iram1_0_phdr
|
||||
|
||||
.irom0.text : ALIGN(4)
|
||||
{
|
||||
_irom0_text_start = ABSOLUTE(.);
|
||||
*(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text)
|
||||
_irom0_text_end = ABSOLUTE(.);
|
||||
} >irom0_0_seg :irom0_0_phdr
|
||||
}
|
||||
|
||||
/* get ROM code address */
|
||||
INCLUDE "../ld/eagle.rom.addr.v6.ld"
|
||||
+211
@@ -0,0 +1,211 @@
|
||||
/* This linker script generated from xt-genldscripts.tpp for LSP . */
|
||||
/* Linker Script for ld -N */
|
||||
MEMORY
|
||||
{
|
||||
dport0_0_seg : org = 0x3FF00000, len = 0x10
|
||||
dram0_0_seg : org = 0x3FFE8000, len = 0x14000
|
||||
iram1_0_seg : org = 0x40100000, len = 0x8000
|
||||
irom0_0_seg : org = 0x40291000, len = 0x6B000
|
||||
}
|
||||
|
||||
PHDRS
|
||||
{
|
||||
dport0_0_phdr PT_LOAD;
|
||||
dram0_0_phdr PT_LOAD;
|
||||
dram0_0_bss_phdr PT_LOAD;
|
||||
iram1_0_phdr PT_LOAD;
|
||||
irom0_0_phdr PT_LOAD;
|
||||
}
|
||||
|
||||
|
||||
/* Default entry point: */
|
||||
ENTRY(call_user_start)
|
||||
EXTERN(_DebugExceptionVector)
|
||||
EXTERN(_DoubleExceptionVector)
|
||||
EXTERN(_KernelExceptionVector)
|
||||
EXTERN(_NMIExceptionVector)
|
||||
EXTERN(_UserExceptionVector)
|
||||
PROVIDE(_memmap_vecbase_reset = 0x40000000);
|
||||
/* Various memory-map dependent cache attribute settings: */
|
||||
_memmap_cacheattr_wb_base = 0x00000110;
|
||||
_memmap_cacheattr_wt_base = 0x00000110;
|
||||
_memmap_cacheattr_bp_base = 0x00000220;
|
||||
_memmap_cacheattr_unused_mask = 0xFFFFF00F;
|
||||
_memmap_cacheattr_wb_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_wba_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_wbna_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_wt_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_bp_trapnull = 0x2222222F;
|
||||
_memmap_cacheattr_wb_strict = 0xFFFFF11F;
|
||||
_memmap_cacheattr_wt_strict = 0xFFFFF11F;
|
||||
_memmap_cacheattr_bp_strict = 0xFFFFF22F;
|
||||
_memmap_cacheattr_wb_allvalid = 0x22222112;
|
||||
_memmap_cacheattr_wt_allvalid = 0x22222112;
|
||||
_memmap_cacheattr_bp_allvalid = 0x22222222;
|
||||
PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wb_trapnull);
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
|
||||
.dport0.rodata : ALIGN(4)
|
||||
{
|
||||
_dport0_rodata_start = ABSOLUTE(.);
|
||||
*(.dport0.rodata)
|
||||
*(.dport.rodata)
|
||||
_dport0_rodata_end = ABSOLUTE(.);
|
||||
} >dport0_0_seg :dport0_0_phdr
|
||||
|
||||
.dport0.literal : ALIGN(4)
|
||||
{
|
||||
_dport0_literal_start = ABSOLUTE(.);
|
||||
*(.dport0.literal)
|
||||
*(.dport.literal)
|
||||
_dport0_literal_end = ABSOLUTE(.);
|
||||
} >dport0_0_seg :dport0_0_phdr
|
||||
|
||||
.dport0.data : ALIGN(4)
|
||||
{
|
||||
_dport0_data_start = ABSOLUTE(.);
|
||||
*(.dport0.data)
|
||||
*(.dport.data)
|
||||
_dport0_data_end = ABSOLUTE(.);
|
||||
} >dport0_0_seg :dport0_0_phdr
|
||||
|
||||
.data : ALIGN(4)
|
||||
{
|
||||
_data_start = ABSOLUTE(.);
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
*(.data1)
|
||||
*(.sdata)
|
||||
*(.sdata.*)
|
||||
*(.gnu.linkonce.s.*)
|
||||
*(.sdata2)
|
||||
*(.sdata2.*)
|
||||
*(.gnu.linkonce.s2.*)
|
||||
*(.jcr)
|
||||
_data_end = ABSOLUTE(.);
|
||||
} >dram0_0_seg :dram0_0_phdr
|
||||
|
||||
.rodata : ALIGN(4)
|
||||
{
|
||||
_rodata_start = ABSOLUTE(.);
|
||||
*(.sdk.version)
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
*(.gnu.linkonce.r.*)
|
||||
*(.rodata1)
|
||||
__XT_EXCEPTION_TABLE__ = ABSOLUTE(.);
|
||||
*(.xt_except_table)
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.e.*)
|
||||
*(.gnu.version_r)
|
||||
*(.eh_frame)
|
||||
/* C++ constructor and destructor tables, properly ordered: */
|
||||
KEEP (*crtbegin.o(.ctors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*(.ctors))
|
||||
KEEP (*crtbegin.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*(.dtors))
|
||||
/* C++ exception handlers table: */
|
||||
__XT_EXCEPTION_DESCS__ = ABSOLUTE(.);
|
||||
*(.xt_except_desc)
|
||||
*(.gnu.linkonce.h.*)
|
||||
__XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
|
||||
*(.xt_except_desc_end)
|
||||
*(.dynamic)
|
||||
*(.gnu.version_d)
|
||||
. = ALIGN(4); /* this table MUST be 4-byte aligned */
|
||||
_bss_table_start = ABSOLUTE(.);
|
||||
LONG(_bss_start)
|
||||
LONG(_bss_end)
|
||||
_bss_table_end = ABSOLUTE(.);
|
||||
_rodata_end = ABSOLUTE(.);
|
||||
} >dram0_0_seg :dram0_0_phdr
|
||||
|
||||
.bss ALIGN(8) (NOLOAD) : ALIGN(4)
|
||||
{
|
||||
. = ALIGN (8);
|
||||
_bss_start = ABSOLUTE(.);
|
||||
*(.dynsbss)
|
||||
*(.sbss)
|
||||
*(.sbss.*)
|
||||
*(.gnu.linkonce.sb.*)
|
||||
*(.scommon)
|
||||
*(.sbss2)
|
||||
*(.sbss2.*)
|
||||
*(.gnu.linkonce.sb2.*)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(.bss.*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
. = ALIGN (8);
|
||||
_bss_end = ABSOLUTE(.);
|
||||
_heap_start = ABSOLUTE(.);
|
||||
/* _stack_sentry = ALIGN(0x8); */
|
||||
} >dram0_0_seg :dram0_0_bss_phdr
|
||||
/* __stack = 0x3ffc8000; */
|
||||
|
||||
.text : ALIGN(4)
|
||||
{
|
||||
_stext = .;
|
||||
_text_start = ABSOLUTE(.);
|
||||
*(.UserEnter.text)
|
||||
. = ALIGN(16);
|
||||
*(.DebugExceptionVector.text)
|
||||
. = ALIGN(16);
|
||||
*(.NMIExceptionVector.text)
|
||||
. = ALIGN(16);
|
||||
*(.KernelExceptionVector.text)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
. = ALIGN(16);
|
||||
*(.UserExceptionVector.text)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
. = ALIGN(16);
|
||||
*(.DoubleExceptionVector.text)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
. = ALIGN (16);
|
||||
*(.entry.text)
|
||||
*(.init.literal)
|
||||
*(.init)
|
||||
*(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
|
||||
*(.fini.literal)
|
||||
*(.fini)
|
||||
*(.gnu.version)
|
||||
_text_end = ABSOLUTE(.);
|
||||
_etext = .;
|
||||
} >iram1_0_seg :iram1_0_phdr
|
||||
|
||||
.lit4 : ALIGN(4)
|
||||
{
|
||||
_lit4_start = ABSOLUTE(.);
|
||||
*(*.lit4)
|
||||
*(.lit4.*)
|
||||
*(.gnu.linkonce.lit4.*)
|
||||
_lit4_end = ABSOLUTE(.);
|
||||
} >iram1_0_seg :iram1_0_phdr
|
||||
|
||||
.irom0.text : ALIGN(4)
|
||||
{
|
||||
_irom0_text_start = ABSOLUTE(.);
|
||||
*(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text)
|
||||
_irom0_text_end = ABSOLUTE(.);
|
||||
} >irom0_0_seg :irom0_0_phdr
|
||||
}
|
||||
|
||||
/* get ROM code address */
|
||||
INCLUDE "../ld/eagle.rom.addr.v6.ld"
|
||||
+211
@@ -0,0 +1,211 @@
|
||||
/* This linker script generated from xt-genldscripts.tpp for LSP . */
|
||||
/* Linker Script for ld -N */
|
||||
MEMORY
|
||||
{
|
||||
dport0_0_seg : org = 0x3FF00000, len = 0x10
|
||||
dram0_0_seg : org = 0x3FFE8000, len = 0x14000
|
||||
iram1_0_seg : org = 0x40100000, len = 0x8000
|
||||
irom0_0_seg : org = 0x40211000, len = 0x2B000
|
||||
}
|
||||
|
||||
PHDRS
|
||||
{
|
||||
dport0_0_phdr PT_LOAD;
|
||||
dram0_0_phdr PT_LOAD;
|
||||
dram0_0_bss_phdr PT_LOAD;
|
||||
iram1_0_phdr PT_LOAD;
|
||||
irom0_0_phdr PT_LOAD;
|
||||
}
|
||||
|
||||
|
||||
/* Default entry point: */
|
||||
ENTRY(call_user_start)
|
||||
EXTERN(_DebugExceptionVector)
|
||||
EXTERN(_DoubleExceptionVector)
|
||||
EXTERN(_KernelExceptionVector)
|
||||
EXTERN(_NMIExceptionVector)
|
||||
EXTERN(_UserExceptionVector)
|
||||
PROVIDE(_memmap_vecbase_reset = 0x40000000);
|
||||
/* Various memory-map dependent cache attribute settings: */
|
||||
_memmap_cacheattr_wb_base = 0x00000110;
|
||||
_memmap_cacheattr_wt_base = 0x00000110;
|
||||
_memmap_cacheattr_bp_base = 0x00000220;
|
||||
_memmap_cacheattr_unused_mask = 0xFFFFF00F;
|
||||
_memmap_cacheattr_wb_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_wba_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_wbna_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_wt_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_bp_trapnull = 0x2222222F;
|
||||
_memmap_cacheattr_wb_strict = 0xFFFFF11F;
|
||||
_memmap_cacheattr_wt_strict = 0xFFFFF11F;
|
||||
_memmap_cacheattr_bp_strict = 0xFFFFF22F;
|
||||
_memmap_cacheattr_wb_allvalid = 0x22222112;
|
||||
_memmap_cacheattr_wt_allvalid = 0x22222112;
|
||||
_memmap_cacheattr_bp_allvalid = 0x22222222;
|
||||
PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wb_trapnull);
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
|
||||
.dport0.rodata : ALIGN(4)
|
||||
{
|
||||
_dport0_rodata_start = ABSOLUTE(.);
|
||||
*(.dport0.rodata)
|
||||
*(.dport.rodata)
|
||||
_dport0_rodata_end = ABSOLUTE(.);
|
||||
} >dport0_0_seg :dport0_0_phdr
|
||||
|
||||
.dport0.literal : ALIGN(4)
|
||||
{
|
||||
_dport0_literal_start = ABSOLUTE(.);
|
||||
*(.dport0.literal)
|
||||
*(.dport.literal)
|
||||
_dport0_literal_end = ABSOLUTE(.);
|
||||
} >dport0_0_seg :dport0_0_phdr
|
||||
|
||||
.dport0.data : ALIGN(4)
|
||||
{
|
||||
_dport0_data_start = ABSOLUTE(.);
|
||||
*(.dport0.data)
|
||||
*(.dport.data)
|
||||
_dport0_data_end = ABSOLUTE(.);
|
||||
} >dport0_0_seg :dport0_0_phdr
|
||||
|
||||
.data : ALIGN(4)
|
||||
{
|
||||
_data_start = ABSOLUTE(.);
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
*(.data1)
|
||||
*(.sdata)
|
||||
*(.sdata.*)
|
||||
*(.gnu.linkonce.s.*)
|
||||
*(.sdata2)
|
||||
*(.sdata2.*)
|
||||
*(.gnu.linkonce.s2.*)
|
||||
*(.jcr)
|
||||
_data_end = ABSOLUTE(.);
|
||||
} >dram0_0_seg :dram0_0_phdr
|
||||
|
||||
.rodata : ALIGN(4)
|
||||
{
|
||||
_rodata_start = ABSOLUTE(.);
|
||||
*(.sdk.version)
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
*(.gnu.linkonce.r.*)
|
||||
*(.rodata1)
|
||||
__XT_EXCEPTION_TABLE__ = ABSOLUTE(.);
|
||||
*(.xt_except_table)
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.e.*)
|
||||
*(.gnu.version_r)
|
||||
*(.eh_frame)
|
||||
/* C++ constructor and destructor tables, properly ordered: */
|
||||
KEEP (*crtbegin.o(.ctors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*(.ctors))
|
||||
KEEP (*crtbegin.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*(.dtors))
|
||||
/* C++ exception handlers table: */
|
||||
__XT_EXCEPTION_DESCS__ = ABSOLUTE(.);
|
||||
*(.xt_except_desc)
|
||||
*(.gnu.linkonce.h.*)
|
||||
__XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
|
||||
*(.xt_except_desc_end)
|
||||
*(.dynamic)
|
||||
*(.gnu.version_d)
|
||||
. = ALIGN(4); /* this table MUST be 4-byte aligned */
|
||||
_bss_table_start = ABSOLUTE(.);
|
||||
LONG(_bss_start)
|
||||
LONG(_bss_end)
|
||||
_bss_table_end = ABSOLUTE(.);
|
||||
_rodata_end = ABSOLUTE(.);
|
||||
} >dram0_0_seg :dram0_0_phdr
|
||||
|
||||
.bss ALIGN(8) (NOLOAD) : ALIGN(4)
|
||||
{
|
||||
. = ALIGN (8);
|
||||
_bss_start = ABSOLUTE(.);
|
||||
*(.dynsbss)
|
||||
*(.sbss)
|
||||
*(.sbss.*)
|
||||
*(.gnu.linkonce.sb.*)
|
||||
*(.scommon)
|
||||
*(.sbss2)
|
||||
*(.sbss2.*)
|
||||
*(.gnu.linkonce.sb2.*)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(.bss.*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
. = ALIGN (8);
|
||||
_bss_end = ABSOLUTE(.);
|
||||
_heap_start = ABSOLUTE(.);
|
||||
/* _stack_sentry = ALIGN(0x8); */
|
||||
} >dram0_0_seg :dram0_0_bss_phdr
|
||||
/* __stack = 0x3ffc8000; */
|
||||
|
||||
.text : ALIGN(4)
|
||||
{
|
||||
_stext = .;
|
||||
_text_start = ABSOLUTE(.);
|
||||
*(.UserEnter.text)
|
||||
. = ALIGN(16);
|
||||
*(.DebugExceptionVector.text)
|
||||
. = ALIGN(16);
|
||||
*(.NMIExceptionVector.text)
|
||||
. = ALIGN(16);
|
||||
*(.KernelExceptionVector.text)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
. = ALIGN(16);
|
||||
*(.UserExceptionVector.text)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
. = ALIGN(16);
|
||||
*(.DoubleExceptionVector.text)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
. = ALIGN (16);
|
||||
*(.entry.text)
|
||||
*(.init.literal)
|
||||
*(.init)
|
||||
*(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
|
||||
*(.fini.literal)
|
||||
*(.fini)
|
||||
*(.gnu.version)
|
||||
_text_end = ABSOLUTE(.);
|
||||
_etext = .;
|
||||
} >iram1_0_seg :iram1_0_phdr
|
||||
|
||||
.lit4 : ALIGN(4)
|
||||
{
|
||||
_lit4_start = ABSOLUTE(.);
|
||||
*(*.lit4)
|
||||
*(.lit4.*)
|
||||
*(.gnu.linkonce.lit4.*)
|
||||
_lit4_end = ABSOLUTE(.);
|
||||
} >iram1_0_seg :iram1_0_phdr
|
||||
|
||||
.irom0.text : ALIGN(4)
|
||||
{
|
||||
_irom0_text_start = ABSOLUTE(.);
|
||||
*(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text)
|
||||
_irom0_text_end = ABSOLUTE(.);
|
||||
} >irom0_0_seg :irom0_0_phdr
|
||||
}
|
||||
|
||||
/* get ROM code address */
|
||||
INCLUDE "../ld/eagle.rom.addr.v6.ld"
|
||||
+211
@@ -0,0 +1,211 @@
|
||||
/* This linker script generated from xt-genldscripts.tpp for LSP . */
|
||||
/* Linker Script for ld -N */
|
||||
MEMORY
|
||||
{
|
||||
dport0_0_seg : org = 0x3FF00000, len = 0x10
|
||||
dram0_0_seg : org = 0x3FFE8000, len = 0x14000
|
||||
iram1_0_seg : org = 0x40100000, len = 0x8000
|
||||
irom0_0_seg : org = 0x40251000, len = 0x2B000
|
||||
}
|
||||
|
||||
PHDRS
|
||||
{
|
||||
dport0_0_phdr PT_LOAD;
|
||||
dram0_0_phdr PT_LOAD;
|
||||
dram0_0_bss_phdr PT_LOAD;
|
||||
iram1_0_phdr PT_LOAD;
|
||||
irom0_0_phdr PT_LOAD;
|
||||
}
|
||||
|
||||
|
||||
/* Default entry point: */
|
||||
ENTRY(call_user_start)
|
||||
EXTERN(_DebugExceptionVector)
|
||||
EXTERN(_DoubleExceptionVector)
|
||||
EXTERN(_KernelExceptionVector)
|
||||
EXTERN(_NMIExceptionVector)
|
||||
EXTERN(_UserExceptionVector)
|
||||
PROVIDE(_memmap_vecbase_reset = 0x40000000);
|
||||
/* Various memory-map dependent cache attribute settings: */
|
||||
_memmap_cacheattr_wb_base = 0x00000110;
|
||||
_memmap_cacheattr_wt_base = 0x00000110;
|
||||
_memmap_cacheattr_bp_base = 0x00000220;
|
||||
_memmap_cacheattr_unused_mask = 0xFFFFF00F;
|
||||
_memmap_cacheattr_wb_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_wba_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_wbna_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_wt_trapnull = 0x2222211F;
|
||||
_memmap_cacheattr_bp_trapnull = 0x2222222F;
|
||||
_memmap_cacheattr_wb_strict = 0xFFFFF11F;
|
||||
_memmap_cacheattr_wt_strict = 0xFFFFF11F;
|
||||
_memmap_cacheattr_bp_strict = 0xFFFFF22F;
|
||||
_memmap_cacheattr_wb_allvalid = 0x22222112;
|
||||
_memmap_cacheattr_wt_allvalid = 0x22222112;
|
||||
_memmap_cacheattr_bp_allvalid = 0x22222222;
|
||||
PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wb_trapnull);
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
|
||||
.dport0.rodata : ALIGN(4)
|
||||
{
|
||||
_dport0_rodata_start = ABSOLUTE(.);
|
||||
*(.dport0.rodata)
|
||||
*(.dport.rodata)
|
||||
_dport0_rodata_end = ABSOLUTE(.);
|
||||
} >dport0_0_seg :dport0_0_phdr
|
||||
|
||||
.dport0.literal : ALIGN(4)
|
||||
{
|
||||
_dport0_literal_start = ABSOLUTE(.);
|
||||
*(.dport0.literal)
|
||||
*(.dport.literal)
|
||||
_dport0_literal_end = ABSOLUTE(.);
|
||||
} >dport0_0_seg :dport0_0_phdr
|
||||
|
||||
.dport0.data : ALIGN(4)
|
||||
{
|
||||
_dport0_data_start = ABSOLUTE(.);
|
||||
*(.dport0.data)
|
||||
*(.dport.data)
|
||||
_dport0_data_end = ABSOLUTE(.);
|
||||
} >dport0_0_seg :dport0_0_phdr
|
||||
|
||||
.data : ALIGN(4)
|
||||
{
|
||||
_data_start = ABSOLUTE(.);
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
*(.data1)
|
||||
*(.sdata)
|
||||
*(.sdata.*)
|
||||
*(.gnu.linkonce.s.*)
|
||||
*(.sdata2)
|
||||
*(.sdata2.*)
|
||||
*(.gnu.linkonce.s2.*)
|
||||
*(.jcr)
|
||||
_data_end = ABSOLUTE(.);
|
||||
} >dram0_0_seg :dram0_0_phdr
|
||||
|
||||
.rodata : ALIGN(4)
|
||||
{
|
||||
_rodata_start = ABSOLUTE(.);
|
||||
*(.sdk.version)
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
*(.gnu.linkonce.r.*)
|
||||
*(.rodata1)
|
||||
__XT_EXCEPTION_TABLE__ = ABSOLUTE(.);
|
||||
*(.xt_except_table)
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.e.*)
|
||||
*(.gnu.version_r)
|
||||
*(.eh_frame)
|
||||
/* C++ constructor and destructor tables, properly ordered: */
|
||||
KEEP (*crtbegin.o(.ctors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*(.ctors))
|
||||
KEEP (*crtbegin.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*(.dtors))
|
||||
/* C++ exception handlers table: */
|
||||
__XT_EXCEPTION_DESCS__ = ABSOLUTE(.);
|
||||
*(.xt_except_desc)
|
||||
*(.gnu.linkonce.h.*)
|
||||
__XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
|
||||
*(.xt_except_desc_end)
|
||||
*(.dynamic)
|
||||
*(.gnu.version_d)
|
||||
. = ALIGN(4); /* this table MUST be 4-byte aligned */
|
||||
_bss_table_start = ABSOLUTE(.);
|
||||
LONG(_bss_start)
|
||||
LONG(_bss_end)
|
||||
_bss_table_end = ABSOLUTE(.);
|
||||
_rodata_end = ABSOLUTE(.);
|
||||
} >dram0_0_seg :dram0_0_phdr
|
||||
|
||||
.bss ALIGN(8) (NOLOAD) : ALIGN(4)
|
||||
{
|
||||
. = ALIGN (8);
|
||||
_bss_start = ABSOLUTE(.);
|
||||
*(.dynsbss)
|
||||
*(.sbss)
|
||||
*(.sbss.*)
|
||||
*(.gnu.linkonce.sb.*)
|
||||
*(.scommon)
|
||||
*(.sbss2)
|
||||
*(.sbss2.*)
|
||||
*(.gnu.linkonce.sb2.*)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(.bss.*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
. = ALIGN (8);
|
||||
_bss_end = ABSOLUTE(.);
|
||||
_heap_start = ABSOLUTE(.);
|
||||
/* _stack_sentry = ALIGN(0x8); */
|
||||
} >dram0_0_seg :dram0_0_bss_phdr
|
||||
/* __stack = 0x3ffc8000; */
|
||||
|
||||
.text : ALIGN(4)
|
||||
{
|
||||
_stext = .;
|
||||
_text_start = ABSOLUTE(.);
|
||||
*(.UserEnter.text)
|
||||
. = ALIGN(16);
|
||||
*(.DebugExceptionVector.text)
|
||||
. = ALIGN(16);
|
||||
*(.NMIExceptionVector.text)
|
||||
. = ALIGN(16);
|
||||
*(.KernelExceptionVector.text)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
. = ALIGN(16);
|
||||
*(.UserExceptionVector.text)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
. = ALIGN(16);
|
||||
*(.DoubleExceptionVector.text)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
LONG(0)
|
||||
. = ALIGN (16);
|
||||
*(.entry.text)
|
||||
*(.init.literal)
|
||||
*(.init)
|
||||
*(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
|
||||
*(.fini.literal)
|
||||
*(.fini)
|
||||
*(.gnu.version)
|
||||
_text_end = ABSOLUTE(.);
|
||||
_etext = .;
|
||||
} >iram1_0_seg :iram1_0_phdr
|
||||
|
||||
.lit4 : ALIGN(4)
|
||||
{
|
||||
_lit4_start = ABSOLUTE(.);
|
||||
*(*.lit4)
|
||||
*(.lit4.*)
|
||||
*(.gnu.linkonce.lit4.*)
|
||||
_lit4_end = ABSOLUTE(.);
|
||||
} >iram1_0_seg :iram1_0_phdr
|
||||
|
||||
.irom0.text : ALIGN(4)
|
||||
{
|
||||
_irom0_text_start = ABSOLUTE(.);
|
||||
*(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text)
|
||||
_irom0_text_end = ABSOLUTE(.);
|
||||
} >irom0_0_seg :irom0_0_phdr
|
||||
}
|
||||
|
||||
/* get ROM code address */
|
||||
INCLUDE "../ld/eagle.rom.addr.v6.ld"
|
||||
Executable
+350
@@ -0,0 +1,350 @@
|
||||
PROVIDE ( Cache_Read_Disable = 0x400047f0 );
|
||||
PROVIDE ( Cache_Read_Enable = 0x40004678 );
|
||||
PROVIDE ( FilePacketSendReqMsgProc = 0x400035a0 );
|
||||
PROVIDE ( FlashDwnLdParamCfgMsgProc = 0x4000368c );
|
||||
PROVIDE ( FlashDwnLdStartMsgProc = 0x40003538 );
|
||||
PROVIDE ( FlashDwnLdStopReqMsgProc = 0x40003658 );
|
||||
PROVIDE ( GetUartDevice = 0x40003f4c );
|
||||
PROVIDE ( MD5Final = 0x40009900 );
|
||||
PROVIDE ( MD5Init = 0x40009818 );
|
||||
PROVIDE ( MD5Update = 0x40009834 );
|
||||
PROVIDE ( MemDwnLdStartMsgProc = 0x400036c4 );
|
||||
PROVIDE ( MemDwnLdStopReqMsgProc = 0x4000377c );
|
||||
PROVIDE ( MemPacketSendReqMsgProc = 0x400036f0 );
|
||||
PROVIDE ( RcvMsg = 0x40003eac );
|
||||
PROVIDE ( SHA1Final = 0x4000b648 );
|
||||
PROVIDE ( SHA1Init = 0x4000b584 );
|
||||
PROVIDE ( SHA1Transform = 0x4000a364 );
|
||||
PROVIDE ( SHA1Update = 0x4000b5a8 );
|
||||
PROVIDE ( SPI_read_status = 0x400043c8 );
|
||||
PROVIDE ( SPI_write_status = 0x40004400 );
|
||||
PROVIDE ( SPI_write_enable = 0x4000443c );
|
||||
PROVIDE ( Wait_SPI_Idle = 0x4000448c );
|
||||
PROVIDE ( SPIEraseArea = 0x40004b44 );
|
||||
PROVIDE ( SPIEraseBlock = 0x400049b4 );
|
||||
PROVIDE ( SPIEraseChip = 0x40004984 );
|
||||
PROVIDE ( SPIEraseSector = 0x40004a00 );
|
||||
PROVIDE ( SPILock = 0x400048a8 );
|
||||
PROVIDE ( SPIParamCfg = 0x40004c2c );
|
||||
PROVIDE ( SPIRead = 0x40004b1c );
|
||||
PROVIDE ( SPIReadModeCnfig = 0x400048ec );
|
||||
PROVIDE ( SPIUnlock = 0x40004878 );
|
||||
PROVIDE ( SPIWrite = 0x40004a4c );
|
||||
PROVIDE ( SelectSpiFunction = 0x40003f58 );
|
||||
PROVIDE ( SendMsg = 0x40003cf4 );
|
||||
PROVIDE ( UartConnCheck = 0x40003230 );
|
||||
PROVIDE ( UartConnectProc = 0x400037a0 );
|
||||
PROVIDE ( UartDwnLdProc = 0x40003368 );
|
||||
PROVIDE ( UartGetCmdLn = 0x40003ef4 );
|
||||
PROVIDE ( UartRegReadProc = 0x4000381c );
|
||||
PROVIDE ( UartRegWriteProc = 0x400037ac );
|
||||
PROVIDE ( UartRxString = 0x40003c30 );
|
||||
PROVIDE ( Uart_Init = 0x40003a14 );
|
||||
PROVIDE ( _DebugExceptionVector = 0x40000010 );
|
||||
PROVIDE ( _DoubleExceptionVector = 0x40000070 );
|
||||
PROVIDE ( _KernelExceptionVector = 0x40000030 );
|
||||
PROVIDE ( _NMIExceptionVector = 0x40000020 );
|
||||
PROVIDE ( _ResetHandler = 0x400000a4 );
|
||||
PROVIDE ( _ResetVector = 0x40000080 );
|
||||
PROVIDE ( _UserExceptionVector = 0x40000050 );
|
||||
PROVIDE ( __adddf3 = 0x4000c538 );
|
||||
PROVIDE ( __addsf3 = 0x4000c180 );
|
||||
PROVIDE ( __divdf3 = 0x4000cb94 );
|
||||
PROVIDE ( __divdi3 = 0x4000ce60 );
|
||||
PROVIDE ( __divsi3 = 0x4000dc88 );
|
||||
PROVIDE ( __extendsfdf2 = 0x4000cdfc );
|
||||
PROVIDE ( __fixdfsi = 0x4000ccb8 );
|
||||
PROVIDE ( __fixunsdfsi = 0x4000cd00 );
|
||||
PROVIDE ( __fixunssfsi = 0x4000c4c4 );
|
||||
PROVIDE ( __floatsidf = 0x4000e2f0 );
|
||||
PROVIDE ( __floatsisf = 0x4000e2ac );
|
||||
PROVIDE ( __floatunsidf = 0x4000e2e8 );
|
||||
PROVIDE ( __floatunsisf = 0x4000e2a4 );
|
||||
PROVIDE ( __muldf3 = 0x4000c8f0 );
|
||||
PROVIDE ( __muldi3 = 0x40000650 );
|
||||
PROVIDE ( __mulsf3 = 0x4000c3dc );
|
||||
PROVIDE ( __subdf3 = 0x4000c688 );
|
||||
PROVIDE ( __subsf3 = 0x4000c268 );
|
||||
PROVIDE ( __truncdfsf2 = 0x4000cd5c );
|
||||
PROVIDE ( __udivdi3 = 0x4000d310 );
|
||||
PROVIDE ( __udivsi3 = 0x4000e21c );
|
||||
PROVIDE ( __umoddi3 = 0x4000d770 );
|
||||
PROVIDE ( __umodsi3 = 0x4000e268 );
|
||||
PROVIDE ( __umulsidi3 = 0x4000dcf0 );
|
||||
PROVIDE ( _rom_store = 0x4000e388 );
|
||||
PROVIDE ( _rom_store_table = 0x4000e328 );
|
||||
PROVIDE ( _start = 0x4000042c );
|
||||
PROVIDE ( _xtos_alloca_handler = 0x4000dbe0 );
|
||||
PROVIDE ( _xtos_c_wrapper_handler = 0x40000598 );
|
||||
PROVIDE ( _xtos_cause3_handler = 0x40000590 );
|
||||
PROVIDE ( _xtos_ints_off = 0x4000bda4 );
|
||||
PROVIDE ( _xtos_ints_on = 0x4000bd84 );
|
||||
PROVIDE ( _xtos_l1int_handler = 0x4000048c );
|
||||
PROVIDE ( _xtos_p_none = 0x4000dbf8 );
|
||||
PROVIDE ( _xtos_restore_intlevel = 0x4000056c );
|
||||
PROVIDE ( _xtos_return_from_exc = 0x4000dc54 );
|
||||
PROVIDE ( _xtos_set_exception_handler = 0x40000454 );
|
||||
PROVIDE ( _xtos_set_interrupt_handler = 0x4000bd70 );
|
||||
PROVIDE ( _xtos_set_interrupt_handler_arg = 0x4000bd28 );
|
||||
PROVIDE ( _xtos_set_intlevel = 0x4000dbfc );
|
||||
PROVIDE ( _xtos_set_min_intlevel = 0x4000dc18 );
|
||||
PROVIDE ( _xtos_set_vpri = 0x40000574 );
|
||||
PROVIDE ( _xtos_syscall_handler = 0x4000dbe4 );
|
||||
PROVIDE ( _xtos_unhandled_exception = 0x4000dc44 );
|
||||
PROVIDE ( _xtos_unhandled_interrupt = 0x4000dc3c );
|
||||
PROVIDE ( aes_decrypt = 0x400092d4 );
|
||||
PROVIDE ( aes_decrypt_deinit = 0x400092e4 );
|
||||
PROVIDE ( aes_decrypt_init = 0x40008ea4 );
|
||||
PROVIDE ( aes_unwrap = 0x40009410 );
|
||||
PROVIDE ( base64_decode = 0x40009648 );
|
||||
PROVIDE ( base64_encode = 0x400094fc );
|
||||
PROVIDE ( bzero = 0x4000de84 );
|
||||
PROVIDE ( cmd_parse = 0x40000814 );
|
||||
PROVIDE ( conv_str_decimal = 0x40000b24 );
|
||||
PROVIDE ( conv_str_hex = 0x40000cb8 );
|
||||
PROVIDE ( convert_para_str = 0x40000a60 );
|
||||
PROVIDE ( dtm_get_intr_mask = 0x400026d0 );
|
||||
PROVIDE ( dtm_params_init = 0x4000269c );
|
||||
PROVIDE ( dtm_set_intr_mask = 0x400026c8 );
|
||||
PROVIDE ( dtm_set_params = 0x400026dc );
|
||||
PROVIDE ( eprintf = 0x40001d14 );
|
||||
PROVIDE ( eprintf_init_buf = 0x40001cb8 );
|
||||
PROVIDE ( eprintf_to_host = 0x40001d48 );
|
||||
PROVIDE ( est_get_printf_buf_remain_len = 0x40002494 );
|
||||
PROVIDE ( est_reset_printf_buf_len = 0x4000249c );
|
||||
PROVIDE ( ets_bzero = 0x40002ae8 );
|
||||
PROVIDE ( ets_char2xdigit = 0x40002b74 );
|
||||
PROVIDE ( ets_delay_us = 0x40002ecc );
|
||||
PROVIDE ( ets_enter_sleep = 0x400027b8 );
|
||||
PROVIDE ( ets_external_printf = 0x40002578 );
|
||||
PROVIDE ( ets_get_cpu_frequency = 0x40002f0c );
|
||||
PROVIDE ( ets_getc = 0x40002bcc );
|
||||
PROVIDE ( ets_install_external_printf = 0x40002450 );
|
||||
PROVIDE ( ets_install_putc1 = 0x4000242c );
|
||||
PROVIDE ( ets_install_putc2 = 0x4000248c );
|
||||
PROVIDE ( ets_install_uart_printf = 0x40002438 );
|
||||
PROVIDE ( ets_intr_lock = 0x40000f74 );
|
||||
PROVIDE ( ets_intr_unlock = 0x40000f80 );
|
||||
PROVIDE ( ets_isr_attach = 0x40000f88 );
|
||||
PROVIDE ( ets_isr_mask = 0x40000f98 );
|
||||
PROVIDE ( ets_isr_unmask = 0x40000fa8 );
|
||||
PROVIDE ( ets_memcmp = 0x400018d4 );
|
||||
PROVIDE ( ets_memcpy = 0x400018b4 );
|
||||
PROVIDE ( ets_memmove = 0x400018c4 );
|
||||
PROVIDE ( ets_memset = 0x400018a4 );
|
||||
PROVIDE ( ets_post = 0x40000e24 );
|
||||
PROVIDE ( ets_printf = 0x400024cc );
|
||||
PROVIDE ( ets_putc = 0x40002be8 );
|
||||
PROVIDE ( ets_rtc_int_register = 0x40002a40 );
|
||||
PROVIDE ( ets_run = 0x40000e04 );
|
||||
PROVIDE ( ets_set_idle_cb = 0x40000dc0 );
|
||||
PROVIDE ( ets_set_user_start = 0x40000fbc );
|
||||
PROVIDE ( ets_str2macaddr = 0x40002af8 );
|
||||
PROVIDE ( ets_strcmp = 0x40002aa8 );
|
||||
PROVIDE ( ets_strcpy = 0x40002a88 );
|
||||
PROVIDE ( ets_strlen = 0x40002ac8 );
|
||||
PROVIDE ( ets_strncmp = 0x40002ab8 );
|
||||
PROVIDE ( ets_strncpy = 0x40002a98 );
|
||||
PROVIDE ( ets_strstr = 0x40002ad8 );
|
||||
PROVIDE ( ets_task = 0x40000dd0 );
|
||||
PROVIDE ( ets_timer_arm = 0x40002cc4 );
|
||||
PROVIDE ( ets_timer_disarm = 0x40002d40 );
|
||||
PROVIDE ( ets_timer_done = 0x40002d80 );
|
||||
PROVIDE ( ets_timer_handler_isr = 0x40002da8 );
|
||||
PROVIDE ( ets_timer_init = 0x40002e68 );
|
||||
PROVIDE ( ets_timer_setfn = 0x40002c48 );
|
||||
PROVIDE ( ets_uart_printf = 0x40002544 );
|
||||
PROVIDE ( ets_update_cpu_frequency = 0x40002f04 );
|
||||
PROVIDE ( ets_vprintf = 0x40001f00 );
|
||||
PROVIDE ( ets_wdt_disable = 0x400030f0 );
|
||||
PROVIDE ( ets_wdt_enable = 0x40002fa0 );
|
||||
PROVIDE ( ets_wdt_get_mode = 0x40002f34 );
|
||||
PROVIDE ( ets_wdt_init = 0x40003170 );
|
||||
PROVIDE ( ets_wdt_restore = 0x40003158 );
|
||||
PROVIDE ( ets_write_char = 0x40001da0 );
|
||||
PROVIDE ( get_first_seg = 0x4000091c );
|
||||
PROVIDE ( gpio_init = 0x40004c50 );
|
||||
PROVIDE ( gpio_input_get = 0x40004cf0 );
|
||||
PROVIDE ( gpio_intr_ack = 0x40004dcc );
|
||||
PROVIDE ( gpio_intr_handler_register = 0x40004e28 );
|
||||
PROVIDE ( gpio_intr_pending = 0x40004d88 );
|
||||
PROVIDE ( gpio_intr_test = 0x40004efc );
|
||||
PROVIDE ( gpio_output_set = 0x40004cd0 );
|
||||
PROVIDE ( gpio_pin_intr_state_set = 0x40004d90 );
|
||||
PROVIDE ( gpio_pin_wakeup_disable = 0x40004ed4 );
|
||||
PROVIDE ( gpio_pin_wakeup_enable = 0x40004e90 );
|
||||
PROVIDE ( gpio_register_get = 0x40004d5c );
|
||||
PROVIDE ( gpio_register_set = 0x40004d04 );
|
||||
PROVIDE ( hmac_md5 = 0x4000a2cc );
|
||||
PROVIDE ( hmac_md5_vector = 0x4000a160 );
|
||||
PROVIDE ( hmac_sha1 = 0x4000ba28 );
|
||||
PROVIDE ( hmac_sha1_vector = 0x4000b8b4 );
|
||||
PROVIDE ( lldesc_build_chain = 0x40004f40 );
|
||||
PROVIDE ( lldesc_num2link = 0x40005050 );
|
||||
PROVIDE ( lldesc_set_owner = 0x4000507c );
|
||||
PROVIDE ( main = 0x40000fec );
|
||||
PROVIDE ( md5_vector = 0x400097ac );
|
||||
PROVIDE ( mem_calloc = 0x40001c2c );
|
||||
PROVIDE ( mem_free = 0x400019e0 );
|
||||
PROVIDE ( mem_init = 0x40001998 );
|
||||
PROVIDE ( mem_malloc = 0x40001b40 );
|
||||
PROVIDE ( mem_realloc = 0x40001c6c );
|
||||
PROVIDE ( mem_trim = 0x40001a14 );
|
||||
PROVIDE ( mem_zalloc = 0x40001c58 );
|
||||
PROVIDE ( memcmp = 0x4000dea8 );
|
||||
PROVIDE ( memcpy = 0x4000df48 );
|
||||
PROVIDE ( memmove = 0x4000e04c );
|
||||
PROVIDE ( memset = 0x4000e190 );
|
||||
PROVIDE ( multofup = 0x400031c0 );
|
||||
PROVIDE ( pbkdf2_sha1 = 0x4000b840 );
|
||||
PROVIDE ( phy_get_romfuncs = 0x40006b08 );
|
||||
PROVIDE ( rand = 0x40000600 );
|
||||
PROVIDE ( rc4_skip = 0x4000dd68 );
|
||||
PROVIDE ( recv_packet = 0x40003d08 );
|
||||
PROVIDE ( remove_head_space = 0x40000a04 );
|
||||
PROVIDE ( rijndaelKeySetupDec = 0x40008dd0 );
|
||||
PROVIDE ( rijndaelKeySetupEnc = 0x40009300 );
|
||||
PROVIDE ( rom_abs_temp = 0x400060c0 );
|
||||
PROVIDE ( rom_ana_inf_gating_en = 0x40006b10 );
|
||||
PROVIDE ( rom_cal_tos_v50 = 0x40007a28 );
|
||||
PROVIDE ( rom_chip_50_set_channel = 0x40006f84 );
|
||||
PROVIDE ( rom_chip_v5_disable_cca = 0x400060d0 );
|
||||
PROVIDE ( rom_chip_v5_enable_cca = 0x400060ec );
|
||||
PROVIDE ( rom_chip_v5_rx_init = 0x4000711c );
|
||||
PROVIDE ( rom_chip_v5_sense_backoff = 0x4000610c );
|
||||
PROVIDE ( rom_chip_v5_tx_init = 0x4000718c );
|
||||
PROVIDE ( rom_dc_iq_est = 0x4000615c );
|
||||
PROVIDE ( rom_en_pwdet = 0x400061b8 );
|
||||
PROVIDE ( rom_get_bb_atten = 0x40006238 );
|
||||
PROVIDE ( rom_get_corr_power = 0x40006260 );
|
||||
PROVIDE ( rom_get_fm_sar_dout = 0x400062dc );
|
||||
PROVIDE ( rom_get_noisefloor = 0x40006394 );
|
||||
PROVIDE ( rom_get_power_db = 0x400063b0 );
|
||||
PROVIDE ( rom_i2c_readReg = 0x40007268 );
|
||||
PROVIDE ( rom_i2c_readReg_Mask = 0x4000729c );
|
||||
PROVIDE ( rom_i2c_writeReg = 0x400072d8 );
|
||||
PROVIDE ( rom_i2c_writeReg_Mask = 0x4000730c );
|
||||
PROVIDE ( rom_iq_est_disable = 0x40006400 );
|
||||
PROVIDE ( rom_iq_est_enable = 0x40006430 );
|
||||
PROVIDE ( rom_linear_to_db = 0x40006484 );
|
||||
PROVIDE ( rom_mhz2ieee = 0x400065a4 );
|
||||
PROVIDE ( rom_pbus_dco___SA2 = 0x40007bf0 );
|
||||
PROVIDE ( rom_pbus_debugmode = 0x4000737c );
|
||||
PROVIDE ( rom_pbus_enter_debugmode = 0x40007410 );
|
||||
PROVIDE ( rom_pbus_exit_debugmode = 0x40007448 );
|
||||
PROVIDE ( rom_pbus_force_test = 0x4000747c );
|
||||
PROVIDE ( rom_pbus_rd = 0x400074d8 );
|
||||
PROVIDE ( rom_pbus_set_rxgain = 0x4000754c );
|
||||
PROVIDE ( rom_pbus_set_txgain = 0x40007610 );
|
||||
PROVIDE ( rom_pbus_workmode = 0x40007648 );
|
||||
PROVIDE ( rom_pbus_xpd_rx_off = 0x40007688 );
|
||||
PROVIDE ( rom_pbus_xpd_rx_on = 0x400076cc );
|
||||
PROVIDE ( rom_pbus_xpd_tx_off = 0x400076fc );
|
||||
PROVIDE ( rom_pbus_xpd_tx_on = 0x40007740 );
|
||||
PROVIDE ( rom_pbus_xpd_tx_on__low_gain = 0x400077a0 );
|
||||
PROVIDE ( rom_phy_reset_req = 0x40007804 );
|
||||
PROVIDE ( rom_restart_cal = 0x4000781c );
|
||||
PROVIDE ( rom_rfcal_pwrctrl = 0x40007eb4 );
|
||||
PROVIDE ( rom_rfcal_rxiq = 0x4000804c );
|
||||
PROVIDE ( rom_rfcal_rxiq_set_reg = 0x40008264 );
|
||||
PROVIDE ( rom_rfcal_txcap = 0x40008388 );
|
||||
PROVIDE ( rom_rfcal_txiq = 0x40008610 );
|
||||
PROVIDE ( rom_rfcal_txiq_cover = 0x400088b8 );
|
||||
PROVIDE ( rom_rfcal_txiq_set_reg = 0x40008a70 );
|
||||
PROVIDE ( rom_rfpll_reset = 0x40007868 );
|
||||
PROVIDE ( rom_rfpll_set_freq = 0x40007968 );
|
||||
PROVIDE ( rom_rxiq_cover_mg_mp = 0x40008b6c );
|
||||
PROVIDE ( rom_rxiq_get_mis = 0x40006628 );
|
||||
PROVIDE ( rom_sar_init = 0x40006738 );
|
||||
PROVIDE ( rom_set_ana_inf_tx_scale = 0x4000678c );
|
||||
PROVIDE ( rom_set_channel_freq = 0x40006c50 );
|
||||
PROVIDE ( rom_set_loopback_gain = 0x400067c8 );
|
||||
PROVIDE ( rom_set_noise_floor = 0x40006830 );
|
||||
PROVIDE ( rom_set_rxclk_en = 0x40006550 );
|
||||
PROVIDE ( rom_set_txbb_atten = 0x40008c6c );
|
||||
PROVIDE ( rom_set_txclk_en = 0x4000650c );
|
||||
PROVIDE ( rom_set_txiq_cal = 0x40008d34 );
|
||||
PROVIDE ( rom_start_noisefloor = 0x40006874 );
|
||||
PROVIDE ( rom_start_tx_tone = 0x400068b4 );
|
||||
PROVIDE ( rom_stop_tx_tone = 0x4000698c );
|
||||
PROVIDE ( rom_tx_mac_disable = 0x40006a98 );
|
||||
PROVIDE ( rom_tx_mac_enable = 0x40006ad4 );
|
||||
PROVIDE ( rom_txtone_linear_pwr = 0x40006a1c );
|
||||
PROVIDE ( rom_write_rfpll_sdm = 0x400078dc );
|
||||
PROVIDE ( roundup2 = 0x400031b4 );
|
||||
PROVIDE ( rtc_enter_sleep = 0x40002870 );
|
||||
PROVIDE ( rtc_get_reset_reason = 0x400025e0 );
|
||||
PROVIDE ( rtc_intr_handler = 0x400029ec );
|
||||
PROVIDE ( rtc_set_sleep_mode = 0x40002668 );
|
||||
PROVIDE ( save_rxbcn_mactime = 0x400027a4 );
|
||||
PROVIDE ( save_tsf_us = 0x400027ac );
|
||||
PROVIDE ( send_packet = 0x40003c80 );
|
||||
PROVIDE ( sha1_prf = 0x4000ba48 );
|
||||
PROVIDE ( sha1_vector = 0x4000a2ec );
|
||||
PROVIDE ( sip_alloc_to_host_evt = 0x40005180 );
|
||||
PROVIDE ( sip_get_ptr = 0x400058a8 );
|
||||
PROVIDE ( sip_get_state = 0x40005668 );
|
||||
PROVIDE ( sip_init_attach = 0x4000567c );
|
||||
PROVIDE ( sip_install_rx_ctrl_cb = 0x4000544c );
|
||||
PROVIDE ( sip_install_rx_data_cb = 0x4000545c );
|
||||
PROVIDE ( sip_post = 0x400050fc );
|
||||
PROVIDE ( sip_post_init = 0x400056c4 );
|
||||
PROVIDE ( sip_reclaim_from_host_cmd = 0x4000534c );
|
||||
PROVIDE ( sip_reclaim_tx_data_pkt = 0x400052c0 );
|
||||
PROVIDE ( sip_send = 0x40005808 );
|
||||
PROVIDE ( sip_to_host_chain_append = 0x40005864 );
|
||||
PROVIDE ( sip_to_host_evt_send_done = 0x40005234 );
|
||||
PROVIDE ( slc_add_credits = 0x400060ac );
|
||||
PROVIDE ( slc_enable = 0x40005d90 );
|
||||
PROVIDE ( slc_from_host_chain_fetch = 0x40005f24 );
|
||||
PROVIDE ( slc_from_host_chain_recycle = 0x40005e94 );
|
||||
PROVIDE ( slc_init_attach = 0x40005c50 );
|
||||
PROVIDE ( slc_init_credit = 0x4000608c );
|
||||
PROVIDE ( slc_pause_from_host = 0x40006014 );
|
||||
PROVIDE ( slc_reattach = 0x40005c1c );
|
||||
PROVIDE ( slc_resume_from_host = 0x4000603c );
|
||||
PROVIDE ( slc_select_tohost_gpio = 0x40005dc0 );
|
||||
PROVIDE ( slc_select_tohost_gpio_mode = 0x40005db8 );
|
||||
PROVIDE ( slc_send_to_host_chain = 0x40005de4 );
|
||||
PROVIDE ( slc_set_host_io_max_window = 0x40006068 );
|
||||
PROVIDE ( slc_to_host_chain_recycle = 0x40005f10 );
|
||||
PROVIDE ( software_reset = 0x4000264c );
|
||||
PROVIDE ( spi_flash_attach = 0x40004644 );
|
||||
PROVIDE ( srand = 0x400005f0 );
|
||||
PROVIDE ( strcmp = 0x4000bdc8 );
|
||||
PROVIDE ( strcpy = 0x4000bec8 );
|
||||
PROVIDE ( strlen = 0x4000bf4c );
|
||||
PROVIDE ( strncmp = 0x4000bfa8 );
|
||||
PROVIDE ( strncpy = 0x4000c0a0 );
|
||||
PROVIDE ( strstr = 0x4000e1e0 );
|
||||
PROVIDE ( timer_insert = 0x40002c64 );
|
||||
PROVIDE ( uartAttach = 0x4000383c );
|
||||
PROVIDE ( uart_baudrate_detect = 0x40003924 );
|
||||
PROVIDE ( uart_buff_switch = 0x400038a4 );
|
||||
PROVIDE ( uart_div_modify = 0x400039d8 );
|
||||
PROVIDE ( uart_rx_intr_handler = 0x40003bbc );
|
||||
PROVIDE ( uart_rx_one_char = 0x40003b8c );
|
||||
PROVIDE ( uart_rx_one_char_block = 0x40003b64 );
|
||||
PROVIDE ( uart_rx_readbuff = 0x40003ec8 );
|
||||
PROVIDE ( uart_tx_one_char = 0x40003b30 );
|
||||
PROVIDE ( wepkey_128 = 0x4000bc40 );
|
||||
PROVIDE ( wepkey_64 = 0x4000bb3c );
|
||||
PROVIDE ( xthal_bcopy = 0x40000688 );
|
||||
PROVIDE ( xthal_copy123 = 0x4000074c );
|
||||
PROVIDE ( xthal_get_ccompare = 0x4000dd4c );
|
||||
PROVIDE ( xthal_get_ccount = 0x4000dd38 );
|
||||
PROVIDE ( xthal_get_interrupt = 0x4000dd58 );
|
||||
PROVIDE ( xthal_get_intread = 0x4000dd58 );
|
||||
PROVIDE ( xthal_memcpy = 0x400006c4 );
|
||||
PROVIDE ( xthal_set_ccompare = 0x4000dd40 );
|
||||
PROVIDE ( xthal_set_intclear = 0x4000dd60 );
|
||||
PROVIDE ( xthal_spill_registers_into_stack_nw = 0x4000e320 );
|
||||
PROVIDE ( xthal_window_spill = 0x4000e324 );
|
||||
PROVIDE ( xthal_window_spill_nw = 0x4000e320 );
|
||||
|
||||
PROVIDE ( Te0 = 0x3fffccf0 );
|
||||
PROVIDE ( Td0 = 0x3fffd100 );
|
||||
PROVIDE ( Td4s = 0x3fffd500);
|
||||
PROVIDE ( rcons = 0x3fffd0f0);
|
||||
PROVIDE ( UartDev = 0x3fffde10 );
|
||||
PROVIDE ( flashchip = 0x3fffc714);
|
||||
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
+276
@@ -0,0 +1,276 @@
|
||||
#!/usr/bin/python
|
||||
#
|
||||
# File : gen_appbin.py
|
||||
# This file is part of Espressif's generate bin script.
|
||||
# Copyright (C) 2013 - 2016, Espressif Systems
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of version 3 of the GNU General Public License as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""This file is part of Espressif's generate bin script.
|
||||
argv[1] is elf file name
|
||||
argv[2] is version num"""
|
||||
|
||||
import string
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
import binascii
|
||||
import struct
|
||||
import zlib
|
||||
|
||||
|
||||
TEXT_ADDRESS = 0x40100000
|
||||
# app_entry = 0
|
||||
# data_address = 0x3ffb0000
|
||||
# data_end = 0x40000000
|
||||
# text_end = 0x40120000
|
||||
|
||||
CHECKSUM_INIT = 0xEF
|
||||
|
||||
chk_sum = CHECKSUM_INIT
|
||||
blocks = 0
|
||||
|
||||
def write_file(file_name,data):
|
||||
if file_name is None:
|
||||
print 'file_name cannot be none\n'
|
||||
sys.exit(0)
|
||||
|
||||
fp = open(file_name,'ab')
|
||||
|
||||
if fp:
|
||||
fp.seek(0,os.SEEK_END)
|
||||
fp.write(data)
|
||||
fp.close()
|
||||
else:
|
||||
print '%s write fail\n'%(file_name)
|
||||
|
||||
def combine_bin(file_name,dest_file_name,start_offset_addr,need_chk):
|
||||
global chk_sum
|
||||
global blocks
|
||||
if dest_file_name is None:
|
||||
print 'dest_file_name cannot be none\n'
|
||||
sys.exit(0)
|
||||
|
||||
if file_name:
|
||||
fp = open(file_name,'rb')
|
||||
if fp:
|
||||
########## write text ##########
|
||||
fp.seek(0,os.SEEK_END)
|
||||
data_len = fp.tell()
|
||||
if data_len:
|
||||
if need_chk:
|
||||
tmp_len = (data_len + 3) & (~3)
|
||||
else:
|
||||
tmp_len = (data_len + 15) & (~15)
|
||||
data_bin = struct.pack('<II',start_offset_addr,tmp_len)
|
||||
write_file(dest_file_name,data_bin)
|
||||
fp.seek(0,os.SEEK_SET)
|
||||
data_bin = fp.read(data_len)
|
||||
write_file(dest_file_name,data_bin)
|
||||
if need_chk:
|
||||
for loop in range(len(data_bin)):
|
||||
chk_sum ^= ord(data_bin[loop])
|
||||
# print '%s size is %d(0x%x),align 4 bytes,\nultimate size is %d(0x%x)'%(file_name,data_len,data_len,tmp_len,tmp_len)
|
||||
tmp_len = tmp_len - data_len
|
||||
if tmp_len:
|
||||
data_str = ['00']*(tmp_len)
|
||||
data_bin = binascii.a2b_hex(''.join(data_str))
|
||||
write_file(dest_file_name,data_bin)
|
||||
if need_chk:
|
||||
for loop in range(len(data_bin)):
|
||||
chk_sum ^= ord(data_bin[loop])
|
||||
blocks = blocks + 1
|
||||
fp.close()
|
||||
else:
|
||||
print '!!!Open %s fail!!!'%(file_name)
|
||||
|
||||
|
||||
def getFileCRC(_path):
|
||||
try:
|
||||
blocksize = 1024 * 64
|
||||
f = open(_path,"rb")
|
||||
str = f.read(blocksize)
|
||||
crc = 0
|
||||
while(len(str) != 0):
|
||||
crc = binascii.crc32(str, crc)
|
||||
str = f.read(blocksize)
|
||||
f.close()
|
||||
except:
|
||||
print 'get file crc error!'
|
||||
return 0
|
||||
return crc
|
||||
|
||||
def gen_appbin():
|
||||
global chk_sum
|
||||
global crc_sum
|
||||
global blocks
|
||||
if len(sys.argv) != 7:
|
||||
print 'Usage: gen_appbin.py eagle.app.out boot_mode flash_mode flash_clk_div flash_size_map'
|
||||
sys.exit(0)
|
||||
|
||||
elf_file = sys.argv[1]
|
||||
boot_mode = sys.argv[2]
|
||||
flash_mode = sys.argv[3]
|
||||
flash_clk_div = sys.argv[4]
|
||||
flash_size_map = sys.argv[5]
|
||||
user_bin = sys.argv[6]
|
||||
flash_data_line = 16
|
||||
data_line_bits = 0xf
|
||||
|
||||
irom0text_bin_name = 'eagle.app.v6.irom0text.bin'
|
||||
text_bin_name = 'eagle.app.v6.text.bin'
|
||||
data_bin_name = 'eagle.app.v6.data.bin'
|
||||
rodata_bin_name = 'eagle.app.v6.rodata.bin'
|
||||
flash_bin_name ='eagle.app.flash.bin'
|
||||
|
||||
BIN_MAGIC_FLASH = 0xE9
|
||||
BIN_MAGIC_IROM = 0xEA
|
||||
data_str = ''
|
||||
sum_size = 0
|
||||
|
||||
if os.getenv('COMPILE')=='gcc' :
|
||||
cmd = 'xtensa-lx106-elf-nm -g ' + elf_file + ' > eagle.app.sym'
|
||||
else :
|
||||
cmd = 'xt-nm -g ' + elf_file + ' > eagle.app.sym'
|
||||
|
||||
os.system(cmd)
|
||||
|
||||
fp = file('./eagle.app.sym')
|
||||
if fp is None:
|
||||
print "open sym file error\n"
|
||||
sys.exit(0)
|
||||
|
||||
lines = fp.readlines()
|
||||
fp.close()
|
||||
|
||||
entry_addr = None
|
||||
p = re.compile('(\w*)(\sT\s)(call_user_start)$')
|
||||
for line in lines:
|
||||
m = p.search(line)
|
||||
if m != None:
|
||||
entry_addr = m.group(1)
|
||||
# print entry_addr
|
||||
|
||||
if entry_addr is None:
|
||||
print 'no entry point!!'
|
||||
sys.exit(0)
|
||||
|
||||
data_start_addr = '0'
|
||||
p = re.compile('(\w*)(\sA\s)(_data_start)$')
|
||||
for line in lines:
|
||||
m = p.search(line)
|
||||
if m != None:
|
||||
data_start_addr = m.group(1)
|
||||
# print data_start_addr
|
||||
|
||||
rodata_start_addr = '0'
|
||||
p = re.compile('(\w*)(\sA\s)(_rodata_start)$')
|
||||
for line in lines:
|
||||
m = p.search(line)
|
||||
if m != None:
|
||||
rodata_start_addr = m.group(1)
|
||||
# print rodata_start_addr
|
||||
|
||||
# write flash bin header
|
||||
#============================
|
||||
# SPI FLASH PARAMS
|
||||
#-------------------
|
||||
#flash_mode=
|
||||
# 0: QIO
|
||||
# 1: QOUT
|
||||
# 2: DIO
|
||||
# 3: DOUT
|
||||
#-------------------
|
||||
#flash_clk_div=
|
||||
# 0 : 80m / 2
|
||||
# 1 : 80m / 3
|
||||
# 2 : 80m / 4
|
||||
# 0xf: 80m / 1
|
||||
#-------------------
|
||||
#flash_size_map=
|
||||
# 0 : 512 KB (256 KB + 256 KB)
|
||||
# 1 : 256 KB
|
||||
# 2 : 1024 KB (512 KB + 512 KB)
|
||||
# 3 : 2048 KB (512 KB + 512 KB)
|
||||
# 4 : 4096 KB (512 KB + 512 KB)
|
||||
# 5 : 2048 KB (1024 KB + 1024 KB)
|
||||
# 6 : 4096 KB (1024 KB + 1024 KB)
|
||||
#-------------------
|
||||
# END OF SPI FLASH PARAMS
|
||||
#============================
|
||||
byte2=int(flash_mode)&0xff
|
||||
byte3=(((int(flash_size_map)<<4)| int(flash_clk_div))&0xff)
|
||||
app=int(user_bin)&0xff
|
||||
if boot_mode == '2':
|
||||
# write irom bin head
|
||||
#data_bin = struct.pack('<BBBBI',BIN_MAGIC_IROM,4,byte2,byte3,long(entry_addr,16))
|
||||
data_bin = struct.pack('<BBBBI',BIN_MAGIC_IROM,4,0,app,long(entry_addr,16))
|
||||
sum_size = len(data_bin)
|
||||
write_file(flash_bin_name,data_bin)
|
||||
|
||||
# irom0.text.bin
|
||||
combine_bin(irom0text_bin_name,flash_bin_name,0x0,0)
|
||||
if boot_mode == '1':
|
||||
data_bin = struct.pack('<BBBBI',BIN_MAGIC_FLASH,3,0,app,long(entry_addr,16))
|
||||
else:
|
||||
data_bin = struct.pack('<BBBBI',BIN_MAGIC_FLASH,3,byte2,byte3,long(entry_addr,16))
|
||||
sum_size = len(data_bin)
|
||||
write_file(flash_bin_name,data_bin)
|
||||
|
||||
# text.bin
|
||||
combine_bin(text_bin_name,flash_bin_name,TEXT_ADDRESS,1)
|
||||
|
||||
# data.bin
|
||||
if data_start_addr:
|
||||
combine_bin(data_bin_name,flash_bin_name,long(data_start_addr,16),1)
|
||||
|
||||
# rodata.bin
|
||||
combine_bin(rodata_bin_name,flash_bin_name,long(rodata_start_addr,16),1)
|
||||
|
||||
# write checksum header
|
||||
sum_size = os.path.getsize(flash_bin_name) + 1
|
||||
sum_size = flash_data_line - (data_line_bits&sum_size)
|
||||
if sum_size:
|
||||
data_str = ['00']*(sum_size)
|
||||
data_bin = binascii.a2b_hex(''.join(data_str))
|
||||
write_file(flash_bin_name,data_bin)
|
||||
write_file(flash_bin_name,chr(chk_sum & 0xFF))
|
||||
|
||||
if boot_mode == '1':
|
||||
sum_size = os.path.getsize(flash_bin_name)
|
||||
data_str = ['FF']*(0x10000-sum_size)
|
||||
data_bin = binascii.a2b_hex(''.join(data_str))
|
||||
write_file(flash_bin_name,data_bin)
|
||||
|
||||
fp = open(irom0text_bin_name,'rb')
|
||||
if fp:
|
||||
data_bin = fp.read()
|
||||
write_file(flash_bin_name,data_bin)
|
||||
fp.close()
|
||||
else :
|
||||
print '!!!Open %s fail!!!'%(flash_bin_name)
|
||||
sys.exit(0)
|
||||
if boot_mode == '1' or boot_mode == '2':
|
||||
all_bin_crc = getFileCRC(flash_bin_name)
|
||||
print all_bin_crc
|
||||
if all_bin_crc < 0:
|
||||
all_bin_crc = abs(all_bin_crc) - 1
|
||||
else :
|
||||
all_bin_crc = abs(all_bin_crc) + 1
|
||||
print all_bin_crc
|
||||
write_file(flash_bin_name,chr((all_bin_crc & 0x000000FF))+chr((all_bin_crc & 0x0000FF00) >> 8)+chr((all_bin_crc & 0x00FF0000) >> 16)+chr((all_bin_crc & 0xFF000000) >> 24))
|
||||
cmd = 'rm eagle.app.sym'
|
||||
os.system(cmd)
|
||||
|
||||
if __name__=='__main__':
|
||||
gen_appbin()
|
||||
Executable
+42
@@ -0,0 +1,42 @@
|
||||
import os
|
||||
|
||||
|
||||
class Cert(object):
|
||||
def __init__(self, name, buff):
|
||||
self.name = name
|
||||
self.len = len(buff)
|
||||
self.buff = buff
|
||||
pass
|
||||
|
||||
def __str__(self):
|
||||
out_str = ['\0']*32
|
||||
for i in range(len(self.name)):
|
||||
out_str[i] = self.name[i]
|
||||
out_str = "".join(out_str)
|
||||
out_str += str(chr(self.len & 0xFF))
|
||||
out_str += str(chr((self.len & 0xFF00) >> 8))
|
||||
out_str += self.buff
|
||||
return out_str
|
||||
pass
|
||||
|
||||
|
||||
def main():
|
||||
cert_list = []
|
||||
file_list = os.listdir(os.getcwd())
|
||||
cert_file_list = []
|
||||
for _file in file_list:
|
||||
pos = _file.find(".cer")
|
||||
if pos != -1:
|
||||
cert_file_list.append(_file[:pos])
|
||||
|
||||
for cert_file in cert_file_list:
|
||||
with open(cert_file+".cer", 'rb') as f:
|
||||
buff = f.read()
|
||||
cert_list.append(Cert(cert_file, buff))
|
||||
with open('esp_ca_cert.bin', 'wb+') as f:
|
||||
for _cert in cert_list:
|
||||
f.write("%s" % _cert)
|
||||
pass
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
Executable
+92
@@ -0,0 +1,92 @@
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the axTLS project nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
#
|
||||
# Generate the certificates and keys for testing.
|
||||
#
|
||||
|
||||
PROJECT_NAME="TLS Project"
|
||||
|
||||
# Generate the openssl configuration files.
|
||||
cat > ca_cert.conf << EOF
|
||||
[ req ]
|
||||
distinguished_name = req_distinguished_name
|
||||
prompt = no
|
||||
|
||||
[ req_distinguished_name ]
|
||||
O = $PROJECT_NAME Dodgy Certificate Authority
|
||||
EOF
|
||||
|
||||
cat > certs.conf << EOF
|
||||
[ req ]
|
||||
distinguished_name = req_distinguished_name
|
||||
prompt = no
|
||||
|
||||
[ req_distinguished_name ]
|
||||
O = $PROJECT_NAME
|
||||
CN = 127.0.0.1
|
||||
EOF
|
||||
|
||||
cat > device_cert.conf << EOF
|
||||
[ req ]
|
||||
distinguished_name = req_distinguished_name
|
||||
prompt = no
|
||||
|
||||
[ req_distinguished_name ]
|
||||
O = $PROJECT_NAME Device Certificate
|
||||
EOF
|
||||
|
||||
# private key generation
|
||||
openssl genrsa -out TLS.ca_key.pem 1024
|
||||
openssl genrsa -out TLS.key_1024.pem 1024
|
||||
|
||||
# convert private keys into DER format
|
||||
openssl rsa -in TLS.key_1024.pem -out TLS.key_1024 -outform DER
|
||||
|
||||
# cert requests
|
||||
openssl req -out TLS.ca_x509.req -key TLS.ca_key.pem -new \
|
||||
-config ./ca_cert.conf
|
||||
openssl req -out TLS.x509_1024.req -key TLS.key_1024.pem -new \
|
||||
-config ./certs.conf
|
||||
|
||||
# generate the actual certs.
|
||||
openssl x509 -req -in TLS.ca_x509.req -out TLS.ca_x509.pem \
|
||||
-sha1 -days 5000 -signkey TLS.ca_key.pem
|
||||
openssl x509 -req -in TLS.x509_1024.req -out TLS.x509_1024.pem \
|
||||
-sha1 -CAcreateserial -days 5000 \
|
||||
-CA TLS.ca_x509.pem -CAkey TLS.ca_key.pem
|
||||
|
||||
# some cleanup
|
||||
rm TLS*.req
|
||||
rm *.conf
|
||||
|
||||
openssl x509 -in TLS.ca_x509.pem -outform DER -out TLS.ca_x509.cer
|
||||
openssl x509 -in TLS.x509_1024.pem -outform DER -out TLS.x509_1024.cer
|
||||
|
||||
#
|
||||
# Generate the certificates and keys for encrypt.
|
||||
#
|
||||
|
||||
# set default cert for use in the client
|
||||
xxd -i TLS.x509_1024.cer | sed -e \
|
||||
"s/TLS_x509_1024_cer/default_certificate/" > cert.h
|
||||
# set default key for use in the server
|
||||
xxd -i TLS.key_1024 | sed -e \
|
||||
"s/TLS_key_1024/default_private_key/" > private_key.h
|
||||
Executable
BIN
Binary file not shown.
+5
-1
@@ -29,10 +29,14 @@ USE_HEATSHRINK = yes
|
||||
|
||||
USE_OPENSDK = yes
|
||||
|
||||
SDK_BASE=/opt/Espressif/esp_iot_sdk_v1.5.2
|
||||
# this ugly trick is needed to allow a relative path
|
||||
SDK_BASE=$(dir $(lastword $(MAKEFILE_LIST)))/esp_iot_sdk_v1.5.2/
|
||||
|
||||
# combined / separate / ota
|
||||
OUTPUT_TYPE = combined
|
||||
|
||||
# SPI flash size, in K
|
||||
ESP_SPI_FLASH_SIZE_K = 1024
|
||||
|
||||
# Admin password, used to store settings to flash as defaults
|
||||
ADMIN_PASSWORD = "19738426"
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
pages/_test_env.php
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Those replacements are done by the development server to test it locally
|
||||
* without esphttpd. This is needed mainly for places where the replacements
|
||||
* are given to JavaScript, to avoid syntax errors with
|
||||
*/
|
||||
return [
|
||||
'term_title' => 'ESPTerm local debug',
|
||||
|
||||
'btn1' => '1',
|
||||
'btn2' => '2',
|
||||
'btn3' => '3',
|
||||
'btn4' => '',
|
||||
'btn5' => '5',
|
||||
'labels_seq' => 'TESPTerm local debug1235',
|
||||
|
||||
'screenData' => 'HELLOxNRE3',//'\u000b\u0001\u001b\u0001\u0001\u0001\u0001\u0001\f\u0005\u0001\u0010\u0003HELLOx\u0002\u000b\u0001\u0001N\u0001RE\u00023\u0001', //,
|
||||
/*'{
|
||||
"w": 26, "h": 10,
|
||||
"x": 10, "y": 5,
|
||||
"cv": 1, "fg": 10, "bg": 2,
|
||||
"screen": ""
|
||||
}',//"70 t259"*/
|
||||
|
||||
'parser_tout_ms' => 10,
|
||||
|
||||
'opmode' => '2',
|
||||
'sta_enable' => '0',
|
||||
'ap_enable' => '1',
|
||||
|
||||
'tpw' => '60',
|
||||
'ap_channel' => '7',
|
||||
'ap_ssid' => 'ESP-123456',
|
||||
'ap_password' => 'Passw0rd!',
|
||||
'ap_hidden' => '0',
|
||||
|
||||
'sta_ssid' => 'Chlivek',
|
||||
'sta_password' => 'windows XP is The Best',
|
||||
'sta_active_ip' => '1.2.3.4',
|
||||
'sta_active_ssid' => 'Chlivek',
|
||||
|
||||
'vers_fw' => '1.2.3',
|
||||
'date' => date('Y-m-d'),
|
||||
'time' => date('G:i'),
|
||||
'vers_httpd' => '4.5.6',
|
||||
'vers_sdk' => '1.52',
|
||||
'githubrepo' => 'https://github.com/MightyPork/esp-vt100-firmware',
|
||||
|
||||
'ap_dhcp_time' => '120',
|
||||
'ap_dhcp_start' => '192.168.4.100',
|
||||
'ap_dhcp_end' => '192.168.4.200',
|
||||
'ap_addr_ip' => '192.168.4.1',
|
||||
'ap_addr_mask' => '255.255.255.0',
|
||||
|
||||
'sta_dhcp_enable' => '1',
|
||||
'sta_addr_ip' => '192.168.0.33',
|
||||
'sta_addr_mask' => '255.255.255.0',
|
||||
'sta_addr_gw' => '192.168.0.1',
|
||||
|
||||
'sta_mac' => 'ab:cd:ef:01:23:45',
|
||||
'ap_mac' => '01:23:45:ab:cd:ef',
|
||||
|
||||
'term_width' => '26',
|
||||
'term_height' => '10',
|
||||
'default_bg' => '0',
|
||||
'default_fg' => '7',
|
||||
|
||||
'uart_baud' => 115200,
|
||||
'uart_stopbits' => 1,
|
||||
'uart_parity' => 2,
|
||||
|
||||
'theme' => 5,
|
||||
];
|
||||
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
define("ESP_IP", "192.168.0.19");
|
||||
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
define("ESP_IP", "192.168.0.19");
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
$pages = [];
|
||||
|
||||
if (! function_exists('pg')) {
|
||||
/** Add a page */
|
||||
function pg($key, $bc, $icon, $path, $titleKey = null)
|
||||
{
|
||||
global $pages;
|
||||
$pages[$key] = (object) [
|
||||
'key' => $key,
|
||||
'bodyclass' => $bc,
|
||||
'path' => $path,
|
||||
'icon' => $icon ? "icn-$icon" : '',
|
||||
'label' => tr("menu.$key"),
|
||||
'title' => $titleKey ? tr($titleKey) : tr("menu.$key"),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
pg('cfg_term', 'cfg', 'terminal', '/cfg/term');
|
||||
pg('term_set', 'api', '', '/cfg/term/set');
|
||||
|
||||
pg('cfg_wifi', 'cfg', 'wifi', '/cfg/wifi');
|
||||
pg('cfg_wifi_conn', '', '', '/cfg/wifi/connecting');
|
||||
pg('wifi_connstatus', 'api', '', '/cfg/wifi/connstatus');
|
||||
pg('wifi_set', 'api', '', '/cfg/wifi/set');
|
||||
pg('wifi_scan', 'api', '', '/cfg/wifi/scan');
|
||||
|
||||
pg('cfg_network', 'cfg', 'network', '/cfg/network');
|
||||
pg('network_set', 'api', '', '/cfg/network/set');
|
||||
|
||||
pg('cfg_system', 'cfg', 'configure', '/cfg/system');
|
||||
pg('system_set', 'api', '', '/cfg/system/set');
|
||||
|
||||
pg('write_defaults', 'api', '', '/cfg/system/write_defaults');
|
||||
pg('restore_defaults', 'api', '', '/cfg/system/restore_defaults');
|
||||
pg('restore_hard', 'api', '', '/cfg/system/restore_hard');
|
||||
|
||||
pg('help', 'cfg page-help', 'help', '/help');
|
||||
pg('about', 'cfg page-about', 'about', '/about');
|
||||
pg('term', 'term', '', '/', 'title.term');
|
||||
|
||||
// ajax API
|
||||
|
||||
return $pages;
|
||||
@@ -1,80 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>About - ESP8266 Remote Terminal</title>
|
||||
<meta name="viewport" content="width=device-width,shrink-to-fit=no,user-scalable=no,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0">
|
||||
|
||||
<link rel="stylesheet" href="/css/app.css">
|
||||
<script src="/js/app.js"></script>
|
||||
</head>
|
||||
<body class="page-about">
|
||||
|
||||
<h1 onclick="location.href='/'">About</h1>
|
||||
|
||||
<div class="Box">
|
||||
<img src="/img/cvut.svg" id="logo" class="mq-tablet-min">
|
||||
<h2>ESP8266 Remote Terminal</h2>
|
||||
|
||||
<img src="/img/cvut.svg" id="logo2" class="mq-phone">
|
||||
|
||||
<p>© Ondřej Hruška, 2017 <<a href="mailto:ondra@ondrovo.com">ondra@ondrovo.com</a>></p>
|
||||
|
||||
<p><a href="http://measure.feld.cvut.cz/" target="blank">Katedra měření, FEL ČVUT</a><br>Department of Measurement, FEE CTU</p>
|
||||
</div>
|
||||
|
||||
<div class="Box">
|
||||
<h2>Firmware</h2>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Firmware</th>
|
||||
<td>v%vers_fw%, build <i>%date%</i> at <i>%time%</i></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>libesphttpd</th>
|
||||
<td>v%vers_httpd%</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>ESP IoT SDK</th>
|
||||
<td>v%vers_sdk%</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="Box">
|
||||
<h2>Issues</h2>
|
||||
<p>
|
||||
Please report any issues to the <a href="%githubrepo%/issues">bugtracker</a> or send them by e-mail.
|
||||
</p>
|
||||
<p>
|
||||
Firmware updates can be downloaded from the <a href="%githubrepo%/releases">releases page</a>.
|
||||
Flash the images using <a href="https://github.com/espressif/esptool">esptool</a>.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="Box">
|
||||
<h2>Contributing</h2>
|
||||
<p>
|
||||
Submit your improvements and ideas to the project on <a href="%githubrepo%">GitHub</a>.<br>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="Box">
|
||||
<h2>Acknowledgements</h2>
|
||||
<p>
|
||||
The webserver is based on a <a href="https://github.com/MightyPork/libesphttpd">fork</a> of the
|
||||
<a href="https://github.com/Spritetm/esphttpd">esphttpd</a> library by Jeroen Domburg (Sprite_tm).
|
||||
</p>
|
||||
<p>
|
||||
Using (modified) JS library <a href="https://github.com/kylebarrow/chibi">chibi.js</a> by Kyle Barrow as a lightweight jQuery alternative.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<nav id="botnav">
|
||||
<a href="/">Terminal</a><!--
|
||||
--><a href="/help">Help</a><!--
|
||||
--><a href="/wifi">WiFi config</a>
|
||||
</nav>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* The common stuff required by both index.php and build_html.php
|
||||
* this must be required_once
|
||||
*/
|
||||
|
||||
if (defined('BASE_INITED')) return;
|
||||
define('BASE_INITED', true);
|
||||
|
||||
if (!empty($argv[1])) {
|
||||
parse_str($argv[1], $_GET);
|
||||
}
|
||||
|
||||
if (!file_exists(__DIR__ . '/_env.php')) {
|
||||
die("Copy <b>_env.php.example</b> to <b>_env.php</b> and check the settings inside!");
|
||||
}
|
||||
|
||||
require_once __DIR__ . '/_env.php';
|
||||
|
||||
$prod = defined('STDIN');
|
||||
define('DEBUG', !$prod);
|
||||
$root = DEBUG ? json_encode(ESP_IP) : 'location.host';
|
||||
define('JS_WEB_ROOT', $root);
|
||||
|
||||
define('LOCALE', isset($_GET['locale']) ? $_GET['locale'] : 'en');
|
||||
|
||||
$_messages = require(__DIR__ . '/lang/' . LOCALE . '.php');
|
||||
$_pages = require(__DIR__ . '/_pages.php');
|
||||
|
||||
define('APP_NAME', 'ESPTerm');
|
||||
|
||||
/** URL (dev or production) */
|
||||
function url($name, $relative = false)
|
||||
{
|
||||
global $_pages;
|
||||
if ($relative) return $_pages[$name]->path;
|
||||
|
||||
if (DEBUG) return "/index.php?page=$name";
|
||||
else return $_pages[$name]->path;
|
||||
}
|
||||
|
||||
/** URL label for a button */
|
||||
function label($name)
|
||||
{
|
||||
global $_pages;
|
||||
return $_pages[$name]->label;
|
||||
}
|
||||
|
||||
function e($s)
|
||||
{
|
||||
return htmlspecialchars($s, ENT_HTML5 | ENT_QUOTES);
|
||||
}
|
||||
|
||||
function tr($key)
|
||||
{
|
||||
global $_messages;
|
||||
return isset($_messages[$key]) ? $_messages[$key] : ('??' . $key . '??');
|
||||
}
|
||||
|
||||
/** Like eval, but allows <?php and ?> */
|
||||
function include_str($code)
|
||||
{
|
||||
$tmp = tmpfile();
|
||||
$tmpf = stream_get_meta_data($tmp);
|
||||
$tmpf = $tmpf ['uri'];
|
||||
fwrite($tmp, $code);
|
||||
$ret = include($tmpf);
|
||||
fclose($tmp);
|
||||
return $ret;
|
||||
}
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/base.php';
|
||||
|
||||
function process_html($s) {
|
||||
$pattern = '/<!--(.*)-->/Uis';
|
||||
$s = preg_replace($pattern, '', $s);
|
||||
|
||||
$pattern = '/(?:(?:\/\*(?:[^*]|(?:\*+[^*\/]))*\*+\/)|(?:(?<!\:|\\\|\'|\")\/\/.*))/';
|
||||
$s = preg_replace($pattern, '', $s);
|
||||
|
||||
$pattern = '/\s+/s';
|
||||
$s = preg_replace($pattern, ' ', $s);
|
||||
return $s;
|
||||
}
|
||||
|
||||
ob_start();
|
||||
foreach($_pages as $_k => $p) {
|
||||
if ($p->bodyclass == 'api') continue;
|
||||
echo "Generating: $_k ($p->title)\n";
|
||||
$_GET['page'] = $_k;
|
||||
ob_flush(); // print the message
|
||||
ob_clean(); // clean up
|
||||
include(__DIR__ . '/index.php');
|
||||
$s = ob_get_contents(); // grab the output
|
||||
|
||||
// remove newlines and comments
|
||||
// as tests have shown, it saves just a couple kilobytes,
|
||||
// making it not a very big improvement at the expense of ugly html.
|
||||
// $s = process_html($s);
|
||||
|
||||
ob_clean(); // clean up
|
||||
$of = __DIR__ . '/../html/' . $_k . '.tpl';
|
||||
file_put_contents($of, $s); // write to a file
|
||||
}
|
||||
|
||||
ob_flush();
|
||||
+1065
-297
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Executable
+22
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
/* This script is run on demand to generate JS version of tr() */
|
||||
|
||||
require_once __DIR__ . '/base.php';
|
||||
|
||||
$selected = [
|
||||
'wifi.connected_ip_is',
|
||||
'wifi.not_conn',
|
||||
'wifi.enter_passwd',
|
||||
];
|
||||
|
||||
$out = [];
|
||||
foreach ($selected as $key) {
|
||||
$out[$key] = $_messages[$key];
|
||||
}
|
||||
|
||||
file_put_contents(__DIR__. '/jssrc/lang.js',
|
||||
"// Generated from PHP locale file\n" .
|
||||
'var _tr = ' . json_encode($out, JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE) . ";\n\n" .
|
||||
"function tr(key) { return _tr[key] || '?'+key+'?'; }\n"
|
||||
);
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user