Skip to content
Snippets Groups Projects
Commit 81fce4c5 authored by rahix's avatar rahix
Browse files

Merge branch 'rahix/clean-warnings' into 'master'

Clean warnings

See merge request card10/firmware!10
parents f49d850f ccf8d648
No related branches found
No related tags found
No related merge requests found
Showing
with 46 additions and 36 deletions
#!/bin/sh
set -e
echo "build multi image" $1 $2 $3 $4
PYTHON="$1"
BIN1="$2"
BIN2="$3"
BINOUT="$4"
dd if=/dev/zero ibs=1k count=448 | tr "\000" "\377" > "$BINOUT"
dd if="$BIN1" of="$BINOUT" conv=notrunc
dd if="$BIN2" of="$BINOUT" conv=notrunc oflag=append
dd if=/dev/zero ibs=1k count=448 2>/dev/null | tr "\000" "\377" > "$BINOUT"
dd if="$BIN1" of="$BINOUT" conv=notrunc 2>/dev/null
dd if="$BIN2" of="$BINOUT" conv=notrunc oflag=append 2>/dev/null
"$PYTHON" "$(dirname "$0")/crc_patch.py" "$BINOUT"
......@@ -2,16 +2,19 @@
import sys
import crc16
crc = 0
data = open(sys.argv[1], 'rb').read()
crc = crc16.crc16xmodem(data)
print(crc)
def main():
data = open(sys.argv[1], 'rb').read()
crc = crc16.crc16xmodem(data)
# print(crc)
padded = data + bytes([crc >> 8, crc & 0xFF])
padded = data + bytes([crc >> 8, crc & 0xFF])
crc = 0
crc = crc16.crc16xmodem(padded)
print(crc)
crc = crc16.crc16xmodem(padded)
# print(crc)
open(sys.argv[1], 'wb').write(padded)
open(sys.argv[1], 'wb').write(padded)
if __name__ == "__main__":
main()
......@@ -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
};
......
......@@ -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;
}}
}}
......
......@@ -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);
}
......
......@@ -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)
{
......
......@@ -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);
......
......@@ -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;
......
......@@ -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));
......
......@@ -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
......
......@@ -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;
......
......@@ -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
}
......
......@@ -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};
......
......@@ -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
......@@ -52,6 +52,7 @@ lib = static_library(
'PeriphDriver',
sources,
include_directories: includes,
c_args: '-w',
)
periphdriver = declare_dependency(
......
......@@ -24,6 +24,7 @@ lib = static_library(
sources,
include_directories: includes,
dependencies: periphdriver,
c_args: '-w',
)
maxusb = declare_dependency(
......
......@@ -16,6 +16,7 @@ lib = static_library(
sources,
include_directories: includes,
dependencies: periphdriver,
c_args: '-w',
)
bhy1 = declare_dependency(
......
......@@ -6,6 +6,7 @@ lib = static_library(
'max86150',
'max86150.c',
dependencies: periphdriver,
c_args: '-w',
)
max86150 = declare_dependency(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment