Skip to content

Add support to add attributes to static_memblk via macro - #58

Open
stefanct wants to merge 1 commit into
eembc:mainfrom
stefanct:attr_memblk
Open

Add support to add attributes to static_memblk via macro#58
stefanct wants to merge 1 commit into
eembc:mainfrom
stefanct:attr_memblk

Conversation

@stefanct

Copy link
Copy Markdown

This allows for putting it into different linker script sections to facilitate testing different memory configurations. For example MEM_STATIC_ATTR='attribute((section("sdram")))' tells the linker to put the data memory of coremark into the section named sdram.

TODO: makefile, docs

What do you think?

This allows for putting it into different linker script sections to
facilitate testing different memory configurations.
For example MEM_STATIC_ATTR='__attribute__((section("sdram")))' tells
the linker to put the data memory of coremark into the section named
sdram.
@joseph-yiu

Copy link
Copy Markdown
Contributor

It seems this is useful when compiling CoreMark for 8051 toolchain, where the static_memblk[ ] array need to be placed in external SRAM. e.g. in Keil C51
xdata ee_u8 static_memblk[TOTAL_DATA_SIZE];
(Although omitting the attribute doesn't seem to cause any confusion to the C51 compiler because this array is too big for the internal SRAM anyway)
I need to check with other folks in SPEC Embedded Group to see if they are happy with this. If there is no concern we could roll this into the maintenance release.

@joseph-yiu

joseph-yiu commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

I would change the code as follow:

#if (MEM_METHOD == MEM_STATIC)
#ifdef STATIC_MEMBLK_ATTR
STATIC_MEMBLK_ATTR ee_u8 static_memblk[TOTAL_DATA_SIZE];
#else
ee_u8 static_memblk[TOTAL_DATA_SIZE];
#endif
#endif
  1. It doesn't break existing setup that doesn't define the attribute macro.
  2. Macro name change to reflect the attribute is specific to the static_memblk array.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants