[riot-commits] [RIOT-OS/RIOT] 6dbbc8: cpu/lpc2387: rtc: remove _rtc_set()

benpicco noreply at github.com
Mon Feb 10 23:36:16 CET 2020


  Branch: refs/heads/master
  Home:   https://github.com/RIOT-OS/RIOT
  Commit: 6dbbc8f33a625f007c1ec752d400ee08c27f0f20
      https://github.com/RIOT-OS/RIOT/commit/6dbbc8f33a625f007c1ec752d400ee08c27f0f20
  Author: Benjamin Valentin <benpicco at beuth-hochschule.de>
  Date:   2020-02-10 (Mon, 10 Feb 2020)

  Changed paths:
    M cpu/lpc2387/periph/rtc.c

  Log Message:
  -----------
  cpu/lpc2387: rtc: remove _rtc_set()

Calling localtime() adds considerable overhead.
There are easier ways to set the date to 1970.

For tests/periph_rtc this results in this ROM change:

master:

   text    data     bss     dec     hex
  31328     240   98064  129632   1fa60

with this patch:

   text    data     bss     dec     hex
  20036     140   98168  118344   1ce48


  Commit: 80dde82c86b33c396a616c4b74f5cc33ba13796a
      https://github.com/RIOT-OS/RIOT/commit/80dde82c86b33c396a616c4b74f5cc33ba13796a
  Author: Benjamin Valentin <benpicco at beuth-hochschule.de>
  Date:   2020-02-10 (Mon, 10 Feb 2020)

  Changed paths:
    M cpu/lpc2387/cpu.c

  Log Message:
  -----------
  cpu/lpc2387: clear POR bit if we woke from Deep Sleep

RSIR is 0x1 (POR) if we woke from Deep Sleep.
This makes it hard to distinguish between real power-on and waking from
Deep Sleep, which is why the Backup RAM signature was introduced.

However, calling cpu_woke_from_backup() a second time will always return
true, as the signature will have been set up by early boot then.

Thus, clear the POR bit if the signature was already in place.
The result is:

	RSIR == 0 -> woke from sleep
	RSIR == 1 -> cold boot


  Commit: 64107dd3a95d3ca300c585a81c811b036c478e78
      https://github.com/RIOT-OS/RIOT/commit/64107dd3a95d3ca300c585a81c811b036c478e78
  Author: Benjamin Valentin <benpicco at beuth-hochschule.de>
  Date:   2020-02-10 (Mon, 10 Feb 2020)

  Changed paths:
    M cpu/lpc2387/periph/rtc.c

  Log Message:
  -----------
  cpu/lpc2387: rtc: only initialize RTC after cold boot or external reset

On the MCB2388 plugging the power will result in both the POR and EXTR
bit being set.
Not sure if this is a property of the board, but it means RTC is also
reset after programming, so it behaves just like Backup RAM.

If we woke from Deep Sleep the POR bit will be cleared, so the RTC is not
reset.


  Commit: 76e19602a29820d0dda400b18b9587ff114a30e4
      https://github.com/RIOT-OS/RIOT/commit/76e19602a29820d0dda400b18b9587ff114a30e4
  Author: Benjamin Valentin <benpicco at beuth-hochschule.de>
  Date:   2020-02-10 (Mon, 10 Feb 2020)

  Changed paths:
    M cpu/arm7_common/arm7_init.c
    M cpu/lpc2387/cpu.c
    M cpu/lpc2387/include/cpu.h

  Log Message:
  -----------
  cpu/lpc2387: rename cpu_woke_from_backup()

The function would always return `true` after early boot, so it
is not very useful for applications.

Now it will only (but always) return true when we woke from Deep Sleep
*after* early boot. This makes it behave the same ways as the function
of the same name on SAME54.

Rename the existing function to cpu_backup_ram_is_initialized() to better
match it's semantics.


  Commit: 9f4920329bc9cbfd5d596bde3d09c568c1235c74
      https://github.com/RIOT-OS/RIOT/commit/9f4920329bc9cbfd5d596bde3d09c568c1235c74
  Author: Benjamin Valentin <benpicco at beuth-hochschule.de>
  Date:   2020-02-10 (Mon, 10 Feb 2020)

  Changed paths:
    M cpu/lpc2387/cpu.c

  Log Message:
  -----------
  cpu/lpc2387: clear BODR if POR is set

>From the data sheet:

> **Note:** Only in case when a reset occurs and the POR = 0, the BODR bit
indicates if the V DD(DCDC)(3V3) voltage was below 2.6 V or not.

So the value of BODR is undefined if POR is set.
Clear it to bring it to a defined state.


  Commit: eede974fa04552ff2c3d524b2da552de8701f6de
      https://github.com/RIOT-OS/RIOT/commit/eede974fa04552ff2c3d524b2da552de8701f6de
  Author: benpicco <benpicco at beuth-hochschule.de>
  Date:   2020-02-10 (Mon, 10 Feb 2020)

  Changed paths:
    M cpu/arm7_common/arm7_init.c
    M cpu/lpc2387/cpu.c
    M cpu/lpc2387/include/cpu.h
    M cpu/lpc2387/periph/rtc.c

  Log Message:
  -----------
  Merge pull request #12871 from benpicco/lpc2387_rtc_cleanup

cpu/lpc2387: rtc: remove use of localtime()


Compare: https://github.com/RIOT-OS/RIOT/compare/d8c050943c11...eede974fa045


More information about the commits mailing list