Fix werror flag and warnings (#321)

* fix Werror flag
* strdup implementation fix
* fix irda and lfrdid printf
* remove unused position
* doubtful type fix
* type fix in EXTI interrupt
* fix warnings in CubeWB, need to fork ST repo
* onewire fixes
* fork STM32WB Cube repo
This commit is contained in:
coreglitch 2021-02-01 10:51:22 +03:00 committed by GitHub
parent 49057be9c9
commit 41219cc78e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 15 additions and 16 deletions

2
.gitmodules vendored
View File

@ -3,7 +3,7 @@
url = https://github.com/P-p-H-d/mlib.git
[submodule "lib/STM32CubeWB"]
path = lib/STM32CubeWB
url = https://github.com/STMicroelectronics/STM32CubeWB.git
url = https://github.com/Flipper-Zero/STM32CubeWB.git
[submodule "applications/floopper-bloopper"]
path = applications/floopper-bloopper
url = https://github.com/glitchcore/floopper-bloopper.git

View File

@ -127,7 +127,7 @@ void render_packet(Canvas* canvas, State* state) {
char buf[24];
sprintf(
buf,
"P[%d]: %s 0x%X 0x%X",
"P[%d]: %s 0x%lX 0x%lX",
state->packet_id,
protocol,
state->packets[state->packet_id].address,

View File

@ -133,7 +133,7 @@ static void extract_data(uint8_t* buf, uint8_t* customer, uint32_t* em_data) {
uint32_t bit = buf[line * (ROW_SIZE + 1) + col];
data |= bit << (7 - offset);
printf("%d ", bit);
printf("%ld ", bit);
offset++;
}
@ -150,7 +150,7 @@ static void extract_data(uint8_t* buf, uint8_t* customer, uint32_t* em_data) {
uint32_t bit = buf[line * (ROW_SIZE + 1) + col];
data |= bit << (31 - offset);
printf("%d ", bit);
printf("%ld ", bit);
offset++;
}

View File

@ -318,7 +318,6 @@ uint64_t fs_file_tell(File* file) {
// Truncate file size to current pointer value
bool fs_file_truncate(File* file) {
FileData* filedata = NULL;
uint64_t position = 0;
file->internal_error_id = _get_file(fs_info, file, &filedata);
@ -478,7 +477,7 @@ fs_common_info(const char* path, FileInfo* fileinfo, char* name, const uint16_t
if(fresult == SD_OK) {
fresult = f_stat(path, &_fileinfo);
if(fresult == FR_OK) {
if((FRESULT)fresult == FR_OK) {
if(fileinfo != NULL) {
fileinfo->date.value = _fileinfo.fdate;
fileinfo->time.value = _fileinfo.ftime;
@ -592,7 +591,7 @@ FS_Error fs_get_fs_info(uint64_t* total_space, uint64_t* free_space) {
FATFS* fs;
fresult = f_getfree("0:/", &free_clusters, &fs);
if(fresult == FR_OK) {
if((FRESULT)fresult == FR_OK) {
uint32_t total_sectors = (fs->n_fatent - 2) * fs->csize;
uint32_t free_sectors = free_clusters * fs->csize;

View File

@ -43,7 +43,8 @@ void* calloc(size_t count, size_t size) {
}
char* strdup(const char* s) {
if(s == NULL) {
const char* s_null = s;
if(s_null == NULL) {
return NULL;
}

View File

@ -1,9 +1,6 @@
PROJECT_ROOT = $(abspath $(dir $(abspath $(firstword $(MAKEFILE_LIST))))..)
PROJECT = firmware
CFLAGS += -Werror
CPPFLAGS += -Werror
include $(PROJECT_ROOT)/make/base.mk
include $(PROJECT_ROOT)/assets/assets.mk
include $(PROJECT_ROOT)/core/core.mk
@ -11,6 +8,9 @@ include $(PROJECT_ROOT)/make/git.mk
include $(PROJECT_ROOT)/applications/applications.mk
include $(PROJECT_ROOT)/lib/lib.mk
CFLAGS += -Werror
CPPFLAGS += -Werror
TARGET ?= f4
TARGET_DIR = targets/$(TARGET)

View File

@ -32,5 +32,5 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef* htim) {
/* External interrupt event */
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
api_interrupt_call(InterruptTypeExternalInterrupt, GPIO_Pin);
api_interrupt_call(InterruptTypeExternalInterrupt, (void*)(uint32_t)GPIO_Pin);
}

@ -1 +1 @@
Subproject commit 17fe6be729cbb8c2a92cff3be3d16696c1d3fc8a
Subproject commit 1c15728a3c08e42919024e2a3781862f7d6c86d7

View File

@ -1,4 +1,3 @@
#pragma once
#include "one_wire_master.h"
#include "one_wire_timings.h"

View File

@ -218,7 +218,7 @@ void OneWireSlave::cmd_search_rom(void) {
if(!send_bit(bit)) return;
if(!send_bit(!bit)) return;
const bool bit_recv = receive_bit();
receive_bit();
if(error != OneWireSlaveError::NO_ERROR) return;
}
}
@ -263,7 +263,7 @@ bool OneWireSlave::bus_start(void) {
__disable_irq();
// TODO think about multiple command cycles
bool return_to_reset = receive_and_process_cmd();
receive_and_process_cmd();
result =
(error == OneWireSlaveError::NO_ERROR ||
error == OneWireSlaveError::INCORRECT_ONEWIRE_CMD);