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

boards/cpu: add support form EFM32 and starter kits #4722

Closed
wants to merge 2 commits into from

Conversation

basilfx
Copy link
Member

@basilfx basilfx commented Jan 31, 2016

This PR adds initial support for the EFM32 and EZR32 MCUs by Silicon Labs. It refers to issue #1123.

The first commit adds the targets, the second commit adds the boards. It uses the existing flash scripts and Cortex architecture. It does not modify any other files.

Overview

The EFM32 and EZR32 MCUs are supported, including the new EFM32 Gemstone MCUs. All peripherals, except random number generator, are supported.

An overview1,2:

  • EFM32 Gecko
  • EFM32 Giant Gecko
  • EFM32 Happy Gecko
  • EFM32 Jade Gecko
  • EFM32 Leopard Gecko
  • EFM32 Pearl Gecko
  • EFM32 Tiny Gecko
  • EFM32 Wonder Gecko
  • EFM32 Zero Gecko
  • EZR32 Leopard Gecko

It targets the following boards2:

  • STK3200 — EFM32 Zero Gecko
  • SLSTK3401A — EFM32 Pearl Gecko
  • STK3600 — EFM32 Leopard Gecko
  • STK3700 — EFM32 Giant Gecko
  • STK3800 — EFM32 Wonder Gecko

Features

  • Low-power UART support (can be disabled via LOW_POWER_ENABLED=0, disables USB UART on STK3200, because it is connected to LEUART0).
  • Code Correlation for Advanced Energy Monitor (Cortex M3/M4 only, can be disabled via AEM_ENABLED=0)
  • RTT or RTC. As I don't know how core: API: RTC interface should not use struct tm #2538 will end, I implemented both. The new EFM32 Gemstone MCUs have proper RTC support, the older ones use time conversions. It can be configured as RTC via RTT_AS_RTC=1.

Documentation

I have prepared wiki pages for the boards here.

Testing

I have a STK3200, SLSTK3401A and STK3600. The STK3700 and STK3800 are identical to the STK3600.

The applicable peripheral tests compile and work, with a few exceptions:

  • periph_rtc fails on STK3200 (problems with timer).
  • periph_uart exceeds RAM on STK3200.
  • periph_spi compiles and works, but I haven't found a way to actually verify what is send on the pins.

I noticed two odds:

  • periph_spi hardcodes PULLUP for output pins. This is not supported by the GPIO peripheral of EFM32.
  • perip_rtc behaviour depends on implementation (time_t wrapper vs dedicated peripheral).

TODO

  • Optimizing code (I'm not a C expert).
  • Fixing SPI.
  • More testing.
  • Benchmarking energy consumption.

Long term (probably not in this PR):

  • Adding DMA support
  • Adding support for LETIMER. I used the EZR32WG timer implementation, but I don't like using two 16-bit timers to create a 32-bit timer. I don't know the timer requirements, but reducing it to 16-bit shortens the period.

Conclusion

I know this PR is using vendor libraries. As mentioned in #1123, it is not a board support package. I also know that RIOT-OS targets as efficient code as possible. That said, emlib (the vendor library) does increase the code size, but adds flexibility. I have reported this before, but I expected a constant increase. To verify/research this, I conducted several benchmarks with different compile options and a few boards. The results of approximately 2200 compilations can be found here (large file!)3,4. I see an increase of 3-4 kb compared to other boards5.

I fully understand that the above may influence the decision not to include this PR in RIOT-OS. But #1123 is open for quite some time, and this could serve as a starting point for optimization. The targeted MCUs have variants with enough flash and ram. Furthermore, It did not stop me from learning about RIOT-OS, EFM32, embedded and coding in general, so no hard feelings. I will probably still use it for my personal projects.

Footnotes

1 EZR32 Wonder Gecko is missing, but is already included in RIOT-OS. There is no compatibility or overlap.

2 SLWSTK6220A is missing, but is already included in RIOT-OS. There is no compatibility or overlap.

3 Parallel builds using make -jN for N > 1 failed in many cases with 'malformed archives'. Therefore a larger number of build failed. Manually cleaning and recompiling the same code for N = 1 succeeded, however.

4 Click the numbers in the TEXT, DATA or BSS column for more information.

5 My code is verbose: I explicitly reset peripherals, and initialize all parameters. Furthermore, clock setup and frequency calculation is also responsible for a big part of code (but used by multiple peripherals).

@basilfx basilfx changed the title Feature/efm32 board/cpu: add support form EFM32 Jan 31, 2016
@basilfx basilfx changed the title board/cpu: add support form EFM32 boards/cpu: add support form EFM32 and starter kits Jan 31, 2016
@basilfx basilfx mentioned this pull request Jan 31, 2016
@@ -0,0 +1,75 @@
/*
* Copyright (C) 2015 Freie Universität Berlin
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

freie universität berlin?

@OlegHahm OlegHahm added this to the Release 2016.03 milestone Jan 31, 2016
@OlegHahm OlegHahm added Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: new feature The issue requests / The PR implemements a new feature for RIOT labels Jan 31, 2016
@haukepetersen
Copy link
Contributor

Would it be possible to split up this PR? This PR adds >1200 files, which is not manageable for decent reviewing... I would propose you add each board (and their corresponding CPU) as separate PR, this should reduce the number of files at least to some extend...

@basilfx
Copy link
Member Author

basilfx commented Feb 5, 2016

Yeah sure, I will do that. I think I will do that tomorrow.

@haukepetersen
Copy link
Contributor

Thanks!

@basilfx
Copy link
Member Author

basilfx commented Feb 8, 2016

I wasn't able to fix this last weekend, sorry. I found a few bugs while working on a Si7021 driver, which I want to fix first.

@haukepetersen
Copy link
Contributor

sure, take your time!

@basilfx
Copy link
Member Author

basilfx commented Feb 15, 2016

I will close this one in favor of #4824. Let's start with one CPU/Board and see where that goes :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: new feature The issue requests / The PR implemements a new feature for RIOT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants