Skip to content

Commit ef2b637

Browse files
authored
Merge pull request #5582 from jepler/mimxrt10xx-prototypes
Mimxrt10xx: enable -Werror=missing-prototypes
2 parents 18b3e6c + edeb31f commit ef2b637

File tree

18 files changed

+38
-11
lines changed

18 files changed

+38
-11
lines changed

ports/mimxrt10xx/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ else
9292
#CFLAGS += -flto -flto-partition=none
9393
endif
9494

95-
CFLAGS += $(INC) -ggdb -Wall -Wno-cast-align -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT)
95+
CFLAGS += $(INC) -ggdb -Wall -Werror -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) -Werror=missing-prototypes
9696

9797
# TODO: add these when -Werror is applied
9898
# Disable some warnings, as do most ports. NXP SDK causes undef, tinyusb causes cast-align
@@ -148,7 +148,7 @@ SRC_SDK := \
148148
system_$(CHIP_FAMILY).c \
149149

150150
SRC_SDK := $(addprefix sdk/devices/$(CHIP_FAMILY)/, $(SRC_SDK))
151-
$(addprefix $(BUILD)/, $(SRC_SDK:.c=.o)): CFLAGS += -Wno-undef
151+
$(addprefix $(BUILD)/, $(SRC_SDK:.c=.o)): CFLAGS += -Wno-undef -Wno-missing-prototypes -Wno-cast-align
152152

153153
SRC_C += \
154154
background.c \

ports/mimxrt10xx/common-hal/analogio/AnalogIn.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
*/
2727

2828
#include "common-hal/analogio/AnalogIn.h"
29+
#include "shared-bindings/analogio/AnalogIn.h"
2930
#include "shared-bindings/microcontroller/Pin.h"
3031

3132
#include <string.h>

ports/mimxrt10xx/common-hal/busio/I2C.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,6 @@ typedef struct {
4141
const mcu_periph_obj_t *sda;
4242
} busio_i2c_obj_t;
4343

44+
void i2c_reset(void);
45+
4446
#endif // MICROPY_INCLUDED_MIMXRT10XX_COMMON_HAL_BUSIO_I2C_H

ports/mimxrt10xx/common-hal/busio/UART.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ static void config_periph_pin(const mcu_periph_obj_t *periph) {
6565
| IOMUXC_SW_PAD_CTL_PAD_SRE(0));
6666
}
6767

