<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">I have a block of parameters that I want to place in FLASH memory at a known location, say the last block of FLASH so that I can read and write it later. (these processors don’t have EEPROM but you can use a page of FLASH as an adequate replacement for internal configuration parameter storage at the cost of halting the bus until the writes complete)<div><br></div><div>It needs to be on a page boundary, because the FLASH is erased in 2K pages. </div><div><br></div><div>Since gcc doesn’t allow syntax like:</div><div><br></div><div>static volatile const PARAM_T fu @ 0x000FF800;</div><div>static volatile const PARAM_T fu __attribute__((at(0x000FF800)))</div><div>or</div><div>static volatile const PARAM_T fu __at__ 0x000FF800</div><div><br></div><div>I have to use the linker script to push the structure to the target location. The STM32F4 BSP has a set of scripts but there is a lot of existing thought that I don’t want to violate.</div><div><br></div><div><br></div><div><div style="margin: 0px;"><span style="color: rgb(0, 0, 0); font-family: Sabon;">Is it possible to add a project specific linker script so that I can place a struct at a particular FLASH location without triggering the </span> .unexpected_sections portion of linkcmds.base? I’ve tried a few things, but the trick escapes me.</div><div style="margin: 0px;"><br></div><div style="margin: 0px;">Thanks,</div><div style="margin: 0px;">Andrei</div><div style="margin: 0px;"><br></div><div style="margin: 0px;"><br></div><div style="margin: 0px;"><br></div><div style="margin: 0px;">Typical lame attempt:</div><div style="margin: 0px;"><br></div><div style="margin: 0px;"><br></div><div style="margin: 0px;"><br></div><div style="margin: 0px;"><div style="margin: 0px; font-family: 'Courier New'; color: rgb(147, 26, 104);"><b>typedef</b><span style="color: #000000"> </span><b>struct</b><span style="color: #000000"> {</span></div><div style="margin: 0px; font-family: 'Courier New'; color: rgb(0, 97, 65);"><span style="color: rgb(0, 0, 0);"><span class="Apple-tab-span" style="white-space:pre">             </span></span>uint8_t<span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(3, 38, 204);">filler</span><span style="color: rgb(0, 0, 0);">[2048</span><span style="color: rgb(0, 0, 0);">];</span></div><div style="margin: 0px; font-family: 'Courier New'; color: rgb(0, 97, 65);"><span style="color: #000000">} </span>PARAM_PAGE_T<span style="color: #000000">;</span></div><div style="margin: 0px; font-family: 'Courier New'; color: rgb(0, 97, 65);"><span style="color: #000000"><br></span></div><div style="margin: 0px; font-family: 'Courier New';"><span style="color: #931a68"><b>static</b></span> <span style="color: #931a68"><b>volatile</b></span> <span style="color: #006141">PARAM_PAGE_T</span> flashParamsPage <span style="color: #931a68"><b>__attribute__</b></span>((section(<span style="color: #3933ff">".</span><span style="text-decoration: underline ; color: #3933ff">params</span><span style="color: #3933ff">"</span>))) ;</div><div><br></div><div><div style="margin: 0px; font-size: 11px; font-family: Monaco;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Monaco;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Monaco;">MEMORY {</div><div style="margin: 0px; font-size: 11px; font-family: Monaco;"><span class="Apple-tab-span" style="white-space:pre">    </span>PARAM_INT : ORIGIN = 0x000FF800, LENGTH = 2k</div><div style="margin: 0px; font-size: 11px; font-family: Monaco;">}</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; min-height: 15px;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Monaco;">SECTIONS {</div><div style="margin: 0px; font-size: 11px; font-family: Monaco;"><span class="Apple-tab-span" style="white-space:pre"> </span>.params : {</div><div style="margin: 0px; font-size: 11px; font-family: Monaco;"><span class="Apple-tab-span" style="white-space:pre">             </span>*(.params)</div><div style="margin: 0px; font-size: 11px; font-family: Monaco;"><span class="Apple-tab-span" style="white-space:pre">      </span>} > PARAM_INT</div><div style="margin: 0px; font-size: 11px; font-family: Monaco;">}</div></div></div><div style="margin: 0px;"><br></div><div style="margin: 0px;"><br></div><div style="margin: 0px; font-family: 'Courier New'; color: rgb(78, 144, 114);"><span style="color: #000000"><br></span></div><div style="margin: 0px; font-family: 'Courier New'; color: rgb(78, 144, 114);"><br></div><div><br></div>
<br></div></body></html>