[riot-commits] [RIOT-OS/RIOT] e0365e: atmega: use software interrupt for context swap

Ludwig Knüpfer ludwig.knuepfer at fu-berlin.de
Wed Sep 21 21:13:06 CEST 2016


  Branch: refs/heads/master
  Home:   https://github.com/RIOT-OS/RIOT
  Commit: e0365e0bf95b18eec57c8b0808e9984133bd2b83
      https://github.com/RIOT-OS/RIOT/commit/e0365e0bf95b18eec57c8b0808e9984133bd2b83
  Author: Jon Thacker <thacker.jon at gmail.com>
  Date:   2016-09-07 (Wed, 07 Sep 2016)

  Changed paths:
    M boards/arduino-mega2560/include/board.h
    M boards/waspmote-pro/include/board.h
    M cpu/atmega_common/thread_arch.c

  Log Message:
  -----------
  atmega: use software interrupt for context swap

Fixes #5745
For AVR based boards, three defines must be defined AVR_CONTEXT_SWAP_INIT,
AVR_CONTEXT_SWAP_INTERRUPT_VECT, and AVR_CONTEXT_SWAP_TRIGGER.
These defines are used to trigger a software interrupt used for context
switching.

When AVR_CONTEXT_SWAP_INTERRUPT_VECT is handled, the scheduler is run
and a context swap will happen if necessary, with the resulting thread
starting following the reti instruction. This results in threads running
at normal priority instead of at interrupt priority.

Atmega devices do provide a pure software interrupt. The method used
here for waspmote-pro and arduino-mega2560 is to use pin change
interrupts, set the pin to act as an output, and toggle the value to
simulate a software interrupt. The main limitation here is that a
physical pin is now occupied and must be defined for each board
supported by RIOT. On the plus side, it provides an easy method for
detecting context swaps with an oscilloscope.


  Commit: 6d30ced410a2d428a976c462d50c130e4d50f1da
      https://github.com/RIOT-OS/RIOT/commit/6d30ced410a2d428a976c462d50c130e4d50f1da
  Author: Ludwig Knüpfer <ludwig.knuepfer at fu-berlin.de>
  Date:   2016-09-21 (Wed, 21 Sep 2016)

  Changed paths:
    M boards/arduino-mega2560/include/board.h
    M boards/waspmote-pro/include/board.h
    M cpu/atmega_common/thread_arch.c

  Log Message:
  -----------
  Merge pull request #5763 from jthacker/avr_thread_arch_isr_stack_usage

atmega: use software interrupt for context swap


Compare: https://github.com/RIOT-OS/RIOT/compare/03a82bc2952b...6d30ced410a2


More information about the commits mailing list