68-
void LPUART_UserCallback(LPUART_Type *base, lpuart_handle_t *handle, status_t status, void *user_data) {
68+
STATIC void LPUART_UserCallback(LPUART_Type *base, lpuart_handle_t *handle, status_t status, void *user_data) {
6969
busio_uart_obj_t *self = (busio_uart_obj_t *)user_data;
7070

7171
if (status == kStatus_LPUART_RxIdle) {

ports/mimxrt10xx/common-hal/busio/UART.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,5 @@ typedef struct {
5151
const mcu_periph_obj_t *rts;
5252
} busio_uart_obj_t;
5353

54+
void uart_reset(void);
5455
#endif // MICROPY_INCLUDED_MIMXRT10XX_COMMON_HAL_BUSIO_UART_H

ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
#define IOMUXC_SW_MUX_CTL_PAD_MUX_MODE_ALT5 5U
4242

43-
void pin_config(const mcu_pin_obj_t *pin, bool open_drain, digitalio_pull_t pull) {
43+
STATIC void pin_config(const mcu_pin_obj_t *pin, bool open_drain, digitalio_pull_t pull) {
4444
IOMUXC_SetPinConfig(0, 0, 0, 0, pin->cfg_reg,
4545
IOMUXC_SW_PAD_CTL_PAD_HYS(1)
4646
| IOMUXC_SW_PAD_CTL_PAD_PUS((pull == PULL_UP) ? 2 : 0)

ports/mimxrt10xx/common-hal/microcontroller/Processor.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <math.h>
2929

3030
#include "common-hal/microcontroller/Processor.h"
31+
#include "shared-bindings/microcontroller/Processor.h"
3132
#include "shared-bindings/microcontroller/ResetReason.h"
3233

3334
#include "fsl_tempmon.h"

ports/mimxrt10xx/common-hal/os/__init__.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
#include "py/objtuple.h"
3232
#include "py/qstr.h"
3333

34+
#include "shared-bindings/os/__init__.h"
35+
3436
#include "fsl_trng.h"
3537

3638
STATIC const qstr os_uname_info_fields[] = {
@@ -58,7 +60,7 @@ mp_obj_t common_hal_os_uname(void) {
5860
return (mp_obj_t)&os_uname_info_obj;
5961
}
6062

61-
bool common_hal_os_urandom(uint8_t *buffer, uint32_t length) {
63+
bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) {
6264
trng_config_t trngConfig;
6365

6466
TRNG_GetDefaultConfig(&trngConfig);

ports/mimxrt10xx/common-hal/rtc/RTC.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
#include "py/runtime.h"
3232
#include "shared/timeutils/timeutils.h"
3333
#include "shared-bindings/rtc/__init__.h"
34+
#include "shared-bindings/rtc/RTC.h"
35+
#include "common-hal/rtc/RTC.h"
3436
#include "supervisor/shared/translate.h"
3537

3638
#include "fsl_snvs_hp.h"

ports/mimxrt10xx/mphalport.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
* THE SOFTWARE.
2626
*/
2727

28+
#include "py/mphal.h"
2829
#include "py/mpstate.h"
2930
#include "py/smallint.h"
3031

ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/clocks.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
#include "fsl_clock.h"
3636
#include "fsl_iomuxc.h"
3737

38+
#include "clocks.h"
39+
3840
#define BOARD_XTAL0_CLK_HZ 24000000U /*!< Board xtal0 frequency in Hz */
3941
#define BOARD_XTAL32K_CLK_HZ 32768U /*!< Board xtal32k frequency in Hz */
4042

ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/clocks.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
#include "fsl_clock.h"
3737
#include "fsl_iomuxc.h"
3838

39+
#include "clocks.h"
40+
3941
// These values are pulled from the SDK's devices/MIMXRT1021/project_template/clock_config.* files.
4042

4143
#define BOARD_XTAL0_CLK_HZ 24000000U /*!< Board xtal0 frequency in Hz */

ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/clocks.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
#include "fsl_clock.h"
3636
#include "fsl_iomuxc.h"
3737

38+
#include "clocks.h"
39+
3840
#define BOARD_XTAL0_CLK_HZ 24000000U /*!< Board xtal0 frequency in Hz */
3941
#define BOARD_XTAL32K_CLK_HZ 32768U /*!< Board xtal32k frequency in Hz */
4042
#define BOARD_BOOTCLOCKRUN_CORE_CLOCK 600000000U /*!< Core clock frequency: 600000000Hz */

ports/mimxrt10xx/supervisor/flexspi_nor_flash_ops.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
#include "fsl_flexspi.h"
1111
#include "internal_flash.h"
1212
#include "boards/flash_config.h"
13+
#include "supervisor/internal_flash.h"
1314
#include "supervisor/linker.h"
1415

15-
status_t PLACE_IN_ITCM(flexspi_nor_write_enable)(FLEXSPI_Type * base, uint32_t baseAddr)
16+
STATIC status_t PLACE_IN_ITCM(flexspi_nor_write_enable)(FLEXSPI_Type * base, uint32_t baseAddr)
1617
{
1718
flexspi_transfer_t flashXfer;
1819
status_t status;
@@ -29,7 +30,7 @@ status_t PLACE_IN_ITCM(flexspi_nor_write_enable)(FLEXSPI_Type * base, uint32_t b
2930
return status;
3031
}
3132

32-
status_t PLACE_IN_ITCM(flexspi_nor_wait_bus_busy)(FLEXSPI_Type * base)
33+
STATIC status_t PLACE_IN_ITCM(flexspi_nor_wait_bus_busy)(FLEXSPI_Type * base)
3334
{
3435
/* Wait status ready. */
3536
bool isBusy;

ports/mimxrt10xx/supervisor/internal_flash.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,6 @@ extern uint32_t __fatfs_flash_length[];
5252
uint8_t _flash_cache[SECTOR_SIZE] __attribute__((aligned(4)));
5353
uint32_t _flash_page_addr = NO_CACHE;
5454

55-
extern status_t flexspi_nor_flash_erase_sector(FLEXSPI_Type *base, uint32_t address);
56-
extern status_t flexspi_nor_flash_page_program(FLEXSPI_Type *base, uint32_t dstAddr, const uint32_t *src);
57-
extern status_t flexspi_nor_enable_quad_mode(FLEXSPI_Type *base);
58-
5955
void PLACE_IN_ITCM(supervisor_flash_init)(void) {
6056
// Update the LUT to make sure all entries are available.
6157
FLEXSPI_UpdateLUT(FLEXSPI, 0, (const uint32_t *)&qspiflash_config.memConfig.lookupTable, 64);

ports/mimxrt10xx/supervisor/internal_flash.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <stdint.h>
3131

3232
#include "py/mpconfig.h"
33+
#include "fsl_common.h"
3334

3435
#define INTERNAL_FLASH_SYSTICK_MASK (0x1ff) // 512ms
3536
#define INTERNAL_FLASH_IDLE_TICK(tick) (((tick) & INTERNAL_FLASH_SYSTICK_MASK) == 2)
@@ -41,4 +42,9 @@
4142
#define ROM_INDEX_PAGEPROGRAM 9
4243
#define ROM_INDEX_READSTATUSREG 1
4344

45+
extern status_t flexspi_nor_flash_erase_sector(FLEXSPI_Type *base, uint32_t address);
46+
extern status_t flexspi_nor_flash_page_program(FLEXSPI_Type *base, uint32_t dstAddr, const uint32_t *src);
47+
extern status_t flexspi_nor_enable_quad_mode(FLEXSPI_Type *base);
48+
49+
4450
#endif // MICROPY_INCLUDED_MIMXRT10XX_INTERNAL_FLASH_H

ports/mimxrt10xx/supervisor/port.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ extern uint32_t _ld_itcm_flash_copy;
104104
extern void main(void);
105105

106106
// This replaces the Reset_Handler in startup_*.S and SystemInit in system_*.c.
107+
void Reset_Handler(void);
107108
__attribute__((used, naked)) void Reset_Handler(void) {
108109
__disable_irq();
109110
SCB->VTOR = (uint32_t)&__isr_vector;
@@ -358,6 +359,8 @@ uint64_t port_get_raw_ticks(uint8_t *subticks) {
358359
return ticks / 32;
359360
}
360361

362+
void SNVS_HP_WRAPPER_IRQHandler(void);
363+
__attribute__((used))
361364
void SNVS_HP_WRAPPER_IRQHandler(void) {
362365
if ((SNVS->HPSR & SNVS_HPSR_PI_MASK) != 0) {
363366
supervisor_tick();
@@ -415,6 +418,7 @@ void port_idle_until_interrupt(void) {
415418
/**
416419
* \brief Default interrupt handler for unused IRQs.
417420
*/
421+
void MemManage_Handler(void);
418422
__attribute__((used)) void MemManage_Handler(void) {
419423
reset_into_safe_mode(MEM_MANAGE);
420424
while (true) {
@@ -425,6 +429,7 @@ __attribute__((used)) void MemManage_Handler(void) {
425429
/**
426430
* \brief Default interrupt handler for unused IRQs.
427431
*/
432+
void BusFault_Handler(void);
428433
__attribute__((used)) void BusFault_Handler(void) {
429434
reset_into_safe_mode(MEM_MANAGE);
430435
while (true) {
@@ -435,6 +440,7 @@ __attribute__((used)) void BusFault_Handler(void) {
435440
/**
436441
* \brief Default interrupt handler for unused IRQs.
437442
*/
443+
void UsageFault_Handler(void);
438444
__attribute__((used)) void UsageFault_Handler(void) {
439445
reset_into_safe_mode(MEM_MANAGE);
440446
while (true) {
@@ -445,6 +451,7 @@ __attribute__((used)) void UsageFault_Handler(void) {
445451
/**
446452
* \brief Default interrupt handler for unused IRQs.
447453
*/
454+
void HardFault_Handler(void);
448455
__attribute__((used)) void HardFault_Handler(void) {
449456
reset_into_safe_mode(HARD_CRASH);
450457
while (true) {

ports/mimxrt10xx/supervisor/usb.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ void init_usb_hardware(void) {
5252
usb_phy->TX = phytx;
5353
}
5454

55+
void USB_OTG1_IRQHandler(void);
5556
void USB_OTG1_IRQHandler(void) {
5657
usb_irq_handler();
5758
}

0 commit comments

Comments
 (0)