mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-12 19:10:32 +03:00
REFACTOR: Moving code sections to platform (#14509)
* REFACTOR: Moving code sections to platform * Correct build error (FAST_CODE_PREF redefined) * Re-ordered * Updated comment (as per @ledvinap)
This commit is contained in:
parent
cbf070af8f
commit
4985d315d5
4 changed files with 85 additions and 57 deletions
|
@ -49,41 +49,45 @@
|
||||||
#define DEFAULT_AUX_CHANNEL_COUNT 6
|
#define DEFAULT_AUX_CHANNEL_COUNT 6
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_ITCM_RAM
|
#ifndef FAST_CODE
|
||||||
#if defined(ITCM_RAM_OPTIMISATION) && !defined(DEBUG)
|
#define FAST_CODE
|
||||||
#define FAST_CODE __attribute__((section(".tcm_code"))) __attribute__((optimize(ITCM_RAM_OPTIMISATION)))
|
|
||||||
#else
|
|
||||||
#define FAST_CODE __attribute__((section(".tcm_code")))
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef FAST_CODE_PREF
|
#ifndef FAST_CODE_PREF
|
||||||
#define FAST_CODE_PREF FAST_CODE
|
#define FAST_CODE_PREF FAST_CODE
|
||||||
// If a particular target is short of ITCM RAM, defining FAST_CODE_PREF in the target.h file will
|
|
||||||
// cause functions decorated FAST_CODE_PREF to *not* go into ITCM RAM
|
|
||||||
// but if FAST_CODE_PREF is not defined for the target, FAST_CODE_PREF is an alias to FAST_CODE, and
|
|
||||||
// functions decorated with FAST_CODE_PREF *will* go into ITCM RAM.
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define FAST_CODE_NOINLINE NOINLINE
|
#ifndef FAST_CODE_NOINLINE
|
||||||
|
|
||||||
#else
|
|
||||||
#define FAST_CODE
|
|
||||||
#define FAST_CODE_PREF
|
|
||||||
#define FAST_CODE_NOINLINE
|
#define FAST_CODE_NOINLINE
|
||||||
#endif // USE_ITCM_RAM
|
#endif
|
||||||
|
|
||||||
#ifdef USE_CCM_CODE
|
#ifndef CCM_CODE
|
||||||
#define CCM_CODE __attribute__((section(".ccm_code")))
|
|
||||||
#else
|
|
||||||
#define CCM_CODE
|
#define CCM_CODE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_FAST_DATA
|
#ifndef FAST_DATA
|
||||||
#define FAST_DATA_ZERO_INIT __attribute__ ((section(".fastram_bss"), aligned(4)))
|
|
||||||
#define FAST_DATA __attribute__ ((section(".fastram_data"), aligned(4)))
|
|
||||||
#else
|
|
||||||
#define FAST_DATA_ZERO_INIT
|
|
||||||
#define FAST_DATA
|
#define FAST_DATA
|
||||||
#endif // USE_FAST_DATA
|
#endif
|
||||||
|
|
||||||
|
#ifndef FAST_DATA_ZERO_INIT
|
||||||
|
#define FAST_DATA_ZERO_INIT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef MMFLASH_CODE
|
||||||
|
#define MMFLASH_CODE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef MMFLASH_CODE_NOINLINE
|
||||||
|
#define MMFLASH_CODE_NOINLINE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef MMFLASH_DATA
|
||||||
|
#define MMFLASH_DATA
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef MMFLASH_DATA_ZERO_INIT
|
||||||
|
#define MMFLASH_DATA_ZERO_INIT
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
BEGIN HARDWARE INCLUSIONS
|
BEGIN HARDWARE INCLUSIONS
|
||||||
|
@ -630,33 +634,6 @@ extern struct linker_symbol __config_start; // configured via linker script wh
|
||||||
extern struct linker_symbol __config_end;
|
extern struct linker_symbol __config_end;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(USE_EXST) && !defined(RAMBASED)
|
|
||||||
#define USE_FLASH_BOOT_LOADER
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(USE_FLASH_MEMORY_MAPPED)
|
|
||||||
#if !defined(USE_RAM_CODE)
|
|
||||||
#define USE_RAM_CODE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define MMFLASH_CODE RAM_CODE
|
|
||||||
#define MMFLASH_CODE_NOINLINE RAM_CODE NOINLINE
|
|
||||||
|
|
||||||
#define MMFLASH_DATA FAST_DATA
|
|
||||||
#define MMFLASH_DATA_ZERO_INIT FAST_DATA_ZERO_INIT
|
|
||||||
#else
|
|
||||||
#define MMFLASH_CODE
|
|
||||||
#define MMFLASH_CODE_NOINLINE
|
|
||||||
#define MMFLASH_DATA
|
|
||||||
#define MMFLASH_DATA_ZERO_INIT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_RAM_CODE
|
|
||||||
// RAM_CODE for methods that need to be in RAM, but don't need to be in the fastest type of memory.
|
|
||||||
// Note: if code is marked as RAM_CODE it *MUST* be in RAM, there is no alternative unlike functions marked with FAST_CODE/CCM_CODE
|
|
||||||
#define RAM_CODE __attribute__((section(".ram_code")))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef USE_ITERM_RELAX
|
#ifndef USE_ITERM_RELAX
|
||||||
#undef USE_ABSOLUTE_CONTROL
|
#undef USE_ABSOLUTE_CONTROL
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -212,3 +212,8 @@
|
||||||
|
|
||||||
#define DMA_STCH_STRING "Stream"
|
#define DMA_STCH_STRING "Stream"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_FAST_DATA
|
||||||
|
#define FAST_DATA_ZERO_INIT __attribute__ ((section(".fastram_bss"), aligned(4)))
|
||||||
|
#define FAST_DATA __attribute__ ((section(".fastram_data"), aligned(4)))
|
||||||
|
#endif // USE_FAST_DATA
|
||||||
|
|
|
@ -471,3 +471,49 @@ extern uint8_t _dmaram_end__;
|
||||||
#if defined(STM32F4) || defined(STM32F7) || defined(STM32H7)
|
#if defined(STM32F4) || defined(STM32F7) || defined(STM32H7)
|
||||||
#define DMA_STCH_STRING "Stream"
|
#define DMA_STCH_STRING "Stream"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_ITCM_RAM
|
||||||
|
#if defined(ITCM_RAM_OPTIMISATION) && !defined(DEBUG)
|
||||||
|
#define FAST_CODE __attribute__((section(".tcm_code"))) __attribute__((optimize(ITCM_RAM_OPTIMISATION)))
|
||||||
|
#else
|
||||||
|
#define FAST_CODE __attribute__((section(".tcm_code")))
|
||||||
|
#endif
|
||||||
|
// If a particular target is short of ITCM RAM, defining FAST_CODE_PREF in the target.h file will
|
||||||
|
// cause functions decorated FAST_CODE_PREF to *not* go into ITCM RAM but if FAST_CODE_PREF is not
|
||||||
|
// defined for the target, FAST_CODE_PREF will become an alias to FAST_CODE (in the common post
|
||||||
|
// header file), and functions decorated with FAST_CODE_PREF *will* go into ITCM RAM.
|
||||||
|
|
||||||
|
#define FAST_CODE_NOINLINE NOINLINE
|
||||||
|
#endif // USE_ITCM_RAM
|
||||||
|
|
||||||
|
// noting this is not used anywhere in the codebase at the moment
|
||||||
|
#ifdef USE_CCM_CODE
|
||||||
|
#define CCM_CODE __attribute__((section(".ccm_code")))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_FAST_DATA
|
||||||
|
#define FAST_DATA_ZERO_INIT __attribute__ ((section(".fastram_bss"), aligned(4)))
|
||||||
|
#define FAST_DATA __attribute__ ((section(".fastram_data"), aligned(4)))
|
||||||
|
#endif // USE_FAST_DATA
|
||||||
|
|
||||||
|
#if defined(USE_EXST) && !defined(RAMBASED)
|
||||||
|
#define USE_FLASH_BOOT_LOADER
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(USE_FLASH_MEMORY_MAPPED)
|
||||||
|
#if !defined(USE_RAM_CODE)
|
||||||
|
#define USE_RAM_CODE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define MMFLASH_CODE RAM_CODE
|
||||||
|
#define MMFLASH_CODE_NOINLINE RAM_CODE NOINLINE
|
||||||
|
|
||||||
|
#define MMFLASH_DATA FAST_DATA
|
||||||
|
#define MMFLASH_DATA_ZERO_INIT FAST_DATA_ZERO_INIT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_RAM_CODE
|
||||||
|
// RAM_CODE for methods that need to be in RAM, but don't need to be in the fastest type of memory.
|
||||||
|
// Note: if code is marked as RAM_CODE it *MUST* be in RAM, there is no alternative unlike functions marked with FAST_CODE/CCM_CODE
|
||||||
|
#define RAM_CODE __attribute__((section(".ram_code")))
|
||||||
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue