Yahoo Groups archive

AVR-Chat

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

Message

IAR - Anyone ?

2005-05-18 by Lasse Madsen

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.