Serial Bootloader and S-Record Files - Questions
‎02-20-2006
12:03 PM
7,939 Views

MichaelA
Contributor I
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey,
I need to implement a serial flash programming feature on the HCS12XDP512 to allow in-field software updates with basic PC utilities (ie just hyper terminal). I have read AN2153 (A Serial Bootloader for Reprogramming FLASH Memory), and think that it should work for what I am after; however, I have a few questions that I would like to get clarified, since I have never worked with FLASH directly nor S-Records.
From what I understand, the bootloader is uploaded onto the target MCU; then after that a project that is compiled in CodeWarrior produces a *.s19 file, that should be transmitted to the MCU using a serial connection (ie, through HyperTerminal). What bugs me, though, is that the *.s19 file for my application is only 23kB! I find it hard to believe that all the code I've written has been bogged down into just 23kB of s-records. There also are other files in the /bin directory, such as a *.abs (which is 389kB), *.phy, and *.map. Do these have anything to do with programming the FLASH through a serial connection?
I also think I understand that I have to create a secondary vector table in my actual application, since the bootloader uses the main vector table. Is there also any extra precautions that need to be taken with the XGATE?
Thanks for any input on the subject.
- Michael
6 Replies
‎02-23-2006
04:17 PM
1,649 Views

MichaelA
Contributor I
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Stu/Alban,
Not a bad idea to use AN2546 as a base and write your own routines for reading in the S-Records through an SCI.
Thanks for the suggestions!
- Michael
‎02-21-2006
01:27 PM
1,649 Views

MichaelA
Contributor I
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Alban, thanks for the reply - it def. cleared a few things up.
I am now in the process of trying to compile the assembly bootloader given in AN2153. However, it does compile nicley in CodeWarrior. I'm currently using CodeWarrior 5.7 with the S12XDP512. It gets hung up with the 'opt lis' line (2nd line of code), with the error: Not a hc12 instruction or directive. I'm not quite sure what this does, as this is my first time looking at HCS12 assembly.
Also, it does not like the fact that the macro switch and offset are being redefined (is this because the bootloader code is old and the new assembler already has these macros defined, so therefore I should leave out the definition from the code?).
I would really like to get this to work, so if anyone has used this on a hcs12, please let me know what you had to do to get it working.
Thanks again!
- Michael
‎02-23-2006
12:29 PM
1,649 Views

Stu
Contributor I
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Michael/Alban,
Im am currently going through exactly the same process and am finding CodeWarrior Is moaning like hell about the source supplied with AN2153 an as my knowledge of assembler is rubbish Im a bit stuck. Conveniently with the S08 some considerate person at Freescale built bootloader project for CodeWarrior. Does such a thing exists already for the S12?
Any help would be greatly appreciated.
Thanks
Stuart
‎02-23-2006
12:56 PM
1,649 Views
Alban
Senior Contributor II
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Stuart,
A good friend advised me the AN2546 - HCS12 Load RAM and Execute Bootloader User Guide with its software AN2546SW.zip for your S12.
Alban.
Message Edited by Alban on 02-23-2006 11:57 AM
‎02-24-2006
11:59 AM
1,649 Views

Stu
Contributor I
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Cheers Alban,
I'll give it a blast.
PS sunnys rock!
‎02-20-2006
01:08 PM
1,649 Views
Alban
Senior Contributor II
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Michael,
You can consider the S-Record as being a snapshot or exact image of the memory to be programmed. As there is added checksum and address information, it means your code will be smaller than 30KB. Maybe some of your code was not compiled/linked.
The ABS file contains debugging info for HiWave debugger, that's why it is much bigger.
The MAP file indicated memory used, it's a good place to start to see if all your functions are implemented. It only gives info and is not required/helpfull for the programmer. I enclosed a file which includes description of the S-Record constitution.
The S-Record is the only file you need to program your soft into the S12X.
Oups, need to edit the post, only replied to half the questions 

The XGate is like a second core, therfore it does need its own vector table. Extra precautions are multiple because it's another core. For instance it is general practise to execute the XGate code from RAM to use it at its full potential. For this effect, the code is stored in Flash and copied to RAM during initialization.
Cheers,
Alban.
Message Edited by Alban on 02-20-2006 12:12 PM
Message Edited by t.dowe on 2009-10-20 11:51 PM
