From ac978969f7474b0a1f9b19189a0dd4d3ed6a908f Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 12 Nov 2021 19:13:35 -0600 Subject: [PATCH] litex: Enable -Werror=missing-prototypes --- ports/litex/Makefile | 2 +- ports/litex/background.c | 1 + ports/litex/common-hal/microcontroller/Processor.c | 1 + ports/litex/common-hal/os/__init__.c | 4 +++- ports/litex/mphalport.c | 2 ++ ports/litex/supervisor/port.c | 1 + 6 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ports/litex/Makefile b/ports/litex/Makefile index e483832fc1..6fe9e46bec 100644 --- a/ports/litex/Makefile +++ b/ports/litex/Makefile @@ -88,7 +88,7 @@ endif # option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk CFLAGS += $(OPTIMIZATION_FLAGS) -CFLAGS += $(INC) -Werror -Wall -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(C_DEFS) $(CFLAGS_MOD) $(COPT) +CFLAGS += $(INC) -Werror -Wall -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(C_DEFS) $(CFLAGS_MOD) $(COPT) -Werror=missing-prototypes # TODO: check this CFLAGS += -D__START=main -DFOMU diff --git a/ports/litex/background.c b/ports/litex/background.c index da86919c0c..d2e94c5b8d 100644 --- a/ports/litex/background.c +++ b/ports/litex/background.c @@ -28,6 +28,7 @@ #include "supervisor/filesystem.h" #include "supervisor/usb.h" #include "supervisor/shared/stack.h" +#include "supervisor/port.h" void port_background_task(void) { } diff --git a/ports/litex/common-hal/microcontroller/Processor.c b/ports/litex/common-hal/microcontroller/Processor.c index 4d4f88288e..ff2f041876 100644 --- a/ports/litex/common-hal/microcontroller/Processor.c +++ b/ports/litex/common-hal/microcontroller/Processor.c @@ -29,6 +29,7 @@ #include "py/runtime.h" #include "common-hal/microcontroller/Processor.h" +#include "shared-bindings/microcontroller/Processor.h" #include "shared-bindings/microcontroller/ResetReason.h" #include "supervisor/shared/translate.h" diff --git a/ports/litex/common-hal/os/__init__.c b/ports/litex/common-hal/os/__init__.c index c070c2777e..717c819335 100644 --- a/ports/litex/common-hal/os/__init__.c +++ b/ports/litex/common-hal/os/__init__.c @@ -30,6 +30,8 @@ #include "py/objtuple.h" #include "py/qstr.h" +#include "shared-bindings/os/__init__.h" + STATIC const qstr os_uname_info_fields[] = { MP_QSTR_sysname, MP_QSTR_nodename, MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine @@ -56,6 +58,6 @@ mp_obj_t common_hal_os_uname(void) { return (mp_obj_t)&os_uname_info_obj; } -bool common_hal_os_urandom(uint8_t *buffer, uint32_t length) { +bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) { return false; } diff --git a/ports/litex/mphalport.c b/ports/litex/mphalport.c index 5eedc73f3c..0747c12190 100644 --- a/ports/litex/mphalport.c +++ b/ports/litex/mphalport.c @@ -31,6 +31,7 @@ #include "py/mphal.h" #include "py/mpstate.h" #include "py/gc.h" +#include "supervisor/cpu.h" #include "supervisor/usb.h" #include "csr.h" @@ -54,6 +55,7 @@ extern void SysTick_Handler(void); // be prematurely enabled by interrupt handlers that enable and disable interrupts. extern volatile uint32_t nesting_count; +void isr(void); __attribute__((section(".ramtext"))) void isr(void) { uint8_t irqs = irq_pending() & irq_getmask(); diff --git a/ports/litex/supervisor/port.c b/ports/litex/supervisor/port.c index 6f108ee051..42d3a63920 100644 --- a/ports/litex/supervisor/port.c +++ b/ports/litex/supervisor/port.c @@ -38,6 +38,7 @@ // crystals. volatile uint64_t raw_ticks = 0; volatile int subsecond = 0; +void SysTick_Handler(void); __attribute__((section(".ramtext"))) void SysTick_Handler(void) { timer0_ev_pending_write(1);