From ccf8d648638af01e353f7ca94a61adf589263ccf Mon Sep 17 00:00:00 2001 From: Rahix <rahix@rahix.de> Date: Mon, 24 Jun 2019 23:23:01 +0200 Subject: [PATCH] chore: Fix most compiler warnings (or disable them for vendor code) Signed-off-by: Rahix <rahix@rahix.de> --- bootloader/main.c | 4 ++++ epicardium/api/genapi.py | 2 +- hw-tests/bmetest/main.c | 12 ++++++------ hw-tests/dual-core/core1.c | 2 +- hw-tests/ecgtest/main.c | 5 +++-- hw-tests/hello-freertos/CLI-commands.c | 8 ++++---- hw-tests/hello-freertos/main.c | 2 +- hw-tests/hello-world/main.c | 4 ++-- hw-tests/imutest/main.c | 6 +++--- lib/card10/card10.c | 2 +- lib/gfx/display.c | 1 - lib/micropython/gen-version.sh | 2 +- lib/sdk/Libraries/MAX32665PeriphDriver/meson.build | 1 + lib/sdk/Libraries/MAXUSB/meson.build | 1 + lib/vendor/Bosch/BHy1/meson.build | 1 + lib/vendor/Maxim/MAX86150/meson.build | 1 + 16 files changed, 31 insertions(+), 23 deletions(-) diff --git a/bootloader/main.c b/bootloader/main.c index 0216e40e..102d4502 100644 --- a/bootloader/main.c +++ b/bootloader/main.c @@ -13,6 +13,7 @@ #include "led.h" #include "ff.h" #include "crc16-ccitt.h" +#include "pb.h" #define GPIO_PORT_IN PORT_1 @@ -161,6 +162,8 @@ static inline void boot(const void * vtable){ SCB->VTOR = (uintptr_t) vtable; // Reset stack pointer & branch to the new reset vector. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated" __asm( "mov r0, %0\n" "ldr sp, [r0]\n" "ldr r0, [r0, #4]\n" @@ -168,6 +171,7 @@ static inline void boot(const void * vtable){ : : "r"(vtable) : "%sp", "r0"); +#pragma GCC diagnostic pop }; diff --git a/epicardium/api/genapi.py b/epicardium/api/genapi.py index c83358b5..4c1f1f32 100644 --- a/epicardium/api/genapi.py +++ b/epicardium/api/genapi.py @@ -201,7 +201,7 @@ void __api_dispatch_call(uint32_t id, void*buffer) tmp = """\ default: /* TODO: Better error handling */ - printf("Error: API function %x is unknown!!\\n", id); + printf("Error: API function %lx is unknown!!\\n", id); break; }} }} diff --git a/hw-tests/bmetest/main.c b/hw-tests/bmetest/main.c index 93595ffd..0c440129 100644 --- a/hw-tests/bmetest/main.c +++ b/hw-tests/bmetest/main.c @@ -79,25 +79,25 @@ int main(void) struct bme680_field_data data; rslt = bme680_get_sensor_data(&data, &gas_sensor); - printf("T: %.2f degC, P: %.2f hPa, H %.2f %%rH ", data.temperature / 100.0l, + printf("T: %.2Lf degC, P: %.2Lf hPa, H %.2Lf %%rH ", data.temperature / 100.0l, data.pressure / 100.0l, data.humidity / 1000.0l ); char buf[128]; - sprintf(buf, "T: %.2f degC", data.temperature / 100.0l); + sprintf(buf, "T: %.2Lf degC", data.temperature / 100.0l); Paint_DrawString_EN(0, 0, buf, &Font16, 0x0000, 0xffff); - sprintf(buf, "P: %.2f hPa", data.pressure / 100.0l); + sprintf(buf, "P: %.2Lf hPa", data.pressure / 100.0l); Paint_DrawString_EN(0, 16, buf, &Font16, 0x0000, 0xffff); - sprintf(buf, "H: %.2f %%rH", data.humidity / 1000.0l); + sprintf(buf, "H: %.2Lf %%rH", data.humidity / 1000.0l); Paint_DrawString_EN(0, 32, buf, &Font16, 0x0000, 0xffff); //printf("%.2f,%.2f,%.2f\n", data.temperature / 100.0f, // data.pressure / 100.0f, data.humidity / 1000.0f ); /* Avoid using measurements from an unstable heating setup */ if(data.status & BME680_GASM_VALID_MSK) { - printf(", G: %d ohms", data.gas_resistance); - sprintf(buf, "G: %d ohms", data.gas_resistance); + printf(", G: %ld ohms", data.gas_resistance); + sprintf(buf, "G: %ld ohms", data.gas_resistance); Paint_DrawString_EN(0, 48, buf, &Font16, 0x0000, 0xffff); } diff --git a/hw-tests/dual-core/core1.c b/hw-tests/dual-core/core1.c index 989c611a..05bc29bf 100644 --- a/hw-tests/dual-core/core1.c +++ b/hw-tests/dual-core/core1.c @@ -2,7 +2,7 @@ #include "gpio.h" #include "mxc_delay.h" -static const gpio_cfg_t motor_pin = {PORT_0, PIN_8, GPIO_FUNC_OUT, GPIO_PAD_NONE}; +static const __attribute__((unused)) gpio_cfg_t motor_pin = {PORT_0, PIN_8, GPIO_FUNC_OUT, GPIO_PAD_NONE}; int main(void) { diff --git a/hw-tests/ecgtest/main.c b/hw-tests/ecgtest/main.c index 282a0685..70337ebd 100644 --- a/hw-tests/ecgtest/main.c +++ b/hw-tests/ecgtest/main.c @@ -14,6 +14,7 @@ #include "i2c.h" #include "rtc.h" #include "spi.h" +#include "pb.h" #include "MAX30003.h" #include "GUI_DEV/GUI_Paint.h" #include "pmic.h" @@ -53,7 +54,7 @@ static uint32_t ecg_read_reg(uint8_t reg) static void ecg_write_reg(uint8_t reg, uint32_t data) { - printf("write %02x %06x\n", reg, data); + printf("write %02x %06lx\n", reg, data); spi_req_t req; uint8_t tx_data[] = {(reg << 1) | 0 , data >> 16, (data >> 8 ) & 0xFF, data & 0xFF}; uint8_t rx_data[] = {0, 0, 0, 0}; @@ -407,7 +408,7 @@ int main(void) for(int i=0; i<0x20; i++) { uint32_t val = ecg_read_reg(i); - printf("%02x: 0x%06x\n", i, val); + printf("%02x: 0x%06lx\n", i, val); } ecg_write_reg(SYNCH, 0); diff --git a/hw-tests/hello-freertos/CLI-commands.c b/hw-tests/hello-freertos/CLI-commands.c index 63a84a94..3abb3ca0 100644 --- a/hw-tests/hello-freertos/CLI-commands.c +++ b/hw-tests/hello-freertos/CLI-commands.c @@ -200,11 +200,11 @@ static BaseType_t prvUptimeCommand(char *pcWriteBuffer, size_t xWriteBufferLen, #if configUSE_TICKLESS_IDLE pcWriteBuffer += snprintf(pcWriteBuffer, xWriteBufferLen, - "Uptime is 0x%08x (%u ms)\r\nMXC_RTCTMR->timer is %u\r\n", + "Uptime is 0x%08lx (%lu ms)\r\nMXC_RTCTMR->timer is %lu\r\n", ticks, ticks / portTICK_PERIOD_MS, MXC_RTC->sec); #else pcWriteBuffer += snprintf(pcWriteBuffer, xWriteBufferLen, - "Uptime is 0x%08x (%u ms)\r\n", + "Uptime is 0x%08lx (%lu ms)\r\n", ticks, ticks / portTICK_PERIOD_MS); #endif @@ -257,7 +257,7 @@ static BaseType_t lParameterNumber = 0; memset( pcWriteBuffer, 0x00, xWriteBufferLen ); sprintf( pcWriteBuffer, "%d: ", (int)lParameterNumber ); strncat( pcWriteBuffer, pcParameter, lParameterStringLength ); - strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) ); + strcat( pcWriteBuffer, "\r\n"); /* If this is the last of the three parameters then there are no more strings to return after this one. */ @@ -323,7 +323,7 @@ static BaseType_t lParameterNumber = 0; memset( pcWriteBuffer, 0x00, xWriteBufferLen ); sprintf( pcWriteBuffer, "%d: ", (int)lParameterNumber ); strncat( pcWriteBuffer, pcParameter, lParameterStringLength ); - strncat( pcWriteBuffer, "\r\n", strlen( "\r\n" ) ); + strcat( pcWriteBuffer, "\r\n"); /* There might be more parameters to return after this one. */ xReturn = pdTRUE; diff --git a/hw-tests/hello-freertos/main.c b/hw-tests/hello-freertos/main.c index 3600e2fe..c0f74a29 100644 --- a/hw-tests/hello-freertos/main.c +++ b/hw-tests/hello-freertos/main.c @@ -186,7 +186,7 @@ void vTickTockTask(void *pvParameters) while (1) { ticks = xTaskGetTickCount(); - printf("Uptime is 0x%08x (%u seconds), tickless-idle is %s\n", + printf("Uptime is 0x%08lx (%lu seconds), tickless-idle is %s\n", ticks, ticks / configTICK_RATE_HZ, disable_tickless ? "disabled" : "ENABLED"); vTaskDelayUntil(&xLastWakeTime, (configTICK_RATE_HZ * 60)); diff --git a/hw-tests/hello-world/main.c b/hw-tests/hello-world/main.c index dc7d6c87..6581b97c 100644 --- a/hw-tests/hello-world/main.c +++ b/hw-tests/hello-world/main.c @@ -19,7 +19,7 @@ /***** Definitions *****/ /***** Globals *****/ -static const gpio_cfg_t motor_pin = {PORT_0, PIN_8, GPIO_FUNC_OUT, GPIO_PAD_NONE}; +static __attribute__((unused)) const gpio_cfg_t motor_pin = {PORT_0, PIN_8, GPIO_FUNC_OUT, GPIO_PAD_NONE}; int main(void) { @@ -35,7 +35,7 @@ int main(void) leds_set_dim(i, 1); } - int h = 0; + int __attribute__((unused)) h = 0; while (1) { #if 0 diff --git a/hw-tests/imutest/main.c b/hw-tests/imutest/main.c index 8aafc254..8b5f1ec4 100644 --- a/hw-tests/imutest/main.c +++ b/hw-tests/imutest/main.c @@ -101,7 +101,7 @@ static void sensors_callback_orientation(bhy_data_generic_t * sensor_data, bhy_v } -static void sensors_callback_vector(bhy_data_generic_t * sensor_data, bhy_virtual_sensor_t sensor_id) +static __attribute__((unused)) void sensors_callback_vector(bhy_data_generic_t * sensor_data, bhy_virtual_sensor_t sensor_id) { printf("x=%05d, y=%05d, z=%05d status=%d\n", sensor_data->data_vector.x, @@ -111,7 +111,7 @@ static void sensors_callback_vector(bhy_data_generic_t * sensor_data, bhy_virtua ); } -static void sensors_callback_vector_uncalib(bhy_data_generic_t * sensor_data, bhy_virtual_sensor_t sensor_id) +static __attribute__((unused)) void sensors_callback_vector_uncalib(bhy_data_generic_t * sensor_data, bhy_virtual_sensor_t sensor_id) { printf("x=%05d, y=%05d, z=%05d status=%d\n", sensor_data->data_uncalib_vector.x, @@ -128,7 +128,7 @@ static void sensors_callback_vector_uncalib(bhy_data_generic_t * sensor_data, bh * @param[in] sensor_data * @param[in] sensor_id */ -static void sensors_callback_rotation_vector(bhy_data_generic_t * sensor_data, bhy_virtual_sensor_t sensor_id) +static __attribute__((unused)) void sensors_callback_rotation_vector(bhy_data_generic_t * sensor_data, bhy_virtual_sensor_t sensor_id) { #if 0 float temp; diff --git a/lib/card10/card10.c b/lib/card10/card10.c index cf377e39..a2037ff9 100644 --- a/lib/card10/card10.c +++ b/lib/card10/card10.c @@ -170,7 +170,7 @@ void card10_diag(void) } #else uint32_t val = ecg_read_reg(0xf); - printf("ECG: %02x: 0x%06x (should be 0x5139a0)\n", 0xf, val); + printf("ECG: %02x: 0x%06lx (should be 0x5139a0)\n", 0xf, val); #endif } diff --git a/lib/gfx/display.c b/lib/gfx/display.c index e68e2391..1caa81c3 100644 --- a/lib/gfx/display.c +++ b/lib/gfx/display.c @@ -7,7 +7,6 @@ #include <stdint.h> #include <stdio.h> /***** Globals *****/ -static const gpio_cfg_t motor_pin = {PORT_0, PIN_8, GPIO_FUNC_OUT, GPIO_PAD_NONE}; //const gpio_cfg_t DEV_RST_PIN = {PORT_0, PIN_28, GPIO_FUNC_OUT, GPIO_PAD_NONE}; const gpio_cfg_t DEV_DC_PIN = {PORT_1, PIN_6, GPIO_FUNC_OUT, GPIO_PAD_NONE}; diff --git a/lib/micropython/gen-version.sh b/lib/micropython/gen-version.sh index fd56bd99..1afe401e 100755 --- a/lib/micropython/gen-version.sh +++ b/lib/micropython/gen-version.sh @@ -10,4 +10,4 @@ mkdir -p "$OUTDIR/genhdr" ln -sfr "$OUT" "$OUTDIR/genhdr/$(basename "$OUT")" cd "$2/micropython" -"$1" "$2/micropython/py/makeversionhdr.py" "$OUT" +"$1" "$2/micropython/py/makeversionhdr.py" "$OUT" >/dev/null diff --git a/lib/sdk/Libraries/MAX32665PeriphDriver/meson.build b/lib/sdk/Libraries/MAX32665PeriphDriver/meson.build index e6ed059f..6dd4f728 100644 --- a/lib/sdk/Libraries/MAX32665PeriphDriver/meson.build +++ b/lib/sdk/Libraries/MAX32665PeriphDriver/meson.build @@ -52,6 +52,7 @@ lib = static_library( 'PeriphDriver', sources, include_directories: includes, + c_args: '-w', ) periphdriver = declare_dependency( diff --git a/lib/sdk/Libraries/MAXUSB/meson.build b/lib/sdk/Libraries/MAXUSB/meson.build index 6df655d6..01f09092 100644 --- a/lib/sdk/Libraries/MAXUSB/meson.build +++ b/lib/sdk/Libraries/MAXUSB/meson.build @@ -24,6 +24,7 @@ lib = static_library( sources, include_directories: includes, dependencies: periphdriver, + c_args: '-w', ) maxusb = declare_dependency( diff --git a/lib/vendor/Bosch/BHy1/meson.build b/lib/vendor/Bosch/BHy1/meson.build index a63540cc..3c30388c 100644 --- a/lib/vendor/Bosch/BHy1/meson.build +++ b/lib/vendor/Bosch/BHy1/meson.build @@ -16,6 +16,7 @@ lib = static_library( sources, include_directories: includes, dependencies: periphdriver, + c_args: '-w', ) bhy1 = declare_dependency( diff --git a/lib/vendor/Maxim/MAX86150/meson.build b/lib/vendor/Maxim/MAX86150/meson.build index 8254e300..0943fd8a 100644 --- a/lib/vendor/Maxim/MAX86150/meson.build +++ b/lib/vendor/Maxim/MAX86150/meson.build @@ -6,6 +6,7 @@ lib = static_library( 'max86150', 'max86150.c', dependencies: periphdriver, + c_args: '-w', ) max86150 = declare_dependency( -- GitLab