[Top][All Lists]

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

[avr-gcc-list] Porting code to/from codevision

From: Peter Harrison
Subject: [avr-gcc-list] Porting code to/from codevision
Date: Thu, 24 Nov 2005 00:15:26 +0000
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)


I have recently started to experiment with WinAVR with a view to moving my code from CodeVision. I have no problem with CodeVision and have found it a delight to use but I want the code to be available without expecting the user(s) to pay for a commercial compiler. Equally, a user with CodeVision should not be disadvantaged either.

Well, I got most stuff done and sorted out the hardware access and, as far as I can see, the AVRGCC way of doing IO will work unchanged on CodeVision. My application compiles and links just fine and will run under AVR studio.

Now, the question of how to deal with data in flash arises. I can redo the code to make sure that things like bitmaps, lookup tables and menu strings all sit neatly in flash. CVAVR, of course makes this trivial by recognising the location of data and generating suitable code.

My question, at last, is: Does anyone have pointers to how I might best arrange things so that the code will compile both in AVRGCC and CVAVR - or am I better not trying?

Specifically, I have a largeish lookup table (4k) and menu data (titles, function pointers etc) to deal with. I have considered using a macro for the data access so that I can write

value = READ_FLASH_BYTE(addr);

and define the macro as null in CVAVR or as required by AVRGCC. However, I am less sure about the declarations and can't get my head round a suitable dodge.

Just to make things more awkward, I may well want this code to compile with the ARM and H8 GCC compilers. On the PC, I simply have a macro that defines 'flash' as null and the code compiles just fine.

Is this overdoing the portability thing?

Pete Harrison

reply via email to

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