<?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>[MDK412] Automatic checksum calculation and insertion</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/39007/mdk412-automatic-checksum-calculation-and-insertion</link><description> 
I&amp;#39;ve downloaded the evaluation versin of uVision 4 and wondering
if it is suitable for a project that we will be starting soon. 

 
The SRS of the project states that the application must be broken
into two parts: 
Bootloader(8K Max) 
Application(56K</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: [MDK412] Automatic checksum calculation and insertion</title><link>https://community.arm.com/thread/78743?ContentTypeID=1</link><pubDate>Thu, 21 Oct 2010 11:22:24 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:995659aa-e674-4e7c-86d5-c2f657f0052a</guid><dc:creator>Steven W</dc:creator><description>&lt;p&gt;&lt;p&gt;
Thanks everyone, I wrote a small app which loads a .hex file, pads
to the size of the flash in the chip and then enters the checksum in
the last 4 bytes.&lt;/p&gt;

&lt;p&gt;
Thanks to JTAG, during development only the used part of the code
is flashed to the device (happy developer) but release versions gets
the full flash + crc.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [MDK412] Automatic checksum calculation and insertion</title><link>https://community.arm.com/thread/104338?ContentTypeID=1</link><pubDate>Thu, 21 Oct 2010 04:40:34 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:0f7003a8-bae3-415d-bb75-35bc9c571b70</guid><dc:creator>Per Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
For download files, I normally have a header at the start, to
allow the boot loader to spit and complain instantly if someone tries
to send a binary that is intended for a different hardware platform,
or to warn about potential incompatible downgrades etc.&lt;/p&gt;

&lt;p&gt;
For stored binary, I normally have a block at the end, which
allows the start to begin with an interrupt table or similar. If the
memory architecture of the platform is complicated, I may store an
index to extra information at a fixed location somewhere in the early
part of the binary - for example directly after the last interrupt
vector.&lt;/p&gt;

&lt;p&gt;
One thing with a CRC stored at the end of a memory block is that I
can have the boot loader compute the CRC for the full block and
expect it to end up with the value 0. This is a bit simpler than
computing the CRC for everything but the CRC and then compare with
the stored CRC.&lt;/p&gt;

&lt;p&gt;
I normally do want all bytes checksummed, even if there are unused
parts of the flash. If they suddenly changes contents then either the
program has a bug trigging IAP flash overwrites, or there is
something wrong with the flash (maybe device running at too high
temperatures) and more bits are likely to fail soon.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [MDK412] Automatic checksum calculation and insertion</title><link>https://community.arm.com/thread/58793?ContentTypeID=1</link><pubDate>Thu, 21 Oct 2010 02:37:29 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:3393ffd8-05e2-4a3e-9a89-99df82d3eaf3</guid><dc:creator>Mike Kleshov</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;Or is there another application that can take the resulting
file and calculate the checksum?&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
There is one. It&amp;#39;s called SRecord:&lt;/p&gt;

&lt;p&gt;
&lt;a href="http://srecord.sf.net"&gt;http://srecord.sf.net&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;
Have a look at the srec_cat program. It can do lots of nifty
things, including adding a checksum to an image.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [MDK412] Automatic checksum calculation and insertion</title><link>https://community.arm.com/thread/78739?ContentTypeID=1</link><pubDate>Thu, 21 Oct 2010 01:10:36 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:2fe66da3-27b3-4e06-8bd6-5406061b95b4</guid><dc:creator>Martin Unger</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hello Steven, hello Per,&lt;/p&gt;

&lt;p&gt;
in some project I used the following solution: I defined a
header-structure with&lt;br /&gt;
markers which is at the beginning of the loaded image. so the
bootloader (&amp;quot;bootware&amp;quot;) can&lt;br /&gt;
verify this header - in fact is searches for it at the possible start
positions&lt;br /&gt;
of the application (&amp;quot;firmware&amp;quot;).&lt;/p&gt;

&lt;p&gt;
Some tool SW is needed to modify the image after linking, in my
case the hex file.&lt;/p&gt;

&lt;p&gt;
Advantages over a simpler solution:&lt;br /&gt;
- several rom sections can be checked&lt;br /&gt;
- checksum calculation only for the used areas saves time&lt;br /&gt;
- only used areas have to be flashed (happy developer)&lt;br /&gt;
- additional embedding of version information at a known location&lt;/p&gt;

&lt;p&gt;
Example (cut out of startup for a STR710):&lt;/p&gt;

&lt;pre&gt;
__startup       PROC
                LDR     PC,Reset_Addr   ; jump to entry point
                ENDP
                ; This is the header which is needed by bootware to detect a valid loaded firmware image
                DCD     0xAAAAAAAA      ; marks header start
                DCB     0x01            ; set to 1 to indicate Firmware
                DCB     FW_VERSION_MAIN ; Version Main
                DCB     FW_VERSION_SUB  ; Version Sub
                DCB     FW_VERSION_REL  ; Version Release
                DCD     Vectors         ; start of checksummed area
                DCD     0               ; length of checksummed area in bytes (inserted by CRCHex)
                DCD     0               ; checksum (inserted by CRCHex)
                DCD     0x60000000      ; start of checksummed area
                DCD     0               ; length of checksummed area in bytes (inserted by CRCHex)
                DCD     0               ; checksum (inserted by CRCHex)
                DCD     0xAAAAAAAA      ; marks header end

Vectors         PROC
                LDR     PC,Reset_Addr   ;  0
&lt;/pre&gt;

&lt;p&gt;
Note header itself is not checksummed in the shown example.&lt;/p&gt;

&lt;p&gt;
Regards, Martin&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [MDK412] Automatic checksum calculation and insertion</title><link>https://community.arm.com/thread/58794?ContentTypeID=1</link><pubDate>Wed, 20 Oct 2010 11:39:46 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:779ea4a3-d9d6-4d24-b567-02414b96a0b2</guid><dc:creator>Per Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
If you convert the file to binary format, then it&amp;#39;s easy to
compute the CRC and then extend the bin file with some optional pad
bytes and the CRC value. Easiest is to make the bin file the maximum
size allowed for the program, and to store the CRC value in the last
two or four bytes.&lt;/p&gt;

&lt;p&gt;
Note that if the boot loader CRC is wrong, then the boot loader
may not be able to compute the CRC at all - it may compute the wrong
value or totally fail to run at all. So it&amp;#39;s hard for the boot loader
to enter any safe mode - all you can do is to try to make it harder
for it to leave any safe mode in case everything isn&amp;#39;t 100%
perfect.&lt;/p&gt;

&lt;p&gt;
If seeing the problem as avoiding the boot loader to leave safe
mode, you can design a solution with hardware locks, where the boot
loader has to present &amp;quot;keys&amp;quot; to allow it to access other parts of
hardware.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>