1### About 2 3Files in this folder (targets/esp8266) are copied from 4`examples/project_template` of `esp_iot_rtos_sdk` and modified for JerryScript. 5You can view online from 6[this](https://github.com/espressif/esp_iot_rtos_sdk/tree/master/examples/project_template) page. 7 8 9### How to build JerryScript for ESP8266 10 11#### 1. SDK 12 13Follow [this](./docs/ESP-PREREQUISITES.md) page to setup build environment 14 15 16#### 2. Building JerryScript 17 18``` 19# assume you are in jerryscript folder 20make -f ./targets/esp8266/Makefile.esp8266 21``` 22 23Output files should be placed at $BIN_PATH 24 25#### 3. Flashing for ESP8266 12E 26Follow 27[this](http://www.kloppenborg.net/images/blog/esp8266/esp8266-esp12e-specs.pdf) page to get details about this board. 28 29``` 30make -f ./targets/esp8266/Makefile.esp8266 flash 31``` 32 33Default USB device is `/dev/ttyUSB0`. If you have different one, give with `USBDEVICE`, like; 34 35``` 36USBDEVICE=/dev/ttyUSB1 make -f ./targets/esp8266/Makefile.esp8266 flash 37``` 38 39### 4. Running 40 41* power off 42* connect GPIO2 with serial of 470 Ohm + LED and to GND 43* power On 44 45LED should blink on and off every second 46 47#### 5. Cleaning 48 49To clean the build result: 50 51``` 52make -f ./targets/esp8266/Makefile.esp8266 clean 53``` 54 55To clean the board's flash memory: 56``` 57make -f ./targets/esp8266/Makefile.esp8266 erase_flash 58``` 59 60 61### 6. Optimizing initial RAM usage (ESP8266 specific) 62The existing open source gcc compiler with Xtensa support stores const(ants) in 63the same limited RAM where our code needs to run. 64 65It is possible to force the compiler to store a constant into ROM and also read it from there thus saving RAM. 66The only requirement is to add `JERRY_ATTR_CONST_DATA` attribute to your constant. 67 68For example: 69 70```C 71static const lit_magic_size_t lit_magic_string_sizes[] = 72``` 73 74can be modified to 75 76```C 77static const lit_magic_size_t lit_magic_string_sizes[] JERRY_ATTR_CONST_DATA = 78``` 79 80That is already done to some constants in jerry-core. E.g.: 81 82- vm_decode_table 83- ecma_property_hashmap_steps 84- lit_magic_string_sizes 85- unicode_letter_interv_sps 86- unicode_letter_interv_len 87- unicode_non_letter_ident_ 88- unicode_letter_chars 89