From: John M. <ato...@gm...> - 2010-11-10 00:36:21
|
On Tue, Nov 9, 2010 at 2:19 PM, Kevin Schoedel <sch...@kw...> wrote: > At 9:35 pm +0100 2010/11/09, you wrote: > >If i remember correctly, when i worked with CodeWarrior for the HC08s, > >placing a const qualifier directly meant placing the data in ROM > > That's fine when you have a single address space, but on the AVR, you'd > have to fake one in software, which would be fatal for performance. > Consider for example: > > &a[0] is an address in RAM, but, if you magically put any object declared > const into ROM, &b[0] is a an address in flash. How is f() supposed to deal > with that? > This could be taken care of with generic pointers similar to the ones 8052 compilers like Keil and SDCC have. It wouldn't be pretty or very efficient but nether would it be fatal. When users require more efficiency they explicitly qualify the pointer parameter which would then *only* allow them to use the specific type qualified object as an argument. Also, this problem would happen even with explicitly qualified types. So without a generic pointer the compiler would throw an error either way. >However how > >should we treate inline strings like printf("hello")? place them in ROM by > >default? because declaring a ptr for each string similar to what gcc does > >is a bit insane. > > In principle, you could have an optimization pass that would, for instance, > replace __builtin_printf(const char *, ...) with __builtin_printf(__flash > const char *, ...) while placing the format string in ROM. To do much more > than that, for C, sounds to me like a large research project. > > >I'm going to ask about this to a friend who is a compiler expert, and i'll > >reply about his thoughts, probably during this weekend, im very busy these > >days. > > Until 2004, I did commercial compiler work on quite a few oddball > processors that would make the AVR look like a model of simplicity. These > days I'm doing compiler work professionally again, which means I'm not > really inclined to do it recreationally as well, but I'm usually happy to > comment. Obviously all the real decisions, especially on what's worth > spending time on, need to be made by the people actually spending their > time doing the work. > > -- > Kevin Schoedel <sch...@kw...> VA3TCS > > > ------------------------------------------------------------------------------ > The Next 800 Companies to Lead America's Growth: New Video Whitepaper > David G. Thomson, author of the best-selling book "Blueprint to a > Billion" shares his insights and actions to help propel your > business during the next growth cycle. Listen Now! > http://p.sf.net/sfu/SAP-dev2dev > _______________________________________________ > avr-llvm-devel mailing list > avr...@li... > https://lists.sourceforge.net/lists/listinfo/avr-llvm-devel > |