Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: IAR - Anyone ?

2005-05-19 by John Mann

Lasse;

I am new to the group, but fimiliar with the IAR EWB.  I currently 
have a system I am working on in which I have placed data in both 
the FLASH and EEPROM on an MEGA128. If you look at the manual and 
help file for the IAR compiler, they describe multiple ways of 
forcing data to either the FLASH (ie code) memory or the EEPROM if 
there.

Example __flash char Hello {"Hello World"};

The above example should put the constant string into flash memory.

Have a nice day.
John


--- In AVR-Chat@yahoogroups.com, "Lasse Madsen" <lasse.madsen@e...> 
wrote:
> 
> Hi All,
> 
> I'm trying out IAR's embedded workbench version 3.2A for the first 
time 
> and I've stumbled upon some questions which i hope you can help me 
with.
> 
> 1)
> when you write:
> 
> printf("Hello World");
> 
> It seems (or so i think) that IAR stores the string in RAM rather
> than 
> in flash why is this and how can it be changed ?
> 
> 
> 2)
> How do you store variables in flash ?
> 
> writing: 
> 
> const char buffer[]="Hello World";   // is this stored in flash ?
> __flash char buffer[]="Hello World"; // this is stored in flash
> 
> 
> 3)
> If I make a long (1024 bytes) string (array) in flash:
> 
> __flash char string[1024]={...alot of data...};
> 
> And I want to print this to the serial port I do this:
> 
> printf("\r\n%s",string);
> 
> But it does not work...
> 
> So I though I needed a pointer to it... 
> 
> 
> __flash char string[1024]={...alot of data...};
> char __flash *ptr;
> 
> ptr=&string[0];
> printf("\r\n%s",ptr);
> 
> This didn't work either !?
> 
> 4)
> It seems that in the manual there's a function called:
> 
> printf_P for printing from flash but which file must I include to 
use 
> this printf function ? I cant seem to find it?
> 
> Best Regards
> Lasse Madsen
> 
>

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.