mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-20 19:41:58 +00:00
Fix ESP8266_RTOS example; add mos flashing
PUBLISHED_FROM=d87814d40f0acdc7a96fbd132c2157ccb499c7c6
This commit is contained in:
1 parent
b1a46da309
commit
f974fddd2a
4 files changed
+43
-11
No files matched your search
@@ -56,7 +56,7 @@ LINKFLAGS_eagle.app.v6 = \
|
|||||||
-Wl,-static \
|
-Wl,-static \
|
||||||
-Wl,--start-group \
|
-Wl,--start-group \
|
||||||
-lcirom \
|
-lcirom \
|
||||||
-lgcc \
|
-lgcc_sdk \
|
||||||
-lhal \
|
-lhal \
|
||||||
-lphy \
|
-lphy \
|
||||||
-lpp \
|
-lpp \
|
||||||
@@ -116,5 +116,23 @@ sinclude $(SDK_PATH)/Makefile
|
|||||||
.PHONY: FORCE
|
.PHONY: FORCE
|
||||||
FORCE:
|
FORCE:
|
||||||
|
|
||||||
|
fw.zip:
|
||||||
|
@/usr/local/bin/fw_meta* create_manifest \
|
||||||
|
--platform=esp8266 \
|
||||||
|
--name=mongoose_example \
|
||||||
|
--build_info='{"build_version": "1.0", "build_id": "test"}' \
|
||||||
|
--staging_dir=$(ODIR) \
|
||||||
|
--output=$(ODIR)/manifest.json \
|
||||||
|
iram:addr=0,src=$(BIN_PATH)/eagle.flash.bin \
|
||||||
|
irom:addr=0x20000,src=$(BIN_PATH)/eagle.irom0text.bin \
|
||||||
|
sysparams:addr=0x7e000,type=sys_params,src=$(SDK_PATH)/bin/esp_init_data_default.bin
|
||||||
|
@/usr/local/bin/fw_meta* create_fw \
|
||||||
|
--manifest=$(ODIR)/manifest.json \
|
||||||
|
--src_dir=$(ODIR) \
|
||||||
|
--output=$@
|
||||||
|
@echo
|
||||||
|
@echo " $@ built. Use \"mos flash $@\" to flash."
|
||||||
|
@echo
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf user/.output .bin
|
rm -rf fw.zip $(BIN_PATH) $(ODIR) user/.output
|
||||||
@@ -6,19 +6,29 @@ Most of the the boilerplate comes from [project_template](https://github.com/esp
|
|||||||
|
|
||||||
To build with no changes to the SDK, you will need a module with 1MB (8Mb) flash or more.
|
To build with no changes to the SDK, you will need a module with 1MB (8Mb) flash or more.
|
||||||
|
|
||||||
Compile (for NodeMCU 1.0):
|
For building the example, you have two options:
|
||||||
|
|
||||||
|
* Using [Docker](https://www.docker.com/products/docker) and use our pre-built SDK container:
|
||||||
|
```
|
||||||
|
$ ./build.sh
|
||||||
|
```
|
||||||
|
* Use SDK and toolchain installed separately as explained [here](https://github.com/espressif/ESP8266_RTOS_SDK#esp8266_rtos_sdk):
|
||||||
```
|
```
|
||||||
$ export SDK_PATH=/path/to/ESP8266_RTOS_SDK
|
$ export SDK_PATH=/path/to/ESP8266_RTOS_SDK
|
||||||
$ export BIN_PATH=./bin
|
$ export BIN_PATH=./bin
|
||||||
$ make clean; make BOOT=none APP=0 SPI_SPEED=40 SPI_MODE=dio SPI_SIZE_MAP=0
|
$ make clean; make BOOT=none APP=0 SPI_SPEED=40 SPI_MODE=dio SPI_SIZE_MAP=0
|
||||||
```
|
```
|
||||||
|
|
||||||
Flash (using [esptool](https://github.com/themadinventor/esptool)):
|
Once built, there are two options for flashing:
|
||||||
|
|
||||||
|
* Using the Mongoose OS [mos](https://mongoose-os.com/software.html) tool:
|
||||||
|
```
|
||||||
|
$ make fw.zip && mos flash fw.zip
|
||||||
|
```
|
||||||
|
* Using [esptool](https://github.com/themadinventor/esptool):
|
||||||
```
|
```
|
||||||
$ 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=dio --flash_size=4m \
|
||||||
0x00000 ${BIN_PATH}/eagle.flash.bin \
|
0x00000 ${BIN_PATH}/eagle.flash.bin \
|
||||||
0x20000 ${BIN_PATH}/eagle.irom0text.bin \
|
0x20000 ${BIN_PATH}/eagle.irom0text.bin \
|
||||||
0x7e000 ${SDK_PATH}/bin/esp_init_data_default.bin
|
0x7e000 ${SDK_PATH}/bin/esp_init_data_default.bin
|
||||||
|
|||||||
@@ -6,5 +6,6 @@ docker run \
|
|||||||
export SDK_PATH=/opt/Espressif/ESP8266_RTOS_SDK;
|
export SDK_PATH=/opt/Espressif/ESP8266_RTOS_SDK;
|
||||||
export BIN_PATH=./bin;
|
export BIN_PATH=./bin;
|
||||||
cd /src/examples/ESP8266_RTOS &&
|
cd /src/examples/ESP8266_RTOS &&
|
||||||
mkdir -p ./bin && make clean &&
|
make clean &&
|
||||||
make BOOT=none APP=0 SPI_SPEED=40 SPI_MODE=qio SPI_SIZE_MAP=0'
|
make BOOT=none APP=0 SPI_SPEED=40 SPI_MODE=dio SPI_SIZE_MAP=0 &&
|
||||||
|
make fw.zip'
|
||||||
@@ -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 4096
|
#define MG_TASK_STACK_SIZE 4096 /* bytes */
|
||||||
#define MGOS_TASK_PRIORITY 1
|
#define MGOS_TASK_PRIORITY 1
|
||||||
|
|
||||||
void uart_div_modify(int uart_no, unsigned int freq);
|
void uart_div_modify(int uart_no, unsigned int freq);
|
||||||
@@ -82,7 +82,8 @@ static void mg_task(void *arg) {
|
|||||||
struct mg_mgr mgr;
|
struct mg_mgr mgr;
|
||||||
struct mg_connection *nc;
|
struct mg_connection *nc;
|
||||||
|
|
||||||
printf("SDK version: %s\n", system_get_sdk_version());
|
printf("\r\n\r\nSDK version: %s\r\n", system_get_sdk_version());
|
||||||
|
printf("Free RAM: %d\r\n", system_get_free_heap_size());
|
||||||
setup_ap();
|
setup_ap();
|
||||||
|
|
||||||
mg_mgr_init(&mgr, NULL);
|
mg_mgr_init(&mgr, NULL);
|
||||||
@@ -104,8 +105,10 @@ xTaskHandle s_mg_task_handle;
|
|||||||
void user_init(void) {
|
void user_init(void) {
|
||||||
uart_div_modify(0, UART_CLK_FREQ / 115200);
|
uart_div_modify(0, UART_CLK_FREQ / 115200);
|
||||||
|
|
||||||
xTaskCreate(mg_task, (const signed char *) "mongoose", MG_TASK_STACK_SIZE,
|
printf("Free RAM: %d\r\n", system_get_free_heap_size());
|
||||||
NULL, MGOS_TASK_PRIORITY, &s_mg_task_handle);
|
xTaskCreate(mg_task, (const signed char *) "mongoose",
|
||||||
|
MG_TASK_STACK_SIZE / 4, /* in 32-bit words */
|
||||||
|
NULL, MGOS_TASK_PRIORITY, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t user_rf_cal_sector_set(void) {
|
uint32_t user_rf_cal_sector_set(void) {
|
||||||
|
|||||||
Reference in new issue
Block a user