Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » AVR-GCC
  • » [avr-gcc-list] Porting code to/from codevision [RSS Feed]

#1 Nov. 24, 2005 00:16:04

Peter H.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

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


HiI have recently started to experiment with WinAVR with a view to movingmy code from CodeVision. I have no problem with CodeVision and havefound it a delight to use but I want the code to be available withoutexpecting the user(s) to pay for a commercial compiler. Equally, a userwith CodeVision should not be disadvantaged either.Well, I got most stuff done and sorted out the hardware access and, asfar as I can see, the AVRGCC way of doing IO will work unchanged onCodeVision. My application compiles and links just fine and will rununder AVR studio.Now, the question of how to deal with data in flash arises. I can redothe code to make sure that things like bitmaps, lookup tables and menustrings all sit neatly in flash. CVAVR, of course makes this trivial byrecognising the location of data and generating suitable code.My question, at last, is: Does anyone have pointers to how I might bestarrange 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 forthe data access so that I can writevalue = 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 asuitable dodge.Just to make things more awkward, I may well want this code to compilewith the ARM and H8 GCC compilers. On the PC, I simply have a macro thatdefines 'flash' as null and the code compiles just fine.Is this overdoing the portability thing?

Pete Harrison


_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.orghttp://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Offline

#2 Nov. 24, 2005 02:50:01

David K.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

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


On Nov 23, 2005, at 6:15 PM, Peter Harrison wrote:Specifically, I have a largeish lookup table (4k) and menu data(titles, function pointers etc) to deal with. I have consideredusing a macro for the data access so that I can writevalue = 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 myhead round a suitable dodge.Just to make things more awkward, I may well want this code tocompile with the ARM and H8 GCC compilers. On the PC, I simply havea macro that defines 'flash' as null and the code compiles just fine.Is this overdoing the portability thing?No, thats what macros and include files are all about.In general avr-gcc uses macros to modify data access to FLASH, and tomodify for declaring data stays in FLASH and should not be copied toRAM during startup. Essentially all you have to do is create NULLversions for Codevision or insert whatever special things Codevisionlikes.--
David Kelly N4HHE,
========================================================================
Whom computers would destroy, they must first drive mad.



_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.orghttp://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Offline

  • Root
  • » AVR-GCC
  • » [avr-gcc-list] Porting code to/from codevision [RSS Feed]

Board footer

Moderator control

Enjoy the 20th of January
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support