unleashed-firmware/targets/f7/ble_glue/compiler.h

139 lines
3.3 KiB
C
Raw Normal View History

New clock switch schema, fixes random core2 crashes (#3008) * Updated stack to 1.17.0 * hal: ble: Fixed stack config * Bumped stack version in config * scripts: added validation of copro stack version in update bundles * Copro: update to 1.17.2 * FuriHal: adjust tick frequency for HSE as sys clk * FuriHal: adjust systick reload on sys clock change * Sync api and format sources * scripts: updated ob.data for newer stack * FuriHal: return core2 hse pll transition on deep sleep * FuriHal: cleanup ble glue * FuriHal: rework ble glue, allow shci_send in critical section * FuriHal: sync api symbols * FuriHal: cleanup BLE glue, remove unused garbage and duplicate declarations * FuriHal: BLE glue cleanup, 2nd iteration * FuriHal: hide tick drift reports under FURI_HAL_OS_DEBUG * Lib: sync stm32wb_copro with latest dev * FuriHal: ble-glue, slightly less editable device name and duplicate definition cleanup * FuriHal: update ble config options, enable some optimizations and ext adv * FuriHal: update clock switch method documentation * FuriHal: better SNBRSA bug workaround fix * FuriHal: complete comment about tick skew * FuriHal: proper condition in clock hsi2hse transition * FuriHal: move PLL start to hse2pll routine, fix lockup caused by core2 switching to HSE before us * FuriHal: explicit HSE start before switch * FuriHal: fix documentation and move flash latency change to later stage, remove duplicate LL_RCC_SetRFWKPClockSource call --------- Co-authored-by: hedger <hedger@nanode.su> Co-authored-by: hedger <hedger@users.noreply.github.com>
2023-09-19 14:22:21 +00:00
#pragma once
#ifndef __PACKED_STRUCT
#define __PACKED_STRUCT PACKED(struct)
#endif
#ifndef __PACKED_UNION
#define __PACKED_UNION PACKED(union)
#endif
/**
* @brief This is the section dedicated to IAR toolchain
*/
#if defined(__ICCARM__) || defined(__IAR_SYSTEMS_ASM__)
#ifndef __WEAK
#define __WEAK __weak
#endif
#define QUOTE_(a) #a
/**
* @brief PACKED
* Use the PACKED macro for variables that needs to be packed.
* Usage: PACKED(struct) myStruct_s
* PACKED(union) myStruct_s
*/
#define PACKED(decl) __packed decl
/**
* @brief SECTION
* Use the SECTION macro to assign data or code in a specific section.
* Usage: SECTION(".my_section")
*/
#define SECTION(name) _Pragma(QUOTE_(location = name))
/**
* @brief ALIGN_DEF
* Use the ALIGN_DEF macro to specify the alignment of a variable.
* Usage: ALIGN_DEF(4)
*/
#define ALIGN_DEF(v) _Pragma(QUOTE_(data_alignment = v))
/**
* @brief NO_INIT
* Use the NO_INIT macro to declare a not initialized variable.
* Usage: NO_INIT(int my_no_init_var)
* Usage: NO_INIT(uint16_t my_no_init_array[10])
*/
#define NO_INIT(var) __no_init var
/**
* @brief This is the section dedicated to GNU toolchain
*/
#else
#ifdef __GNUC__
#ifndef __WEAK
#define __WEAK __attribute__((weak))
#endif
/**
* @brief PACKED
* Use the PACKED macro for variables that needs to be packed.
* Usage: PACKED(struct) myStruct_s
* PACKED(union) myStruct_s
*/
#define PACKED(decl) decl __attribute__((packed))
/**
* @brief SECTION
* Use the SECTION macro to assign data or code in a specific section.
* Usage: SECTION(".my_section")
*/
#define SECTION(name) __attribute__((section(name)))
/**
* @brief ALIGN_DEF
* Use the ALIGN_DEF macro to specify the alignment of a variable.
* Usage: ALIGN_DEF(4)
*/
#define ALIGN_DEF(N) __attribute__((aligned(N)))
/**
* @brief NO_INIT
* Use the NO_INIT macro to declare a not initialized variable.
* Usage: NO_INIT(int my_no_init_var)
* Usage: NO_INIT(uint16_t my_no_init_array[10])
*/
#define NO_INIT(var) var __attribute__((section(".noinit")))
/**
* @brief This is the section dedicated to Keil toolchain
*/
#else
#ifdef __CC_ARM
#ifndef __WEAK
#define __WEAK __weak
#endif
/**
* @brief PACKED
* Use the PACKED macro for variables that needs to be packed.
* Usage: PACKED(struct) myStruct_s
* PACKED(union) myStruct_s
*/
#define PACKED(decl) decl __attribute__((packed))
/**
* @brief SECTION
* Use the SECTION macro to assign data or code in a specific section.
* Usage: SECTION(".my_section")
*/
#define SECTION(name) __attribute__((section(name)))
/**
* @brief ALIGN_DEF
* Use the ALIGN_DEF macro to specify the alignment of a variable.
* Usage: ALIGN_DEF(4)
*/
#define ALIGN_DEF(N) __attribute__((aligned(N)))
/**
* @brief NO_INIT
* Use the NO_INIT macro to declare a not initialized variable.
* Usage: NO_INIT(int my_no_init_var)
* Usage: NO_INIT(uint16_t my_no_init_array[10])
*/
#define NO_INIT(var) var __attribute__((section("NoInit")))
#else
#error Neither ICCARM, CC ARM nor GNUC C detected. Define your macros.
#endif
#endif
#endif