[ell-i-developers] Linker non used peripheral removal

  • From: Ivan Raul <supra.material@xxxxxxxxx>
  • To: ell-i-developers@xxxxxxxxxxxxx
  • Date: Thu, 23 Jan 2014 18:09:20 +0200

Dear Pekka.

I read this piece of comment about the removal of unused peripherals, in
particular the timers.


 * With the current Arduino API, it is not possible to reliably
 * determine at compile time which PWM ports are used and which are
 * not.  Hence, the only viable option at the moment is to explicitly
 * refer to the TIMER system init records, by creating explicit
 * references to them.  With the -fdata-sections gcc options, the
 * __TIMERx names below will be deleted during link time, leaving only
 * the referenced and explicitly kept TIMERx_INIT records into the
 * linked code (due to the corresponding linker KEEP directive.)


KEEP (*(.peripheral.*)) /* Read-only peripheral initialisation data */

I don't know how to track if those unused elements should be removed by the
linker or not, and then not activated during the initialization of the

The point is that right now all the peripherals are activated, regardless
of their use or not. In particular, all the timers are registered.

Other related posts: