Skip to content

Commit

Permalink
Replace all __attribute__((section(x)) with locate_data(x)
Browse files Browse the repository at this point in the history
Signed-off-by: Xiang Xiao <[email protected]>
  • Loading branch information
xiaoxiang781216 authored and gustavonihei committed Jul 30, 2021
1 parent b3f9ffb commit 007adc7
Show file tree
Hide file tree
Showing 74 changed files with 108 additions and 108 deletions.
2 changes: 1 addition & 1 deletion arch/arm/src/armv6-m/arm_ramvec_initialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
*/

up_vector_t g_ram_vectors[ARMV6M_VECTAB_SIZE]
__attribute__ ((section (".ram_vectors"))) aligned_data(RAMVEC_ALIGN);
locate_data(".ram_vectors") aligned_data(RAMVEC_ALIGN);

/****************************************************************************
* Public Functions
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/armv6-m/arm_vectors.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ extern void exception_common(void);
* Note that the [ ... ] desginated initialiser is a GCC extension.
*/

unsigned _vectors[] __attribute__((section(".vectors"))) =
unsigned _vectors[] locate_data(".vectors") =
{
/* Initial stack */

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/armv6-m/ram_vectors.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
*/

extern up_vector_t g_ram_vectors[ARMV6M_VECTAB_SIZE]
__attribute__ ((section (".ram_vectors"))) aligned_data(128);
locate_data(".ram_vectors") aligned_data(128);

/****************************************************************************
* Public Function Prototypes
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/armv7-m/arm_ramvec_initialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
*/

up_vector_t g_ram_vectors[ARMV7M_VECTAB_SIZE]
__attribute__ ((section (".ram_vectors"))) aligned_data(RAMVEC_ALIGN);
locate_data(".ram_vectors") aligned_data(RAMVEC_ALIGN);

/****************************************************************************
* Public Functions
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/armv7-m/arm_vectors.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ extern void exception_common(void);
* Note that the [ ... ] designated initializer is a GCC extension.
*/

unsigned _vectors[] __attribute__((section(".vectors"))) =
unsigned _vectors[] locate_data(".vectors") =
{
/* Initial stack */

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/armv7-m/ram_vectors.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
*/

extern up_vector_t g_ram_vectors[ARMV7M_VECTAB_SIZE]
__attribute__ ((section (".ram_vectors"))) aligned_data(128);
locate_data(".ram_vectors") aligned_data(128);

/****************************************************************************
* Public Function Prototypes
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/armv8-m/arm_ramvec_initialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
*/

up_vector_t g_ram_vectors[ARMV8M_VECTAB_SIZE]
__attribute__ ((section (".ram_vectors"))) aligned_data(RAMVEC_ALIGN);
locate_data(".ram_vectors") aligned_data(RAMVEC_ALIGN);

/****************************************************************************
* Public Functions
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/armv8-m/arm_vectors.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ extern void exception_common(void);
* Note that the [ ... ] designated initializer is a GCC extension.
*/

unsigned _vectors[] __attribute__((section(".vectors"))) =
unsigned _vectors[] locate_data(".vectors") =
{
/* Initial stack */

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/armv8-m/ram_vectors.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
*/

extern up_vector_t g_ram_vectors[ARMV8M_VECTAB_SIZE]
__attribute__ ((section (".ram_vectors"))) aligned_data(128);
locate_data(".ram_vectors") aligned_data(128);

/****************************************************************************
* Public Function Prototypes
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/kinetis/kinetis_cfmconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* Public Data
****************************************************************************/

__attribute__ ((section(".cfmconfig")))
locate_data(".cfmconfig")
const uint8_t __flashconfigbytes[16] =
{
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/kl/kl_cfmconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* Public Data
****************************************************************************/

const uint8_t _cfmconfig[16] __attribute__((section(".cfmconfig"))) =
const uint8_t _cfmconfig[16] locate_data(".cfmconfig") =
{
0xff, /* NV_BACKKEY3: KEY=0xff */
0xff, /* NV_BACKKEY2: KEY=0xff */
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/rtl8720c/ameba_vectors.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ extern void exception_common(void);
* Note that the [ ... ] designated initialiser is a GCC extension.
*/

unsigned _vectors[] __attribute__((section(".vectors"))) \
unsigned _vectors[] locate_data(".vectors") \
aligned_data(0x100) =
{
/* Initial stack */
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/s32k1xx/s32k1xx_flashcfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

/* Configured FLASH configuration bytes. NOTE: Little endian assumed. */

const uint8_t g_flashcfg[16] __attribute__((section(".flashcfg"))) =
const uint8_t g_flashcfg[16] locate_data(".flashcfg") =
{
(uint8_t)(CONFIG_S32K1XX_FLASHCFG_BACKDOOR1 & 0xff), /* 0x0400 */
(uint8_t)((CONFIG_S32K1XX_FLASHCFG_BACKDOOR1 >> 8) & 0xff), /* 0x0401 */
Expand Down
6 changes: 3 additions & 3 deletions arch/arm/src/samd2l2/sam_dmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,17 +143,17 @@ static struct sam_dmach_s g_dmach[SAMD2L2_NDMACHAN];
*/

static struct dma_desc_s g_base_desc[SAMD2L2_NDMACHAN]
__attribute__ ((section(".lpram"), aligned(16)));
locate_data(".lpram"), aligned(16);
static struct dma_desc_s g_writeback_desc[SAMD2L2_NDMACHAN]
__attribute__ ((section(".lpram"), aligned(16)));
locate_data(".lpram"), aligned(16);

#if CONFIG_SAMD2L2_DMAC_NDESC > 0
/* Additional DMA descriptors for (optional) multi-block transfer support.
* Also positioned in LPRAM.
*/

static struct dma_desc_s g_dma_desc[CONFIG_SAMD2L2_DMAC_NDESC]
__attribute__ ((section(".lpram"), aligned(16)));
locate_data(".lpram"), aligned(16);
#endif

/****************************************************************************
Expand Down
6 changes: 3 additions & 3 deletions arch/arm/src/samd5e5/sam_dmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,17 @@ static struct sam_dmach_s g_dmach[SAMD5E5_NDMACHAN];
*/

static struct dma_desc_s g_base_desc[SAMD5E5_NDMACHAN]
__attribute__ ((section(".lpram"), aligned(16)));
locate_data(".lpram"), aligned(16);
static struct dma_desc_s g_writeback_desc[SAMD5E5_NDMACHAN]
__attribute__ ((section(".lpram"), aligned(16)));
locate_data(".lpram"), aligned(16);

#if CONFIG_SAMD5E5_DMAC_NDESC > 0
/* Additional DMA descriptors for (optional) multi-block transfer support.
* Also positioned in LPRAM.
*/

static struct dma_desc_s g_dma_desc[CONFIG_SAMD5E5_DMAC_NDESC]
__attribute__ ((section(".lpram"), aligned(16)));
locate_data(".lpram"), aligned(16);
#endif

/****************************************************************************
Expand Down
20 changes: 10 additions & 10 deletions arch/renesas/src/rx65n/rx65n_vector_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
* Pre-processor Definitions
****************************************************************************/

#define OFS_REG __attribute__ ((section (".ofs1"))) /* 0xfe7f5d00 */
#define OFS_TMINF __attribute__ ((section (".ofs2"))) /* 0xfe7f5d10 */
#define OFS_SPCC __attribute__ ((section (".ofs3"))) /* 0xfe7f5d40 */
#define OFS_TMEF __attribute__ ((section (".ofs4"))) /* 0xfe7f5d48 */
#define OFS_OSIS __attribute__ ((section (".ofs5"))) /* 0xfe7f5d50 */
#define OFS_FAW __attribute__ ((section (".ofs6"))) /* 0xfe7f5d64 */
#define OFS_ROMCODE __attribute__ ((section (".ofs7"))) /* 0xfe7f5d70 */
#define OFS_REG locate_data(".ofs1") /* 0xfe7f5d00 */
#define OFS_TMINF locate_data(".ofs2") /* 0xfe7f5d10 */
#define OFS_SPCC locate_data(".ofs3") /* 0xfe7f5d40 */
#define OFS_TMEF locate_data(".ofs4") /* 0xfe7f5d48 */
#define OFS_OSIS locate_data(".ofs5") /* 0xfe7f5d50 */
#define OFS_FAW locate_data(".ofs6") /* 0xfe7f5d64 */
#define OFS_ROMCODE locate_data(".ofs7") /* 0xfe7f5d70 */

/* SPCC register */

Expand Down Expand Up @@ -181,7 +181,7 @@ void r_floatingpoint_exception(void)
#endif
}

#define EXVECT_SECT __attribute__ ((section (".exvectors")))
#define EXVECT_SECT locate_data(".exvectors")

const void *except_vectors[] EXVECT_SECT =
{
Expand Down Expand Up @@ -218,7 +218,7 @@ const void *except_vectors[] EXVECT_SECT =
r_nmi_exception /* 0xfffffff8 NMI */
};

#define FVECT_SECT __attribute__ ((section (".fvectors")))
#define FVECT_SECT locate_data(".fvectors")
extern void _start(void); /* defined in rx65n_head.S */
const void *hardware_vectors[] FVECT_SECT =
{
Expand All @@ -227,7 +227,7 @@ const void *hardware_vectors[] FVECT_SECT =
_start /* Power On Reset PC */
};

#define RVECT_SECT __attribute__ ((section (".rvectors")))
#define RVECT_SECT locate_data(".rvectors")
const void *relocatable_vectors[256] RVECT_SECT =
{
0
Expand Down
2 changes: 1 addition & 1 deletion arch/risc-v/src/bl602/bl602_netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ struct bl602_net_driver_s g_bl602_net[BL602_NET_NINTERFACES];
static struct tx_buf_ind_s g_tx_buf_indicator =
BITSET_T_INITIALIZER((1 << BL602_NET_TXBUFF_NUM) - 1);

static uint8_t __attribute__((section(".wifi_ram.txbuff")))
static uint8_t locate_data(".wifi_ram.txbuff")
g_tx_buff[BL602_NET_TXBUFF_NUM][BL602_NET_TXBUFF_SIZE];

static sem_t g_wifi_scan_sem; /* wifi scan complete semaphore */
Expand Down
6 changes: 3 additions & 3 deletions arch/risc-v/src/bl602/bl602_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
*/

uint8_t g_idle_stack[BL602_IDLESTACK_SIZE]
__attribute__((section(".noinit_idle_stack")));
locate_data(".noinit_idle_stack");

/* Dont change the name of variable, since we refer this
* g_boot2_partition_table in linker script
Expand Down Expand Up @@ -107,7 +107,7 @@ uint32_t __attribute__((no_instrument_function)) boot2_get_flash_addr(void)
}

#ifdef CONFIG_STACK_OVERFLOW_CHECK
void __attribute__((no_instrument_function, section(".tcm_code")))
void __attribute__(((no_instrument_function))) locate_code(".tcm_code")
__cyg_profile_func_enter(void *this_fn, void *call_site)
{
register uintptr_t *sp;
Expand Down Expand Up @@ -149,7 +149,7 @@ __cyg_profile_func_enter(void *this_fn, void *call_site)
return;
}

void __attribute__((no_instrument_function, section(".tcm_code")))
void __attribute__((no_instrument_function)) locate_code(".tcm_code")
__cyg_profile_func_exit(void *this_fn, void *call_site)
{
return;
Expand Down
10 changes: 5 additions & 5 deletions arch/risc-v/src/esp32c3/esp32c3_attr.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,27 @@

/* Forces code into IRAM instead of flash */

#define IRAM_ATTR __attribute__((section(".iram1")))
#define IRAM_ATTR locate_data(".iram1")

/* Forces data into DRAM instead of flash */

#define DRAM_ATTR __attribute__((section(".dram1")))
#define DRAM_ATTR locate_data(".dram1")

/* Forces code into RTC fast memory */

#define RTC_IRAM_ATTR __attribute__((section(".rtc.text")))
#define RTC_IRAM_ATTR locate_data(".rtc.text")

/* Forces data into RTC slow memory
* Any variable marked with this attribute will keep its value
* during a deep sleep / wake cycle.
*/

#define RTC_DATA_ATTR __attribute__((section(".rtc.data")))
#define RTC_DATA_ATTR locate_data(".rtc.data")

/* Forces read-only data into RTC slow memory
* Makes constant data available to RTC wake stubs.
*/

#define RTC_RODATA_ATTR __attribute__((section(".rtc.rodata")))
#define RTC_RODATA_ATTR locate_data(".rtc.rodata")

#endif /* __ARCH_RISCV_SRC_ESP32C3_ESP32C3_ATTR_H */
2 changes: 1 addition & 1 deletion arch/risc-v/src/esp32c3/esp32c3_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
/* Address of the IDLE thread */

uint8_t g_idlestack[CONFIG_IDLETHREAD_STACKSIZE]
aligned_data(16) __attribute__((section(".noinit")));
aligned_data(16) locate_data(".noinit");
uint32_t g_idle_topstack = ESP32C3_IDLESTACK_TOP;

/****************************************************************************
Expand Down
12 changes: 6 additions & 6 deletions arch/xtensa/src/common/xtensa_attr.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,33 +40,33 @@

/* Forces code into IRAM instead of flash */

#define IRAM_ATTR __attribute__((section(".iram1")))
#define IRAM_ATTR locate_data(".iram1")

/* Forces data into DRAM instead of flash */

#define DRAM_ATTR __attribute__((section(".dram1")))
#define DRAM_ATTR locate_data(".dram1")

/* Forces code into RTC fast memory */

#define RTC_IRAM_ATTR __attribute__((section(".rtc.text")))
#define RTC_IRAM_ATTR locate_data(".rtc.text")

/* Forces data into RTC slow memory
* Any variable marked with this attribute will keep its value
* during a deep sleep / wake cycle.
*/

#define RTC_DATA_ATTR __attribute__((section(".rtc.data")))
#define RTC_DATA_ATTR locate_data(".rtc.data")

/* Forces read-only data into RTC slow memory
* Makes constant data available to RTC wake stubs.
*/

#define RTC_RODATA_ATTR __attribute__((section(".rtc.rodata")))
#define RTC_RODATA_ATTR locate_data(".rtc.rodata")

/* Allow bss variables into external memory. */

#ifdef CONFIG_XTENSA_EXTMEM_BSS
# define EXT_RAM_ATTR __attribute__((section(".extmem.bss")))
# define EXT_RAM_ATTR locate_data(".extmem.bss")
#else
# define EXT_RAM_ATTR
#endif
Expand Down
2 changes: 1 addition & 1 deletion arch/xtensa/src/esp32/esp32_cpuidlestack.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
/* Address of the CPU0 IDLE thread */

uint32_t g_cpu1_idlestack[CPU1_IDLETHREAD_STACKWORDS]
aligned_data(16) __attribute__((section(".noinit")));
aligned_data(16) locate_data(".noinit");

/****************************************************************************
* Public Functions
Expand Down
2 changes: 1 addition & 1 deletion arch/xtensa/src/esp32/esp32_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
/* Address of the CPU0 IDLE thread */

uint32_t g_idlestack[IDLETHREAD_STACKWORDS]
aligned_data(16) __attribute__((section(".noinit")));
aligned_data(16) locate_data(".noinit");

/****************************************************************************
* Public Functions
Expand Down
2 changes: 1 addition & 1 deletion arch/xtensa/src/esp32s2/esp32s2_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
/* Address of the CPU0 IDLE thread */

uint32_t g_idlestack[IDLETHREAD_STACKWORDS]
aligned_data(16) __attribute__((section(".noinit")));
aligned_data(16) locate_data(".noinit");

/****************************************************************************
* Public Functions
Expand Down
4 changes: 2 additions & 2 deletions boards/arm/imxrt/imxrt1020-evk/src/imxrt_flexspi_nor_boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* Public Data
****************************************************************************/

__attribute__((section(".boot_hdr.ivt")))
locate_data(".boot_hdr.ivt")
const struct ivt_s g_image_vector_table =
{
IVT_HEADER, /* IVT Header */
Expand All @@ -41,7 +41,7 @@ const struct ivt_s g_image_vector_table =
IVT_RSVD /* Reserved = 0 */
};

__attribute__((section(".boot_hdr.boot_data")))
locate_data(".boot_hdr.boot_data")
const struct boot_data_s g_boot_data =
{
FLASH_BASE, /* boot start location */
Expand Down
4 changes: 2 additions & 2 deletions boards/arm/imxrt/imxrt1020-evk/src/imxrt_flexspi_nor_flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
*/

#if defined (CONFIG_IMXRT1020_EVK_HYPER_FLASH)
__attribute__((section(".boot_hdr.conf")))
locate_data(".boot_hdr.conf")
const struct flexspi_nor_config_s g_flash_config =
{
.mem_config =
Expand Down Expand Up @@ -115,7 +115,7 @@ const struct flexspi_nor_config_s g_flash_config =
.is_uniform_blocksize = 1,
};
#elif defined (CONFIG_IMXRT1020_EVK_QSPI_FLASH)
__attribute__((section(".boot_hdr.conf")))
locate_data(".boot_hdr.conf")
const struct flexspi_nor_config_s g_flash_config =
{
.mem_config =
Expand Down
2 changes: 1 addition & 1 deletion boards/arm/imxrt/imxrt1050-evk/kernel/imxrt_userspace.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ extern uint32_t _ebss; /* End+1 of .bss */

int CONFIG_USER_ENTRYPOINT(int argc, char *argv[]);

const struct userspace_s userspace __attribute__ ((section (".userspace"))) =
const struct userspace_s userspace locate_data(".userspace") =
{
/* General memory map */

Expand Down
Loading

0 comments on commit 007adc7

Please sign in to comment.