diff --git a/docs/build_system.rst b/docs/build_system.rst index a7f6fe1..492195f 100644 --- a/docs/build_system.rst +++ b/docs/build_system.rst @@ -17,7 +17,7 @@ To start using it, create a source file... #include - int main() { + int main(void) { IOA = OEA = 1; while(1); } diff --git a/docs/fx2ints_h.rst b/docs/fx2ints_h.rst index fc2e510..3163b9f 100644 --- a/docs/fx2ints_h.rst +++ b/docs/fx2ints_h.rst @@ -15,7 +15,7 @@ To define a core interrupt handler, override the corresponding ``isr_`` function .. code-block:: c - void isr_TF0() __interrupt(_INT_TF0) { + void isr_TF0(void) __interrupt(_INT_TF0) { // TIMER0 has overflowed } @@ -23,7 +23,7 @@ Interrupts with flags in the ``EXIF`` register need to be reset manually: .. code-block:: c - void isr_I2C() __interrupt(_INT_I2C) { + void isr_I2C(void) __interrupt(_INT_I2C) { // I2C is done or errored CLEAR_I2C_IRQ(); } @@ -35,7 +35,7 @@ To define an autovectored interrupt handler, override the corresponding ``isr_`` .. code-block:: c - void isr_SOF() __interrupt { + void isr_SOF(void) __interrupt { // Start of Frame packet has been received CLEAR_USB_IRQ(); USBIRQ = _SOF; diff --git a/examples/blinky/main.c b/examples/blinky/main.c index bee79f4..0b040b4 100644 --- a/examples/blinky/main.c +++ b/examples/blinky/main.c @@ -2,13 +2,13 @@ #include // Register an interrupt handler for TIMER0 overflow -void isr_TF0() __interrupt(_INT_TF0) { +void isr_TF0(void) __interrupt(_INT_TF0) { static int i; if(i++ % 64 == 0) PA0 = !PA0; } -int main() { +int main(void) { // Configure pins PA0 = 1; // set PA0 to high OEA = 0b1; // set PA0 as output diff --git a/examples/boot-dfu-spiflash/main.c b/examples/boot-dfu-spiflash/main.c index 14e183e..b0c2ecd 100644 --- a/examples/boot-dfu-spiflash/main.c +++ b/examples/boot-dfu-spiflash/main.c @@ -15,10 +15,10 @@ // The following routines should handle the multi-master nature of SPI flash usage in // an application. E.g. if an FPGA is the primary user of the SPI flash, flash_bus_init() should // also assert FPGA reset, and flash_bus_deinit() would deassert it. -void flash_bus_init() { +void flash_bus_init(void) { OEA |= 0b0111; } -void flash_bus_deinit() { +void flash_bus_deinit(void) { OEA &= ~0b0111; } @@ -292,7 +292,7 @@ void handle_usb_setup(__xdata struct usb_req_setup *req) { STALL_EP0(); } -int main() { +int main(void) { CPUCS = _CLKSPD1; flash_bus_deinit(); diff --git a/examples/boot-uf2-dfu/main.c b/examples/boot-uf2-dfu/main.c index cb8f295..d0c0dfb 100644 --- a/examples/boot-uf2-dfu/main.c +++ b/examples/boot-uf2-dfu/main.c @@ -259,14 +259,14 @@ void handle_usb_setup(__xdata struct usb_req_setup *req) { volatile bool pending_ep6_in; -void isr_IBN() __interrupt { +void isr_IBN(void) __interrupt { pending_ep6_in = true; CLEAR_USB_IRQ(); NAKIRQ = _IBN; IBNIRQ = _IBNI_EP6; } -int main() { +int main(void) { CPUCS = _CLKSPD1; REVCTL = _ENH_PKT|_DYN_OUT; diff --git a/examples/cdc-acm/main.c b/examples/cdc-acm/main.c index 19d5527..cd18149 100644 --- a/examples/cdc-acm/main.c +++ b/examples/cdc-acm/main.c @@ -208,14 +208,14 @@ void handle_usb_setup(__xdata struct usb_req_setup *req) { volatile bool pending_ep6_in; -void isr_IBN() __interrupt { +void isr_IBN(void) __interrupt { pending_ep6_in = true; CLEAR_USB_IRQ(); NAKIRQ = _IBN; IBNIRQ = _IBNI_EP6; } -int main() { +int main(void) { // Run core at 48 MHz fCLK. CPUCS = _CLKSPD1; diff --git a/examples/printf/main.c b/examples/printf/main.c index 2e48c5e..64ba60b 100644 --- a/examples/printf/main.c +++ b/examples/printf/main.c @@ -4,7 +4,7 @@ DEFINE_DEBUG_PUTCHAR_FN(PA0, 57600) -int main() { +int main(void) { // Any of these will work at 57600 baud: CPUCS = 0; // CPUCS = _CLKSPD0; diff --git a/firmware/boot-cypress/main.c b/firmware/boot-cypress/main.c index 51a9850..b8f9d31 100644 --- a/firmware/boot-cypress/main.c +++ b/firmware/boot-cypress/main.c @@ -102,7 +102,7 @@ void handle_usb_setup(__xdata struct usb_req_setup *req) { // requests A2/A9 work the same as in Cypress libraries by default. uint8_t page_size = 0; // log2(page size in bytes) -void handle_pending_usb_setup() { +void handle_pending_usb_setup(void) { __xdata struct usb_req_setup *req = (__xdata struct usb_req_setup *)SETUPDAT; if(req->bmRequestType == (USB_RECIP_DEVICE|USB_TYPE_VENDOR|USB_DIR_OUT) && @@ -194,7 +194,7 @@ void handle_pending_usb_setup() { STALL_EP0(); } -int main() { +int main(void) { CPUCS = _CLKOE|_CLKSPD1; // Don't re-enumerate. `fx2tool -B` will load this firmware to access EEPROM, and it diff --git a/firmware/boot-dfu/main.c b/firmware/boot-dfu/main.c index 061e630..ce9eeeb 100644 --- a/firmware/boot-dfu/main.c +++ b/firmware/boot-dfu/main.c @@ -169,7 +169,7 @@ usb_dfu_status_t firmware_dnload(uint32_t address, __xdata uint8_t *data, } } -usb_dfu_status_t firmware_manifest() __reentrant { +usb_dfu_status_t firmware_manifest(void) __reentrant { // Simulate committing the firmware. If this function is not necessary, it may simply be omitted, // together with its entry in `usb_dfu_iface_state`. delay_ms(1000); @@ -193,7 +193,7 @@ void handle_usb_setup(__xdata struct usb_req_setup *req) { STALL_EP0(); } -int main() { +int main(void) { // Run core at 48 MHz fCLK. CPUCS = _CLKSPD1; diff --git a/firmware/boot-uf2/main.c b/firmware/boot-uf2/main.c index cf15b36..367b7a7 100644 --- a/firmware/boot-uf2/main.c +++ b/firmware/boot-uf2/main.c @@ -154,14 +154,14 @@ void handle_usb_setup(__xdata struct usb_req_setup *req) { volatile bool pending_ep6_in; -void isr_IBN() __interrupt { +void isr_IBN(void) __interrupt { pending_ep6_in = true; CLEAR_USB_IRQ(); NAKIRQ = _IBN; IBNIRQ = _IBNI_EP6; } -int main() { +int main(void) { // Run core at 48 MHz fCLK. CPUCS = _CLKSPD1; diff --git a/firmware/library/defautoisr.c b/firmware/library/defautoisr.c index cc22543..f51f9cb 100644 --- a/firmware/library/defautoisr.c +++ b/firmware/library/defautoisr.c @@ -1,3 +1,3 @@ #include -void ISRNAME() __interrupt {} +void ISRNAME(void) __interrupt {} diff --git a/firmware/library/defisr.c b/firmware/library/defisr.c index f9b8bcb..9848808 100644 --- a/firmware/library/defisr.c +++ b/firmware/library/defisr.c @@ -1,3 +1,3 @@ #include -void ISRNAME() __interrupt(INTNAME) {} +void ISRNAME(void) __interrupt(INTNAME) {} diff --git a/firmware/library/defusbgetconfig.c b/firmware/library/defusbgetconfig.c index 60c3657..6c96ea3 100644 --- a/firmware/library/defusbgetconfig.c +++ b/firmware/library/defusbgetconfig.c @@ -1,6 +1,6 @@ #include -void handle_usb_get_configuration() { +void handle_usb_get_configuration(void) { EP0BUF[0] = usb_config_value; SETUP_EP0_BUF(1); } diff --git a/firmware/library/i2c.c b/firmware/library/i2c.c index 2e83956..55b5876 100644 --- a/firmware/library/i2c.c +++ b/firmware/library/i2c.c @@ -25,7 +25,7 @@ bool i2c_start(uint8_t chip) { return i2c_wait(/*need_ack=*/true); } -bool i2c_stop() { +bool i2c_stop(void) { if(I2CS & _BERR) return false; diff --git a/firmware/library/include/fx2i2c.h b/firmware/library/include/fx2i2c.h index 1a570bc..180702b 100644 --- a/firmware/library/include/fx2i2c.h +++ b/firmware/library/include/fx2i2c.h @@ -39,7 +39,7 @@ bool i2c_start(uint8_t chip); /** * This function generates a stop condition. */ -bool i2c_stop(); +bool i2c_stop(void); /** * This function writes `len` bytes from `buf` to the I2C bus. diff --git a/firmware/library/include/fx2ints.h b/firmware/library/include/fx2ints.h index 0db12b6..b7c53b0 100644 --- a/firmware/library/include/fx2ints.h +++ b/firmware/library/include/fx2ints.h @@ -40,19 +40,19 @@ enum fx2_core_interrupt { #define CLEAR_INT5_IRQ() \ do { EXIF &= ~_IE5; } while(0) -void isr_IE0() __interrupt(_INT_IE0); -void isr_TF0() __interrupt(_INT_TF0); -void isr_IE1() __interrupt(_INT_IE1); -void isr_TF1() __interrupt(_INT_TF1); -void isr_RI_TI_0() __interrupt(_INT_RI_TI_0); -void isr_TF2() __interrupt(_INT_TF2); -void isr_RESUME() __interrupt(_INT_RESUME); -void isr_RI_TI_1() __interrupt(_INT_RI_TI_1); -void isr_USB() __interrupt(_INT_USB); -void isr_I2C() __interrupt(_INT_I2C); -void isr_GPIF_IE4() __interrupt(_INT_GPIF_IE4); -void isr_IE5() __interrupt(_INT_IE5); -void isr_IE6() __interrupt(_INT_IE6); +void isr_IE0(void) __interrupt(_INT_IE0); +void isr_TF0(void) __interrupt(_INT_TF0); +void isr_IE1(void) __interrupt(_INT_IE1); +void isr_TF1(void) __interrupt(_INT_TF1); +void isr_RI_TI_0(void) __interrupt(_INT_RI_TI_0); +void isr_TF2(void) __interrupt(_INT_TF2); +void isr_RESUME(void) __interrupt(_INT_RESUME); +void isr_RI_TI_1(void) __interrupt(_INT_RI_TI_1); +void isr_USB(void) __interrupt(_INT_USB); +void isr_I2C(void) __interrupt(_INT_I2C); +void isr_GPIF_IE4(void) __interrupt(_INT_GPIF_IE4); +void isr_IE5(void) __interrupt(_INT_IE5); +void isr_IE6(void) __interrupt(_INT_IE6); /**@}*/ @@ -74,33 +74,33 @@ void isr_IE6() __interrupt(_INT_IE6); #define CLEAR_USB_IRQ() \ do { EXIF &= ~_USBINT; } while(0) -void isr_SUDAV() __interrupt; -void isr_SOF() __interrupt; -void isr_SUTOK() __interrupt; -void isr_SUSPEND() __interrupt; -void isr_USBRESET() __interrupt; -void isr_HISPEED() __interrupt; -void isr_EP0ACK() __interrupt; -void isr_EP0IN() __interrupt; -void isr_EP0OUT() __interrupt; -void isr_EP1IN() __interrupt; -void isr_EP1OUT() __interrupt; -void isr_EP2() __interrupt; -void isr_EP4() __interrupt; -void isr_EP6() __interrupt; -void isr_EP8() __interrupt; -void isr_IBN() __interrupt; -void isr_EP0PING() __interrupt; -void isr_EP1PING() __interrupt; -void isr_EP2PING() __interrupt; -void isr_EP4PING() __interrupt; -void isr_EP6PING() __interrupt; -void isr_EP8PING() __interrupt; -void isr_ERRLIMIT() __interrupt; -void isr_EP2ISOERR() __interrupt; -void isr_EP4ISOERR() __interrupt; -void isr_EP6ISOERR() __interrupt; -void isr_EP8ISOERR() __interrupt; +void isr_SUDAV(void) __interrupt; +void isr_SOF(void) __interrupt; +void isr_SUTOK(void) __interrupt; +void isr_SUSPEND(void) __interrupt; +void isr_USBRESET(void) __interrupt; +void isr_HISPEED(void) __interrupt; +void isr_EP0ACK(void) __interrupt; +void isr_EP0IN(void) __interrupt; +void isr_EP0OUT(void) __interrupt; +void isr_EP1IN(void) __interrupt; +void isr_EP1OUT(void) __interrupt; +void isr_EP2(void) __interrupt; +void isr_EP4(void) __interrupt; +void isr_EP6(void) __interrupt; +void isr_EP8(void) __interrupt; +void isr_IBN(void) __interrupt; +void isr_EP0PING(void) __interrupt; +void isr_EP1PING(void) __interrupt; +void isr_EP2PING(void) __interrupt; +void isr_EP4PING(void) __interrupt; +void isr_EP6PING(void) __interrupt; +void isr_EP8PING(void) __interrupt; +void isr_ERRLIMIT(void) __interrupt; +void isr_EP2ISOERR(void) __interrupt; +void isr_EP4ISOERR(void) __interrupt; +void isr_EP6ISOERR(void) __interrupt; +void isr_EP8ISOERR(void) __interrupt; /**@}*/ @@ -123,20 +123,20 @@ void isr_EP8ISOERR() __interrupt; #define CLEAR_GPIF_IRQ() \ do { EXIF &= ~_IE4; } while(0) -void isr_EP2PF() __interrupt; -void isr_EP4PF() __interrupt; -void isr_EP6PF() __interrupt; -void isr_EP8PF() __interrupt; -void isr_EP2EF() __interrupt; -void isr_EP4EF() __interrupt; -void isr_EP6EF() __interrupt; -void isr_EP8EF() __interrupt; -void isr_EP2FF() __interrupt; -void isr_EP4FF() __interrupt; -void isr_EP6FF() __interrupt; -void isr_EP8FF() __interrupt; -void isr_GPIFDONE() __interrupt; -void isr_GPIFWF() __interrupt; +void isr_EP2PF(void) __interrupt; +void isr_EP4PF(void) __interrupt; +void isr_EP6PF(void) __interrupt; +void isr_EP8PF(void) __interrupt; +void isr_EP2EF(void) __interrupt; +void isr_EP4EF(void) __interrupt; +void isr_EP6EF(void) __interrupt; +void isr_EP8EF(void) __interrupt; +void isr_EP2FF(void) __interrupt; +void isr_EP4FF(void) __interrupt; +void isr_EP6FF(void) __interrupt; +void isr_EP8FF(void) __interrupt; +void isr_GPIFDONE(void) __interrupt; +void isr_GPIFWF(void) __interrupt; /**@}*/ diff --git a/firmware/library/include/fx2spiflash.h b/firmware/library/include/fx2spiflash.h index 3fdff46..60429a1 100644 --- a/firmware/library/include/fx2spiflash.h +++ b/firmware/library/include/fx2spiflash.h @@ -9,14 +9,14 @@ __xdata uint8_t _##name##_spiflash_buf[4]; #define _DEFINE_SPIFLASH_INIT_FN(name, cs, sck, si, so) \ - void name##_init() { \ + void name##_init(void) { \ __asm setb _ASM_REG(cs) __endasm; \ __asm setb _ASM_REG(sck) __endasm; \ __asm setb _ASM_REG(si) __endasm; \ } #define _DEFINE_SPIFLASH_RDP_FN(name, cs) \ - void name##_rdp() { \ + void name##_rdp(void) { \ _##name##_spiflash_buf[0] = 0xAB; \ __asm clr _ASM_REG(cs) __endasm; \ _##name##_spi_wr(_##name##_spiflash_buf, 1); \ @@ -24,7 +24,7 @@ } #define _DEFINE_SPIFLASH_DP_FN(name, cs) \ - void name##_dp() { \ + void name##_dp(void) { \ _##name##_spiflash_buf[0] = 0xB9; \ __asm clr _ASM_REG(cs) __endasm; \ _##name##_spi_wr(_##name##_spiflash_buf, 1); \ @@ -44,7 +44,7 @@ } #define _DEFINE_SPIFLASH_WREN_FN(name, cs) \ - void name##_wren() { \ + void name##_wren(void) { \ _##name##_spiflash_buf[0] = 0x06; \ __asm clr _ASM_REG(cs) __endasm; \ _##name##_spi_wr(_##name##_spiflash_buf, 1); \ @@ -52,7 +52,7 @@ } #define _DEFINE_SPIFLASH_RDSR_FN(name, cs) \ - uint8_t name##_rdsr() { \ + uint8_t name##_rdsr(void) { \ _##name##_spiflash_buf[0] = 0x05; \ __asm clr _ASM_REG(cs) __endasm; \ _##name##_spi_wr(_##name##_spiflash_buf, 1); \ @@ -62,7 +62,7 @@ } #define _DEFINE_SPIFLASH_CE_FN(name, cs) \ - void name##_ce() { \ + void name##_ce(void) { \ _##name##_spiflash_buf[0] = 0x60; \ __asm clr _ASM_REG(cs) __endasm; \ _##name##_spi_wr(_##name##_spiflash_buf, 1); \ diff --git a/firmware/library/include/fx2usb.h b/firmware/library/include/fx2usb.h index 42434b2..77745f8 100644 --- a/firmware/library/include/fx2usb.h +++ b/firmware/library/include/fx2usb.h @@ -183,7 +183,7 @@ bool handle_usb_set_configuration(uint8_t config_value); * This callback has a default implementation that sets up an EP0 IN transfer * with value `usb_config_value`. */ -void handle_usb_get_configuration(); +void handle_usb_get_configuration(void); /** * Callback for the standard Set Interface request. diff --git a/firmware/library/include/fx2usbdfu.h b/firmware/library/include/fx2usbdfu.h index 2154497..2413df8 100644 --- a/firmware/library/include/fx2usbdfu.h +++ b/firmware/library/include/fx2usbdfu.h @@ -57,7 +57,7 @@ struct usb_dfu_iface_state { * If this callback is set to ``NULL``, the behavior is the same as if the callback was * implemented as an empty function returning ``USB_DFU_STATUS_OK``. */ - usb_dfu_status_t (*firmware_manifest)() __reentrant; + usb_dfu_status_t (*firmware_manifest)(void) __reentrant; /// State of the DFU interface, as per DFU specification. volatile enum usb_dfu_state state; diff --git a/firmware/library/usb.c b/firmware/library/usb.c index 8dd0251..0bb0994 100644 --- a/firmware/library/usb.c +++ b/firmware/library/usb.c @@ -57,7 +57,7 @@ __xdata volatile uint8_t *EPnCS_for_n(uint8_t n) { } } -void isr_SUDAV() __interrupt { +void isr_SUDAV(void) __interrupt { __xdata struct usb_req_setup *req = (__xdata struct usb_req_setup *)SETUPDAT; bool handled = false;