Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
f1cc8379
Commit
f1cc8379
authored
Mar 21, 2016
by
Deomid Ryabkov
Committed by
rojer
Mar 21, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ESP8266_RTOS example tweaks
PUBLISHED_FROM=11096f272afc0716e0677c68d58ebf4d4e001a47
parent
4f9627c6
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
40 deletions
+27
-40
Makefile
examples/ESP8266_RTOS/Makefile
+1
-1
README.md
examples/ESP8266_RTOS/README.md
+3
-13
eagle.app.v6.512.compact.ld
examples/ESP8266_RTOS/ld/eagle.app.v6.512.compact.ld
+0
-20
Makefile
examples/ESP8266_RTOS/user/Makefile
+0
-1
esp_libc.c
examples/ESP8266_RTOS/user/esp_libc.c
+14
-4
user_main.c
examples/ESP8266_RTOS/user/user_main.c
+9
-1
No files found.
examples/ESP8266_RTOS/Makefile
View file @
f1cc8379
...
@@ -55,7 +55,7 @@ LINKFLAGS_eagle.app.v6 = \
...
@@ -55,7 +55,7 @@ LINKFLAGS_eagle.app.v6 = \
-u
call_user_start
\
-u
call_user_start
\
-Wl,-static
\
-Wl,-static
\
-Wl,--start-group
\
-Wl,--start-group
\
-lc
\
-lc
irom
\
-lgcc
\
-lgcc
\
-lhal
\
-lhal
\
-lphy
\
-lphy
\
...
...
examples/ESP8266_RTOS/README.md
View file @
f1cc8379
...
@@ -17,20 +17,10 @@ $ make clean; make BOOT=new APP=1 SPI_SPEED=40 SPI_MODE=dio SPI_SIZE_MAP=6
...
@@ -17,20 +17,10 @@ $ make clean; make BOOT=new APP=1 SPI_SPEED=40 SPI_MODE=dio SPI_SIZE_MAP=6
Flash (using
[
esptool
](
https://github.com/themadinventor/esptool
)
):
Flash (using
[
esptool
](
https://github.com/themadinventor/esptool
)
):
```
```
$ esptool.py --port /dev/ttyUSB0 --baud 230400 \
$ make clean; make BOOT=none APP=0 SPI_SPEED=40 SPI_MODE=qio SPI_SIZE_MAP=0
write_flash --flash_mode=dio --flash_size=32m \
0x00000 ${SDK_PATH}/bin/boot_v1.4\(b1\).bin \
0x01000 ${BIN_PATH}/upgrade/user1.4096.new.6.bin
```
The output can be made to fit in 512KB (4Mb), but stock linker scripts do not reserve enough space for code.
Custom linker script is provided for that, so you can use it for smaller devices like so (example that will work with ESP-01):
```
$ make clean; make BOOT=none APP=0 SPI_SPEED=40 SPI_MODE=qio SPI_SIZE_MAP=0 LD_FILE=ld/eagle.app.v6.512.compact.ld
$ esptool.py --port /dev/ttyUSB0 --baud 230400 \
$ esptool.py --port /dev/ttyUSB0 --baud 230400 \
write_flash --flash_mode=qio --flash_size=4m \
write_flash --flash_mode=qio --flash_size=4m \
0x00000 ${BIN_PATH}/eagle.flash.bin \
0x00000 ${BIN_PATH}/eagle.flash.bin \
0x10000 ${BIN_PATH}/eagle.irom0text.bin
0x20000 ${BIN_PATH}/eagle.irom0text.bin \
0x7e000 ${SDK_PATH}/bin/esp_init_data_default.bin
```
```
examples/ESP8266_RTOS/ld/eagle.app.v6.512.compact.ld
deleted
100644 → 0
View file @
4f9627c6
/* eagle.flash.bin @ 0x00000 */
/* eagle.irom0text.bin @ 0x10000 */
/*
* Flash map for 512KB flash.
*
* There is 0x8000 (32KB) available between 0x8000 and 0x10000.
*
* Note: IROM images starts at 0x10000 (ignore Makefile output which says 0x40000.
*/
MEMORY
{
dport0_0_seg : org = 0x3FF00000, len = 0x10
dram0_0_seg : org = 0x3FFE8000, len = 0x18000
iram1_0_seg : org = 0x40100000, len = 0x8000
irom0_0_seg : org = 0x40210000, len = 0x6C000
}
INCLUDE "../ld/eagle.app.v6.common.ld"
examples/ESP8266_RTOS/user/Makefile
View file @
f1cc8379
...
@@ -26,7 +26,6 @@ endif
...
@@ -26,7 +26,6 @@ endif
DEFINES
+=
-DCS_PLATFORM
=
3
\
DEFINES
+=
-DCS_PLATFORM
=
3
\
-DMG_NO_BSD_SOCKETS
\
-DMG_NO_BSD_SOCKETS
\
-DMG_DISABLE_FILESYSTEM
\
-DMG_DISABLE_FILESYSTEM
\
-DMG_DISABLE_STDIO
\
-DMG_MAX_HTTP_HEADERS
=
20
-DMG_MAX_HTTP_REQUEST_SIZE
=
1024
\
-DMG_MAX_HTTP_HEADERS
=
20
-DMG_MAX_HTTP_REQUEST_SIZE
=
1024
\
-DMG_MAX_PATH
=
40
-DMG_MAX_HTTP_SEND_MBUF
=
1024
\
-DMG_MAX_PATH
=
40
-DMG_MAX_HTTP_SEND_MBUF
=
1024
\
-DRTOS_SDK
-DMG_LWIP
-DLWIP_TIMEVAL_PRIVATE
=
0
\
-DRTOS_SDK
-DMG_LWIP
-DLWIP_TIMEVAL_PRIVATE
=
0
\
...
...
examples/ESP8266_RTOS/user/esp_libc.c
View file @
f1cc8379
...
@@ -16,7 +16,6 @@
...
@@ -16,7 +16,6 @@
#include "esp_common.h"
#include "esp_common.h"
/* Makes fprintf(stdout) and stderr work. */
/* Makes fprintf(stdout) and stderr work. */
/*
_ssize_t
_write_r
(
struct
_reent
*
r
,
int
fd
,
void
*
buf
,
size_t
len
)
{
_ssize_t
_write_r
(
struct
_reent
*
r
,
int
fd
,
void
*
buf
,
size_t
len
)
{
if
(
fd
==
1
||
fd
==
2
)
{
if
(
fd
==
1
||
fd
==
2
)
{
size_t
i
;
size_t
i
;
...
@@ -27,7 +26,6 @@ _ssize_t _write_r(struct _reent *r, int fd, void *buf, size_t len) {
...
@@ -27,7 +26,6 @@ _ssize_t _write_r(struct _reent *r, int fd, void *buf, size_t len) {
}
}
return
-
1
;
return
-
1
;
}
}
*/
/*
/*
* You'll need to implement _open_r and friends if you want file operations. See
* You'll need to implement _open_r and friends if you want file operations. See
...
@@ -47,9 +45,21 @@ void _exit(int status) {
...
@@ -47,9 +45,21 @@ void _exit(int status) {
abort
();
abort
();
}
}
/*
* This will prevent counter wrap if time is read regularly.
* At least Mongoose poll queries time, so we're covered.
*/
int
_gettimeofday_r
(
struct
_reent
*
r
,
struct
timeval
*
tp
,
void
*
tzp
)
{
int
_gettimeofday_r
(
struct
_reent
*
r
,
struct
timeval
*
tp
,
void
*
tzp
)
{
static
uint32_t
prev_time
=
0
;
static
uint32_t
num_overflows
=
0
;
uint32_t
time
=
system_get_time
();
uint32_t
time
=
system_get_time
();
tp
->
tv_sec
=
time
/
1000000
;
uint64_t
time64
=
time
;
tp
->
tv_usec
=
time
%
1000000
;
if
(
prev_time
>
0
&&
time
<
prev_time
)
num_overflows
++
;
time64
+=
(((
uint64_t
)
num_overflows
)
*
(
1ULL
<<
32
));
tp
->
tv_sec
=
time64
/
1000000ULL
;
tp
->
tv_usec
=
time64
%
1000000ULL
;
prev_time
=
time
;
return
0
;
return
0
;
(
void
)
r
;
(
void
)
tzp
;
}
}
examples/ESP8266_RTOS/user/user_main.c
View file @
f1cc8379
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
#define AP_CHAN 9
#define AP_CHAN 9
#define MG_LISTEN_ADDR "80"
#define MG_LISTEN_ADDR "80"
#define MG_TASK_STACK_SIZE
2048
#define MG_TASK_STACK_SIZE
4096
#define MG_TASK_PRIORITY 1
#define MG_TASK_PRIORITY 1
void
uart_div_modify
(
int
uart_no
,
unsigned
int
freq
);
void
uart_div_modify
(
int
uart_no
,
unsigned
int
freq
);
...
@@ -55,6 +55,8 @@ void ev_handler(struct mg_connection *nc, int ev, void *p) {
...
@@ -55,6 +55,8 @@ void ev_handler(struct mg_connection *nc, int ev, void *p) {
}
}
void
setup_ap
()
{
void
setup_ap
()
{
int
off
=
0
;
struct
ip_info
info
;
struct
softap_config
cfg
;
struct
softap_config
cfg
;
wifi_set_opmode_current
(
SOFTAP_MODE
);
wifi_set_opmode_current
(
SOFTAP_MODE
);
...
@@ -71,6 +73,12 @@ void setup_ap() {
...
@@ -71,6 +73,12 @@ void setup_ap() {
LOG
(
LL_INFO
,
(
"Setting up AP '%s' on channel %d"
,
cfg
.
ssid
,
cfg
.
channel
));
LOG
(
LL_INFO
,
(
"Setting up AP '%s' on channel %d"
,
cfg
.
ssid
,
cfg
.
channel
));
wifi_softap_set_config_current
(
&
cfg
);
wifi_softap_set_config_current
(
&
cfg
);
wifi_softap_dhcps_stop
();
wifi_softap_set_dhcps_offer_option
(
OFFER_ROUTER
,
&
off
);
wifi_softap_dhcps_start
();
wifi_get_ip_info
(
SOFTAP_IF
,
&
info
);
LOG
(
LL_INFO
,
(
"WiFi AP: SSID %s, channel %d, IP "
IPSTR
""
,
cfg
.
ssid
,
cfg
.
channel
,
IP2STR
(
&
info
.
ip
)));
}
}
static
void
mg_task
(
void
*
arg
)
{
static
void
mg_task
(
void
*
arg
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment