Skip to content

Commit

Permalink
teensy: Fix build errors and warnings and enable -Werror.
Browse files Browse the repository at this point in the history
Changes are:
- Remove include of stm32's adc.h because it was recently changed and is
  no longer compatible with teensy (and not used anyway).
- Remove define of __disable_irq in mpconfigport.h because it was clashing
  with an equivalent definition in core/mk20dx128.h.
- Add -Werror to CFLAGS, and change -std=gnu99 to -std=c99.

Signed-off-by: Damien George <[email protected]>
  • Loading branch information
dpgeorge authored and pfalcon committed Jan 25, 2021
1 parent cee7f75 commit 85fe97a
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
2 changes: 1 addition & 1 deletion ports/teensy/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ INC += -I$(TOP)/ports/stm32
INC += -I$(BUILD)
INC += -Icore

CFLAGS = $(INC) -Wall -Wpointer-arith -std=gnu99 -nostdlib $(CFLAGS_CORTEX_M4)
CFLAGS = $(INC) -Wall -Wpointer-arith -Werror -std=c99 -nostdlib $(CFLAGS_CORTEX_M4)
LDFLAGS = -nostdlib -T mk20dx256.ld -msoft-float -mfloat-abi=soft

ifeq ($(USE_ARDUINO_TOOLCHAIN),1)
Expand Down
1 change: 0 additions & 1 deletion ports/teensy/modpyb.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#include "usrsw.h"
#include "rng.h"
#include "uart.h"
#include "adc.h"
#include "storage.h"
#include "sdcard.h"
#include "accel.h"
Expand Down
6 changes: 1 addition & 5 deletions ports/teensy/mpconfigport.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ typedef long mp_off_t;
// value from disable_irq back to enable_irq. If you really need
// to know the machine-specific values, see irq.h.

#ifndef __disable_irq
#define __disable_irq() __asm__ volatile ("CPSID i");
#endif

__attribute__((always_inline)) static inline uint32_t __get_PRIMASK(void) {
uint32_t result;
__asm volatile ("MRS %0, primask" : "=r" (result));
Expand All @@ -92,7 +88,7 @@ __attribute__((always_inline)) static inline void enable_irq(mp_uint_t state) {

__attribute__((always_inline)) static inline mp_uint_t disable_irq(void) {
mp_uint_t state = __get_PRIMASK();
__disable_irq();
__asm__ volatile ("CPSID i");
return state;
}

Expand Down

0 comments on commit 85fe97a

Please sign in to comment.