SW checksums and S-Records when uploading code to targets
02-22-2007
10:33 AM
7,099件の閲覧回数

AndersJ
Contributor IV
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Hi,
Working with a bootloader I started thinking about checksumming an entire application, to ensure the full program is downloaded into the the target via the bootloader.
Question 1:
Is there a way to automatically generate, and/or add a checksum to the firmware so a check can be made that the S-Record file is intact before committing to erase and reprogram the target.
Follow up:
Every line of an S-Record has a checksum, which is fine.
But, how do you make sure ALL lines of the S-Record file are in the file?
It is an editable file, and a line may have been lost?
Thanks for any and all comments,
Anders J
9 返答(返信)
02-28-2007
02:45 PM
2,642件の閲覧回数

sjmelnikoff
Contributor III
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
AndersJ wrote:...Is there a way to automatically generate, and/or add a checksum to the firmware so a check can be made that the S-Record file is intact before committing to erase and reprogram the target....Every line of an S-Record has a checksum, which is fine.But, how do you make sure ALL lines of the S-Record file are in the file?It is an editable file, and a line may have been lost?
You could do it like this:
- Use the 'FILL' command in the linker file (for HCS12; may be different for ColdFire), to ensure that the S-Record file always contains the same amount of data, regardless of the size of your code.
- Write a utility to process the S-Record file. Because the whole (flash) memory space is always covered, you always know the order in which the S-Records will appear, which is of particular relevance if you're using an HCS12 with banked memory.
- Compute a checksum over the whole memory space, and insert it into the code.
- Given that the S-Record format is quite inefficient, you might want to convert to a simple binary format, perhaps with a header at the start, and a checksum at the end, perhaps with encryption as well, if desired.
Steve.
02-22-2007
10:42 AM
2,642件の閲覧回数

peg
Senior Contributor IV
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Hmmm.....
You would have to loose EXACTLY a whole line, quite unlikely.
Checksum the checksums????
02-22-2007
10:37 AM
2,642件の閲覧回数

CrasyCat
Specialist III
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Hello
This depends on the processor you are targeting and on the version of CodeWarrior you are using.
- Which CPU are you targeting (HC08, HC12, Coldfire, ..)
- Which version of CodeWarrior are you using?
To retrieve that info:
- Start CodeWarrior
- Select Help -> About Freescale CodeWarrior
- Click on "Install Products"
- CodeWarrior version used is displayed on top in the Installed Products dialog.
- Which version of CodeWarrior are you using?
To retrieve that info:
- Start CodeWarrior
- Select Help -> About Freescale CodeWarrior
- Click on "Install Products"
- CodeWarrior version used is displayed on top in the Installed Products dialog.
CrasyCat
02-22-2007
10:46 AM
2,642件の閲覧回数

AndersJ
Contributor IV
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Sorry, some people never learn, do they?
HCS12 and CW3.1
Anders
02-22-2007
10:53 AM
2,642件の閲覧回数

CrasyCat
Specialist III
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Hello
CodeWarrior for HCS12 includes a checksum computation feature.
Check in "{}Install}\help\pdf\Manual_SmartLinker.pdf", chapter "Linking Issues" section "Checksum Computation".
There are also sample project using Checksum computation in directory
{Install}\(CodeWarrior_Examples)\HC12\Checksums
Please note that if you have banked code in your application, you cannot compute checksum over page boundary. You need to evaluate checksum of each page separately.
I hope this helps.
CrasyCat
02-22-2007
08:58 PM
2,642件の閲覧回数

GonzaloVictorio
Contributor I
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
I've done MainApp checksumming with the products I've worked on. We created an application that calculates the checksums and inserts it into the "update" file. We also use that for joining the bootloader and mainapp applications.
I wouldn't mess doing checksums with S19 files... is a lot easier getting checksums and reprogram a product using raw binary files. Actually I don't generate S19 files after linking... but binaries.
02-23-2007
06:02 AM
2,642件の閲覧回数

AndersJ
Contributor IV
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
How do you generate binaries?
For a banked memory application?
Anders
02-27-2007
08:56 AM
2,642件の閲覧回数

CrasyCat
Specialist III
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Hello
Just my 10 cents on that topic.
I would not recommend using binary files for HCS12 banked application.
A binary file does not include any address information.
And keep in mind address space for HCS12 is not linear.
You cannot map that in a raw binary file.
CrasyCat
02-23-2007
07:48 PM
2,642件の閲覧回数

GonzaloVictorio
Contributor I
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
For generating binaries I basically modified the .bbl file of the project:
OPENFILE "%ABS_FILE%.bin"
format=binary
busWidth=1
origin=0x7c00
len=0x6600
undefByte=0xff
SENDBYTE 1 "%ABS_FILE%"
CLOSE
format=binary
busWidth=1
origin=0x7c00
len=0x6600
undefByte=0xff
SENDBYTE 1 "%ABS_FILE%"
CLOSE
You can have more than one bbl file; for instance I have one for the Bootloader targets and one for the MainApp targets... your target will use the one that is selected as part of the target (using the Files tab).
I compile the code using the -Ms option and have quite a few segments defined in the .prm file for all the memory areas that I use for boot and mainapp.
Hope this helps!
btw: I use CW v5.1 for HC08
