<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Using Flash to save the code and data.How to?</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/42124/using-flash-to-save-the-code-and-data-how-to</link><description> I am using the P89C51RD+ from Philips. I intend to use the flash as follows: 
0x000- 0x1FFF to save the program code.This prohram acquires data from a GPS, processes it and saves it. 
0x2000- 0xFFFF : the processed data ust be saved in this space in</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Using Flash to save the code and data.How to?</title><link>https://community.arm.com/thread/95662?ContentTypeID=1</link><pubDate>Mon, 04 Aug 2003 13:01:06 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:92f96b66-97f4-47f4-885a-5d2726b7c255</guid><dc:creator>Amilcar  Peres</dc:creator><description>&lt;p&gt;Here is a small code that I am using to try save data to a memory position:&lt;br /&gt;
void main(void)&lt;br /&gt;
{&lt;br /&gt;
  unsigned char man_id=45, status=50, teste=55;&lt;br /&gt;
&lt;br /&gt;
  config_timer1();&lt;br /&gt;
  config_serialIO();&lt;br /&gt;
 set_baudrate (4800);&lt;br /&gt;
  //iap_init(11);                                    // initialize IAP Library by specifying&lt;br /&gt;
  //com_initialize ();              /* initialize interrupt driven serial I/O */&lt;br /&gt;
                                        crystal frequency (rounded down to&lt;br /&gt;
                                             // nearest integer)&lt;br /&gt;
  teste = 120;&lt;br /&gt;
             // read manufacturer id&lt;br /&gt;
&lt;br /&gt;
man_id = iap_read_manufacturer_id();&lt;br /&gt;
com_putchar(man_id);&lt;br /&gt;
&lt;br /&gt;
  //status = iap_read_status_byte();                 // read and print status byte&lt;br /&gt;
  // com_putchar(status);&lt;br /&gt;
&lt;br /&gt;
  iap_erase_block(BLOCK_0x2000_0x3FFF);            // erase flash memory from 2000H to 3FFFH&lt;br /&gt;
  iap_erase_block(BLOCK_0x4000_0x7FFF);            // erase flash memory from 2000H to 3FFFH&lt;br /&gt;
  iap_erase_block(BLOCK_0x8000_0xBFFF);            // erase flash memory from 2000H to 3FFFH&lt;br /&gt;
  iap_erase_block(BLOCK_0xC000_0xFFFF);            // erase flash memory from 2000H to 3FFFH&lt;br /&gt;
  printf(&amp;quot;memoria limpa!&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
  while(1){&lt;br /&gt;
&lt;br /&gt;
//  escrever numeros seguidos para posicoes contiguas de memoria.&lt;br /&gt;
  putchar(&amp;quot;Programming memory...\n&amp;quot;);&lt;br /&gt;
 teste++;&lt;br /&gt;
  if (iap_program_data_byte(teste++, 0x2000)!=0)&lt;br /&gt;
  if (teste &amp;gt;= 0xFF) teste = 0;&lt;br /&gt;
  com_putchar(teste);&lt;br /&gt;
  com_putchar(&amp;#39;\n&amp;#39;);&lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using Flash to save the code and data.How to?</title><link>https://community.arm.com/thread/71689?ContentTypeID=1</link><pubDate>Fri, 01 Aug 2003 16:11:11 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:ffef053c-163a-4aee-bf28-9e7b5802b570</guid><dc:creator>Bob Andersen</dc:creator><description>&lt;p&gt;&amp;gt;why not just use FlashMagic.&lt;br /&gt;
&lt;br /&gt;
He&amp;#39;s trying to collect and store data in the flash at run time.   How would you propose to use FlashMagic for this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using Flash to save the code and data.How to?</title><link>https://community.arm.com/thread/95661?ContentTypeID=1</link><pubDate>Fri, 01 Aug 2003 09:18:41 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:f8a1f6aa-b20e-42cd-b6a8-187620fca101</guid><dc:creator>Amilcar  Peres</dc:creator><description>&lt;p&gt;I have found the functions that you mentioned.I am running the example but there is no sign that its working.Do you know how to use the monitor51?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using Flash to save the code and data.How to?</title><link>https://community.arm.com/thread/71684?ContentTypeID=1</link><pubDate>Wed, 30 Jul 2003 02:37:39 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:1c023448-4abb-426d-9904-39d4eb132748</guid><dc:creator>Amilcar  Peres</dc:creator><description>&lt;p&gt;I made those routines based on a aplication note. Le_D_Flash is the same then READ_FROM_FLASH, COPIA_P_FLASH is for COPY_TO_FLASH and APAGAR... is for ERASE_BLOCK.I am sorry for the inconvinence.The comments are writen i portuguese.&lt;br /&gt;
My problem is that when I try to use this functions to save data in the Flash the program does not run! But if I take this functions off it works.&lt;br /&gt;
The difference between RAM and FLASH is that in RAM the data is lost when the power in turned off.In the Flash the proceudre to save is slower but is never lost when power is turned off.&lt;br /&gt;
The link you gave has 3 functions that are alike the ones  I am using but it is still useful, I am working on it.Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using Flash to save the code and data.How to?</title><link>https://community.arm.com/thread/40617?ContentTypeID=1</link><pubDate>Tue, 29 Jul 2003 08:40:10 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:18b9f6e9-b003-4bbc-9253-eb0ce18d1052</guid><dc:creator>erik  malund</dc:creator><description>&lt;p&gt;It is difficult to read your non-english comments and routine names; however &lt;a href="http://www.esacademy.com" target="_blank"&gt;http://www.esacademy.com&lt;/a&gt; has all kinds of routines for the RD2 (&lt;b&gt;skip the RD+, it is discontinued&lt;/b&gt;) to achieve what you want.&lt;br /&gt;
&lt;br /&gt;
It seems to me (again, &amp;quot;reading&amp;quot; non-english)that you do not understand the difference between Flash and RAM, you can not just write to flash, you must erasse before write.&lt;br /&gt;
&lt;br /&gt;
Also it seems (again, &amp;quot;reading&amp;quot; non-english)that you try to do IAP yourself, why not just use FlashMagic.&lt;br /&gt;
&lt;br /&gt;
Erik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>