Skip to main content
Rajssss
Associate II
April 10, 2021
Question

warning: 'at' attribute directive being ignored in stm32cubeide 1.6.1

  • April 10, 2021
  • 2 replies
  • 6259 views

I don't know why but I am getting this warning in STM32CUBE IDE 1.6.1:

'at' attribute directive ignored [-Wattributes]

Any explanations please? Any solutions?

2 replies

waclawek.jan
Super User
April 10, 2021

Where? When? In what context? Show us the complete compile output and/or relevant piece of code.

JW

Rajssss
RajssssAuthor
Associate II
April 10, 2021

I am trying to port an camera application originally created on keil MDK, The buffer for the camera data is meant to be stored at external SDRAM.

Below is the code which works on Keil.

const uint8_t jpeg_data_buf[JPEG_BUF_SIZE_MAX] __attribute__((at(SDRAM_DEVICE_ADDR+0x400000)));

I now know that, GNU GCC that the stm32cube IDE uses doesn't support 'at' attribute, is there any other similar method to acheive this besides copying the data to SDRAM manually, as I have found in the example:

https://github.com/STMicroelectronics/STM32CubeF7/blob/master/Projects/STM32746G-Discovery/Examples/FMC/FMC_SDRAM/Src/main.c#L129

MM..1
Chief III
April 10, 2021

Example from lcd code

 // Use the section "TouchGFX_Framebuffer" in the linker to specify the placement of the buffer
 LOCATION_PRAGMA("TouchGFX_Framebuffer")
 uint32_t frameBuf[(320 * 1024 + 3) / 4] LOCATION_ATTRIBUTE("TouchGFX_Framebuffer");

then edit ld file and add section def.

Pavel A.
Super User
April 10, 2021

Attribute at is specific to the Keil's ARMCC compiler. GCC does not know it.

Anyway - to place stuff at absolute address you don't need any pragmas or attributes or link script. Just use pointers.

-- pa

rohittheozzy
Associate II
October 9, 2024

I am a bit confused as to how it can be implemented. Can you please elaborate on how do you define variable in flash at a perticular location using pointers? Thank you. 

Pavel A.
Super User
October 9, 2024

how do you define variable in flash at a perticular location using pointers?

Not quite a variable, rather an expression that points to the location.

#define THE_ADDRESS 0x08100000
struct foo {
 int v1;
 int v2;
};

#define foo_at_address (*(struct foo*)THE_ADDRESS)

// or a pointer
const struct foo *pfoo = (struct foo*)THE_ADDRESS;