avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [avr-gcc-list] Re: global variables - II


From: Bernard Fouché
Subject: RE: [avr-gcc-list] Re: global variables - II
Date: Wed, 29 Sep 2004 18:46:14 +0200


-----Message d'origine-----
De : address@hidden
[mailto:address@hidden la part de Stein Haaland
Envoyé : mercredi 29 septembre 2004 13:07
À : address@hidden
Objet : [avr-gcc-list] Re: global variables - II



My problem is not really connected to the EEPROM writing, more
to the definition of global variables, thus the subject.

The code snippet below illustrates the problem. The Port
(on a STK 500) does not sequentially output the character
string as expected; it rather toggles between 0x00 and 0xFF.

I can set the port to any value, using local variables.
Is there anything I have misunderstood in the use of global
variables and avr-gcc ?

----
#  include <avr/io.h>

char text[] = "This is a test";    // test string or uint8 array or...


void wait(uint16_t ms)
{
 ...
 // a multiple do while loop to create a delay. Works !
}



>> If you want to store data in the EEPROM once, you could also build
>> a Intel Hex File ...
>> Bernard
>
>This is my intention - any examples references on how to do this ?

I wrote here a PHP class that do the job, after some google search to get
the format. I can post it if the subject interest the people here.

PHP is great for processing text and now it can be used as a stand alone
script language.

I use PHP to write the .h file giving the embedded applications the offset
to find the requested data in the eeprom and also PHP writes other PHP files
that will be used on the production phase.

The aim is to have a real synchronisation between what gets stored in the
eeprom when the product is made, and what the application expects to find in
the same eeprom.

When I need a new reference in the eeprom, I change a PHP file and run it to
have a new .h and new scripts ready to use to write the eeprom in the
factory.

I compile the application and I'm sure that if it expects for instance, byte
23 of the EEPROM to have a particular parameter, the php scripts in the
factory will store the parameter value at the same position. In fact, I
never hear of 'byte 23'. I just manipulate constants and PHP takes care of
placing them, checking that the eeprom is not full, etc.

That also allows the factory to make a product-by-product configuration, to
store a serial number for instance since the flashing is also done by using
avrdude from PHP.

(End of PHP advocacy :-) )



reply via email to

[Prev in Thread] Current Thread [Next in Thread]