Re: [avr-gcc-list] avr-gcc 4.7 for Windows
From:Georg-Johann Lay g...@gcc.gnu.org To: avr-gcc-list@nongnu.org Subject: [avr-gcc-list] avr-gcc 4.7 for Windows GCC 4.7 has just been released, and I decided to provide a MinGW32 build of avr-gcc-4.7.2. Many people feel uncomfortable with building the tools to run under MS Windows, so here they are. The package is supplied as a ZIP archive avr-gcc-4.7.2-mingw32.zip. Unpack the ZIP file to your favorite a location; it will inflate to a directory called avr-gcc-4.7.2-mingw32. The binaries are located in avr-gcc-4.7.2-mingw32\bin To use the compiler, call avr-gcc-4.7.2-mingw32\bin\avr-gcc.exe directly or add the avr-gcc-4.7.2-mingw32\bin to your PATH environment variable. Most notable changes in 4.7.2 compared to 4.7.1 is the support of a new configure option --with-avrlibc that implements a better integration of AVR-Libc with avr-gcc: AVR-Libc supplies optimized versions of support functions that traditionally live in libgcc. --with-avrlibc makes sure that always the optimized versions from AVR-Libc are used. Hi, Thanks for the post. I noticed some peculiarities in the latest version specially regard to FLASH section. The compiler is throwing out errors when PROGMEM attribute is provided. unsigned char PROGMEM P_gu8_nlup[] dvr.c:205:40: error: variable 'P_gu8_nlup' must be const in order to be put into read-only section by means of '__attribute__((progmem))' The error clears if 'const' is placed before 'PROGMEM'. unsigned char const PROGMEM P_gu8_nlup[] Wondering whether there is any change in the latest version. Thank you. Nayani ___ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org https://lists.nongnu.org/mailman/listinfo/avr-gcc-list
Re: [avr-gcc-list] avr-gcc 4.7 for Windows
Parthasaradhi Nayani: From:Georg-Johann Lay: GCC 4.7 has just been released, and I decided to provide a MinGW32 build of avr-gcc-4.7.2. Many people feel uncomfortable with building the tools to run under MS Windows, so here they are. The package is supplied as a ZIP archive avr-gcc-4.7.2-mingw32.zip. Unpack the ZIP file to your favorite a location; it will inflate to a directory called avr-gcc-4.7.2-mingw32. The binaries are located in avr-gcc-4.7.2-mingw32\bin To use the compiler, call avr-gcc-4.7.2-mingw32\bin\avr-gcc.exe directly or add the avr-gcc-4.7.2-mingw32\bin to your PATH environment variable. Most notable changes in 4.7.2 compared to 4.7.1 is the support of a new configure option --with-avrlibc that implements a better integration of AVR-Libc with avr-gcc: AVR-Libc supplies optimized versions of support functions that traditionally live in libgcc. --with-avrlibc makes sure that always the optimized versions from AVR-Libc are used. Hi, Thanks for the post. I noticed some peculiarities in the latest version specially regard to FLASH section. The compiler is throwing out errors when PROGMEM attribute is provided. unsigned char PROGMEM P_gu8_nlup[] dvr.c:205:40: error: variable 'P_gu8_nlup' must be const in order to be put into read-only section by means of '__attribute__((progmem))' The error clears if 'const' is placed before 'PROGMEM'. unsigned char const PROGMEM P_gu8_nlup[] Wondering whether there is any change in the latest version. The change is already in the 4.6 release series, see the 4.6 release notes and caveats: http://gcc.gnu.org/gcc-4.6/changes.html#avr ___ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org https://lists.nongnu.org/mailman/listinfo/avr-gcc-list
Re: [avr-gcc-list] External 256K FLASH - memory pointer
Hi, 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. Use a 32-bit unsigned integer and a typedef as it has been suggested and You're done. It would be foolish to move on to C++ in an existing project. For fun You can try to translate Your code with avr-g++. It should compile and library functions seem to work even without declaring them as extern C, but may have side effects. Most of the language core is backward compatible to C. Many stereotypes exist about the inefficiency of C++ and some of them contain a grain of truth. Try it Yourself and have a deep look into Stroustrup's The C++ programming language, which is worth every cent. The following code example may look dumb, because it does nothing really interesting. But the point is: By defining all those operators manually You gain full control over type conversion and You can not mix up internal and external addresses. Many operators are missing, so take it as a hint for further experiments. // Everything related to address calculation and conversion class ExtFlashAddr { public: // ExtFlashAddr myAddr = ExtFlashAddr(0x4711) inline explicit ExtFlashAddr(uint32_t address = 0); // Copy constructor inline ExtFlashAddr(const ExtFlashAddr other); // ExtFlashAddr myAddr = otherAddr inline ExtFlashAddr operator=(const ExtFlashAddr other); // myAddr++ inline ExtFlashAddr operator++(); friend ExtFlashAddr operator+(const ExtFlashAddr, const ExtFlashAddr); private: uint32_t addr; }; inline ExtFlashAddr operator+(const ExtFlashAddr addr1, const ExtFlashAddr addr2); // Access functions class ExtFlashTools { public: static void read(void* dst, const ExtFlashAddr src, size_t size); static void erase(const ExtFlashAddr src, size_t size); static void write(const ExtFlashAddr dst, void const* src, size_t size); }; ExtFlashAddr::ExtFlashAddr(uint32_t address) { this-addr = address; } ExtFlashAddr::ExtFlashAddr(const ExtFlashAddr other) { this-addr = other.addr; } ExtFlashAddr ExtFlashAddr::operator=(const ExtFlashAddr other) { this-addr = other.addr; return *this; } ExtFlashAddr ExtFlashAddr::operator++() { addr++; return *this; } ExtFlashAddr operator+(const ExtFlashAddr addr1, const ExtFlashAddr addr2) { return ExtFlashAddr(addr1.addr + addr2.addr); } The code above should be optimized away with -Os. ___ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org https://lists.nongnu.org/mailman/listinfo/avr-gcc-list