Philipp Klaus Krause schreef op 2022-06-22 17:38:
Am 21.06.22 um 14:12 schrieb Maarten Brock:
Philipp Klaus Krause schreef op 2022-06-21 14:00:
Am 21.06.22 um 13:47 schrieb Maarten Brock:

On a related note: is something specified for non-initialized variables? Currently SDCC creates no implicit initializer to zero when __at is used
and no explicit initializer is provided.
int __at(10) x; // not initilized to zero
int __at(12) y = 0x1234; // is initialized

I suspect that this is a feature of __at that people actually use: the
x in the example could be a memory-mapped I/O register.

Philipp

I know that it's used and indeed this is one of the use cases. What I was wondering is if there is any standardized keyword for this. E.g. __no_init
for IAR.

Maarten

Not that I know of. If we want it standardized: I don't think this
functionality would be of general interest, I guess it is something
embedded-specific. So we'd want it in the Embedded C TS; so we'd need
a new version of that TS, which means we would need an embedded C
study group (SG) within SC22WG14. I'd have to check the requirements,
but I think we'd need at least representatives of three national
standard bodies for that.
Also, WG14 is likely to want two implementations. Getting on of the
big ones (GCC, clang, IBM, Intel) on board would surely be helpful.

Philipp

I was just wondering, not proposing to get it added.
Btw. GCC has
__attribute__((section("no_init")))
or
__attribute__((section(".noinit")))
to tell the linker to allocate some memory without initializing it.

Another use case is (calibration/configuration) data in a flash page.

The alternative is to use pointers and keep the area away from the
linker to allocate in.

Maarten


_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to