[jhc] [BUG] Poke should use volatile.

John Meacham john at repetae.net
Wed Mar 6 15:17:51 CET 2013


Interesting. Perhaps  something like

foreign import "volatile &periphBase" :: Ptr Word32

which will declare

extern volatile uint32_t periphBase in the file, then you would just
have a linker symbol periphBase at 0x4000000. (or just import a value
with zero and do pointer arithmetic like you do)

   John

On Wed, Mar 6, 2013 at 6:05 AM, Kiwamu Okabe <kiwamu at gmail.com> wrote:
> Hi John.
>
> On Wed, Mar 6, 2013 at 10:06 PM, John Meacham <john at repetae.net> wrote:
>> What do you mean by raw memory? I don't think the volatile should be
>> needed in general for C allocated variables, but perhaps you are
>> writing to hardware registers?
>
> Yes. I would like to write to hardware registers.
>
>   https://github.com/ajhc/demo-cortex-m3/blob/master/stbee-mini/hs_src/Main_simple_led.hs#L18
>
> We can do real programming with pure Haskell code,
> if poke function is used.
>
> Best regards,
> --
> Kiwamu Okabe
>
> _______________________________________________
> jhc mailing list
> jhc at haskell.org
> http://www.haskell.org/mailman/listinfo/jhc



More information about the jhc mailing list