<?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>During Build I need to Generate a structure &amp;amp; write its content to predefined area in the flash</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/31536/during-build-i-need-to-generate-a-structure-write-its-content-to-predefined-area-in-the-flash</link><description> 
Hello Everyone, 

 
I am using Keil uversion4 for writing my embedded program. I have
written a sample program for STM32F437 micro controller(content of
which is not important), after compiling my sample code i am getting
a hex file along with the </description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: During Build I need to Generate a structure &amp; write its content to predefined area in the flash</title><link>https://community.arm.com/thread/120401?ContentTypeID=1</link><pubDate>Wed, 06 Aug 2014 07:53:02 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:7ef024eb-f64e-45bd-8798-cc30b1e31935</guid><dc:creator>Westonsupermare Pier</dc:creator><description>&lt;p&gt;&lt;p&gt;
Dumping out a structure in Intel HEX format might take a few
hundred lines of C, it&amp;#39;s not at all complicated. Simple enough to do
on a 1970-1980 era CPU in assembler.&lt;/p&gt;

&lt;p&gt;
There&amp;#39;s an open source app called &amp;quot;srecord&amp;quot; as I recall, and
probably plenty of other code in the public domain if you need
inspiration.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: During Build I need to Generate a structure &amp; write its content to predefined area in the flash</title><link>https://community.arm.com/thread/107834?ContentTypeID=1</link><pubDate>Wed, 06 Aug 2014 03:29:31 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:1ec03e38-c4a0-4aab-922f-82d1c6be3299</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
If you have read the documentation for the hex file format, then
you would see how trivial it is to dump some binary data into hex
records.&lt;/p&gt;

&lt;p&gt;
You could even use existing programs to do it, if you first
generate your record as a block of binary data, and then use a
program that takes a start offset as a command-line parameter, so it
knows what address range to use when generating the hex data.&lt;/p&gt;

&lt;p&gt;
Most tools do not require the lines in a hex file to be in
strictly increasing address order. So it is normally ok, to add extra
data just before the final line of a hex file - the last line is a
special end-of-file marker so a programming tool can spot a partial
file and complain.&lt;/p&gt;

&lt;p&gt;
It&amp;#39;s even allowed to have lines of different length.&lt;/p&gt;

&lt;p&gt;
The main thing that isn&amp;#39;t allowed is to have overlapping address
ranges.&lt;/p&gt;

&lt;p&gt;
By the way - you haven&amp;#39;t managed to explain why you must have this
extra data first. Quite often, people &amp;quot;must&amp;quot; things just because they
think that they must.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: During Build I need to Generate a structure &amp; write its content to predefined area in the flash</title><link>https://community.arm.com/thread/107846?ContentTypeID=1</link><pubDate>Wed, 06 Aug 2014 03:18:05 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:dc79fd43-26cf-44f1-8b2f-0792cf3726ca</guid><dc:creator>Amit Mahapatra</dc:creator><description>&lt;p&gt;&lt;p&gt;
Thank You Per Westermark.&lt;/p&gt;

&lt;p&gt;
But in my case i need to add some records at the start of the
sector &amp;amp; I will be accessing the structure elements at regular
interval during the execution of my embedded code.&lt;/p&gt;

&lt;p&gt;
If you could suggest me some way to convert the structure to a hex
record, that would of great help.&lt;/p&gt;

&lt;p&gt;
Thanks &amp;amp; Regards,&lt;br /&gt;
Amit mahapatra&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: During Build I need to Generate a structure &amp; write its content to predefined area in the flash</title><link>https://community.arm.com/thread/82062?ContentTypeID=1</link><pubDate>Wed, 06 Aug 2014 03:12:47 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:d8d6d87d-7122-4710-94fc-77076367fdd6</guid><dc:creator>Amit Mahapatra</dc:creator><description>&lt;p&gt;&lt;p&gt;
Thank You Westonsupermare Pier for replying..&lt;/p&gt;

&lt;p&gt;
After going through the Keil support document &amp;quot;How to read Intel
HEX file&amp;quot; i also feel that going with the HEX file will be a more
suitable option, as from the file we can determine the start &amp;amp;
end address of our application.&lt;/p&gt;

&lt;p&gt;
As per my plan in the PC application i would first fetch the start
&amp;amp; end address of the application from the HEX file then create a
structure whose 1st element will hold the entry point to my embedded
application, followed by structure elements that would hold the start
&amp;amp; end addresses.&lt;/p&gt;

&lt;p&gt;
As in a HEX file data are written in horizontal rows known as
&lt;b&gt;record&lt;/b&gt; Now I need to convert this Structure in to records so
that i could write it to the hex file at a predetermined offset
followed by some padding.&lt;/p&gt;

&lt;p&gt;
if you could help me figure out a way to convert the structure in
to hex records, then that would solve my problem.&lt;/p&gt;

&lt;p&gt;
Eagerly waiting for reply.&lt;/p&gt;

&lt;p&gt;
Thanks &amp;amp; regards,&lt;br /&gt;
Amit mahapatra&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: During Build I need to Generate a structure &amp; write its content to predefined area in the flash</title><link>https://community.arm.com/thread/93243?ContentTypeID=1</link><pubDate>Tue, 05 Aug 2014 21:39:52 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:2359924d-d7e7-40c4-9f96-1420d1ea08d9</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
I normally add extra information to the last memory addresses of
the flash - hex files allows address range holes, so having a record
at the end doesn&amp;#39;t make much of the difference in amount of data to
program into the chip.&lt;/p&gt;

&lt;p&gt;
I can then also store some checksum information, to allow both a
boot loader and the main application to verify the validity of the
application.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: During Build I need to Generate a structure &amp; write its content to predefined area in the flash</title><link>https://community.arm.com/thread/63041?ContentTypeID=1</link><pubDate>Tue, 05 Aug 2014 17:32:08 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:d5274d8b-c496-4b96-ab6b-94adbf2a3d71</guid><dc:creator>Westonsupermare Pier</dc:creator><description>&lt;p&gt;&lt;p&gt;
The .HEX file should be easier to parse, the .AXF (ELF) format is
reasonably well documented. Adding data records to the .HEX would
definitely be the simpler route.&lt;/p&gt;

&lt;p&gt;
The Vector table needs to be on a 512 byte boundary, ie
0x08000000, 0x08000200, 0x08000400, etc&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>