<?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>structure initialized to a file</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/27825/structure-initialized-to-a-file</link><description> 
Hi, 
I have a structure initialized in a flash 

 
struct DEFSTRUCT const str_default;
 

 
I also have an assembly module which loads a binary file: 

 
 AREA defprog_00111, CODE, READONLY, PREINIT_ARRAY

 EXPORT EXT_Default_profile
EXT_Default_profile</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: structure initialized to a file</title><link>https://community.arm.com/thread/66545?ContentTypeID=1</link><pubDate>Tue, 03 May 2011 04:34:36 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:6768649e-d05c-4d61-84d3-e521844889a8</guid><dc:creator>Scott Douglass</dc:creator><description>&lt;p&gt;&lt;p&gt;
If I understand the question correctly, then I think what you want
is:&lt;/p&gt;

&lt;pre&gt;
extern struct DEFSTRUCT const str_default;
&lt;/pre&gt;

&lt;p&gt;
and&lt;/p&gt;

&lt;pre&gt;
    AREA    defprog_00111, CODE, READONLY, PREINIT_ARRAY

;    EXPORT EXT_Default_profile
;EXT_Default_profile
    EXPORT str_default
str_default
    INCBIN  E:\Aprojects\default_30.bin  ; includes file
    END
&lt;/pre&gt;

&lt;p&gt;
Then the contents of &amp;#39;str_default&amp;#39; are defined by the file
&amp;#39;default_30.bin&amp;#39;.&lt;/p&gt;

&lt;p&gt;
Be careful: having the structure data external to the program
(that is, in a file) is a fragile thing. Any change to the structure
type could invalidate your data file.&lt;/p&gt;

&lt;p&gt;
You might well be better off expressing the structure value as a C
initialization:&lt;/p&gt;

&lt;pre&gt;
struct DEFSTRUCT const str_default = {
   /* ... member values here ... */
};
&lt;/pre&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: structure initialized to a file</title><link>https://community.arm.com/thread/59399?ContentTypeID=1</link><pubDate>Thu, 28 Apr 2011 18:09:20 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:ce6bebbb-77cd-423c-a17d-43b3f7659668</guid><dc:creator>Genp</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;b&gt;I have a structure initialized in a flash&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;
Sorry, I meant &amp;#39;a structure instantiated in a flash&amp;#39;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>