Compare commits

...
232 Commits
Author SHA1 Message Date
MightyPork 3f0b6f2d26 fix bad submodue ref 2017-09-13 01:21:45 +02:00
MightyPork 5846d46e0c Merge remote-tracking branch 'origin/work' 2017-09-13 01:20:34 +02:00
MightyPork 1454987fcf Merge branch 'work' of github.com:espterm/espterm-firmware into work 2017-09-13 01:12:13 +02:00
MightyPork 2ba04b92d7 frontend update + fixes 2017-09-13 01:12:07 +02:00
MightyPorkandGitHub 6a7493a7be Update README.md 2017-09-12 15:47:15 +02:00
MightyPork 565b2113a5 submodue update - cache busting 2017-09-12 00:53:32 +02:00
MightyPork 128515a9a7 git hashes on about page 2017-09-12 00:26:43 +02:00
MightyPork 038c3b6466 update build script 2017-09-11 22:59:26 +02:00
MightyPork fa5953a231 front-end update 2017-09-11 15:05:29 +02:00
MightyPork 5aef8a0f11 Fix js error prevending wifi scanning 2017-09-11 12:36:23 +02:00
MightyPork 356c4557bb change default size back to 26x10 so it makes better first impression on a phone 2017-09-11 11:34:26 +02:00
MightyPork 5ff9d17850 adjusted defaults (disabled buttons by default so we dont confuse users with something they dont expect) 2017-09-11 05:09:22 +02:00
MightyPork ccbb1886af two hundred and fifty six colors, ladies and gentlemen!! 2017-09-11 04:27:50 +02:00
MightyPork 65d177f149 shortened utf cache & added missing flash storage attr 2017-09-11 03:26:57 +02:00
MightyPork 7cf82753ff bugfixes 2017-09-11 03:15:20 +02:00
MightyPork c4d399ccb0 added utf8 cache implementation, not yet used 2017-09-11 02:07:17 +02:00
MightyPork 521bc63c22 submodule ref 2017-09-11 00:58:49 +02:00
MightyPork b02aebf8c2 repeat character command 2017-09-11 00:53:42 +02:00
MightyPork 4c2421121f moved funcs to flash to make it build again, reduced logging buffer, disabled some logging; add missing files 2017-09-11 00:08:50 +02:00
MightyPork 6e1173cfcf make canvas branch be the default now 2017-09-10 14:05:02 +02:00
MightyPork b0992702b9 Added MPL license file 2017-09-10 10:48:58 +02:00
MightyPork 1742f4604a small cleaning 2017-09-10 10:15:35 +02:00
MightyPork 10fafd7c23 upse capital G for consistency 2017-09-10 02:24:50 +02:00
MightyPork c838883e69 back-end for #123 2017-09-10 02:23:57 +02:00
MightyPork 384372e6c8 backend support for SGR overline, bit 7 of attrib byte 2017-09-10 02:13:34 +02:00
MightyPork 74c7628474 groundwork for 256 color parsing, added conceal 2017-09-10 02:02:43 +02:00
MightyPork bd43c4d9c3 prevent compressor blowing up short repetitions 2017-09-10 01:28:30 +02:00
MightyPork 2e004b6048 changes to terminal settings now have immediate effect via notify 2017-09-10 00:43:31 +02:00
MightyPork ab921d2523 fix newline mode, add backend for cursor and crlf config in terminal config page 2017-09-09 23:51:26 +02:00
MightyPork 9ac5143228 fix compile error - missing declaration 2017-09-09 23:08:48 +02:00
MightyPork 2bea6397c6 cursor shape CSI and cursor blink toggle 2017-09-09 23:06:58 +02:00
MightyPork ea97752867 implemented saving to alternate buffer (except screen content) 2017-09-09 22:27:29 +02:00
MightyPork a12dcfc86f update github repo link 2017-09-09 20:59:17 +02:00
MightyPork b89db56c48 fix build script and switch default submodule to use master branch 2017-09-09 19:52:37 +02:00
MightyPork 6b603a1a8c Delete old html files & moved front-end to a submodule 2017-09-09 19:42:29 +02:00
cpsdqs 0caadb6f41 Actually fix selection not working
by just adding the selection colors to the palette
2017-09-09 16:20:47 +02:00
MightyPork ff5aa4c12c Merge branch 'canvas' of github.com:MightyPork/ESPTerm into canvas 2017-09-09 16:11:36 +02:00
MightyPork 0967d7f94a fixed bad submodule revision 2017-09-09 16:11:30 +02:00
cpsdqs 26e385b4c0 Fix selection not working 2017-09-09 16:10:10 +02:00
cpsdqs 5cc3003e47 Only redraw changed cells (huge performance boost!)
also add semicolons
2017-09-09 16:01:36 +02:00
cpsdqs 3e6187dba9 Add resize button 2017-09-09 15:15:11 +02:00
cpsdqs 7407419e56 Use proper soft keyboard events
...or as close as it gets because the way input events work on mobile is awful.
2017-09-09 14:55:54 +02:00
MightyPork 93824964ed gitignore update 2017-09-09 14:45:05 +02:00
cpsdqsandMightyPork abecf0d4ce Add fitIntoWidth/Height 2017-09-09 14:38:03 +02:00
cpsdqsandMightyPork d6d985a172 Make operators more readable
(it'll be minified anyway)
2017-09-09 14:38:03 +02:00
cpsdqsandMightyPork 71cab02b3e Set to ctx.font as little as possible to improve Firefox performance 2017-09-09 14:38:03 +02:00
MightyPork 3926776adc Fixed the stupid unicode bug 2017-09-09 14:38:03 +02:00
MightyPork 3b7cd0a42e yarn lock 2017-09-09 14:38:03 +02:00
cpsdqsandMightyPork f85bcb3ef6 Use local sass instead of mysterious global CLI 2017-09-09 14:38:03 +02:00
cpsdqsandMightyPork 0f9809c290 Prevent space from scrolling 2017-09-09 14:38:03 +02:00
MightyPork 2d22d5cff1 fix firmware build scripts & disable yuicompressor 2017-09-09 14:38:03 +02:00
cpsdqsandMightyPork ab2dc10e35 Add Menlo to monospace font stack
lest it be Courier on iOS
2017-09-09 14:38:03 +02:00
cpsdqsandMightyPork 34b72625a5 Add touch selection 2017-09-09 14:38:03 +02:00
MightyPork a3567ec338 nicer underlines & allow underline + strike together 2017-09-09 14:38:03 +02:00
cpsdqsandMightyPork 7576cd859a Add floating soft keyboard input 2017-09-09 14:38:03 +02:00
cpsdqsandMightyPork d82c33d774 Fix misaligned characters(?) 2017-09-09 14:38:03 +02:00
cpsdqsandMightyPork d57ed19c42 Add events to TermScreen; use correct cursor 2017-09-09 14:38:03 +02:00
cpsdqsandMightyPork bee99b4c55 Add babel-minify to packjs 2017-09-09 14:38:03 +02:00
MightyPork fe44927a62 cleaning and jslint syntax fixes 2017-09-09 14:35:37 +02:00
cpsdqsandMightyPork 8f81616ca8 Add hanging cursor 2017-09-09 14:33:50 +02:00
cpsdqsandMightyPork 15f539f4d4 Add mouse events, ⌃⇧C to copy, alt-select override
Also prevent body scroll when the terminal is scrollable
2017-09-09 14:33:50 +02:00
cpsdqsandMightyPork 3b6dfbda49 Add selection, other themes, cursor styles
and fix some issues
2017-09-09 14:33:50 +02:00
cpsdqsandMightyPork dd08290587 Rewrite term_screen with canvas 2017-09-09 14:33:50 +02:00
MightyPork b8ed46cbea removed some generated junk 2017-09-09 03:47:36 +02:00
MightyPork 8d7419b666 You wouldn't believe this simple trick that freed 10 kB of RAM! 2017-09-09 03:45:41 +02:00
MightyPork 830ec073bf fix #109 2017-09-09 03:03:12 +02:00
MightyPork 7d6cb2b660 screen serialize speedup + fix bad utf encode 2017-09-09 01:57:15 +02:00
MightyPork 1d6d6ee228 Implement initial load through websocket to cut one unnecessary HTTP GET that caused conn pool overflow. Increased reload / retry delays to reduce server spamming by poorly loaded client. 2017-09-08 23:53:23 +02:00
MightyPork a20ec8a49e version bmup 2017-09-07 22:49:38 +02:00
MightyPork 831ebe3b54 Fix broken codepage 1 2017-09-07 22:44:56 +02:00
MightyPork ea3c815a39 added script to auto-deploy demo; fixes for Edge 2017-09-07 22:42:34 +02:00
MightyPork 85f707401d Updated README 2017-09-07 18:28:23 +02:00
MightyPork 0dbfbf707f removed doc and updated readme 2017-09-07 18:15:06 +02:00
MightyPork a18b1d726e fix bad defaumt msg causing corrupt buttons 2017-09-07 16:40:45 +02:00
MightyPork f8e3454250 Modified HTML pages to allow building Demo version 2017-09-07 16:31:15 +02:00
MightyPork 184ef1ec36 change version to 1.0.0 2017-09-07 02:39:24 +02:00
MightyPork 99b07399b4 added back About link under terminal 2017-09-07 02:32:24 +02:00
MightyPork e46abe175f reduced buffers, not really needed 2017-09-07 02:27:05 +02:00
MightyPork 48cd9c1a2a fine-tuned upload system 2017-09-07 02:18:28 +02:00
MightyPork 07d1a3d3b4 remove some less useful mimes from matcher 2017-09-07 00:31:53 +02:00
MightyPork 44ea1e5b49 Upload modal 2017-09-07 00:29:06 +02:00
MightyPork 6fdb23531b implemented backindex 2017-09-06 21:35:48 +02:00
MightyPork 116201e232 Fixed a couple bugs and cleaned up the parser callbacks file for CSI 2017-09-06 20:54:20 +02:00
MightyPork a78830f805 Paste button 2017-09-06 17:27:33 +02:00
MightyPork 3f198f8360 fix parser bug with bell & broken mouse tracking sgr reporting for movement with button 2017-09-06 17:08:19 +02:00
MightyPork f693373a34 button to force screen reset 2017-09-06 16:31:48 +02:00
MightyPork 0af62f47e6 configurable button codes 2017-09-06 16:13:14 +02:00
MightyPork a673843a63 cleaning 2017-09-06 14:48:01 +02:00
MightyPork 023a2db01a off by one 2017-09-06 14:46:39 +02:00
MightyPork 979f956e7e fixed regression - buttons not sending commands 2017-09-06 14:45:34 +02:00
MightyPork 5f6566a6fd implemented loopback option SRM 2017-09-06 14:44:42 +02:00
MightyPork 6d98d2c6da removed outline from term buttons 2017-09-06 14:24:02 +02:00
MightyPork 9fa9cb0ca2 vers = 8.0.0 in preparation for next release 2017-09-06 14:22:30 +02:00
MightyPork ba9c757cdc help page improvements, opt to hide botnav and buttons, DECOPT for those: 800 and 801, charset tables added to help page, terminal css overhaul to avoid Black Lines 2017-09-06 14:21:38 +02:00
MightyPork d2b2b89593 improved the help page + added markdown style html formatting processor) 2017-09-05 21:45:12 +02:00
MightyPorkandGitHub 6aa4747d3e Mouse tracking explained 2017-09-05 17:52:13 +02:00
MightyPorkandGitHub 5eec7d2bf6 added a table with nomenclature 2017-09-05 16:54:55 +02:00
MightyPork 8028f14387 version bump 2017-09-05 02:14:55 +02:00
MightyPork daba5340f7 fixes and tweaks. implemented polling reload on HB loss 2017-09-05 02:13:16 +02:00
MightyPork a82e14961c RAM tuning 2017-09-05 01:48:37 +02:00
MightyPork 6c9ae7e126 remove debug log 2017-09-04 22:54:27 +02:00
MightyPork a3c84f9a8f Merge branch 'better-mouse' 2017-09-04 22:53:38 +02:00
MightyPork 7aa3cd7f75 working mouse 2017-09-04 22:53:29 +02:00
MightyPork 58ed6098c4 untested impl of mouse tracking modes 2017-09-04 22:03:08 +02:00
MightyPork 16a36a3d26 cleaning 2017-09-04 01:49:17 +02:00
MightyPork 9d1cefeaab done client-side mouse reporting 2017-09-04 01:46:00 +02:00
MightyPork 357600de8f expanded Help section and grouped some things; added screen resize command 2017-09-04 01:01:16 +02:00
MightyPork fe699c7918 Temporarily fixed #71 by fixed cell width, rel 7.0 preparations 2017-09-03 23:06:55 +02:00
MightyPork 4edaa0687d Implemented heartbeat 2017-09-03 22:37:54 +02:00
MightyPork f8ebae044a Fixed #63 2017-09-03 22:25:02 +02:00
MightyPork 9e9539472c renamed the project in the cmakelists clion file 2017-09-03 22:05:48 +02:00
MightyPork b57e0ee75b change GitHub URL 2017-09-03 22:02:02 +02:00
MightyPork 65e34a1634 Updated help page 2017-09-03 21:54:37 +02:00
MightyPork 6f32a6ef1a fix messed up insert/delete with region 2017-09-02 01:04:30 +02:00
MightyPork d3468a109c fix bug with hanging flag left set after GoTo col 80 2017-09-02 00:40:08 +02:00
MightyPorkandGitHub 8f82b81434 Update README.md 2017-08-25 15:19:26 +02:00
MightyPorkandGitHub 653dc55d85 Update README.md 2017-08-25 15:18:55 +02:00
MightyPork dda469ff21 Updated the xterm comparison page 2017-08-25 15:07:16 +02:00
MightyPork 3515e178cb Updated readme 2017-08-25 15:06:54 +02:00
MightyPork 5fd5c92390 bumped patch number 2017-08-25 12:47:41 +02:00
MightyPork e3ae34a932 fix broken cursor save / restore 2017-08-25 12:47:21 +02:00
MightyPork 423022b8bc Fixed the DECCOLM bug (not clearing screen etc) and a scrolling up not erasing freed lines bug 2017-08-25 12:26:18 +02:00
MightyPork fce3995800 changed mkfile attrs 2017-08-25 01:40:15 +02:00
MightyPork 67625a9317 bumped version for a new pre release for testing 2017-08-25 01:12:30 +02:00
MightyPork 35e1a788f0 Merge branch 'scrolling-region' 2017-08-25 01:08:43 +02:00
MightyPork dd68c112b0 implemented scrolling region and origin mode 2017-08-25 01:08:36 +02:00
MightyPork 2c7c496862 Merge branch 'throttle-redraw' 2017-08-24 23:08:17 +02:00
MightyPork 73c943bb97 throttle screen redraw via cooldown, setting 10/30 largely eliminates dropped bytes 2017-08-24 23:08:09 +02:00
MightyPork beda5e67c0 Merge branch 'async_uart' 2017-08-24 22:17:54 +02:00
MightyPork 357c81ba07 added async buffers for uart0, maybe improved byte drop ratio 2017-08-24 22:12:59 +02:00
MightyPork acd8801d33 W.I.P. new async Rx Tx buffer, probably not working 2017-08-24 00:47:14 +02:00
MightyPork 5c57ea3b28 Logging is now toggleable and updates are postponed if socket is busy 2017-08-22 23:05:21 +02:00
MightyPork 0e73f57da1 missing paren 2017-08-21 22:54:20 +02:00
MightyPork 1f18c7d1f6 moved the styles to the top 2017-08-21 22:47:54 +02:00
MightyPork 2a76eaee8e removed css files for doc and inlined them 2017-08-21 22:45:26 +02:00
MightyPork 3b8cfd41e3 small fixes & added doc directory 2017-08-21 22:39:59 +02:00
MightyPork 09cc66c75c fixed broken character sets & added character set 1 - augmented DOS codepage 437 2017-08-21 01:35:28 +02:00
MightyPork 7947b3a88c tab bug fixed 2017-08-20 22:44:56 +02:00
MightyPork 3355295aa3 CSI split to subroutines 2017-08-20 22:25:42 +02:00
MightyPork 87e0030be8 lowered fifo full threshold, seems the byte drop bug has improved 2017-08-20 20:51:42 +02:00
MightyPork 6d9d068268 split parser handlers file to multiple 2017-08-20 20:41:56 +02:00
MightyPork 276af04945 implemented CSI ! p as an alias to ESC c 2017-08-20 14:57:47 +02:00
MightyPork 8d9c5bb246 DECREPTPARM is now ID'd as Response to Query explicitly 2017-08-20 14:50:43 +02:00
MightyPork 59f26adf68 Stubs for scrolling region and other functions, implemented inverse video, improved parse (hardeing against xterm travesty), optimize tabs, DECREPTPARM 2017-08-20 14:42:38 +02:00
MightyPork 5995988a9b BEEEEEEEEEEEEEEEEEP 2017-08-20 00:28:31 +02:00
MightyPork fe714bf473 Parser cleanup; implemented #67, support for DCS queries, added doc comments, SGR enum 2017-08-19 23:15:15 +02:00
MightyPork 68747d493c Tab Stops™ 2017-08-19 18:58:55 +02:00
MightyPork 184b186b85 some missing sequences 2017-08-19 03:06:55 +02:00
MightyPork af47249492 NLM 2017-08-19 03:02:23 +02:00
MightyPork e22ae1e66a Buffered Logging + fix bel osc bug 2017-08-19 02:55:01 +02:00
MightyPork bf1507b624 ignore cursor chars inside escape seqs + can, sub terminate, esc start new 2017-08-19 01:35:30 +02:00
MightyPork b5378a6626 config toggle for xterm fn keys and display timeout added 2017-08-18 14:52:51 +02:00
MightyPork 9cac029e58 implemented numpad alt mode, fn keys alt mode and cursor alt mode 2017-08-18 14:19:54 +02:00
MightyPork 8117229926 moving some stuff around, removed "soft reset" seq, added server-side support for control key remaps 2017-08-18 00:38:46 +02:00
MightyPork 04b75b8218 xenl 2017-08-17 01:38:25 +02:00
MightyPork 89fca5c40a insert mode 2017-08-17 00:51:28 +02:00
MightyPork ca410736f7 removed some logging and version bump 2017-08-15 03:14:07 +02:00
MightyPork 2ca8bf1483 workaround for buggy ets_timer_disarm causing bootloop in some devices with perser tiemout > 0 2017-08-15 02:29:16 +02:00
MightyPork 35393827a9 implemented ctrl-, f- and other keys. enter now sends CR, use ctrl-enter for LF. 2017-08-15 01:04:58 +02:00
MightyPork ea84d1889d 0.6.6 2017-08-14 01:44:02 +02:00
MightyPork bc41a21f23 some more missing commands, added code pages, fixed the xterm size command and some other stuff. also FRAKTUR 2017-08-14 01:40:40 +02:00
MightyPork e48180ac10 more commands and glitches fixed, better debug messages, discard bad unicode 2017-08-13 17:30:54 +02:00
MightyPork e47a5477f9 fixed swapped 0 and 1 in clearing commands 2017-08-12 23:01:51 +02:00
MightyPork e944a994a7 version bump 2017-08-11 12:16:41 +02:00
MightyPork 6535b49551 implemented Inser and Delete lines/characters (e[ Pn L,M,@,P) 2017-08-11 11:59:50 +02:00
MightyPork 2cb8586c94 preparation for insert and delete commands 2017-08-10 01:58:10 +02:00
MightyPork ec1cebdd4c bugfixes 2017-08-10 01:52:48 +02:00
MightyPork af5a3a64ed fix bug and undo regression with cursor restore 2017-08-09 20:45:22 +02:00
MightyPork 7b94eef448 implemented a couple new ESC codes and stubs for 4 others 2017-08-09 20:41:47 +02:00
MightyPork c8067122d5 parser cleanup for adding new hash and short ESC sequences (issue #41) - EDM tbd 2017-08-07 00:48:15 +02:00
MightyPork 12385b7a5f dont clear terminal screen when not needed. also allow setting term title or buttons to empty string 2017-08-06 19:50:18 +02:00
MightyPork 5564147f67 version bump 2017-08-06 19:08:12 +02:00
MightyPork 32ba7dc0d7 fixed a lot of bugs with wifi connecting 2017-08-06 19:07:43 +02:00
MightyPork 80721c1715 allow submitting empty get args - may solve some bugs with wifi config 2017-08-06 17:56:27 +02:00
MightyPork e22d3f26d9 Added Wifi conf link to the bottom navbar, auto-expand Station config box 2017-08-06 17:53:21 +02:00
MightyPork 24a6a0dfd3 added git hash to version string 2017-08-06 14:58:46 +02:00
MightyPork 8a182f072d removed mentions of " ' > < from help, as those characters are now allowed and properly escaped everywhere 2017-08-06 14:26:54 +02:00
MightyPork 76b447d03e throttle reload nad use textarea for mobile input bc it shows better symbol for the enter button 2017-08-06 14:20:34 +02:00
MightyPork 319427ba2e the onscreen android keyboard now works 2017-08-06 14:17:05 +02:00
MightyPork f8c60b0668 parser timeout, better checksum checking and struct stuffing, shaved some bytes off RAM 2017-08-06 11:22:45 +02:00
MightyPork 4eaee9389d use html and js escapes for tpl strings 2017-08-06 02:15:31 +02:00
MightyPork 0a731bd35e fix some bugs 2017-08-06 00:24:16 +02:00
MightyPork 0b3cfe0e74 use 0x01 for seps in labels string so users can use pipe if they want to 2017-08-05 23:56:35 +02:00
MightyPork 4551ad6dbe added info about the new commands to help. also e]FRa is removed bc it is no longer useful for anything 2017-08-05 23:46:11 +02:00
MightyPork 3f4b8a94f1 commands to set button or title 2017-08-05 21:40:25 +02:00
MightyPork 373affb582 parser formatting to look lkike a huge comment to C editors 2017-08-05 18:57:57 +02:00
MightyPork b48bb12067 help page update 2017-08-05 18:20:13 +02:00
MightyPork 110f461cf5 bold works !! 2017-07-31 02:59:13 +02:00
MightyPork 3ae1451821 working unicode!!! WTF!! and ajax initial load to avoid having to escape shit 2017-07-31 02:41:35 +02:00
MightyPork d711909812 w.i.p. Terminal Themes added, improved terminal color picker, new compression in front-end 2017-07-31 00:39:46 +02:00
MightyPork 76167b8014 WiFi sections hiding, STA auto enable on scan click, Terminal colors preview, better explanations, CONFIGURABLE UART 2017-07-29 20:55:16 +02:00
MightyPork e42407ad62 fontello unpack script & improved checkbox style 2017-07-29 12:33:55 +02:00
MightyPork 083eb4a9b3 version bump and removed the development AP default config 2017-07-24 01:22:27 +02:00
MightyPork 97d4ff12da persist tweaks 2017-07-24 01:07:09 +02:00
MightyPork 481c671f03 fixed some bugs with persistent settings and hard reset 2017-07-24 00:59:56 +02:00
MightyPork 50c877d7bb updated readme a bit 2017-07-24 00:52:47 +02:00
MightyPorkandGitHub 9a9ed1445a Merge pull request #30 from MightyPork/wifi-redesign
Settings overhaul & exposed many new wifi settings
2017-07-24 00:41:10 +02:00
MightyPork ff6f4e35c4 bumped esplib version 2017-07-24 00:40:15 +02:00
MightyPork 28a170faa3 Fixed a ton of bugs and made almost everything work 2017-07-24 00:35:04 +02:00
MightyPork 314239842e fixed buikld_:web[ 2017-07-23 18:28:21 +02:00
MightyPork 7f8f7d8ad1 all accessible and nice, also added icons 2017-07-23 18:22:57 +02:00
MightyPork 5f3cb6685d terminal settings page and backend 2017-07-23 14:59:59 +02:00
MightyPork 3c202a1f50 error indication via GET arg err=... 2017-07-23 01:47:18 +02:00
MightyPork b238390ca8 network settings page 2017-07-23 00:57:31 +02:00
MightyPork 3f09cc3601 wifi sta picker improvements and better transl 2017-07-22 14:16:12 +02:00
MightyPork 812feebf54 scan on demand 2017-07-22 13:56:14 +02:00
MightyPork f6621252f6 frontend improvements 2017-07-22 13:23:57 +02:00
MightyPork 21b304de9f bump lib version + fix wifipage url 2017-07-16 22:55:45 +02:00
MightyPork 232e8802e2 wifi scan 2017-07-16 22:34:22 +02:00
MightyPork 357a9b6513 css for Box folding, impl network forget 2017-07-16 21:07:52 +02:00
MightyPork 856a694f0b almost complete wifi page redesign 2017-07-16 20:37:31 +02:00
MightyPork a85582b94e wifi settings remake, now correctly applied only as needed via change flags 2017-07-10 00:26:29 +02:00
MightyPork d5bd53b78a cleaning & linked boot button to new factory reset impl 2017-07-09 18:10:48 +02:00
MightyPork 5c8eab387e some renaming 2017-07-09 17:22:47 +02:00
MightyPork 509b19a9bc implemented a persistence subsystem 2017-07-09 16:44:41 +02:00
MightyPork e617b4f283 implemented "wifi manager" and many advanced wifi config options. todo unification and persistence 2017-07-09 00:41:08 +02:00
MightyPork c39391f4a0 small cleanup of ignore files etc 2017-07-08 15:09:05 +02:00
MightyPork fd5c8f3a6b Removed some junk from the SDK 2017-05-28 17:40:02 +02:00
MightyPork 13564727d9 Added the (possibly modified) Espressif SDK to the project to avoid problems with building. This may not be OK license wise, but who cares 2017-05-28 17:39:17 +02:00
MightyPork c04433b7f5 v5.6 - ESP-01S compatibility (blue LED at GPIO2, not GPIO1) 2017-03-27 20:49:40 +02:00
MightyPork ab00467914 blinking indication of BOOT held down; added info to the help page 2017-03-21 20:00:48 +01:00
MightyPork 97044c2a17 Auto wipe & reset SSID name if AI-THINKER ssid found 2017-03-19 00:47:51 +01:00
MightyPork 8eb01a725b 0.5.3 - added auto reconnect fn to javascript to fix broken page loads in some cases 2017-03-19 00:35:12 +01:00
MightyPork b074eb4f2c version bump 2017-03-02 00:52:31 +01:00
MightyPork 9dd5a1f082 Implemented cursor wrap control codes e[?7h and l 2017-03-02 00:06:45 +01:00
MightyPork e7c26b3e94 send code 0x18 on restart 2017-03-01 23:57:07 +01:00
MightyPork b6a0e796d8 Fixed broken Report Device OK response 2017-01-30 01:22:16 +01:00
MightyPork 29f726c073 Fixed some broken impl 2017-01-30 01:10:10 +01:00
MightyPork 0acf0bdd72 Small front-end improvements + made screen clearing apply cursor color to cleared area 2017-01-29 20:08:58 +01:00
MightyPork 03179a0ff0 readme 2017-01-29 15:18:00 +01:00
MightyPork 2560eae519 removed html folder, added to gitignore 2017-01-29 15:15:38 +01:00
MightyPork 9113756091 Fixed a mistake on the help page with color numbers 2017-01-29 15:13:17 +01:00
306 changed files with 17907 additions and 13823 deletions
+3 -1
View File
@@ -1,3 +1,5 @@
html/
html_demo/
build/
firmware/
espfs/mkespfsimage/*.o
@@ -9,10 +11,10 @@ espfs/espfstest/espfstest
html_compressed/
ldscript_memspecific.ld
eagle.app.sym
node_modules
# Garbage added by CLion
.idea/
CMakeLists.txt
cmake-build-debug/
.sass-cache
+4
View File
@@ -1,3 +1,7 @@
[submodule "libesphttpd"]
path = libesphttpd
url = git@github.com:MightyPork/libesphttpd.git
[submodule "front-end"]
path = front-end
url = git@github.com:espterm/espterm-front-end.git
branch = master
+168
View File
@@ -0,0 +1,168 @@
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(ESPTerm)
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/wifimgr.c
user/wifimgr.h
user/persist.c
user/persist.h
include/helpers.h
user/syscfg.c
user/syscfg.h
user/ascii.h
user/sgr.h
user/apars_utf8.c
user/apars_utf8.h
user/apars_logging.h
user/version.h
user/apars_csi.c
user/apars_csi.h
user/apars_short.c
user/apars_short.h
user/apars_string.c
user/apars_string.h
user/apars_osc.c
user/apars_osc.h
user/apars_dcs.c
user/apars_dcs.h user/uart_buffer.c user/uart_buffer.h user/jstring.c user/jstring.h user/character_sets.h user/utf8.h user/utf8.c user/cgi_logging.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
-DUSE_OPTIMIZE_PRINTF=1
-DHTTPD_MAX_CONNECTIONS=5
-DHTTPD_STACKSIZE=1000
-DICACHE_FLASH_ATTR=
-DICACHE_RODATA_ATTR=
-DFLAG_GZIP=2
-DADMIN_PASSWORD="asdf"
-DGIT_HASH="blabla"
-DDEBUG_HEAP=1
-DDEBUG_MALLOC=1
-DESPFS_HEATSHRINK)
add_executable(ESPTerm ${SOURCE_FILES})
+373
View File
@@ -0,0 +1,373 @@
Mozilla Public License Version 2.0
==================================
1. Definitions
--------------
1.1. "Contributor"
means each individual or legal entity that creates, contributes to
the creation of, or owns Covered Software.
1.2. "Contributor Version"
means the combination of the Contributions of others (if any) used
by a Contributor and that particular Contributor's Contribution.
1.3. "Contribution"
means Covered Software of a particular Contributor.
1.4. "Covered Software"
means Source Code Form to which the initial Contributor has attached
the notice in Exhibit A, the Executable Form of such Source Code
Form, and Modifications of such Source Code Form, in each case
including portions thereof.
1.5. "Incompatible With Secondary Licenses"
means
(a) that the initial Contributor has attached the notice described
in Exhibit B to the Covered Software; or
(b) that the Covered Software was made available under the terms of
version 1.1 or earlier of the License, but not also under the
terms of a Secondary License.
1.6. "Executable Form"
means any form of the work other than Source Code Form.
1.7. "Larger Work"
means a work that combines Covered Software with other material, in
a separate file or files, that is not Covered Software.
1.8. "License"
means this document.
1.9. "Licensable"
means having the right to grant, to the maximum extent possible,
whether at the time of the initial grant or subsequently, any and
all of the rights conveyed by this License.
1.10. "Modifications"
means any of the following:
(a) any file in Source Code Form that results from an addition to,
deletion from, or modification of the contents of Covered
Software; or
(b) any new file in Source Code Form that contains any Covered
Software.
1.11. "Patent Claims" of a Contributor
means any patent claim(s), including without limitation, method,
process, and apparatus claims, in any patent Licensable by such
Contributor that would be infringed, but for the grant of the
License, by the making, using, selling, offering for sale, having
made, import, or transfer of either its Contributions or its
Contributor Version.
1.12. "Secondary License"
means either the GNU General Public License, Version 2.0, the GNU
Lesser General Public License, Version 2.1, the GNU Affero General
Public License, Version 3.0, or any later versions of those
licenses.
1.13. "Source Code Form"
means the form of the work preferred for making modifications.
1.14. "You" (or "Your")
means an individual or a legal entity exercising rights under this
License. For legal entities, "You" includes any entity that
controls, is controlled by, or is under common control with You. For
purposes of this definition, "control" means (a) the power, direct
or indirect, to cause the direction or management of such entity,
whether by contract or otherwise, or (b) ownership of more than
fifty percent (50%) of the outstanding shares or beneficial
ownership of such entity.
2. License Grants and Conditions
--------------------------------
2.1. Grants
Each Contributor hereby grants You a world-wide, royalty-free,
non-exclusive license:
(a) under intellectual property rights (other than patent or trademark)
Licensable by such Contributor to use, reproduce, make available,
modify, display, perform, distribute, and otherwise exploit its
Contributions, either on an unmodified basis, with Modifications, or
as part of a Larger Work; and
(b) under Patent Claims of such Contributor to make, use, sell, offer
for sale, have made, import, and otherwise transfer either its
Contributions or its Contributor Version.
2.2. Effective Date
The licenses granted in Section 2.1 with respect to any Contribution
become effective for each Contribution on the date the Contributor first
distributes such Contribution.
2.3. Limitations on Grant Scope
The licenses granted in this Section 2 are the only rights granted under
this License. No additional rights or licenses will be implied from the
distribution or licensing of Covered Software under this License.
Notwithstanding Section 2.1(b) above, no patent license is granted by a
Contributor:
(a) for any code that a Contributor has removed from Covered Software;
or
(b) for infringements caused by: (i) Your and any other third party's
modifications of Covered Software, or (ii) the combination of its
Contributions with other software (except as part of its Contributor
Version); or
(c) under Patent Claims infringed by Covered Software in the absence of
its Contributions.
This License does not grant any rights in the trademarks, service marks,
or logos of any Contributor (except as may be necessary to comply with
the notice requirements in Section 3.4).
2.4. Subsequent Licenses
No Contributor makes additional grants as a result of Your choice to
distribute the Covered Software under a subsequent version of this
License (see Section 10.2) or under the terms of a Secondary License (if
permitted under the terms of Section 3.3).
2.5. Representation
Each Contributor represents that the Contributor believes its
Contributions are its original creation(s) or it has sufficient rights
to grant the rights to its Contributions conveyed by this License.
2.6. Fair Use
This License is not intended to limit any rights You have under
applicable copyright doctrines of fair use, fair dealing, or other
equivalents.
2.7. Conditions
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
in Section 2.1.
3. Responsibilities
-------------------
3.1. Distribution of Source Form
All distribution of Covered Software in Source Code Form, including any
Modifications that You create or to which You contribute, must be under
the terms of this License. You must inform recipients that the Source
Code Form of the Covered Software is governed by the terms of this
License, and how they can obtain a copy of this License. You may not
attempt to alter or restrict the recipients' rights in the Source Code
Form.
3.2. Distribution of Executable Form
If You distribute Covered Software in Executable Form then:
(a) such Covered Software must also be made available in Source Code
Form, as described in Section 3.1, and You must inform recipients of
the Executable Form how they can obtain a copy of such Source Code
Form by reasonable means in a timely manner, at a charge no more
than the cost of distribution to the recipient; and
(b) You may distribute such Executable Form under the terms of this
License, or sublicense it under different terms, provided that the
license for the Executable Form does not attempt to limit or alter
the recipients' rights in the Source Code Form under this License.
3.3. Distribution of a Larger Work
You may create and distribute a Larger Work under terms of Your choice,
provided that You also comply with the requirements of this License for
the Covered Software. If the Larger Work is a combination of Covered
Software with a work governed by one or more Secondary Licenses, and the
Covered Software is not Incompatible With Secondary Licenses, this
License permits You to additionally distribute such Covered Software
under the terms of such Secondary License(s), so that the recipient of
the Larger Work may, at their option, further distribute the Covered
Software under the terms of either this License or such Secondary
License(s).
3.4. Notices
You may not remove or alter the substance of any license notices
(including copyright notices, patent notices, disclaimers of warranty,
or limitations of liability) contained within the Source Code Form of
the Covered Software, except that You may alter any license notices to
the extent required to remedy known factual inaccuracies.
3.5. Application of Additional Terms
You may choose to offer, and to charge a fee for, warranty, support,
indemnity or liability obligations to one or more recipients of Covered
Software. However, You may do so only on Your own behalf, and not on
behalf of any Contributor. You must make it absolutely clear that any
such warranty, support, indemnity, or liability obligation is offered by
You alone, and You hereby agree to indemnify every Contributor for any
liability incurred by such Contributor as a result of warranty, support,
indemnity or liability terms You offer. You may include additional
disclaimers of warranty and limitations of liability specific to any
jurisdiction.
4. Inability to Comply Due to Statute or Regulation
---------------------------------------------------
If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Software due to
statute, judicial order, or regulation then You must: (a) comply with
the terms of this License to the maximum extent possible; and (b)
describe the limitations and the code they affect. Such description must
be placed in a text file included with all distributions of the Covered
Software under this License. Except to the extent prohibited by statute
or regulation, such description must be sufficiently detailed for a
recipient of ordinary skill to be able to understand it.
5. Termination
--------------
5.1. The rights granted under this License will terminate automatically
if You fail to comply with any of its terms. However, if You become
compliant, then the rights granted under this License from a particular
Contributor are reinstated (a) provisionally, unless and until such
Contributor explicitly and finally terminates Your grants, and (b) on an
ongoing basis, if such Contributor fails to notify You of the
non-compliance by some reasonable means prior to 60 days after You have
come back into compliance. Moreover, Your grants from a particular
Contributor are reinstated on an ongoing basis if such Contributor
notifies You of the non-compliance by some reasonable means, this is the
first time You have received notice of non-compliance with this License
from such Contributor, and You become compliant prior to 30 days after
Your receipt of the notice.
5.2. If You initiate litigation against any entity by asserting a patent
infringement claim (excluding declaratory judgment actions,
counter-claims, and cross-claims) alleging that a Contributor Version
directly or indirectly infringes any patent, then the rights granted to
You by any and all Contributors for the Covered Software under Section
2.1 of this License shall terminate.
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
end user license agreements (excluding distributors and resellers) which
have been validly granted by You or Your distributors under this License
prior to termination shall survive termination.
************************************************************************
* *
* 6. Disclaimer of Warranty *
* ------------------------- *
* *
* Covered Software is provided under this License on an "as is" *
* basis, without warranty of any kind, either expressed, implied, or *
* statutory, including, without limitation, warranties that the *
* Covered Software is free of defects, merchantable, fit for a *
* particular purpose or non-infringing. The entire risk as to the *
* quality and performance of the Covered Software is with You. *
* Should any Covered Software prove defective in any respect, You *
* (not any Contributor) assume the cost of any necessary servicing, *
* repair, or correction. This disclaimer of warranty constitutes an *
* essential part of this License. No use of any Covered Software is *
* authorized under this License except under this disclaimer. *
* *
************************************************************************
************************************************************************
* *
* 7. Limitation of Liability *
* -------------------------- *
* *
* Under no circumstances and under no legal theory, whether tort *
* (including negligence), contract, or otherwise, shall any *
* Contributor, or anyone who distributes Covered Software as *
* permitted above, be liable to You for any direct, indirect, *
* special, incidental, or consequential damages of any character *
* including, without limitation, damages for lost profits, loss of *
* goodwill, work stoppage, computer failure or malfunction, or any *
* and all other commercial damages or losses, even if such party *
* shall have been informed of the possibility of such damages. This *
* limitation of liability shall not apply to liability for death or *
* personal injury resulting from such party's negligence to the *
* extent applicable law prohibits such limitation. Some *
* jurisdictions do not allow the exclusion or limitation of *
* incidental or consequential damages, so this exclusion and *
* limitation may not apply to You. *
* *
************************************************************************
8. Litigation
-------------
Any litigation relating to this License may be brought only in the
courts of a jurisdiction where the defendant maintains its principal
place of business and such litigation shall be governed by laws of that
jurisdiction, without reference to its conflict-of-law provisions.
Nothing in this Section shall prevent a party's ability to bring
cross-claims or counter-claims.
9. Miscellaneous
----------------
This License represents the complete agreement concerning the subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. Any law or regulation which provides
that the language of a contract shall be construed against the drafter
shall not be used to construe this License against a Contributor.
10. Versions of the License
---------------------------
10.1. New Versions
Mozilla Foundation is the license steward. Except as provided in Section
10.3, no one other than the license steward has the right to modify or
publish new versions of this License. Each version will be given a
distinguishing version number.
10.2. Effect of New Versions
You may distribute the Covered Software under the terms of the version
of the License under which You originally received the Covered Software,
or under the terms of any subsequent version published by the license
steward.
10.3. Modified Versions
If you create software not governed by this License, and you want to
create a new license for such software, you may create and use a
modified version of this License if you rename the license and remove
any references to the name of the license steward (except to note that
such modified license differs from this License).
10.4. Distributing Source Code Form that is Incompatible With Secondary
Licenses
If You choose to distribute Source Code Form that is Incompatible With
Secondary Licenses under the terms of this version of the License, the
notice described in Exhibit B of this License must be attached.
Exhibit A - Source Code Form License Notice
-------------------------------------------
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
If it is not possible or desirable to put the notice in a particular
file, then You may include the notice in a location (such as a LICENSE
file in a relevant directory) where a recipient would be likely to look
for such a notice.
You may add additional accurate notices of copyright ownership.
Exhibit B - "Incompatible With Secondary Licenses" Notice
---------------------------------------------------------
This Source Code Form is "Incompatible With Secondary Licenses", as
defined by the Mozilla Public License, v. 2.0.
+28 -9
View File
@@ -62,10 +62,18 @@ LIBS = c gcc hal phy pp net80211 wpa main lwip crypto
#Add in esphttpd lib
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 \
# compiler flags using during compilation of source files -ggdb
CFLAGS = -Os -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 += -DGIT_HASH_BACKEND='"$(shell git rev-parse --short HEAD)"'
CFLAGS += -DGIT_HASH_FRONTEND='"$(shell cd front-end && git rev-parse --short HEAD)"'
CFLAGS += -DADMIN_PASSWORD=$(ADMIN_PASSWORD)
ifdef GLOBAL_CFLAGS
CFLAGS += $(GLOBAL_CFLAGS)
endif
# linker flags used to generate the main object file
LDFLAGS = -nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static
@@ -145,7 +153,6 @@ define maplookup
$(patsubst $(strip $(1)):%,%,$(filter $(strip $(1)):%,$(2)))
endef
#Include options and target specific to the OUTPUT_TYPE
include Makefile.$(OUTPUT_TYPE)
@@ -164,7 +171,7 @@ MODULE_INCDIR := $(addsuffix /include,$(INCDIR))
ESP_FLASH_SIZE_IX=$(call maplookup,$(ESP_SPI_FLASH_SIZE_K),512:0 1024:2 2048:5 4096:6)
ESPTOOL_FREQ=$(call maplookup,$(ESP_FLASH_FREQ_DIV),0:40m 1:26m 2:20m 0xf:80m 15:80m)
ESPTOOL_MODE=$(call maplookup,$(ESP_FLASH_MODE),0:qio 1:qout 2:dio 3:dout)
ESPTOOL_SIZE=$(call maplookup,$(ESP_SPI_FLASH_SIZE_K),512:4m 256:2m 1024:8m 2048:16m 4096:32m)
ESPTOOL_SIZE=$(call maplookup,$(ESP_SPI_FLASH_SIZE_K),512:512KB 256:256KB 1024:1MB 2048:2MB 4096:4MB)
ESPTOOL_OPTS=--port $(ESPPORT) --baud $(ESPBAUD)
ESPTOOL_FLASHDEF=--flash_freq $(ESPTOOL_FREQ) --flash_mode $(ESPTOOL_MODE) --flash_size $(ESPTOOL_SIZE)
@@ -182,7 +189,7 @@ $1/%.o: %.S
$(Q) $(CC) $(INCDIR) $(MODULE_INCDIR) $(EXTRA_INCDIR) $(SDK_INCDIR) $(CFLAGS) -c $$< -o $$@
endef
.PHONY: all web parser checkdirs clean libesphttpd default-tgt
.PHONY: all web parser checkdirs clean libesphttpd default-tgt espsize espmac
web:
$(Q) ./build_web.sh
@@ -190,19 +197,31 @@ web:
parser:
$(Q) ./build_parser.sh
all: checkdirs web parser $(TARGET_OUT) $(FW_BASE)
espsize:
$(Q) esptool --port /dev/ttyUSB0 flash_id
espmac:
$(Q) esptool --port /dev/ttyUSB0 read_mac
all: checkdirs
$(Q) make actual_all -j4 -B
actual_all: parser $(TARGET_OUT) $(FW_BASE)
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 " -j4
$(APP_AR): libesphttpd $(OBJ)
$(vecho) "AR $@"
$(Q) $(AR) cru $@ $(OBJ)
checkdirs: $(BUILD_DIR)
checkdirs: $(BUILD_DIR) html/favicon.ico
html/favicon.ico:
$(Q) [[ -e "html/favicon.ico" ]] || ./build_web.sh
$(BUILD_DIR):
$(Q) mkdir -p $@
+123 -74
View File
@@ -1,116 +1,165 @@
# esp-vt100-firmware
# ESPTerm
ESP8266 Remote Terminal project
**ESPTerm is a VT100-like terminal emulator running on the ESP8266 WiFi chip.**
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.
![Photo][photo-hw]<br>
*Fig 1: Breadboard adapter developed for ESPTerm*
Those forks include improvements not yet available upstream.
As of release 1.0, ESPTerm **passes most of VTTEST test cases** (from the main menu and some Xterm specific), making it
functionally comparable to eg. gnome-terminal, terminator, konsole, GtkTerm or PuTTY.
ESPTerm is **capable of running Midnight Commander** through agetty, **including full
mouse support**, provided agetty is made to believe it's Xterm, which shows ESPTerm is sufficiently well
implemented to work with ncurses.
## Goals
To see what escape sequences are supported, check out this [annotated Xterm manual page][xterm-compare]
which was used for reference, or the built-in help page ([online demo][demo-help])
This 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.
The terminal screen can be accessed using any web browser, even on a phone or tablet.
It works with ESP-01, ESP-01S, ESP-12 and likely many other modules (I use an ESP-12
on a LoLin NodeMCU board from eBay for development).
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.
With ESPTerm, you can add remote access via WiFi to any embeded project, all you need is
a serial port and some imagination!
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.
## Try it online
The screen size is adjustable up to 25x80 (via a special control sequence) and uses 16 standard colors
(8 dark and 8 bright).
You can try the web user interface here: [espterm.github.io][demo-term]
## Project status
The demo is almost identical to the real thing, except, of course, it doesn't do much without the
emulator backend that runs on the ESP8266. The web version will be updated to match this repository
after each minor release (and sometimes in between for testing; the version currently being show-cased
can be read on the About page of the demo).
*Almost finished, still possibly buggy, but it looks promising. Most of the features are there now.*
## Main features
- We have a working **2-way terminal** (UART->ESP->Browser and vice versa) with real-time update via websocket.
- **Almost complete VT102 emulation** with some extras from Xterm, eg.
- Screen size up to 80x25 (the limit can be modified when compiling from source)
- All standard text styles and 16 colors supported
- Full UTF-8 support, alternate character sets
- Standard mouse tracking modes
- You can dynamically set screen title, button labels...
- **Web Terminal Interface**
- Real-time screen update via WebSocket
- Mouse and keyboard input, works also on mobile
- 5 optional buttons for quick commands
- Text file upload tool with adjustable delays and line endings
- *Built-in help page* ([demo][demo-help]) with basic troubleshooting and command reference
- **User-friendly comprehensive WiFi configuration** (Demo: [WiFi][demo-wifi], [network][demo-network] config)
- Static IP, DHCP, channel selection, power
- SSID search utility for finding your existing network
This means that what you type in the browser is sent to UART0 and what's received on UART0 is processed by the
ANSI parser and applied to the internal screen buffer. You'll also immediately see the changes in your browser.
There's a filter in the way that discards garbage characters (like unicode and most ASCII outside 32-126).
## Running ESPTerm
For a quick test, try connecting the UART0 Rx and Tx with a piece of wire to make a loopback interface.
*NOTE: Use the bare module, not something like LoLin or NodeMCU with a FTDI, it'll interfere*.
You should then directly see what you type & can even try some ANSI sequences, right from the browser.
To run ESPTerm on your ESP8266, either build it yourself from source using `xtensa-lx106-elf-gcc`
(and the included Makefile), or download pre-built binaries from the [GitHub releases section][releases].
Flash the binaries using [esptool][esptool].
- All ANSI sequences that make sense, as well as control codes like Backspace and CR / LF are implemented.
Set colors with your usual `\e[31;1m` etc (see Wikipedia). `\e` is the ASCII code 27 (ESC).
### Pins
Arrow keys generate ANSI sequences, ESC sends literal ASCII code 27 etc. Almost everything can be input
straight from the browser.
- Pin GPIO2 is used for debug messages at 115200 baud, 8 bit, no parity.
- Pins Rx and Tx are used for the main communication UART, parameters of which can be set on the system config page.
Connect your USB-serial dongle or application microcontroller here.
- To resize the screen, send `\e]W<rows>;<cols>\a` (it's an OSC code, terminated by ST).
### Setup
- Buttons pressed in the browser UI send ASCII codes 1..5. Mouse clicks also send events to the server,
but currently don't generate any output in the terminal, I still hadn't decided on the best encoding.
- When flashed for the first time, ESPTerm wipes any possible previous WiFi configuration, because it implements its own WiFi
config manager with many additional features.
- It should start in AP mode, the default SSID being `TERM-MACADR` with `MACADR` being three unique bytes from the MAC
address / Device ID as ASCII hex.
- Connect to the AP via a smartphone or laptop and configure WiFi as desired. If a captive portal page does not open,
try 192.168.4.1 in your web browser.
- By tapping the header on the terminal page, you'll open the WiFi config page. It's in essence the
esphttpd's wifi config page, but re-styled and much improved. You can set AP SSID, channel, see the IP
address etc right there.
### Rescue from messed up config
It can happen that some changes to the WiFi or network config make the module inaccessible.
- To re-enable the built-in AP, hold the BOOT (GPIO0 -> GND) button for about 1 s, until the blue LED starts flashing.
Then quickly release the button.
- To reset all settings to defaults, hold the button a couple seconds until the LED flashes rapidly, then release it.
- You can cancel this wipe/reset operation (when triggered by accident) by pressing Reset or disconnecting the power supply.
### Config files
ESPTerm has two config "files", one for defaults and one for the currently used settings. In the case of the terminal
config, there is also a third, temporary file for changes done via ESC commands.
When you get your settings *just right*, you can store them as defaults, which can then be at any time restored
by holding the BOOT (GPIO0) button. You can do this on the System Settings page. This asks for an "admin password",
which you can define when building the firmware in the `esphttpdconfig.mk` file.
The default password is `19738426`. This password can't presently be changed without re-flashing the firmware.
You can also restore everything (except the saved defaults) to "factory defaults", there is a button for this
on the System Settings page. Those are the initial values in the config files.
## Research resources
Developing ESPTerm wasn't an easy task, because the information is scattered across many places and the existing
terminal emulators I originally used for reference (terminator, Konsole) are not implemented correctly in some details.
A great tool for checking my implementation has proven to be [VTTTEST][vttest] and Xterm as a reference
implementation that is probably the most complete emulator available, although it's cumbersome to use and its age
really shows in the looks.
I've comnpiled a list of those I found most helpful here: [VT100 emulation resources][resources]
## Development
ESPTerm's firmware is written in C and is based on SpriteTM's `libesphttpd` http server library forked to
[MightyPork/libesphttpd][httpdlib]. This fork includes various improvements
and changes required by the project.
### Installation for development
- Clone this project with `--recursive`, or afterwards run `git submodule init` and `git submodule update`.
- Install [esp-open-sdk](https://github.com/pfalcon/esp-open-sdk/) and build it with
- Install [esp-open-sdk][opensdk] and build it with
`make toolchain esptool libhal STANDALONE=n`.
Make sure the `xtensa-lx106-elf/bin` folder is on $PATH.
- Install [esptool](https://github.com/espressif/esptool) (it's in the Arch community repo and on AUR, too)
- Install [esptool][esptool] (it's in the Arch community repo and on AUR, too)
- Set up udev rules so you have access to ttyUSB0 without root, eg:
```
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 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.
- 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 dependencies of the front-end submodule (`yarn install` in the front-end folder, installed PHP)
- 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
copies over to `html`. The compression and minification is handled by scripts in libesphttpd, specifically
it runs yuicompressor on js and css and gzip or heatshrink on the other files. The `html` folder is
then embedded in the firmware image.
The web resources are in the `front-end` git submodule. To prepare the web resources for a build,
run `make web`. The resulting files are copied to `html/`. The `html/` folder is 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` (more details in the front-end repo's readme).
It's possible to talk to the API endpoints of a running ESP8266 from a page served by your local server
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`.
Sometimes it does not, particularly with `make -B`. Try just plain `make`. You can always run those
build scripts manually, too.
The web resources are normally no re-built, because the build process is quite slow. To manually rebuild them,
run `make web` before `make`.
To flash, just run `make flash`.
To flash, just run `make flash`. It will use parameters you setup in the `esphttpdconfig.mk` file.
[releases]: https://github.com/MightyPork/esp-vt100-firmware/releases
[httpdlib]: https://github.com/MightyPork/libesphttpd
[esptool]: https://github.com/espressif/esptool
[opensdk]: https://github.com/pfalcon/esp-open-sdk/
[demo-help]: https://espterm.github.io/help.html
[demo-wifi]: https://espterm.github.io/cfg_wifi.html
[demo-network]: https://espterm.github.io/cfg_network.html
[demo-term]: https://espterm.github.io/term.html
[xterm-compare]: https://espterm.github.io/docs/espterm-xterm.html
[photo-hw]: https://espterm.github.io/docs/espterm-hw-small.jpg
[resources]: https://espterm.github.io/docs/index.html
[vttest]: http://invisible-island.net/vttest/
+4 -23
View File
@@ -2,29 +2,10 @@
echo "-- Preparing WWW files --"
rm -r html
mkdir -p html/img
mkdir -p html/js
mkdir -p html/css
[[ -e html ]] && rm -r html
# 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
ESP_PROD=1 front-end/build.sh
sass --sourcemap=none html_orig/sass/app.scss html_orig/css/app.css
echo "Copying from submodule..."
# 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
cp html_orig/favicon.ico html/favicon.ico
cp -r front-end/out html
View File
+24
View File
@@ -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 产品的应用开发。在此情况下,该许可证免费授权任何获得该软件及其相关文档(统称为“软件”)的人无限制地经营该软件,包括无限制的使用、复制、修改、合并、出版发行、散布、再授权、及贩售软件及软件副本的权利。被授权人在享受这些权利的同时,需服从下面的条件:
在软件和软件的所有副本中都必须包含以上的版权声明和授权声明。
该软件按本来的样子提供,没有任何明确或暗含的担保,包括但不仅限于关于试销性、适合某一特定用途和非侵权的保证。作者和版权持有人在任何情况下均不就由软件或软件使用引起的以合同形式、民事侵权或其它方式提出的任何索赔、损害或其它责任负责。
+379
View File
@@ -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
+147
View File
@@ -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%
+150
View File
@@ -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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+77
View File
@@ -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.
+1
View File
@@ -0,0 +1 @@
Binary file not shown.
Binary file not shown.
Binary file not shown.
+122
View File
@@ -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_ */
+161
View File
@@ -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
+97
View File
@@ -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_ */
+95
View File
@@ -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_ */
+315
View File
@@ -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_
+2
View File
@@ -0,0 +1,2 @@
#undef ESP_SDK_VERSION
#define ESP_SDK_VERSION 010502
+918
View File
@@ -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
+55
View File
@@ -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
+105
View File
@@ -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 */
+100
View File
@@ -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_
+63
View File
@@ -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__ */
+70
View File
@@ -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__ */
+94
View File
@@ -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__ */
+145
View File
@@ -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__ */
+57
View File
@@ -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
+341
View File
@@ -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
+19
View File
@@ -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
+50
View File
@@ -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
+34
View File
@@ -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__ */
+34
View File
@@ -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
+204
View File
@@ -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_ */
+283
View File
@@ -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
+31
View File
@@ -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
+68
View File
@@ -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
+41
View File
@@ -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
+202
View File
@@ -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
+163
View File
@@ -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
+52
View File
@@ -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
File diff suppressed because it is too large Load Diff
+211
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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"
+350
View File
@@ -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);
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+276
View File
@@ -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()
+42
View File
@@ -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()
+92
View File
@@ -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
BIN
View File
Binary file not shown.
+27 -2
View File
@@ -18,7 +18,7 @@ GZIP_COMPRESSION = yes
# This option works only when GZIP_COMPRESSION is set to "yes"
# http://yui.github.io/yuicompressor/
#Disabled by default.
COMPRESS_W_YUI = yes
COMPRESS_W_YUI = no
YUI-COMPRESSOR = /usr/bin/yui-compressor
@@ -29,10 +29,35 @@ 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"
GLOBAL_CFLAGS = \
-DDEBUG_ROUTER=0 \
-DDEBUG_CAPTDNS=0 \
-DDEBUG_HTTP=0 \
-DDEBUG_ESPFS=0 \
-DDEBUG_PERSIST=0 \
-DDEBUG_UTFCACHE=0 \
-DDEBUG_CGI=0 \
-DDEBUG_WIFI=0 \
-DDEBUG_WS=0 \
-DDEBUG_ANSI=1 \
-DDEBUG_ANSI_NOIMPL=1 \
-DDEBUG_INPUT=0 \
-DDEBUG_HEAP=1 \
-DDEBUG_MALLOC=0 \
-DHTTPD_MAX_BACKLOG_SIZE=8192 \
-DHTTPD_MAX_HEAD_LEN=1024 \
-DHTTPD_MAX_POST_LEN=512 \
-mforce-l32 \
-DUSE_OPTIMIZE_PRINTF=1
Submodule
+1
Submodule front-end added at b2174fc528
-80
View File
@@ -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>&copy; Ondřej Hruška, 2017 &lt;<a href="mailto:ondra@ondrovo.com">ondra@ondrovo.com</a>&gt;</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&nbsp;IoT&nbsp;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>
-864
View File
@@ -1,864 +0,0 @@
/* normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */
/**
* 1. Set default font family to sans-serif.
* 2. Prevent iOS and IE text size adjust after device orientation change,
* without disabling user zoom.
*/
*, *:before, *:after {
box-sizing: border-box; }
html {
font-family: sans-serif;
/* 1 */
-ms-text-size-adjust: 100%;
/* 2 */
-webkit-text-size-adjust: 100%;
/* 2 */ }
/**
* Remove default margin.
*/
body {
margin: 0; }
/* HTML5 display definitions
========================================================================== */
/**
* Correct `block` display not defined for any HTML5 element in IE 8/9.
* Correct `block` display not defined for `details` or `summary` in IE 10/11
* and Firefox.
* Correct `block` display not defined for `main` in IE 11.
*/
figure,
nav
{
display: block; }
/**
* 1. Correct `inline-block` display not defined in IE 8/9.
* 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.
*/
canvas,
progress
{
display: inline-block;
/* 1 */
vertical-align: baseline;
/* 2 */ }
/**
* Prevent modern browsers from displaying `audio` without controls.
* Remove excess height in iOS 5 devices.
*/
/**
* Address `[hidden]` styling not present in IE 8/9/10.
* Hide the `template` element in IE 8/9/10/11, Safari, and Firefox < 22.
*/
[hidden]
{
display: none; }
/* Links
========================================================================== */
/**
* Remove the gray background color from active links in IE 10.
*/
a {
background-color: transparent; }
/**
* Improve readability of focused elements when they are also in an
* active/hover state.
*/
a:active,
a:hover {
outline: 0; }
/* Text-level semantics
========================================================================== */
/**
* Address styling not present in IE 8/9/10/11, Safari, and Chrome.
*/
/**
* Address style set to `bolder` in Firefox 4+, Safari, and Chrome.
*/
b
{
font-weight: bold; }
/**
* Address styling not present in Safari and Chrome.
*/
/**
* Address variable `h1` font-size and margin within `section` and `article`
* contexts in Firefox 4+, Safari, and Chrome.
*/
h1 {
font-size: 2em;
margin: 0.67em 0; }
h2 {
font-size: 2em;
margin: 0.67em 0; }
/**
* Address styling not present in IE 8/9.
*/
/**
* Address inconsistent and variable font size in all browsers.
*/
small {
font-size: 80%; }
/**
* Prevent `sub` and `sup` affecting `line-height` in all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline; }
sup {
top: -0.5em; }
sub {
bottom: -0.25em; }
/* Embedded content
========================================================================== */
/**
* Remove border when inside `a` element in IE 8/9/10.
*/
img {
border: 0; }
/**
* Correct overflow not hidden in IE 9/10/11.
*/
svg:not(:root) {
overflow: hidden; }
/* Grouping content
========================================================================== */
/**
* Address margin not present in IE 8/9 and Safari.
*/
/**
* Address differences between Firefox and other browsers.
*/
hr {
box-sizing: content-box;
height: 0; }
/**
* Contain overflow in all browsers.
*/
pre {
overflow: auto; }
/**
* Address odd `em`-unit font size rendering in all browsers.
*/
code,
pre
{
font-family: monospace;
font-size: 1em; }
/* Forms
========================================================================== */
/**
* Known limitation: by default, Chrome and Safari on OS X allow very limited
* styling of `select`, unless a `border` property is set.
*/
/**
* 1. Correct color not being inherited.
* Known issue: affects color of disabled elements.
* 2. Correct font properties not being inherited.
* 3. Address margins set differently in Firefox 4+, Safari, and Chrome.
*/
button,
input,
select,
textarea {
color: inherit;
/* 1 */
font: inherit;
/* 2 */
margin: 0;
/* 3 */ }
/**
* Address `overflow` set to `hidden` in IE 8/9/10/11.
*/
button {
overflow: visible; }
/**
* Address inconsistent `text-transform` inheritance for `button` and `select`.
* All other form control elements do not inherit `text-transform` values.
* Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera.
* Correct `select` style inheritance in Firefox.
*/
button,
select {
text-transform: none; }
/**
* 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
* and `video` controls.
* 2. Correct inability to style clickable `input` types in iOS.
* 3. Improve usability and consistency of cursor style between image-type
* `input` and others.
*/
button,
input[type="reset"],
input[type="submit"] {
-webkit-appearance: button;
/* 2 */
cursor: pointer;
/* 3 */ }
/**
* Re-set default cursor for disabled elements.
*/
button[disabled],
html input[disabled] {
cursor: default; }
/**
* Remove inner padding and border in Firefox 4+.
*/
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0; }
/**
* Address Firefox 4+ setting `line-height` on `input` using `!important` in
* the UA stylesheet.
*/
input {
line-height: normal; }
/**
* It's recommended that you don't attempt to style these elements.
* Firefox's implementation doesn't respect box-sizing, padding, or width.
*
* 1. Address box sizing set to `content-box` in IE 8/9/10.
* 2. Remove excess padding in IE 8/9/10.
*/
input[type="checkbox"],
input[type="radio"] {
box-sizing: border-box;
/* 1 */
padding: 0;
/* 2 */ }
/**
* Fix the cursor style for Chrome's increment/decrement buttons. For certain
* `font-size` values of the `input`, it causes the cursor style of the
* decrement button to change from `default` to `text`.
*/
/**
* 1. Address `appearance` set to `searchfield` in Safari and Chrome.
* 2. Address `box-sizing` set to `border-box` in Safari and Chrome.
*/
/**
* Remove inner padding and search cancel button in Safari and Chrome on OS X.
* Safari (but not Chrome) clips the cancel button when the search input has
* padding (and `textfield` appearance).
*/
/**
* Define consistent border, margin, and padding.
*/
/**
* 1. Correct `color` not being inherited in IE 8/9/10/11.
* 2. Remove padding so people aren't caught out if they zero out fieldsets.
*/
legend {
border: 0;
/* 1 */
padding: 0;
/* 2 */ }
/**
* Remove default vertical scrollbar in IE 8/9/10/11.
*/
textarea {
overflow: auto; }
/**
* Don't inherit the `font-weight` (applied by a rule above).
* NOTE: the default cannot safely be changed in Chrome and Safari on OS X.
*/
/* Tables
========================================================================== */
/**
* Remove most spacing between table cells.
*/
table {
border-collapse: collapse;
border-spacing: 0; }
td,
th {
padding: 0; }
html {
box-sizing: border-box; }
*, *::after, *::before {
box-sizing: inherit; }
.hidden {
display: none !important; }
[onclick] {
cursor: pointer; }
.Modal {
position: fixed;
width: 100%;
height: 100%;
left: 0;
top: 0;
right: 0;
bottom: 0;
display: flex;
justify-content: center;
align-items: center;
transition: opacity .5s;
background: rgba(0, 0, 0, 0.65);
opacity: 0; }
.Modal.visible {
opacity: 1; }
.Modal.hidden {
display: none; }
.Dialog {
margin: 0.61805rem;
padding: 1rem;
overflow: hidden;
max-width: 100%;
max-height: 100%;
flex: 0 1 30rem;
background: #1c1c1e;
border-left: 6px solid #2972ba;
border-right: 6px solid #2972ba;
box-shadow: 0 0 2px 0 #434349, 0 0 6px 0 black;
border-radius: 6px; }
.Dialog h1, .Dialog h2 {
margin-top: 0; }
.Dialog p:last-child {
margin-bottom: 0; }
/*
// "toast"
.NotifyMsg {
position: fixed;
bottom: dist(2);
padding: dist(-1) dist(0);
// center horizontally
left: 50%;
@include translate(-50%,0);
// hack to remove blur in chrome
-webkit-font-smoothing: subpixel-antialiased;
-webkit-transform: translateZ(0) scale(1.0, 1.0);
background: #37a349;
&.error {
background: #d03e42;
}
color: white;
text-shadow: 0 0 2px black;
box-shadow: 0 0 6px 0 rgba(black, .6);
border-radius: 5px;
max-width: 80%;
@include media($phone) {
width: calc(100% - 1rem);
}
transition: opacity .5s;
opacity: 0;
&.visible { opacity: 1 }
&.hidden { display: none }
}
*/
html {
font-family: Arial, sans-serif;
color: #D0D0D0;
background: #131315; }
html, body {
border: 0 none;
margin: 0;
padding: 0;
text-decoration: none;
width: 100%;
height: 100%;
overflow: hidden; }
a, a:visited, a:link {
cursor: pointer;
color: #5abfff;
text-decoration: none; }
a:hover {
color: #5abfff;
text-decoration: underline; }
.Box {
display: block;
max-width: 900px;
margin-top: 1rem;
padding: 0.61805rem 1rem;
border-radius: 3px;
background-color: rgba(255, 255, 255, 0.07); }
@media screen and (max-width: 544px) {
.Box {
margin-top: 0.61805rem;
padding: 0.23608rem 0.38198rem; } }
.Box p:first-child {
margin-top: 0; }
body {
position: relative;
padding: 1rem;
overflow-y: auto; }
@media screen and (max-width: 544px) {
body {
padding: 0.61805rem; } }
body > * {
margin-left: auto;
margin-right: auto; }
h1, h2 {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none; }
h1 {
text-align: center;
font-size: 2.02729em;
margin-top: 0;
margin-bottom: 1rem; }
@media screen and (max-width: 544px) {
h1 {
font-size: 1.42383em;
margin-bottom: 0.61805rem; } }
@media screen and (min-width: 545px) and (max-width: 1000px) {
h1 {
font-size: 1.80203em; } }
h2 {
font-size: 1.26563em;
margin-bottom: 0.61805rem; }
td, th {
padding: 0.38198rem;
white-space: nowrap; }
@media screen and (max-width: 544px) {
td, th {
padding: 0.23608rem; } }
tbody th {
text-align: right;
width: 130px;
color: white; }
@media screen and (max-width: 544px) {
tbody th {
width: auto; } }
tbody td input[type="text"], tbody td input[type="number"] {
width: 10em; }
@media screen and (max-width: 544px) {
tbody td input[type="text"], tbody td input[type="number"] {
width: 8em; } }
#loader {
position: absolute;
right: 1.618rem;
top: 1.618rem;
transition: opacity .2s;
opacity: 0; }
@media screen and (max-width: 544px) {
#loader {
top: 1rem;
right: 1rem; } }
#loader.show {
opacity: 1; }
ul > * {
padding-top: .1em;
padding-bottom: .1em; }
#botnav {
padding-top: 1.5em;
text-align: center; }
#botnav a {
padding: 0 0.38198rem;
text-decoration: underline; }
#botnav a, #botnav a:visited, #botnav a:link {
color: #2e4d6e; }
#botnav a:hover {
color: #5abfff; }
button, input[type=submit], .button {
text-align: center;
cursor: pointer;
display: inline-block;
border-radius: 2px;
padding: 0 0.6em;
border: 0 none;
outline: 0 none !important;
line-height: 1.8em;
font-size: 1.1em;
margin-bottom: 3px;
min-width: 5em;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
text-shadow: 1.5px 1.5px 2px rgba(0, 0, 0, 0.6);
background-color: #3983cd;
box-shadow: 0 3px 0 #265f98;
text-decoration: none !important; }
button:active, input[type=submit]:active, .button:active {
position: relative;
top: 2px; }
button.narrow, input[type=submit].narrow, .button.narrow {
min-width: initial; }
button, button:link, button:visited, input[type=submit], input[type=submit]:link, input[type=submit]:visited, .button, .button:link, .button:visited {
color: #FEFEFE; }
button:hover, button:active, button.active, button.selected, input[type=submit]:hover, input[type=submit]:active, input[type=submit].active, input[type=submit].selected, .button:hover, .button:active, .button.active, .button.selected {
background-color: #2076C6;
color: #FEFEFE; }
button:hover, button.selected, button.active, input[type=submit]:hover, input[type=submit].selected, input[type=submit].active, .button:hover, .button.selected, .button.active {
box-shadow: 0 3px 0 #154c80; }
button:active, input[type=submit]:active, .button:active {
box-shadow: 0 1px 0 #154c80; }
button, input[type=submit], .button {
text-align: center;
cursor: pointer;
display: inline-block;
border-radius: 2px;
padding: 0 0.6em;
border: 0 none;
outline: 0 none !important;
line-height: 1.8em;
font-size: 1.1em;
margin-bottom: 3px;
min-width: 5em;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
text-shadow: 1.5px 1.5px 2px rgba(0, 0, 0, 0.6);
background-color: #3983cd;
box-shadow: 0 3px 0 #265f98;
text-decoration: none !important; }
button:active, input[type=submit]:active, .button:active {
position: relative;
top: 2px; }
button.narrow, input[type=submit].narrow, .button.narrow {
min-width: initial; }
button, button:link, button:visited, input[type=submit], input[type=submit]:link, input[type=submit]:visited, .button, .button:link, .button:visited {
color: #FEFEFE; }
button:hover, button:active, button.active, button.selected, input[type=submit]:hover, input[type=submit]:active, input[type=submit].active, input[type=submit].selected, .button:hover, .button:active, .button.active, .button.selected {
background-color: #2076C6;
color: #FEFEFE; }
button:hover, button.selected, button.active, input[type=submit]:hover, input[type=submit].selected, input[type=submit].active, .button:hover, .button.selected, .button.active {
box-shadow: 0 3px 0 #154c80; }
button:active, input[type=submit]:active, .button:active {
box-shadow: 0 1px 0 #154c80; }
input[type="number"], input[type="password"], input[type="text"], textarea, select {
border: 0 none;
border-bottom: 2px solid #214e7a;
background-color: #303030;
color: white;
padding: 6px;
line-height: 1em;
outline: 0 none !important;
-moz-outline: 0 none !important;
font-weight: normal; }
input[type="number"]:focus, input[type="number"]:hover, input[type="password"]:focus, input[type="password"]:hover, input[type="text"]:focus, input[type="text"]:hover, textarea:focus, textarea:hover, select:focus, select:hover {
border-bottom-color: #2972ba; }
#psk-modal form > *, #wificonfbox form > * {
margin-right: 0.38198rem; }
#psk-modal form > *:last-child, #wificonfbox form > *:last-child {
margin-right: 0; }
#ap-list {
column-count: 3;
column-gap: 0;
margin: 0 -0.23608rem; }
@media screen and (min-width: 545px) and (max-width: 1000px) {
#ap-list {
column-count: 2; } }
@media screen and (max-width: 544px) {
#ap-list {
column-count: 1; } }
#ap-loader, #ap-noscan {
background: rgba(255, 255, 255, 0.1);
border-radius: 5px;
padding: 0.38198rem;
margin-bottom: 0.38198rem; }
#ap-noscan {
font-weight: bold; }
#ap-box {
padding-bottom: 0.38198rem; }
#psk-modal form {
display: flex;
align-items: center;
margin: 0.38198rem; }
#psk-modal form input[type=password] {
min-width: 5rem; }
.AP {
break-inside: avoid-column;
max-width: 500px;
padding: 0.23608rem; }
.AP.selected .inner {
background: #42a6f9 !important;
cursor: default;
top: 0 !important; }
.AP .inner {
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
position: relative;
border-radius: 3px;
color: #222;
background: #afafaf;
transition: background-color 0.5s;
display: flex; }
.AP .inner:active {
left: 0;
top: 1px; }
.AP .inner:hover {
background: white; }
.AP .inner > * {
padding: 0.61805rem;
white-space: nowrap;
word-wrap: normal; }
.AP .inner .rssi {
min-width: 2.5rem;
flex: 0 0 15%;
text-align: right; }
.AP .inner .rssi:after {
padding-left: 0.09018rem;
content: '%';
font-size: 0.88889em; }
.AP .inner .essid {
flex: 1 1 70%;
min-width: 0;
text-overflow: ellipsis;
overflow: hidden;
font-weight: bold; }
.AP .inner .auth {
flex: 0 0 15%; }
.page-term h1 {
font-size: 1.80203em; }
@media screen and (max-width: 544px) {
.page-term h1 {
font-size: 1.42383em; } }
.page-term #screen {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
font-family: monospace;
font-size: 16pt;
white-space: nowrap;
background: #111213;
padding: 6px;
display: inline-block;
border: 2px solid #3983CD; }
.page-term #screen span {
white-space: pre;
cursor: pointer; }
.page-term #screen span:hover {
outline: 1px solid rgba(255, 255, 255, 0.4); }
@media screen and (max-width: 544px) {
.page-term #screen span:hover {
outline: 0 none; } }
.page-term #screen .fg8, .page-term #screen .fg9, .page-term #screen .fg10, .page-term #screen .fg11, .page-term #screen .fg12, .page-term #screen .fg13, .page-term #screen .fg14, .page-term #screen .fg15 {
font-weight: bold; }
.page-term #buttons {
margin-top: 10px;
white-space: nowrap; }
.page-term #buttons button {
margin: 0 3px;
padding: 10px 0;
width: 18%;
max-width: 65px;
min-width: initial;
cursor: pointer;
font-weight: bold; }
#termwrap {
text-align: center; }
.page-about .Box {
padding-left: 1rem;
padding-right: 1rem; }
.page-about .Box a {
font-weight: bold; }
.page-about #logo {
float: right;
height: 130px; }
.page-about #logo2 {
max-width: 100%; }
.page-about td {
white-space: normal; }
.colorprev {
margin-top: 0.38198rem;
margin-bottom: 0.38198rem; }
.colorprev span {
display: inline-block;
width: 2em;
padding: 0.38198rem 0;
text-align: center; }
.ansiref, .ansiref td, .ansiref th {
border: 1px solid #666; }
.ansiref th, .ansiref td {
white-space: normal; }
.ansiref th {
background-color: rgba(255, 255, 255, 0.1); }
.ansiref td:nth-child(1) {
font-family: monospace; }
.ansiref.w100 {
width: 100%; }
.ansiref.w100 td:nth-child(1) {
width: 6em; }
.ansiref.w100 td:nth-child(2) {
width: 8em; }
.fg0 {
color: #111213; }
.bg0 {
background-color: #111213; }
.fg1 {
color: #CC0000; }
.bg1 {
background-color: #CC0000; }
.fg2 {
color: #4E9A06; }
.bg2 {
background-color: #4E9A06; }
.fg3 {
color: #C4A000; }
.bg3 {
background-color: #C4A000; }
.fg4 {
color: #3465A4; }
.bg4 {
background-color: #3465A4; }
.fg5 {
color: #75507B; }
.bg5 {
background-color: #75507B; }
.fg6 {
color: #06989A; }
.bg6 {
background-color: #06989A; }
.fg7 {
color: #D3D7CF; }
.bg7 {
background-color: #D3D7CF; }
.fg8 {
color: #555753; }
.bg8 {
background-color: #555753; }
.fg9 {
color: #EF2929; }
.bg9 {
background-color: #EF2929; }
.fg10 {
color: #8AE234; }
.bg10 {
background-color: #8AE234; }
.fg11 {
color: #FCE94F; }
.bg11 {
background-color: #FCE94F; }
.fg12 {
color: #729FCF; }
.bg12 {
background-color: #729FCF; }
.fg13 {
color: #AD7FA8; }
.bg13 {
background-color: #AD7FA8; }
.fg14 {
color: #34E2E2; }
.bg14 {
background-color: #34E2E2; }
.fg15 {
color: #EEEEEC; }
.bg15 {
background-color: #EEEEEC; }
@media screen and (min-width: 545px) {
.mq-phone {
display: none; } }
@media screen and (max-width: 544px) {
.mq-tablet-min {
display: none; } }
@media screen and (min-width: 1001px) {
.mq-tablet-max {
display: none; } }
@media screen and (max-width: 1000px) {
.mq-normal-min {
display: none; } }
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

-326
View File
@@ -1,326 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Help - 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-help">
<h1 onclick="location.href='/'">Quick Reference</h1>
<div class="Box">
<h2>Wiring</h2>
<ul>
<li>Communication UART on pins <b>Rx, Tx</b> at 115200-8-1-N</li>
<li>Debug log on pin <b>GPIO2</b> at 115200-8-1-N</li>
<li>Use 3.3V logic, or 5V with protection resistors (10k)</li>
<li>Connect Rx and Tx with a piece of wire to test the terminal alone, you should see what you type in the browser.
NOTE: This won't work if your ESP8266 board has a built-in USB-serial.</li>
</ul>
</div>
<div class="Box">
<h2>Screen</h2>
<ul>
<li>Most ANSI escape sequences are supported.</li>
<li>The max screen size is 2000 characters (eg. <b>25x80</b>), default is <b>10x26</b>. Set using <code>\e]W?;?\a</code> with rows;cols.</li>
<li>The screen will automatically scroll, can be used for log output.</li>
<li>Display update is sent <b>after 20 ms of inactivity</b>.</li>
<li>The browser display needs WebSockets for the real-time updating. It may not work on really old phones / browsers.</li>
</ul>
</div>
<div class="Box">
<h2>Color Reference</h2>
<p>Color is set using <code>\e[?m</code> or <code>\e[?;?m</code> where "?" are numbers from the following tables:</p>
<b>Foreground</b>
<div class="colorprev">
<span class="fg0" style="background:#333">30</span>
<span class="bg0 fg1">31</span>
<span class="bg0 fg2">32</span>
<span class="bg0 fg3">33</span>
<span class="bg0 fg4">34</span>
<span class="bg0 fg5">35</span>
<span class="bg0 fg6">36</span>
<span class="bg0 fg7">37</span>
</div>
<div class="colorprev">
<span class="bg0 fg8">90</span>
<span class="bg0 fg9">91</span>
<span class="bg0 fg10">92</span>
<span class="bg0 fg11">93</span>
<span class="bg0 fg12">94</span>
<span class="bg0 fg13">95</span>
<span class="bg0 fg14">96</span>
<span class="bg0 fg15">97</span>
</div>
<b>Background</b>
<div class="colorprev">
<span class="bg0 fg15">30</span>
<span class="bg1 fg15">31</span>
<span class="bg2 fg15">32</span>
<span class="bg3 fg0">33</span>
<span class="bg4 fg15">34</span>
<span class="bg5 fg15">35</span>
<span class="bg6 fg15">36</span>
<span class="bg7 fg0">37</span>
</div>
<div class="colorprev">
<span class="bg8 fg15">100</span>
<span class="bg9 fg0">101</span>
<span class="bg10 fg0">102</span>
<span class="bg11 fg0">103</span>
<span class="bg12 fg0">104</span>
<span class="bg13 fg0">105</span>
<span class="bg14 fg0">106</span>
<span class="bg15 fg0">107</span>
</div>
<p>Bright foreground can also be set using the "bold" attribute 1 (eg. <code>\e[31;1m</code>). For more details, see the ANSI code reference below.</p>
</div>
<div class="Box">
<h2>User Input</h2>
<p>
All the user types on their keyboard is sent as-is to the UART, including ESC, ANSI sequences for arrow keys and CR-LF for Enter.
The input is limited to ASCII codes 32-126, backspace 8 and tab 9.
</p>
<p>The buttons under the screen send ASCII codes 1, 2, 3, 4, 5.</p>
<p>
<b>Mouse input</b> (click/tap) is sent as <code>\e?;?M</code> with row;column. You can use this for on-screen buttons, menu navigation etc.
<i>Please note this is a custom sequence, not supported by PuTTY or other terminals.</i>
</p>
</div>
<div class="Box">
<h2>Supported ANSI Escape Sequences</h2>
<p>Sequences are started by ASCII code 27 (ESC, <code>\e</code>, <code>\x1b</code>, <code>\033</code>)</p>
<p>Instead of <code>\a</code> (BELL, ASCII 7) in the commands, you can use `\e\` (ESC + backslash). It's the Text Separator code.</p>
<h3>Text Attributes</h3>
<p>
All text attributes are set using <code>\e[...m</code> where the dots are numbers separated by semicolons.
You can combine up to 3 attributes in a single command.
</p>
<table class="ansiref">
<thead>
<tr>
<th>Attribute</th>
<th>Meaning</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>Reset text attributes to default</td>
</tr>
<tr>
<td>7</td>
<td>Inverse (fg/bg swap when printing)</td>
</tr>
<tr>
<td>27</td>
<td>Inverse OFF</td>
</tr>
<tr>
<td>30-37, 90-97</td>
<td>Foreground color, normal and bright</td>
</tr>
<tr>
<td>40-47, 100-107</td>
<td>Background color, normal and bright</td>
</tr>
</tbody>
</table>
<h3>Cursor</h3>
<p>Movement commands scroll the screen if needed. The coordinates are 1-based, origin top left.</p>
<table class="ansiref w100">
<thead>
<tr>
<th>Code</th>
<th>Params</th>
<th>Meaning</th>
</tr>
</thead>
<tbody>
<tr>
<td>\e[?A</td>
<td>[count]</td>
<td>Move cursor up</td>
</tr>
<tr>
<td>\e[?B</td>
<td>[count]</td>
<td>Move cursor down</td>
</tr>
<tr>
<td>\e[?C</td>
<td>[count]</td>
<td>Move cursor forward (right)</td>
</tr>
<tr>
<td>\e[?D</td>
<td>[count]</td>
<td>Move cursor backward (left)</td>
</tr>
<tr>
<td>\e[?E</td>
<td>[count]</td>
<td>Go N line down, start of line</td>
</tr>
<tr>
<td>\e[?F</td>
<td>[count]</td>
<td>Go N lines up, start of line</td>
</tr>
<tr>
<td>\e[?G</td>
<td>column</td>
<td>Go to column</td>
</tr>
<tr>
<td>\e[?;?G</td>
<td>[row=1];[col=1]</td>
<td>Go to row and column</td>
</tr>
<tr>
<td>\e[6n</td>
<td>--</td>
<td>Query cursor position. Position is sent back as <code>\e[?;?R</code> with row;column.</td>
</tr>
<tr>
<td>\e[s</td>
<td>--</td>
<td>Store position</td>
</tr>
<tr>
<td>\e[u</td>
<td>--</td>
<td>Restore position</td>
</tr>
<tr>
<td>\e7</td>
<td>--</td>
<td>Store position & attributes</td>
</tr>
<tr>
<td>\e8</td>
<td>--</td>
<td>Restore position & attributes</td>
</tr>
<tr>
<td>\e[?25l</td>
<td>--</td>
<td>Hide cursor (literal question mark, lowercase L!)</td>
</tr>
<tr>
<td>\e[?25h</td>
<td>--</td>
<td>Show cursor (literal question mark!)</td>
</tr>
</tbody>
</table>
<h3>Screen</h3>
<table class="ansiref w100">
<thead>
<tr>
<th>Code</th>
<th>Params</th>
<th>Meaning</th>
</tr>
</thead>
<tbody>
<tr>
<td>\e[?J</td>
<td>[mode=0]</td>
<td>Clear screen. Mode: 0 - from cursor, 1 - to cursor, 2 - all</td>
</tr>
<tr>
<td>\e[?K</td>
<td>[mode=0]</td>
<td>Erase line. Mode: 0 - from cursor, 1 - to cursor, 2 - all</td>
</tr>
<tr>
<td>\e[?S</td>
<td>[lines]</td>
<td>Scroll screen content up, add empty line at the bottom</td>
</tr>
<tr>
<td>\e[?T</td>
<td>[lines]</td>
<td>Scroll screen content down, add empty line at the top</td>
</tr>
<tr>
<td>\e]W?;?\a</td>
<td>rows;cols</td>
<td>Set screen size, maximum 25x80 (resp. total 2000 characters). This also clears the screen.</td>
</tr>
</tbody>
</table>
<h3>System Commands</h3>
<table class="ansiref w100">
<thead>
<tr>
<th>Code</th>
<th>Params</th>
<th>Meaning</th>
</tr>
</thead>
<tbody>
<tr>
<td>\ec</td>
<td>--</td>
<td>
"Device Reset" - clear screen, reset attributes, show cursor & move it to 1,1.
The screen size and WiFi settings stay unchanged.
</td>
</tr>
<tr>
<td>\e]FR\a</td>
<td>--</td>
<td>"Factory Reset", emergency code when you mess up the WiFi, restores SSID to unique default, clears stored credentials & enters Client+AP mode.</td>
</tr>
<tr>
<td>\e[5n</td>
<td>--</td>
<td>Query device status, replies with <code>\e[0n</code> "device is OK". Can be used to check if the UART works.</td>
</tr>
</tbody>
</table>
</div>
<nav id="botnav">
<a href="/">Terminal</a><!--
--><a href="/wifi">WiFi config</a><!--
--><a href="/about">About</a>
</nav>
</body>
</html>
File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

-1390
View File
File diff suppressed because it is too large Load Diff
-39
View File
@@ -1,39 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>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-term">
<h1 onclick="location.href='/wifi'">ESP8266 Remote Terminal</h1>
<div id="termwrap">
<div id="screen"></div>
<div id="buttons">
<button data-n="1" class="btn-blue">1</button><!--
--><button data-n="2" class="btn-blue">2</button><!--
--><button data-n="3" class="btn-blue">3</button><!--
--><button data-n="4" class="btn-blue">4</button><!--
--><button data-n="5" class="btn-blue">5</button>
</div>
</div>
<nav id="botnav">
<a href="/wifi">WiFi config</a><!--
--><a href="/help">Help</a><!--
--><a href="/about">About</a>
</nav>
<script>
_root = window.location.host;
termInit(%screenData%);
</script>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More