[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] External 256K FLASH - memory pointer

From: Parthasaradhi Nayani
Subject: Re: [avr-gcc-list] External 256K FLASH - memory pointer
Date: Thu, 20 Sep 2012 02:11:51 -0700 (PDT)

Hello Richard,
Thanks a lot for your suggestion.

>Yes we can and it has already been suggested: Define Your own abstract data type with an underlying 32 bit integer. You can even overload all operators for it to achieve full >pointer semantics. But I would not go so far and overload the dereferencing operator for readability reasons. The signature for Your read function would then look like:
>void ReadXFlashBlock (unsigned char* dst, FlashAddress src, unsigned int size);

>If templates are Your friends, You can go further and add the value type to Your abstract address type.

>This way You avoid ugly casting orgies everywhere in Your code and You can not mess up integers, internal memory pointers and external flash addresses. Ok, these are >features of avr-g++, but why not?

I do not know if there will be any code over head due to C++. Unfortunately my forte is 'C'. Can I trouble you for some examples/sample code please? Thank you once again.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]