From 420493669d72f9b8b00919c22f1504798f9b5b0a Mon Sep 17 00:00:00 2001 From: Sergey Chupligin Date: Fri, 20 Jan 2023 14:31:28 +0300 Subject: [PATCH] Fixup build on modern GCC Closes #26, this is the rebased and newer version. Co-authored-by: Dom Rodriguez --- apps/audioplayers/a2dp_decoder/a2dp_decoder.cpp | 2 ++ apps/audioplayers/a2dp_decoder/a2dp_decoder.h | 5 +++++ apps/audioplayers/a2dp_decoder/a2dp_decoder_aac_lc.cpp | 2 ++ apps/audioplayers/a2dp_decoder/a2dp_decoder_sbc.cpp | 2 ++ apps/audioplayers/plc_utils.h | 5 +++++ apps/common/app_spec_ostimer.cpp | 3 +++ include/rtos/rtx/cmsis_os.h | 5 +++++ platform/cmsis/inc/arm_math.h | 6 +++++- platform/cmsis/inc/core_cm4.h | 7 +++++++ platform/cmsis/inc/mpu_armv7.h | 5 +++++ platform/hal/best2300p/hal_cmu_best2300p.h | 5 +++++ platform/hal/hal_aud.h | 5 +++++ platform/hal/hal_cmu.h | 5 +++++ platform/hal/hal_i2c.h | 5 +++++ platform/hal/hal_norflash.h | 5 +++++ platform/hal/hal_sleep.h | 5 +++++ platform/hal/hal_timer.h | 5 +++++ platform/hal/hal_trace.h | 5 +++++ platform/hal/hal_uart.h | 5 +++++ platform/hal/plat_types.h | 5 +++++ services/bt_app/app_bt.h | 5 +++++ services/bt_app/audio_prompt_sbc.h | 5 +++++ services/bt_if_enhanced/inc/bluetooth.h | 5 +++++ services/bt_if_enhanced/inc/me_api.h | 5 +++++ utils/boot_struct/reboot_param.h | 5 +++++ utils/heap/heap_api.h | 5 +++++ 26 files changed, 121 insertions(+), 1 deletion(-) diff --git a/apps/audioplayers/a2dp_decoder/a2dp_decoder.cpp b/apps/audioplayers/a2dp_decoder/a2dp_decoder.cpp index f1e246c6..1d5a5adf 100644 --- a/apps/audioplayers/a2dp_decoder/a2dp_decoder.cpp +++ b/apps/audioplayers/a2dp_decoder/a2dp_decoder.cpp @@ -14,6 +14,8 @@ * ****************************************************************************/ // Standard C Included Files +#define __STDC_LIMIT_MACROS +#include #include "a2dp_decoder.h" #include "a2dp_decoder_internal.h" #include "app_audio.h" diff --git a/apps/audioplayers/a2dp_decoder/a2dp_decoder.h b/apps/audioplayers/a2dp_decoder/a2dp_decoder.h index af8681b8..71b83eba 100644 --- a/apps/audioplayers/a2dp_decoder/a2dp_decoder.h +++ b/apps/audioplayers/a2dp_decoder/a2dp_decoder.h @@ -23,6 +23,11 @@ //#define A2DP_DECODER_HISTORY_LOCTIME_SAVE (1) //#define A2DP_DECODER_HISTORY_CHECK_SUM_SAVE (1) +#ifndef __uint32_t_defined +typedef unsigned int uint32_t; +#define __uint32_t_defined +#endif + typedef uint16_t A2DP_AUDIO_CODEC_TYPE; #define A2DP_AUDIO_CODEC_TYPE_SBC (1u<<0) diff --git a/apps/audioplayers/a2dp_decoder/a2dp_decoder_aac_lc.cpp b/apps/audioplayers/a2dp_decoder/a2dp_decoder_aac_lc.cpp index 9cde66a4..11f4f36c 100644 --- a/apps/audioplayers/a2dp_decoder/a2dp_decoder_aac_lc.cpp +++ b/apps/audioplayers/a2dp_decoder/a2dp_decoder_aac_lc.cpp @@ -14,6 +14,8 @@ * ****************************************************************************/ // Standard C Included Files +#define __STDC_LIMIT_MACROS +#include #include "a2dp_decoder_internal.h" #include "cmsis.h" #include "cmsis_os.h" diff --git a/apps/audioplayers/a2dp_decoder/a2dp_decoder_sbc.cpp b/apps/audioplayers/a2dp_decoder/a2dp_decoder_sbc.cpp index 713cb53b..ec0b42bc 100644 --- a/apps/audioplayers/a2dp_decoder/a2dp_decoder_sbc.cpp +++ b/apps/audioplayers/a2dp_decoder/a2dp_decoder_sbc.cpp @@ -14,6 +14,8 @@ * ****************************************************************************/ // Standard C Included Files +#define __STDC_LIMIT_MACROS +#include #include "a2dp_decoder_internal.h" #include "cmsis.h" #include "cmsis_os.h" diff --git a/apps/audioplayers/plc_utils.h b/apps/audioplayers/plc_utils.h index a219dc9f..6c753bb4 100644 --- a/apps/audioplayers/plc_utils.h +++ b/apps/audioplayers/plc_utils.h @@ -4,6 +4,11 @@ #include #include +#ifndef __uint32_t_defined +typedef unsigned int uint32_t; +#define __uint32_t_defined +#endif + typedef enum plc_type { PLC_TYPE_PASS = 0, diff --git a/apps/common/app_spec_ostimer.cpp b/apps/common/app_spec_ostimer.cpp index 8b391c55..0852f523 100644 --- a/apps/common/app_spec_ostimer.cpp +++ b/apps/common/app_spec_ostimer.cpp @@ -13,6 +13,9 @@ * trademark and other intellectual property rights. * ****************************************************************************/ +#define __STDC_LIMIT_MACROS +#include + #include "app_spec_ostimer.h" #include "cmsis_os.h" #include "hal_trace.h" diff --git a/include/rtos/rtx/cmsis_os.h b/include/rtos/rtx/cmsis_os.h index d8b3d96f..2b0b67db 100644 --- a/include/rtos/rtx/cmsis_os.h +++ b/include/rtos/rtx/cmsis_os.h @@ -149,6 +149,11 @@ extern "C" { #endif +#ifndef __uint32_t_defined +typedef unsigned int uint32_t; +#define __uint32_t_defined +#endif + #include "os_tcb.h" // ==== Enumeration, structures, defines ==== diff --git a/platform/cmsis/inc/arm_math.h b/platform/cmsis/inc/arm_math.h index 3288e37c..c3a5e2e0 100644 --- a/platform/cmsis/inc/arm_math.h +++ b/platform/cmsis/inc/arm_math.h @@ -263,10 +263,14 @@ * @defgroup groupExamples Examples */ - #ifndef _ARM_MATH_H #define _ARM_MATH_H +#ifndef __uint32_t_defined +typedef unsigned int uint32_t; +#define __uint32_t_defined +#endif + /* Compiler specific diagnostic adjustment */ #if defined ( __CC_ARM ) diff --git a/platform/cmsis/inc/core_cm4.h b/platform/cmsis/inc/core_cm4.h index a92b642e..1a8a70ec 100644 --- a/platform/cmsis/inc/core_cm4.h +++ b/platform/cmsis/inc/core_cm4.h @@ -33,12 +33,19 @@ #ifndef __ASSEMBLER__ #include + +#ifndef __uint32_t_defined +typedef unsigned int uint32_t; +#define __uint32_t_defined +#endif + #endif #ifdef __cplusplus extern "C" { #endif + /** \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions CMSIS violates the following MISRA-C:2004 rules: diff --git a/platform/cmsis/inc/mpu_armv7.h b/platform/cmsis/inc/mpu_armv7.h index f2b83e0c..f986f19b 100644 --- a/platform/cmsis/inc/mpu_armv7.h +++ b/platform/cmsis/inc/mpu_armv7.h @@ -22,6 +22,11 @@ * limitations under the License. */ +#ifndef __uint32_t_defined +typedef unsigned int uint32_t; +#define __uint32_t_defined +#endif + #if defined ( __ICCARM__ ) #pragma system_include /* treat file as system include file for MISRA check */ #elif defined (__clang__) diff --git a/platform/hal/best2300p/hal_cmu_best2300p.h b/platform/hal/best2300p/hal_cmu_best2300p.h index 864364e2..1c12955d 100644 --- a/platform/hal/best2300p/hal_cmu_best2300p.h +++ b/platform/hal/best2300p/hal_cmu_best2300p.h @@ -20,6 +20,11 @@ extern "C" { #endif +#ifndef __uint32_t_defined +typedef unsigned int uint32_t; +#define __uint32_t_defined +#endif + #define HAL_CMU_VALID_CRYSTAL_FREQ { 26000000, 24000000, 40000000, 48000000, } enum HAL_CMU_MOD_ID_T { diff --git a/platform/hal/hal_aud.h b/platform/hal/hal_aud.h index 508170ef..db968427 100644 --- a/platform/hal/hal_aud.h +++ b/platform/hal/hal_aud.h @@ -22,6 +22,11 @@ extern "C" { #include +#ifndef __uint32_t_defined +typedef unsigned int uint32_t; +#define __uint32_t_defined +#endif + #define CODEC_FREQ_24M 24000000 #define CODEC_FREQ_26M 26000000 #define CODEC_FREQ_24P576M 24576000 diff --git a/platform/hal/hal_cmu.h b/platform/hal/hal_cmu.h index 39ed1592..70e1107c 100644 --- a/platform/hal/hal_cmu.h +++ b/platform/hal/hal_cmu.h @@ -24,6 +24,11 @@ extern "C" { #include "stdint.h" #include CHIP_SPECIFIC_HDR(hal_cmu) +#ifndef __uint32_t_defined +typedef unsigned int uint32_t; +#define __uint32_t_defined +#endif + #ifndef HAL_CMU_DEFAULT_CRYSTAL_FREQ #define HAL_CMU_DEFAULT_CRYSTAL_FREQ 26000000 #endif diff --git a/platform/hal/hal_i2c.h b/platform/hal/hal_i2c.h index 7dc45837..1b46efad 100644 --- a/platform/hal/hal_i2c.h +++ b/platform/hal/hal_i2c.h @@ -27,6 +27,11 @@ extern "C" { // For 10-bit address devices: OR the following mask with the real address #define HAL_I2C_10BITADDR_MASK (1 << 15) +#ifndef __uint32_t_defined +typedef unsigned int uint32_t; +#define __uint32_t_defined +#endif + enum HAL_I2C_ACTION_AFTER_WRITE_T { HAL_I2C_STOP_AFTER_WRITE = 0, HAL_I2C_RESTART_AFTER_WRITE, diff --git a/platform/hal/hal_norflash.h b/platform/hal/hal_norflash.h index 41ce65ef..21f72041 100644 --- a/platform/hal/hal_norflash.h +++ b/platform/hal/hal_norflash.h @@ -20,6 +20,11 @@ extern "C" { #endif +#ifndef __uint32_t_defined +typedef unsigned int int32_t; +#define __uint32_t_defined +#endif + #include "plat_types.h" #include "hal_cmu.h" diff --git a/platform/hal/hal_sleep.h b/platform/hal/hal_sleep.h index b81f5447..63eb5832 100644 --- a/platform/hal/hal_sleep.h +++ b/platform/hal/hal_sleep.h @@ -20,6 +20,11 @@ extern "C" { #endif +#ifndef __uint32_t_defined +typedef unsigned int uint32_t; +#define __uint32_t_defined +#endif + #include "plat_types.h" enum HAL_CPU_WAKE_LOCK_USER_T { diff --git a/platform/hal/hal_timer.h b/platform/hal/hal_timer.h index e2ae66a3..8ad1e171 100644 --- a/platform/hal/hal_timer.h +++ b/platform/hal/hal_timer.h @@ -20,6 +20,11 @@ extern "C" { #endif +#ifndef __uint32_t_defined +typedef unsigned int uint32_t; +#define __uint32_t_defined +#endif + #include "hal_cmu.h" #include "plat_types.h" diff --git a/platform/hal/hal_trace.h b/platform/hal/hal_trace.h index 9e5626a9..0fd88db3 100644 --- a/platform/hal/hal_trace.h +++ b/platform/hal/hal_trace.h @@ -20,6 +20,11 @@ extern "C" { #endif +#ifndef __uint32_t_defined +typedef unsigned int uint32_t; +#define __uint32_t_defined +#endif + #include "hal_trace_mod.h" #include "plat_types.h" diff --git a/platform/hal/hal_uart.h b/platform/hal/hal_uart.h index 0375f8eb..cb903523 100644 --- a/platform/hal/hal_uart.h +++ b/platform/hal/hal_uart.h @@ -22,6 +22,11 @@ extern "C" { #ifdef CHIP_HAS_UART +#ifndef __uint32_t_defined +typedef unsigned int uint32_t; +#define __uint32_t_defined +#endif + #include "plat_types.h" #include "stdbool.h" #include "stdint.h" diff --git a/platform/hal/plat_types.h b/platform/hal/plat_types.h index 9c93a91b..5eedf413 100644 --- a/platform/hal/plat_types.h +++ b/platform/hal/plat_types.h @@ -24,6 +24,11 @@ extern "C" { #include "stdint.h" #include "stdbool.h" +#ifndef __uint32_t_defined +typedef unsigned int uint32_t; +#define __uint32_t_defined +#endif + typedef unsigned char u8; typedef unsigned short u16; typedef unsigned long u32; diff --git a/services/bt_app/app_bt.h b/services/bt_app/app_bt.h index afbbdac9..30731b7a 100644 --- a/services/bt_app/app_bt.h +++ b/services/bt_app/app_bt.h @@ -23,6 +23,11 @@ extern "C" { #include "a2dp_api.h" #include "hfp_api.h" +#ifndef __uint32_t_defined +typedef unsigned int uint32_t; +#define __uint32_t_defined +#endif + enum APP_BT_REQ_T { APP_BT_REQ_ACCESS_MODE_SET, APP_BT_REQ_AUTO_TEST, diff --git a/services/bt_app/audio_prompt_sbc.h b/services/bt_app/audio_prompt_sbc.h index 65e18448..a6922c03 100644 --- a/services/bt_app/audio_prompt_sbc.h +++ b/services/bt_app/audio_prompt_sbc.h @@ -15,6 +15,11 @@ extern "C" { #define PENDING_TO_STOP_SCO_STREAMING 1 #define PENDING_TO_STOP_STREAM_INVALID (0xFF) +#ifndef __uint32_t_defined +typedef unsigned int uint32_t; +#define __uint32_t_defined +#endif + typedef struct { uint8_t channelCnt; diff --git a/services/bt_if_enhanced/inc/bluetooth.h b/services/bt_if_enhanced/inc/bluetooth.h index ef873033..f99c322b 100644 --- a/services/bt_if_enhanced/inc/bluetooth.h +++ b/services/bt_if_enhanced/inc/bluetooth.h @@ -23,6 +23,11 @@ extern "C" { #endif +#ifndef __uint32_t_defined +typedef unsigned int uint32_t; +#define __uint32_t_defined +#endif + #ifndef BOOL_DEFINED typedef unsigned int BOOL; /* IGNORESTYLE */ #endif diff --git a/services/bt_if_enhanced/inc/me_api.h b/services/bt_if_enhanced/inc/me_api.h index b8db4709..bd4ac530 100644 --- a/services/bt_if_enhanced/inc/me_api.h +++ b/services/bt_if_enhanced/inc/me_api.h @@ -23,6 +23,11 @@ typedef uint8_t btif_event_type_t; +#ifndef __uint32_t_defined +typedef unsigned int uint32_t; +#define __uint32_t_defined +#endif + #if defined(BTIF_HCI_HOST_FLOW_CONTROL) && defined(__IAG_BLE_INCLUDE__) #define BTIF_BTEVENT_CONNECT_CPMPLETE 1 #endif /* */ diff --git a/utils/boot_struct/reboot_param.h b/utils/boot_struct/reboot_param.h index 0f517055..6d647584 100644 --- a/utils/boot_struct/reboot_param.h +++ b/utils/boot_struct/reboot_param.h @@ -22,6 +22,11 @@ extern "C" { #include "stdint.h" +#ifndef __uint32_t_defined +typedef unsigned int uint32_t; +#define __uint32_t_defined +#endif + struct REBOOT_PARAM_T { uint32_t reserved[4]; }; diff --git a/utils/heap/heap_api.h b/utils/heap/heap_api.h index b5bdd9b6..8e1e6ba7 100644 --- a/utils/heap/heap_api.h +++ b/utils/heap/heap_api.h @@ -8,6 +8,11 @@ extern "C" { #endif +#ifndef __uint32_t_defined +typedef unsigned int uint32_t; +#define __uint32_t_defined +#endif + #define SYSPOOL_PURE __attribute__((__const__)) void syspool_init(void);