Added -Wundef to compiler options (#3815)

* fbt: added -Wundef to compiler options; libs: various small fixes for missing defines; desktop: proper access to current RTOS config
* apps: fixes for FURI_DEBUG handling
* rpc: unified definition checks
* Cleanup various defines use
* Cleanup configs and move SVCall ISR priority configuration to furi_hal_interrupts

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
hedger 2024-07-31 19:38:20 +03:00 committed by GitHub
parent afc4e299a1
commit 380ec2ac46
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 36 additions and 29 deletions

View file

@ -260,7 +260,7 @@ void cli_command_sysctl_heap_track(Cli* cli, FuriString* args, void* context) {
} else if(!furi_string_cmp(args, "main")) { } else if(!furi_string_cmp(args, "main")) {
furi_hal_rtc_set_heap_track_mode(FuriHalRtcHeapTrackModeMain); furi_hal_rtc_set_heap_track_mode(FuriHalRtcHeapTrackModeMain);
printf("Heap tracking enabled for application main thread"); printf("Heap tracking enabled for application main thread");
#if FURI_DEBUG #ifdef FURI_DEBUG
} else if(!furi_string_cmp(args, "tree")) { } else if(!furi_string_cmp(args, "tree")) {
furi_hal_rtc_set_heap_track_mode(FuriHalRtcHeapTrackModeTree); furi_hal_rtc_set_heap_track_mode(FuriHalRtcHeapTrackModeTree);
printf("Heap tracking enabled for application main and child threads"); printf("Heap tracking enabled for application main and child threads");
@ -279,7 +279,7 @@ void cli_command_sysctl_print_usage(void) {
printf("Cmd list:\r\n"); printf("Cmd list:\r\n");
printf("\tdebug <0|1>\t - Enable or disable system debug\r\n"); printf("\tdebug <0|1>\t - Enable or disable system debug\r\n");
#if FURI_DEBUG #ifdef FURI_DEBUG
printf("\theap_track <none|main|tree|all>\t - Set heap allocation tracking mode\r\n"); printf("\theap_track <none|main|tree|all>\t - Set heap allocation tracking mode\r\n");
#else #else
printf("\theap_track <none|main>\t - Set heap allocation tracking mode\r\n"); printf("\theap_track <none|main>\t - Set heap allocation tracking mode\r\n");

View file

@ -1,12 +1,11 @@
#include <projdefs.h>
#include <stdint.h>
#include <furi.h> #include <furi.h>
#include <gui/elements.h> #include <gui/elements.h>
#include <gui/icon.h> #include <gui/icon.h>
#include <gui/view.h> #include <gui/view.h>
#include <assets_icons.h> #include <assets_icons.h>
#include <desktop/desktop_settings.h>
#include "../desktop_i.h" #include "../desktop_i.h"
#include "desktop_view_locked.h" #include "desktop_view_locked.h"

View file

@ -1,9 +1,5 @@
#include <furi.h> #include <furi.h>
#include <stdint.h>
#include <stdio.h>
#include <projdefs.h>
#include <input/input.h>
#include <gui/canvas.h> #include <gui/canvas.h>
#include <gui/view.h> #include <gui/view.h>

View file

@ -228,7 +228,7 @@ bool rpc_pb_stream_read(pb_istream_t* istream, pb_byte_t* buf, size_t count) {
} }
} }
#if SRV_RPC_DEBUG #ifdef SRV_RPC_DEBUG
rpc_debug_print_data("INPUT", buf, bytes_received); rpc_debug_print_data("INPUT", buf, bytes_received);
#endif #endif
@ -268,7 +268,7 @@ static int32_t rpc_session_worker(void* context) {
bool message_decode_failed = false; bool message_decode_failed = false;
if(pb_decode_ex(&istream, &PB_Main_msg, session->decoded_message, PB_DECODE_DELIMITED)) { if(pb_decode_ex(&istream, &PB_Main_msg, session->decoded_message, PB_DECODE_DELIMITED)) {
#if SRV_RPC_DEBUG #ifdef SRV_RPC_DEBUG
FURI_LOG_I(TAG, "INPUT:"); FURI_LOG_I(TAG, "INPUT:");
rpc_debug_print_message(session->decoded_message); rpc_debug_print_message(session->decoded_message);
#endif #endif
@ -452,7 +452,7 @@ void rpc_send(RpcSession* session, PB_Main* message) {
pb_ostream_t ostream = PB_OSTREAM_SIZING; pb_ostream_t ostream = PB_OSTREAM_SIZING;
#if SRV_RPC_DEBUG #ifdef SRV_RPC_DEBUG
FURI_LOG_I(TAG, "OUTPUT:"); FURI_LOG_I(TAG, "OUTPUT:");
rpc_debug_print_message(message); rpc_debug_print_message(message);
#endif #endif
@ -465,7 +465,7 @@ void rpc_send(RpcSession* session, PB_Main* message) {
pb_encode_ex(&ostream, &PB_Main_msg, message, PB_ENCODE_DELIMITED); pb_encode_ex(&ostream, &PB_Main_msg, message, PB_ENCODE_DELIMITED);
#if SRV_RPC_DEBUG #ifdef SRV_RPC_DEBUG
rpc_debug_print_data("OUTPUT", buffer, ostream.bytes_written); rpc_debug_print_data("OUTPUT", buffer, ostream.bytes_written);
#endif #endif

View file

@ -92,7 +92,7 @@ static void debug_changed(VariableItem* item) {
const char* const heap_trace_mode_text[] = { const char* const heap_trace_mode_text[] = {
"None", "None",
"Main", "Main",
#if FURI_DEBUG #ifdef FURI_DEBUG
"Tree", "Tree",
"All", "All",
#endif #endif
@ -101,7 +101,7 @@ const char* const heap_trace_mode_text[] = {
const uint32_t heap_trace_mode_value[] = { const uint32_t heap_trace_mode_value[] = {
FuriHalRtcHeapTrackModeNone, FuriHalRtcHeapTrackModeNone,
FuriHalRtcHeapTrackModeMain, FuriHalRtcHeapTrackModeMain,
#if FURI_DEBUG #ifdef FURI_DEBUG
FuriHalRtcHeapTrackModeTree, FuriHalRtcHeapTrackModeTree,
FuriHalRtcHeapTrackModeAll, FuriHalRtcHeapTrackModeAll,
#endif #endif

View file

@ -15,13 +15,6 @@ void furi_run(void) {
furi_check(!furi_kernel_is_irq_or_masked()); furi_check(!furi_kernel_is_irq_or_masked());
furi_check(xTaskGetSchedulerState() == taskSCHEDULER_NOT_STARTED); furi_check(xTaskGetSchedulerState() == taskSCHEDULER_NOT_STARTED);
#if(__ARM_ARCH_7A__ == 0U)
/* Service Call interrupt might be configured before kernel start */
/* and when its priority is lower or equal to BASEPRI, svc instruction */
/* causes a Hard Fault. */
NVIC_SetPriority(SVCall_IRQn, 0U);
#endif
/* Start the kernel scheduler */ /* Start the kernel scheduler */
vTaskStartScheduler(); vTaskStartScheduler();
} }

View file

@ -2,8 +2,8 @@
#include <stdlib.h> #include <stdlib.h>
#include "core/check.h"
#include "core/common_defines.h" #include "core/common_defines.h"
#include "core/check.h"
#include "core/event_loop.h" #include "core/event_loop.h"
#include "core/event_loop_timer.h" #include "core/event_loop_timer.h"
#include "core/event_flag.h" #include "core/event_flag.h"

View file

@ -3,8 +3,8 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#if BITS_BIG_ENDIAN == 1 #if defined(BITS_BIG_ENDIAN) && BITS_BIG_ENDIAN == 1
#error Bit structures defined in this file is not portable to BE #error Bit structures defined in this file are not portable to BE
#endif #endif
#define BQ25896_ADDRESS 0xD6 #define BQ25896_ADDRESS 0xD6

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
#if BITS_BIG_ENDIAN == 1 #if defined(BITS_BIG_ENDIAN) && BITS_BIG_ENDIAN == 1
#error Bit structures defined in this file is not portable to BE #error Bit structures defined in this file are not portable to BE
#endif #endif
#define LP5562_ADDRESS 0x60 #define LP5562_ADDRESS 0x60

View file

@ -28,6 +28,7 @@ ENV.AppendUnique(
"-Wno-address-of-packed-member", "-Wno-address-of-packed-member",
"-Wredundant-decls", "-Wredundant-decls",
"-Wdouble-promotion", "-Wdouble-promotion",
"-Wundef",
"-fdata-sections", "-fdata-sections",
"-ffunction-sections", "-ffunction-sections",
"-fsingle-precision-constant", "-fsingle-precision-constant",

View file

@ -194,3 +194,7 @@
255 /**< Set to 255 with the memory manager and the mailbox */ 255 /**< Set to 255 with the memory manager and the mailbox */
#define TL_BLE_EVENT_FRAME_SIZE (TL_EVT_HDR_SIZE + CFG_TLBLE_MOST_EVENT_PAYLOAD_SIZE) #define TL_BLE_EVENT_FRAME_SIZE (TL_EVT_HDR_SIZE + CFG_TLBLE_MOST_EVENT_PAYLOAD_SIZE)
/* Various defines for compatibility with -Wundef - thanks, ST */
#define CFG_DEBUG_TRACE_FULL 0
#define CFG_DEBUG_TRACE_LIGHT 0

View file

@ -9,3 +9,15 @@
#define BLE_CFG_SVC_MAX_NBR_CB 0 #define BLE_CFG_SVC_MAX_NBR_CB 0
#define BLE_CFG_CLT_MAX_NBR_CB 0 #define BLE_CFG_CLT_MAX_NBR_CB 0
/* Various defines for compatibility with -Wundef - thanks, ST */
#define BLE_CFG_BLS_INTERMEDIATE_CUFF_PRESSURE 0
#define BLE_CFG_BLS_TIME_STAMP_FLAG 0
#define BLE_CFG_BLS_PULSE_RATE_FLAG 0
#define BLE_CFG_BLS_USER_ID_FLAG 0
#define BLE_CFG_BLS_MEASUREMENT_STATUS_FLAG 0
#define BLE_CFG_HRS_ENERGY_EXPENDED_INFO_FLAG 0
#define BLE_CFG_HRS_ENERGY_RR_INTERVAL_FLAG 0
#define BLE_CFG_HTS_MEASUREMENT_INTERVAL 0
#define BLE_CFG_HTS_TIME_STAMP_FLAG 0
#define BLE_CFG_HTS_TEMPERATURE_TYPE_VALUE_STATIC 0

View file

@ -120,6 +120,7 @@ void furi_hal_interrupt_init(void) {
TAMP_STAMP_LSECSS_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 0, 0)); TAMP_STAMP_LSECSS_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 0, 0));
NVIC_EnableIRQ(TAMP_STAMP_LSECSS_IRQn); NVIC_EnableIRQ(TAMP_STAMP_LSECSS_IRQn);
NVIC_SetPriority(SVCall_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 0, 0));
NVIC_SetPriority(PendSV_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 15, 0)); NVIC_SetPriority(PendSV_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 15, 0));
NVIC_SetPriority(FPU_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 15, 0)); NVIC_SetPriority(FPU_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 15, 0));

View file

@ -17,11 +17,13 @@
#define configUSE_PREEMPTION 1 #define configUSE_PREEMPTION 1
#define configSUPPORT_STATIC_ALLOCATION 1 #define configSUPPORT_STATIC_ALLOCATION 1
#define configSUPPORT_DYNAMIC_ALLOCATION 0 #define configSUPPORT_DYNAMIC_ALLOCATION 0
#define configUSE_MALLOC_FAILED_HOOK 0
#define configUSE_IDLE_HOOK 0 #define configUSE_IDLE_HOOK 0
#define configUSE_TICK_HOOK 0 #define configUSE_TICK_HOOK 0
#define configCPU_CLOCK_HZ (SystemCoreClock) #define configCPU_CLOCK_HZ (SystemCoreClock)
#define configTICK_RATE_HZ_RAW 1000 #define configTICK_RATE_HZ_RAW 1000
#define configTICK_RATE_HZ ((TickType_t)configTICK_RATE_HZ_RAW) #define configTICK_RATE_HZ ((TickType_t)configTICK_RATE_HZ_RAW)
#define configUSE_16_BIT_TICKS 0
#define configMAX_PRIORITIES (32) #define configMAX_PRIORITIES (32)
#define configMINIMAL_STACK_SIZE ((uint16_t)128) #define configMINIMAL_STACK_SIZE ((uint16_t)128)
@ -34,7 +36,6 @@
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
#define configUSE_TRACE_FACILITY 1 #define configUSE_TRACE_FACILITY 1
#define configUSE_16_BIT_TICKS 0
#define configUSE_MUTEXES 1 #define configUSE_MUTEXES 1
#define configQUEUE_REGISTRY_SIZE 0 #define configQUEUE_REGISTRY_SIZE 0
#define configCHECK_FOR_STACK_OVERFLOW 0 #define configCHECK_FOR_STACK_OVERFLOW 0