[riot-notifications] [RIOT-OS/RIOT] cpu/kinetis: fix compile issue in LPTMR timer (#15728)

Leandro Lanzieri notifications at github.com
Fri Jan 8 12:20:52 CET 2021


### Contribution description
When trying to build the default example for the `pba-d-01-kw2x` using `arm-none-eabi-gcc (Arch Repository) 10.2.0`, it catches the following issue:

```
/home/leandro/Work/RIOT/cpu/kinetis/periph/timer.c: In function 'isr_lptmr0':
/home/leandro/Work/RIOT/cpu/kinetis/periph/timer.c:596:10: error: array subscript 0 is outside array bounds of 'lptmr_t[0]' [-Werror=array-bounds]
  596 |     lptmr[dev].running = 0;
      |     ~~~~~^~~~~
/home/leandro/Work/RIOT/cpu/kinetis/periph/timer.c:87:16: note: while referencing 'lptmr'
   87 | static lptmr_t lptmr[LPTMR_NUMOF];
      |                ^~~~~
/home/leandro/Work/RIOT/cpu/kinetis/periph/timer.c:602:14: error: array subscript 0 is outside array bounds of 'lptmr_t[0]' [-Werror=array-bounds]
  602 |     if (lptmr[dev].isr_ctx.cb != NULL) {
      |         ~~~~~^~~~~
/home/leandro/Work/RIOT/cpu/kinetis/periph/timer.c:87:16: note: while referencing 'lptmr'
   87 | static lptmr_t lptmr[LPTMR_NUMOF];
      |                ^~~~~
/home/leandro/Work/RIOT/cpu/kinetis/periph/timer.c:603:36: error: array subscript 0 is outside array bounds of 'lptmr_t[0]' [-Werror=array-bounds]
  603 |         lptmr[dev].isr_ctx.cb(lptmr[dev].isr_ctx.arg, 0);
      |                               ~~~~~^~~~~
/home/leandro/Work/RIOT/cpu/kinetis/periph/timer.c:87:16: note: while referencing 'lptmr'
   87 | static lptmr_t lptmr[LPTMR_NUMOF];
      |                ^~~~~
cc1: all warnings being treated as errors
make[3]: *** [/home/leandro/Work/RIOT/Makefile.base:107: /home/leandro/Work/RIOT/examples/default/bin/pba-d-01-kw2x/periph/timer.o] Error 1
make[2]: *** [/home/leandro/Work/RIOT/Makefile.base:30: ALL--/home/leandro/Work/RIOT/cpu/kinetis/periph] Error 2
make[1]: *** [/home/leandro/Work/RIOT/Makefile.base:30: ALL--/home/leandro/Work/RIOT/cpu/kinetis] Error 2
make: *** [/home/leandro/Work/RIOT/examples/default/../../Makefile.include:619: application_default.module] Error 2
```

Indeed the board defines `0` LPTMR timers on its configuration. The check to decide if the platform has or not support for that peripheral does not take this into account. This does not seem to be a problem when building in Docker by the way.

This PR changes that and also removes the define for the interrupt vector macro, as it should not be needed.

### Testing procedure
- Green CI
- Timer tests should succeed
- Other kinetis boards that have LPTMR should still use it

### Issues/PRs references
None
You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/15728

-- Commit Summary --

  * boards/pba-d-01-kw2x: not define LPTMR_ISR_1
  * cpu/kinetis/timer: consider no LPTMR when no config present

-- File Changes --

    M boards/pba-d-01-kw2x/include/periph_conf.h (1)
    M cpu/kinetis/periph/timer.c (32)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/15728.patch
https://github.com/RIOT-OS/RIOT/pull/15728.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/15728
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210108/d2e86eb0/attachment.htm>


More information about the notifications mailing list