You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/04/05 20:00:34 UTC

[GitHub] alvarop opened a new pull request #996: WIP: hal_nvreg (Retained register interface)

alvarop opened a new pull request #996: WIP: hal_nvreg (Retained register interface)
URL: https://github.com/apache/mynewt-core/pull/996
 
 
   This is a first attempt at a hal interface to retained registers. (And added support for serial bootloader to use it to enter bootloader on reset if a specific value is saved in one of them)
   
   Various microcontrollers have a few registers that survive a soft reset. This interface exposes them (if available) via hal_nvreg (Happy to change the name if we can think of something better).
   I was thinking nv for nonvolatile, which isn't always true since they will get cleared after hard reset (in some devices). Another options was hal_retained_reg, which is a bit long, but also works.
   
   ## hal_nvreg functions
   * `void hal_nvreg_write(unsigned int reg, uint32_t val);`
     * Stores value to retained register at index <reg>
   * `uint32_t hal_nvreg_read(unsigned int reg);`
     * Returns value of retained register at index <reg>
   * `unsigned int hal_nvreg_get_num_regs();`
     * Different devices might have more, less, or no retained registers. This will return how many there are.
   * `unsigned int hal_nvreg_get_reg_width();`
     * Since not all registers are 32 bits, this function allows for querying the actual stored size
   
   ## boot_serial modifications
   Added an optional check for a specific value if **MYNEWT_VAL(BOOT_SERIAL_NVREG_INDEX) != -1**.
   
   If the value stored in retained register <**MYNEWT_VAL(BOOT_SERIAL_NVREG_INDEX)** > matches  <**MYNEWT_VAL(BOOT_SERIAL_NVREG_MAGIC)**>, then the serial bootloader starts instead of continuing to run the main application.
   
   ## Serial Bootloader Example
   I wrote a small example app to test the serial bootloader here: https://github.com/alvarop/mynewt_bootloader_app

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services