1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-23 16:25:16 +03:00

Move __attribute__ ((section(s), used)) macro, and cosmetics in definitions.h. (#5549)

This commit is contained in:
Max Paperno 2017-12-20 04:19:59 -05:00 committed by Bertrand Songis
parent aff40dac8d
commit 38762fb618
2 changed files with 23 additions and 33 deletions

View file

@ -23,8 +23,10 @@
#if defined(SIMU) #if defined(SIMU)
#define __ALIGNED #define __ALIGNED
#define __SECTION_USED(s)
#else #else
#define __ALIGNED __attribute__((aligned(32))) #define __ALIGNED __attribute__((aligned(32)))
#define __SECTION_USED(s) __attribute__ ((section(s), used))
#endif #endif
#if defined(SIMU) #if defined(SIMU)
@ -37,13 +39,9 @@
#if defined(PCBHORUS) && !defined(SIMU) #if defined(PCBHORUS) && !defined(SIMU)
#define __SDRAM __attribute__((section(".sdram"), aligned(32))) #define __SDRAM __attribute__((section(".sdram"), aligned(32)))
#else
#define __SDRAM __DMA
#endif
#if defined(PCBHORUS) && !defined(SIMU)
#define __NOINIT __attribute__((section(".noinit"))) #define __NOINIT __attribute__((section(".noinit")))
#else #else
#define __SDRAM __DMA
#define __NOINIT #define __NOINIT
#endif #endif
@ -54,29 +52,27 @@ typedef __int24 int24_t;
#endif #endif
#if __GNUC__ #if __GNUC__
#define PACK( __Declaration__ ) __Declaration__ __attribute__((__packed__)) #define PACK( __Declaration__ ) __Declaration__ __attribute__((__packed__))
#else #else
#define PACK( __Declaration__ ) __pragma( pack(push, 1) ) __Declaration__ __pragma( pack(pop) ) #define PACK( __Declaration__ ) __pragma( pack(push, 1) ) __Declaration__ __pragma( pack(pop) )
#endif #endif
#if defined(SIMU) #if defined(SIMU)
#if !defined(FORCEINLINE) #if !defined(FORCEINLINE)
#define FORCEINLINE inline #define FORCEINLINE inline
#endif #endif
#if !defined(NOINLINE) #if !defined(NOINLINE)
#define NOINLINE #define NOINLINE
#endif #endif
#define CONVERT_PTR_UINT(x) ((uint32_t)(uint64_t)(x)) #define CONVERT_PTR_UINT(x) ((uint32_t)(uint64_t)(x))
#define CONVERT_UINT_PTR(x) ((uint32_t*)(uint64_t)(x)) #define CONVERT_UINT_PTR(x) ((uint32_t*)(uint64_t)(x))
#else #else
#if !defined(_MSC_VER) || (_MSC_VER < 1200)
#define FORCEINLINE inline __attribute__ ((always_inline)) #define FORCEINLINE inline __attribute__ ((always_inline))
#endif #define NOINLINE __attribute__ ((noinline))
#define NOINLINE __attribute__ ((noinline)) #define SIMU_SLEEP(x)
#define SIMU_SLEEP(x) #define SIMU_SLEEP_NORET(x)
#define SIMU_SLEEP_NORET(x) #define CONVERT_PTR_UINT(x) ((uint32_t)(x))
#define CONVERT_PTR_UINT(x) ((uint32_t)(x)) #define CONVERT_UINT_PTR(x) ((uint32_t *)(x))
#define CONVERT_UINT_PTR(x) ((uint32_t *)(x))
#endif #endif
#endif // _DEFINITIONS_H_ #endif // _DEFINITIONS_H_

View file

@ -51,14 +51,8 @@
*/ */
#if defined(STM32) #if defined(STM32)
#if defined(SIMU) __SECTION_USED(".fwversiondata") const char firmware_version[] = "opentx-" FLAVOUR "-" VERSION " (" GIT_STR ")";
#define ATTRIBUTE_SECTION(s) __SECTION_USED(".bootversiondata") const char boot_version[] = "opentx-" FLAVOUR "-" VERSION " (" GIT_STR ")";
#else
#define ATTRIBUTE_SECTION(s) __attribute__ ((section(s), used))
#endif
ATTRIBUTE_SECTION(".fwversiondata") const char firmware_version[] = "opentx-" FLAVOUR "-" VERSION " (" GIT_STR ")";
ATTRIBUTE_SECTION(".bootversiondata") const char boot_version[] = "opentx-" FLAVOUR "-" VERSION " (" GIT_STR ")";
/** /**
* Tries to find opentx version in the first 1024 byte of either firmware/bootloader (the one not running) or the buffer * Tries to find opentx version in the first 1024 byte of either firmware/bootloader (the one not running) or the buffer