On Monday, 7 March 2016 at 21:12:02 UTC, Taylor Hillegeist wrote:
I'm working on getting my FRDM-kl25z board up and running with d. whatever works at this point.

The issue is when i try to specify hey this struct is over here! using:

__gshared SIM_MemMap * SIMY = cast(SIM_MemMap *) 0x40047000; __gshared PORT_MemMap * TMP2CH = cast(PORT_MemMap*) 0x4004A000; __gshared PORT_MemMap * TMP0CH = cast(PORT_MemMap*) 0x4004C000; __gshared TPM_MemMap * TPM0 = cast(TPM_MemMap *) 0x40038000; __gshared TPM_MemMap * TPM2 = cast(TPM_MemMap *) 0x4003A000; __gshared SCB_MemMap * SCB = cast(SCB_MemMap *) 0xE000E000;

and then try an set values:

SIMY.COPC = 0; //DISABLE WATCHDOG TIMER;

it looks like someone moves my cheese when i run in the simulator (uvision)

SIMY actual address ends up being 0x1FFFF0C4;

http://dpaste.dzfl.pl/20c95c182f6c

the whole projects is two files a linker and the file above. i switched from LDC because i couldn't get the section attribute working on 0.14.
Any help would be appreciated thanks!

I make it this way:
shared (uartreg*) uart2=cast (shared(uartreg*))0x40004400;

See for example
https://bitbucket.org/timosi/minlibd/src/61039fcbbf5845c7f18370c30857cfc034241fa2/tools/main/uart.d?at=default&fileviewer=file-view-default

Then I mark all individual registers as ahared too.

The compiler may optimize register accesses when it thinks they are not necessary. For example, if there are multiple writes to the same register, the compiler may remove all but the last. Repetitive reads, like status poll may be optimized to be done just once.

Gdc treats all shared variables as volatile and marking all struct members shared solves the problem partially. However this is unstable and buggy feature and may be removed in future.

Reply via email to