Max Kielland
Max Kielland

Reputation: 5841

XC16 - How do I prevent a parameter const array body to be copied to RAM?

I know const variables are copied to RAM so they can be referenced, but if I declare a const array body as a parameter in a function call, is it copied to RAM every time I do the call?

printf("Mode: %s",((__attribute__((space(prog))) const char[5][10]){"Off","HW","MB","HW or MB","HW and MB"})[EVENT_GetDinMode(channel)]);

My intention is to have the array in Flash and not be copied to RAM at all. I'm not sure if the __attribute__((space(prog)) will do the trick.

Upvotes: 1

Views: 115

Answers (0)

Related Questions