реклама на сайте
подробности

 
 
> Инициализация EEPROM в WinAVR
megaboy
сообщение Sep 17 2010, 05:50
Сообщение #1


Участник
*

Группа: Участник
Сообщений: 34
Регистрация: 30-10-07
Пользователь №: 31 885



Вопрос, собственно, как выключить инициализацию eeprom нулями по умолчанию. Файл *.eep содержит нули
для объявленных переменных eeprom, а нужны значения 0xFF.
Попробывал в скрипте линкера добавить 0xFF в качестве заполнения секции, но это ничего не дало:
Код
  .eeprom  :
  {
    *(.eeprom*)
     __eeprom_end = .;
  }  > eeprom =0xFF

Собственно ранее в файле программы делал так:
Код
struct EEDATA eeprom eep =
{
  .sn = {0xFF, 0xFF, 0xFF, 0xFF},
  .cfg.apn = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
                   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
  .cfg.name = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
                      0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
            0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
            0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
  .cfg.pass = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
           0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
           0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
           0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
};

Но не кашерно, так нужно постоянно отслеживать изменения в размерах элементов данных.
Может кто уже решил эту проблему?
Go to the top of the page
 
+Quote Post
 
Start new topic
Ответов
swisst
сообщение Sep 17 2010, 08:06
Сообщение #2


Частый гость
**

Группа: Свой
Сообщений: 163
Регистрация: 16-02-07
Из: Харьков
Пользователь №: 25 425



может быть как-то так...
Цитата
3.6.8.7 Output Section Fill

You can set the fill pattern for an entire section by using =fillexp. fillexp is an expression (see Expressions). Any otherwise unspecified regions of memory within the output section (for example, gaps left due to the required alignment of input sections) will be filled with the value, repeated as necessary. If the fill expression is a simple hex number, ie. a string of hex digit starting with 0x and without a trailing k or M, then an arbitrarily long sequence of hex digits can be used to specify the fill pattern; Leading zeros become part of the pattern too. For all other cases, including extra parentheses or a unary +, the fill pattern is the four least significant bytes of the value of the expression. In all cases, the number is big-endian.

You can also change the fill value with a FILL command in the output section commands; (see Output Section Data).

Here is a simple example:

SECTIONS { .text : { *(.text) } =0x90909090 }
Go to the top of the page
 
+Quote Post



Reply to this topicStart new topic
2 чел. читают эту тему (гостей: 2, скрытых пользователей: 0)
Пользователей: 0

 


RSS Текстовая версия Сейчас: 23rd July 2025 - 18:02
Рейтинг@Mail.ru


Страница сгенерированна за 0.01383 секунд с 7
ELECTRONIX ©2004-2016