<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
Ano přesně tak to dělám, mám rutinu v bootloader, která umí
zapisovat a pak ji volám z aplikace.<br>
Dokonce mám tam dvě stejné, abych mohl vyměnit i celý kód botlooader
včetně rutiny.<br>
<br>
Je to dělané tak, že přesně na pevných adresách mám jmp do těch
rutin. A ty rutiny okupuji taky<br>
daný prostor mám pocit 2x 256 bajtů aby to bylo v jednom bloku.<br>
<br>
Nemám to sice pro ATmega328 ale xmegy, ale funguje to dobře. Jen
upozornuji, ze zapisujici rutiny<br>
ma jeste pojistku nejakou hodnotu promene co se predava a ta
potvrzuje ze fakt chci a je nutne mi zapnuty<br>
watchdog na napeti, protoze se mi stavalo, ze se obcas pri poklesu
napajeni pri vypnuti, skocilo do te rutiny<br>
a ta jen tak neco nahodne smazala. Nedela to vzdy, ale tech atxmeg v
tom zarizeni bylo zhruba 200kusu,<br>
tak se to obcas projevilo dokud jsem to takto nevylepsil....<br>
<br>
Zdeněk Aster<br>
<br>
<div class="moz-cite-prefix">Dne 05.11.2021 v 12:03 Jaroslav Buchta
napsal(a):<br>
</div>
<blockquote type="cite"
cite="mid:0e559bca-f224-a2e5-39a0-e5024970aa14@hascomp.cz">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<div class="moz-cite-prefix">Neni resenim uprevit bootloader,
vytvorit si v nem funkci, ktera bude zapisovat nekam do FLASK a
volat jiz normalne z programu? Z</div>
<div class="moz-cite-prefix">Z fora:</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">
<p style="margin-top: 0px; margin-right: 0px; margin-bottom:
var(--s-prose-spacing); margin-left: 0px; padding: 0px;
border: 0px; font-style: normal; font-variant-ligatures:
normal; font-variant-caps: normal; font-variant-numeric:
inherit; font-variant-east-asian: inherit; font-weight: 400;
font-stretch: inherit; line-height: inherit; font-family:
-apple-system, BlinkMacSystemFont, "Segoe UI",
"Liberation Sans", sans-serif; font-size: 15px;
vertical-align: baseline; box-sizing: inherit; clear: both;
color: rgb(35, 38, 41); letter-spacing: normal; orphans: 2;
text-align: left; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255,
255, 255); text-decoration-thickness: initial;
text-decoration-style: initial; text-decoration-color:
initial;">Solution: Install a bootloader that does allow you
to run functions that enable you to write to flash.</p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom:
var(--s-prose-spacing); margin-left: 0px; padding: 0px;
border: 0px; font-style: normal; font-variant-ligatures:
normal; font-variant-caps: normal; font-variant-numeric:
inherit; font-variant-east-asian: inherit; font-weight: 400;
font-stretch: inherit; line-height: inherit; font-family:
-apple-system, BlinkMacSystemFont, "Segoe UI",
"Liberation Sans", sans-serif; font-size: 15px;
vertical-align: baseline; box-sizing: inherit; clear: both;
color: rgb(35, 38, 41); letter-spacing: normal; orphans: 2;
text-align: left; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255,
255, 255); text-decoration-thickness: initial;
text-decoration-style: initial; text-decoration-color:
initial;">Here is a bootloader (featured on hackaday) for an
arduino that allows you to write to flash memory during
runtime<span> </span><a
href="http://majek.mamy.to/en/writing-to-internal-flash-on-arduino/"
rel="nofollow noreferrer" style="margin: 0px; padding: 0px;
border: 0px; font-style: inherit; font-variant: inherit;
font-weight: inherit; font-stretch: inherit; line-height:
inherit; font-family: inherit; font-size: 15px;
vertical-align: baseline; box-sizing: inherit;
text-decoration: underline; color: var(--theme-link-color);
cursor: pointer; user-select: auto;" moz-do-not-send="true"
class="moz-txt-link-freetext">http://majek.mamy.to/en/writing-to-internal-flash-on-arduino/</a></p>
<p style="margin: 0px; padding: 0px; border: 0px; font-style:
normal; font-variant-ligatures: normal; font-variant-caps:
normal; font-variant-numeric: inherit;
font-variant-east-asian: inherit; font-weight: 400;
font-stretch: inherit; line-height: inherit; font-family:
-apple-system, BlinkMacSystemFont, "Segoe UI",
"Liberation Sans", sans-serif; font-size: 15px;
vertical-align: baseline; box-sizing: inherit; clear: both;
color: rgb(35, 38, 41); letter-spacing: normal; orphans: 2;
text-align: left; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255,
255, 255); text-decoration-thickness: initial;
text-decoration-style: initial; text-decoration-color:
initial;">Here is the hackaday post on the subject<span> </span><a
href="https://hackaday.com/2015/07/03/arduinos-and-other-avrs-write-to-own-flash/"
rel="nofollow noreferrer" style="margin: 0px; padding: 0px;
border: 0px; font-style: inherit; font-variant: inherit;
font-weight: inherit; font-stretch: inherit; line-height:
inherit; font-family: inherit; font-size: 15px;
vertical-align: baseline; box-sizing: inherit;
text-decoration: underline; color: var(--theme-link-color);
cursor: pointer; user-select: auto;" moz-do-not-send="true"
class="moz-txt-link-freetext">https://hackaday.com/2015/07/03/arduinos-and-other-avrs-write-to-own-flash/</a></p>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Dne 05.11.2021 v 10:58 Martin Hanek
napsal(a):<br>
</div>
<blockquote type="cite"
cite="mid:075d6286-2d0a-eabd-7ff8-903828c3bbf9@hanek.net">Asi
ne: <br>
<a class="moz-txt-link-freetext"
href="https://stackoverflow.com/questions/29732014/how-to-store-data-in-the-flash-memory-of-a-arduino-uno-atmega328p"
moz-do-not-send="true">https://stackoverflow.com/questions/29732014/how-to-store-data-in-the-flash-memory-of-a-arduino-uno-atmega328p</a>
<br>
<br>
Martin Hanek <br>
<br>
Dne 05.11.2021 v 10:50 Admin HWnews napsal(a): <br>
<blockquote type="cite">Zdravim, <br>
<br>
snad jsem uz nejak zmermomocnil praci s MPLAB X ...timto
dekuji vsem kdo mi radili. <br>
<br>
Nicmene krome neveho IDE jsem presel (alespon kvuli jednomu
projektu, kde je jiz hotovy HW) i na Atmega328P, se kterym se
take seznamuji ale samozrejme nemuzu to pojmout cele tak
rychle jak bych chtel. <br>
<br>
Bohuzel narazil jsem v zadani na nutnost ukladat pomerne dost
cfg. dat (ne casto...spis jen v pripade zmeny konfigurace) a
uz ted jsem skoro na 80% cele EEPROM. <br>
<br>
Existuje nejaka moznost ukladat data (promenne) do PROGMEM?
Tedy abych ji mohl pouzivat podobne jako EEPROM? V DS ke
kontroleru je zminena tzv. SPM, ale netusim zda je to jen
otazka v rezimu kdy bezi bootloader nebo je to bezne mozne
pouzit za chodu. <br>
<br>
Pripadne je na to nejaka knihovna v ramci prekladace XC8 v
MPLABu? Asi mam problem se na to googla doptat, ale nic
rozumneho nenachazim...potrebuji aspo nejak postrcit. <br>
<br>
V prekladaci co jsem doted pouzival pro PICy tam podpora byla
a mohl jsem zapisovat do flash. <br>
<br>
Dekuji za nakopnuti. <br>
<br>
RV <br>
_______________________________________________ <br>
HW-list mailing list - sponsored by <a
class="moz-txt-link-abbreviated" href="http://www.HW.cz"
moz-do-not-send="true">www.HW.cz</a> <br>
<a class="moz-txt-link-abbreviated moz-txt-link-freetext"
href="mailto:Hw-list@list.hw.cz" moz-do-not-send="true">Hw-list@list.hw.cz</a>
<br>
<a class="moz-txt-link-freetext"
href="http://list.hw.cz/mailman/listinfo/hw-list"
moz-do-not-send="true">http://list.hw.cz/mailman/listinfo/hw-list</a>
<br>
</blockquote>
<br>
_______________________________________________ <br>
HW-list mailing list - sponsored by <a
class="moz-txt-link-abbreviated" href="http://www.HW.cz"
moz-do-not-send="true">www.HW.cz</a> <br>
<a class="moz-txt-link-abbreviated moz-txt-link-freetext"
href="mailto:Hw-list@list.hw.cz" moz-do-not-send="true">Hw-list@list.hw.cz</a>
<br>
<a class="moz-txt-link-freetext"
href="http://list.hw.cz/mailman/listinfo/hw-list"
moz-do-not-send="true">http://list.hw.cz/mailman/listinfo/hw-list</a>
<br>
</blockquote>
<p><br>
</p>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
HW-list mailing list - sponsored by <a class="moz-txt-link-abbreviated" href="http://www.HW.cz">www.HW.cz</a>
<a class="moz-txt-link-abbreviated" href="mailto:Hw-list@list.hw.cz">Hw-list@list.hw.cz</a>
<a class="moz-txt-link-freetext" href="http://list.hw.cz/mailman/listinfo/hw-list">http://list.hw.cz/mailman/listinfo/hw-list</a>
</pre>
</blockquote>
<br>
</body>
</html>