Skip to content

cpu/efm32: RTC Series 0: use RTC helper functions#15413

Merged
benpicco merged 1 commit intoRIOT-OS:masterfrom
benpicco:cpu/efm32_rtc_helper
Nov 11, 2020
Merged

cpu/efm32: RTC Series 0: use RTC helper functions#15413
benpicco merged 1 commit intoRIOT-OS:masterfrom
benpicco:cpu/efm32_rtc_helper

Conversation

@benpicco
Copy link
Copy Markdown
Contributor

@benpicco benpicco commented Nov 9, 2020

Contribution description

By using the RTC helper functions instead of POSIX mktime()/gmtime() we can not only extend the RTC range beyond Y2038, but also save some ROM.

For tests/periph_rtc:

before:

   text	   data	    bss	    dec	    hex	filename
  28028	    248	   2472	  30748	   781c stk3700/tests_periph_rtc.elf

after:

   text	   data	    bss	    dec	    hex	filename
  19400	    144	   2424	  21968	   55d0 stk3700/tests_periph_rtc.elf

Testing procedure

tests/periph_rtc should still run on Series 0 MCUs.

Issues/PRs references

fixes #13277

By using the RTC helper functions instead of POSIX mktime()/gmtime()
we can not only extend the RTC range beyond Y2038.

For tests/periph_rtc:

before:

   text	   data	    bss	    dec	    hex	filename
  28028	    248	   2472	  30748	   781c stk3700/tests_periph_rtc.elf

after:

   text	   data	    bss	    dec	    hex	filename
  19400	    144	   2424	  21968	   55d0 stk3700/tests_periph_rtc.elf

fixes RIOT-OS#13277
@benpicco benpicco requested a review from basilfx November 9, 2020 17:02
@benpicco benpicco added Area: cpu Area: CPU/MCU ports Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Nov 9, 2020
@fjmolinas
Copy link
Copy Markdown
Contributor

@benpicco I currently don't have access to a efm32 board, can you provide some test output?

@benpicco
Copy link
Copy Markdown
Contributor Author

I don't have a Series 0 board unfortunately.

@basilfx
Copy link
Copy Markdown
Member

basilfx commented Nov 10, 2020

I have a series 0 board. Can do some tests tonight.

@basilfx
Copy link
Copy Markdown
Member

basilfx commented Nov 10, 2020

Works fine on the STK3600:

2020-11-10 22:41:57,226 # Help: Press s to start test, r to print it is ready
s
2020-11-10 22:41:59,117 # START
2020-11-10 22:41:59,118 # main(): This is RIOT! (Version: 2021.01-devel-729-gbad38-cpu/efm32_rtc_helper)
2020-11-10 22:41:59,118 #
2020-11-10 22:41:59,119 # RIOT RTC low-level driver test
2020-11-10 22:41:59,129 # This test will display 'Alarm!' every 2 seconds for 4 times
2020-11-10 22:41:59,130 #   Setting clock to   2020-02-28 23:59:57
2020-11-10 22:41:59,139 # Clock value is now   2020-02-28 23:59:57
2020-11-10 22:41:59,140 #   Setting alarm to   2020-02-28 23:59:59
2020-11-10 22:41:59,140 #    Alarm is set to   2020-02-28 23:59:59
2020-11-10 22:41:59,140 #
2020-11-10 22:42:02,124 # Alarm!
2020-11-10 22:42:04,124 # Alarm!
2020-11-10 22:42:06,124 # Alarm!
2020-11-10 22:42:08,124 # Alarm!

Quite amazed how much bytes it saved, although my difference is smaller ('only' 6764 bytes).

@benpicco benpicco merged commit 38552ed into RIOT-OS:master Nov 11, 2020
@benpicco benpicco deleted the cpu/efm32_rtc_helper branch November 11, 2020 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: cpu Area: CPU/MCU ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Y2038 tracking issue / strategy

3 participants