Commit f974fddd authored by Deomid Ryabkov's avatar Deomid Ryabkov Committed by Cesanta Bot

Fix ESP8266_RTOS example; add mos flashing

PUBLISHED_FROM=d87814d40f0acdc7a96fbd132c2157ccb499c7c6
parent b1a46da3
......@@ -56,7 +56,7 @@ LINKFLAGS_eagle.app.v6 = \
-Wl,-static \
-Wl,--start-group \
-lcirom \
-lgcc \
-lgcc_sdk \
-lhal \
-lphy \
-lpp \
......@@ -116,5 +116,23 @@ sinclude $(SDK_PATH)/Makefile
.PHONY: 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:
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.
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 BIN_PATH=./bin
$ 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 \
write_flash --flash_mode=qio --flash_size=4m \
write_flash --flash_mode=dio --flash_size=4m \
0x00000 ${BIN_PATH}/eagle.flash.bin \
0x20000 ${BIN_PATH}/eagle.irom0text.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 BIN_PATH=./bin;
cd /src/examples/ESP8266_RTOS &&
mkdir -p ./bin && make clean &&
make BOOT=none APP=0 SPI_SPEED=40 SPI_MODE=qio SPI_SIZE_MAP=0'
make clean &&
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 MG_LISTEN_ADDR "80"
#define MG_TASK_STACK_SIZE 4096
#define MG_TASK_STACK_SIZE 4096 /* bytes */
#define MGOS_TASK_PRIORITY 1
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_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();
mg_mgr_init(&mgr, NULL);
......@@ -104,8 +105,10 @@ xTaskHandle s_mg_task_handle;
void user_init(void) {
uart_div_modify(0, UART_CLK_FREQ / 115200);
xTaskCreate(mg_task, (const signed char *) "mongoose", MG_TASK_STACK_SIZE,
NULL, MGOS_TASK_PRIORITY, &s_mg_task_handle);
printf("Free RAM: %d\r\n", system_get_free_heap_size());
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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment