Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PoC for handling Erase WiFi Setting after OTA #6965

Draft
wants to merge 64 commits into
base: master
Choose a base branch
from

Commits on Dec 28, 2019

  1. Configuration menu
    Copy the full SHA
    6fde10f View commit details
    Browse the repository at this point in the history

Commits on Dec 30, 2019

  1. Added a 2nd method

    mhightower83 committed Dec 30, 2019
    Configuration menu
    Copy the full SHA
    93fb3d3 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c66ae2e View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    6d882e4 View commit details
    Browse the repository at this point in the history

Commits on Dec 31, 2019

  1. Configuration menu
    Copy the full SHA
    500b7cc View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    afd603b View commit details
    Browse the repository at this point in the history
  3. A proof of concept for handling Erase WiFi Setting after OTA

    Issue: Sometimes when an ESP8266 is reflashed/upgraded the WiFi does not work.
    Then a  serial flash with Erase Flash with WiFi setting is recommended. I have
    seen this more often when changing SDK by OTA. We don't have an erase WiFi for
    OTA.
    
    The PR tries to present a proof of concept solution. Actually it describes two
    different methods.
    
    There are 3 cases to consider when the firmware is updated by OTA. The new
    firmware:
    1. has the same Flash Configuration as the old.
    2. has a larger Flash Configuration than the old.
    3. has a smaller Flash Configuration then the old.
    
    In theory after an OTA and before a restart, the flash could be erased for
    _case 1_. _Case 2_ is a problem because the size exceeds what the SPIEraseSector
    expects and fails. We have to wait for a restart, after which the SDK will have
    updated the values in `flashchip`. _Case 3_ is potentially unsafe because we
    could be erasing the code that is running.
    
    At app_entry() `flashchip` properties appear to be reset to a default 4MByte
    flash. Even an ESP8285 reported 4MByte. The value of `flashchip->chip_size` was
    changed at the 2nd SPIRead. The 1st read was to address 0, 4 bytes.
    
    To erase the flash WiFi area, I choose to wait until the SDK has finished its
    adjustments to the `flashchip` structure. Then to begin erasing WiFi sectors.
    
    I implemented two methods:
    1. The first runs after the SDK calls `user_init()` and flash code execution is
    available (No IRAM needed), but restarts to be sure the SDK  does not get
    confused about its sectors being erased.
    2. The 2nd method runs as early as possible required IRAM. The sectors are
    erased before that 2nd read is processed. The SDK allowing the SDK to start off
    thinking the sectors were blank at boot.
    
    I also added an example/test sketch for exercising the feature. It is
    OTAEraseConfig.
    mhightower83 committed Dec 31, 2019
    Configuration menu
    Copy the full SHA
    bfb21b1 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    e51ab08 View commit details
    Browse the repository at this point in the history
  5. Take two

    mhightower83 committed Dec 31, 2019
    Configuration menu
    Copy the full SHA
    a284b0a View commit details
    Browse the repository at this point in the history

Commits on Jan 6, 2020

  1. Configuration menu
    Copy the full SHA
    3258d63 View commit details
    Browse the repository at this point in the history

Commits on Jan 8, 2020

  1. Configuration menu
    Copy the full SHA
    9d6e059 View commit details
    Browse the repository at this point in the history

Commits on Jan 9, 2020

  1. Configuration menu
    Copy the full SHA
    95eefed View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    815f1dc View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    660d19c View commit details
    Browse the repository at this point in the history
  4. style fix

    mhightower83 committed Jan 9, 2020
    Configuration menu
    Copy the full SHA
    4554a7c View commit details
    Browse the repository at this point in the history

Commits on Jan 16, 2020

  1. Configuration menu
    Copy the full SHA
    1ce4c60 View commit details
    Browse the repository at this point in the history

Commits on Jan 23, 2020

  1. Configuration menu
    Copy the full SHA
    7130877 View commit details
    Browse the repository at this point in the history

Commits on Jan 28, 2020

  1. Configuration menu
    Copy the full SHA
    73f16dc View commit details
    Browse the repository at this point in the history

Commits on Feb 6, 2020

  1. Added print messages to show progress.

    And code to ensure the UART speed stayed at 74880 for a more complete
    viewing of messages. Well at least, it stays at 74880 for a longer time than it was.
    Added pinMode filter to prevent UART TX pin from being disabled during user_init().
    mhightower83 committed Feb 6, 2020
    Configuration menu
    Copy the full SHA
    9c4e44b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    546f0cb View commit details
    Browse the repository at this point in the history

Commits on Feb 7, 2020

  1. Set default Method to 2, to side step travis issue of using preinit().

    This is just a PoC an alternate for preinit() can be created later.
    mhightower83 committed Feb 7, 2020
    Configuration menu
    Copy the full SHA
    560ddc5 View commit details
    Browse the repository at this point in the history

Commits on Feb 18, 2020

  1. Added a Third method.

    This method runs before the NONOS SDK is started. Patches the flashchip
    structure that the ROM APIs reference for validating input before calling
    SPIEraseSector.
    
    Extracted logic from EspClass::magicFlashChipSize() to make a "C"
    callable function and made EspClass::magicFlashChipSize() a thin wrapper
    to avoid duplicating code.
    
    Use Cache_Read_Enable() to enable flash code execution to reduce IRAM
    usage by pre SDK starup code.
    
    Improved comments and made comment formating more consistant in erase_config.cpp.
    
    Improved issolation of debug printing.
    mhightower83 committed Feb 18, 2020
    Configuration menu
    Copy the full SHA
    049d91b View commit details
    Browse the repository at this point in the history

Commits on Feb 19, 2020

  1. Resolve merge conflict.

    Changed method for reading image header, freeing 16 bytes of iRAM"
    mhightower83 committed Feb 19, 2020
    Configuration menu
    Copy the full SHA
    4e2493a View commit details
    Browse the repository at this point in the history
  2. one more :(

    mhightower83 committed Feb 19, 2020
    Configuration menu
    Copy the full SHA
    39160c8 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    c0394fb View commit details
    Browse the repository at this point in the history

Commits on Feb 21, 2020

  1. Access bin image header through ICACHE reduces IRAM usage by 16.

    Latest merge broke my TZ logic. Updated to the new configTime method.
    
    Updated WifiHealth to handle multiple/duplicate disconnects w/o connects.
    When a AP goes off line, a disconnect callback is done for each failed
    connect attempt. Before the total connect time was getting inflated.
    
    Now uses LED_BUILTIN for WiFi Up/Down state.
    
    Updated WifiHealth.ino to report total time connected and disconnected.
    "Connection Uptime" is the time since last connect.
    "Total Uptime" is the sum of all past uptimes.
    "Total Downtime" is the sum of all past downtimes.
    "min/max/avg" reportings are of past uptimes or past downtimes.
    
    Adjust comments for style?
    mhightower83 committed Feb 21, 2020
    Configuration menu
    Copy the full SHA
    f1acb40 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    604b40a View commit details
    Browse the repository at this point in the history

Commits on Mar 11, 2020

  1. Made function name longer to avoid possible name conflicts in the fut…

    …ure.
    
    Using static caused the compiler to inline with functions with different IRAM
    attributes. Updated some comments. Maybe fixed CI host issue with Update.cpp.
    mhightower83 committed Mar 11, 2020
    Configuration menu
    Copy the full SHA
    4553009 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    372998c View commit details
    Browse the repository at this point in the history
  3. CI issues

    mhightower83 committed Mar 11, 2020
    Configuration menu
    Copy the full SHA
    39b9508 View commit details
    Browse the repository at this point in the history

Commits on Mar 17, 2020

  1. Configuration menu
    Copy the full SHA
    4954dcd View commit details
    Browse the repository at this point in the history

Commits on Mar 27, 2020

  1. Configuration menu
    Copy the full SHA
    828a47d View commit details
    Browse the repository at this point in the history

Commits on Apr 9, 2020

  1. Configuration menu
    Copy the full SHA
    b2d35ea View commit details
    Browse the repository at this point in the history

Commits on Apr 16, 2020

  1. Configuration menu
    Copy the full SHA
    74129c5 View commit details
    Browse the repository at this point in the history

Commits on Apr 28, 2020

  1. Configuration menu
    Copy the full SHA
    14fede0 View commit details
    Browse the repository at this point in the history

Commits on May 5, 2020

  1. Configuration menu
    Copy the full SHA
    be5fe6d View commit details
    Browse the repository at this point in the history

Commits on May 16, 2020

  1. Configuration menu
    Copy the full SHA
    cfd54df View commit details
    Browse the repository at this point in the history

Commits on May 31, 2020

  1. Configuration menu
    Copy the full SHA
    6f91be0 View commit details
    Browse the repository at this point in the history

Commits on Jun 4, 2020

  1. Configuration menu
    Copy the full SHA
    6b1cdb8 View commit details
    Browse the repository at this point in the history

Commits on Jun 19, 2020

  1. Configuration menu
    Copy the full SHA
    fcb8b21 View commit details
    Browse the repository at this point in the history

Commits on Jul 7, 2020

  1. Configuration menu
    Copy the full SHA
    c40a873 View commit details
    Browse the repository at this point in the history

Commits on Jul 10, 2020

  1. Corrected new errors after upgrade to GCC 10.1 toolchain.

    Method 3 was failing with an unaligned access due to 32-bit word access
    being optomized to an 8-bit when accessing ICACHE memory.
    Added noinline with IRAM_CACHE attribute in module erase_config.cpp.
    Also, revised print macros to be more globally unique.
    mhightower83 committed Jul 10, 2020
    Configuration menu
    Copy the full SHA
    2b2def2 View commit details
    Browse the repository at this point in the history

Commits on Jul 22, 2020

  1. Configuration menu
    Copy the full SHA
    48ed5e9 View commit details
    Browse the repository at this point in the history

Commits on Sep 2, 2020

  1. Configuration menu
    Copy the full SHA
    b211727 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    ab9b6b2 View commit details
    Browse the repository at this point in the history

Commits on Sep 17, 2020

  1. Configuration menu
    Copy the full SHA
    e5539fe View commit details
    Browse the repository at this point in the history

Commits on Oct 2, 2020

  1. Configuration menu
    Copy the full SHA
    502d8bc View commit details
    Browse the repository at this point in the history

Commits on Nov 11, 2020

  1. Configuration menu
    Copy the full SHA
    f50b3a6 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    94365e1 View commit details
    Browse the repository at this point in the history
  3. Updated wifi_health_t and WiFiDisconnectLog_t to take

    advange of C++ element initialization options.
    mhightower83 committed Nov 11, 2020
    Configuration menu
    Copy the full SHA
    5234f3f View commit details
    Browse the repository at this point in the history

Commits on Dec 8, 2020

  1. Configuration menu
    Copy the full SHA
    025bb2f View commit details
    Browse the repository at this point in the history

Commits on Dec 29, 2020

  1. Configuration menu
    Copy the full SHA
    edade1c View commit details
    Browse the repository at this point in the history

Commits on Feb 19, 2021

  1. Configuration menu
    Copy the full SHA
    24a117c View commit details
    Browse the repository at this point in the history

Commits on Mar 14, 2021

  1. Configuration menu
    Copy the full SHA
    4e31c91 View commit details
    Browse the repository at this point in the history
  2. Replaced ROM_uart_div_modify and associated logic, with the current

    method of handling direct ROM calls.
    mhightower83 committed Mar 14, 2021
    Configuration menu
    Copy the full SHA
    0b01518 View commit details
    Browse the repository at this point in the history

Commits on Apr 3, 2021

  1. Configuration menu
    Copy the full SHA
    f9a3f95 View commit details
    Browse the repository at this point in the history
  2. Cleanup merge conflict. Now use IRAM_ATTR and _NOINLINE_STATIC w/o ch…

    …anges.
    
    Fixed missed edit (rom_uart_div_modify) for debug build.
    mhightower83 committed Apr 3, 2021
    Configuration menu
    Copy the full SHA
    217b2d2 View commit details
    Browse the repository at this point in the history

Commits on Jul 28, 2021

  1. Configuration menu
    Copy the full SHA
    0b7fced View commit details
    Browse the repository at this point in the history

Commits on Aug 8, 2021

  1. Configuration menu
    Copy the full SHA
    9f0e220 View commit details
    Browse the repository at this point in the history

Commits on Aug 21, 2021

  1. Configuration menu
    Copy the full SHA
    e44e752 View commit details
    Browse the repository at this point in the history

Commits on Aug 22, 2021

  1. Configuration menu
    Copy the full SHA
    c44a3f9 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    63a2048 View commit details
    Browse the repository at this point in the history

Commits on Dec 21, 2021

  1. Configuration menu
    Copy the full SHA
    21b0154 View commit details
    Browse the repository at this point in the history

Commits on May 2, 2022

  1. Configuration menu
    Copy the full SHA
    fb05f15 View commit details
    Browse the repository at this point in the history