[riot-notifications] [RIOT-OS/RIOT] cpu/esp8266: move most .rodata sections from RAM to IROM (flash) (#10981)

Gunar Schorcht notifications at github.com
Sat Feb 9 19:31:42 CET 2019


### Contribution description

With this PR most `.rodata` sections are moved from RAM to IROM (flash).

#### Background

Since IROM (flash) access requires 32-bit word aligned reads, usually all `.rodata` sections are placed in RAM by the Espressif SDK.

#### Solution

Using the `LoadStoreError` exception handler from [esp-open-rtos](https://github.com/SuperHouse/esp-open-rtos/blob/master/core/exception_vectors.S) makes it possible to place `.rodata` sections also in IROM (flash) to save RAM resources.

This PR adds the `LoadStoreError` handler and moves mose `.rodata` sections to IROM which saves for example about 12 kBytes of RAM for an application like `examples/gnrc_networking`.

### Testing procedure

1. Compile `examples/gnrc_networking` with and without the PR and check the size of `.rodata` in the output of `size` command.
    ```
    USEMODULE=esp_wifi make BOARD=esp8266-esp-12x -C examples/gnrc_networking
    size -Ax examples/gnrc_networking/bin/esp8266-esp-12x/gnrc_networking.elf
    ```
    Without PR you should get something like:
    ``` 
    size -Ax examples/gnrc_networking/bin/esp8266-esp-12x/gnrc_networking.elf
    ...
    .rodata           0x3fb0   0x3ffe8fa0
    .bss              0xb0d0   0x3ffecf50
    ...
    ```
    With PR you should get something like:
    ``` 
    size -Ax examples/gnrc_networking/bin/esp8266-esp-12x/gnrc_networking.elf
    ...
    .rodata            0xfb0   0x3ffe8fa0
    .bss              0xb0e0   0x3ffe9f50
    ...
    ```
    `.rodata` is much smaller and `.bss` starts at lower address.

2. Flash the application and use command `help`
    ```
    USEMODULE=esp_wifi make BOARD=esp8266-esp-12x -C examples/gnrc_networking flash test
    > help
    ```
    Help text is read from IROM.

### Issues/PRs references

Depends on #10980.

You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/10981

-- Commit Summary --

  * cpu/esp8266: add LoadStoreError exception handler
  * cpu/esp8266: move most rodata sections to IROM

-- File Changes --

    M cpu/esp8266/ld/esp8266.riot-os.sdk.app.ld (37)
    M cpu/esp8266/vendor/xtensa/xtensa_vectors.S (312)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/10981.patch
https://github.com/RIOT-OS/RIOT/pull/10981.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/10981
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190209/3ef39aac/attachment.html>


More information about the notifications mailing list