Hi,

I am porting an old application from CAmkES 2.x to CAmkES 3.7.0. But I am having an issue with a very large dataport. The data structure mapped between components needs to be about 25 MiB. I have defined the size of the connection to be 64 MiB. But compilation fails.

Looking at the generated code for the shared data I see this

struct {
    char content[ROUND_UP_UNSAFE(sizeof(ui_config_t),
        PAGE_SIZE_4K)];
} to_0_ui_configbuf_data
        ALIGN(16777216)
        SECTION("align_24bit")
        USED;



extern typeof(to_0_ui_configbuf_data) to_0_ui_configbuf_data ALIGN(67108864) VISIBLE;
static_assert(sizeof(to_0_ui_configbuf_data) <= 67108864,
  "typeof(to_0_ui_configbuf_data) size greater than dataport size.");
static_assert(sizeof(to_0_ui_configbuf_data) % 16777216 == 0,
  "to_0_ui_configbuf_data not page-sized. Template bug in its declaration? Suggested formulation: `char to_0_ui_configbuf_data[ROUND_UP_UNSAFE(sizeof(...), PAGE_SIZE_4K)];`");

But compilation fails with

projects/musllibc/build-temp/stage/include/assert.h:12:23: error: static assertion failed: "to_0_ui_configbuf_data not page-sized. Template bug in its declaration? Suggested formulation: `char to_0_ui_configbuf_data[ROUND_UP_UNSAFE(sizeof(...), PAGE_SIZE_4K)];`"

The assert is looking for the buffer to be a multiple of 16MiB but the ROUND_UP_UNSAFE is only doing working to a multiple of 4KiB. PAGE_SIZE_4K is hard coded in the template but the alignment has changed from 12bit to 24bit so CAmkES is aware of the large data structure. 

I guess I could pad and align my data structure to a multiple of 16MiB. 

Also, having hard coded numbers in my top level CAmkES configuration for the dataport size is a bit of a maintenance nightmare. Being able to use a #define from the code base would be ideal but this doesn't work. It does work for paddr and irq_number specifications!

Cheers,
Zippy