AN2295 (HC08/S08 Developer's Serial Bootloader) updated for rev. 9.2 - CF V1 (alpha) support added

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AN2295 (HC08/S08 Developer's Serial Bootloader) updated for rev. 9.2 - CF V1 (alpha) support added

Jump to solution
85,722 Views
ok2ucx
Contributor IV
Dears,

software for Application note AN2295 (HC08/S08 Developer's Serial Bootloader) has been updated recently. Since the last rev. 8 (Aug-2006) several additions and enhancements has been done:
  • S08LC family added
  • S08QE (Flexis) added
  • S08GB/GT family updated for A-family
  • S08EL/SL family added (including EEPROM programming)
  • S08QD family added (with software SCI)
  • S08DZ family added (including EEPROM programming)
  • HC08GR8A corrected
  • S08QG8 corrected
  • hc08sprg.exe master updated
  • simple Windows GUI application added
  • all projects updated for CodeWarrior 6.1
HC08 families supported: AB/AS/AZ, AP, GP32, GR(A), GZ, JKJL, JKJL8, JW32, KX/EY/GT, LB, LJ, MR, QB, QC, QT/QY, SR

S08 families supported: AW, DZ, EL/SL, GB/GT(A), LC, QD, QE, QG, RC/RD/RE/RG, SR

Any comments, reports, suggestions or wishes are more than welcome. Some of the latest bootloaders are still in alpha stage, tested briefly.

Direct download link is here:
http://www.freescale.com/webapp/sps/download/license.jsp?colCode=AN2295SW

Unfortunately accompanying application note AN2295.pdf has not been updated yet (to reflect new protocol variations).

Best regards, Pavel, ok2ucx
Freescale Czech Republic
an2295 developer


Message Edited by ok2ucx on 2008-02-19 04:16 PM
Message Edited by ok2ucx on 2009-08-04 10:37 AM
Labels (1)
1 Solution
33,863 Views
Limestone
Contributor III

Hi Pavel and thanks for your response!

 

It worked like a charm!

 

I changed that line and stopt feeding my watchdog when I wanted to reboot and enter the bootloader.

 

Since I spent alot of time searching for a solution like this on the forum and did not find it, mabey this should be documented in someway :smileyhappy:

 

Best regards

Martin

 

 

View solution in original post

0 Kudos
241 Replies
1,209 Views
TurboBob
Contributor IV

Hello everyone.

 

I am trying to get the bootloader to run on a Coldfire JM64.  No luck so far.

 

1,  my crystal is 8 mhz,  I found the clock setup in target.c,  but after changing that it still will not run,  Windows never sees any USB.

 

2,  I believe I have my Button correctly defined,  I want to use PTA4

 

Anyone else using AN2295 on the CF V1  JM64?  I know this is the 8 bit forum,  the 32 bit guys don't have a AN2295 thread.

 

Thanks!!

 

Bob

0 Kudos
1,209 Views
bigmac
Specialist III

Hello Bob,

 

I assume that the bootloader does not make use of any inline assembly code?  It would then be non-portable.

 

Regards,

Mac

0 Kudos
1,209 Views
TurboBob
Contributor IV

The bootloader has  a CF JM64 USB version,  it appears to be built on the demoboard configuration details.  The clock is hardcoded for a 12 mhz crystal and has LEDs defined like the demoboard stuff.

 

So it should have worked once I changed the MCG stuff.

 

Time to drag the demo board back out I guess.

 

Bob

0 Kudos
1,209 Views
ok2ucx
Contributor IV

Dears,

 

it should definitely work once you touch settings in hc08sprg\src\MCF51JM-USB\Sources\target.c file:

 

static void init_clock(void){ /* Assume 12MHz external clock source connected. */

12MHz is kind of "standard" crystal used in USB applications, definitely on the demo board.

 

Pavel

0 Kudos
1,209 Views
TurboBob
Contributor IV

What are the guidelines for using the interrupt vector options?

 

What memory space (for the application software) or other restrictions are there in the CF/USB version?

 

Thanks,

 

Bob

0 Kudos
1,209 Views
TurboBob
Contributor IV

got out the demo board,  and installed the CF processor.

 

opened up a fresh copy of AN2295,  and built the CF JM/usb project.

 

the version 0 target will not load,  there are errors.  I noticed that there is a line commented relative to flash protection. for one of the targets.  Commented out the other one and now both version 1 and version 0 will load into the processor.

 

But no LED's  No USB activity on the laptop thats plugged into the USB,  the reset LED just flickers.  pushing the button and resetting do nothing.

 

The usb on the demo board works,  as I had the mouse demo running for a bit.

 

Do I have the wrong version of AN2295?  Am I missing something?

 

I am using Codewarrior 6.3

 

Thanks!

 

Bob

0 Kudos
1,209 Views
pavel_krenek
NXP Employee
NXP Employee

Hi all,

 

Could you try to test this version of the bootloader for MCF51JM? Next I attach the new GUI for AN2295 bootloader. I tested both version of the bootloaders and all working OK.

 

If you use the VERSION 0 you must update the lcf file by moving start address of the program to 0x3300 (IN YOUR PROJECT).

 

Regards,

Pavel

 

[Win GUI removed by ok2ucx]

 

[Corrected MCF51JM download to beta-1 version]

0 Kudos
1,209 Views
TurboBob
Contributor IV

are there any other changes required,  like vector redefinition?

 

I will try the new version later today.

 

Bob

0 Kudos
1,209 Views
ok2ucx
Contributor IV

TurboBob wrote:

are there any other changes required,  like vector redefinition?

...



Nothing of this nature. AN2295 is (by design) made so no vector changes are required. Typically, the application must only take care of memory occupied by bootloader itself. Some features (like Flash protection or Flash security on S08 devices) are not fully available - because these are used by bootloader and configuration bytes are typically in the protected area and effectively protecting bootloader.

 

Pavel

0 Kudos
1,209 Views
TurboBob
Contributor IV

that was the version I was trying to use.

 

I tried to get it to run again without success.

 

Are there any updates,  or other people using the Coldfire V1 (JM) version using USB?

 

Bob

0 Kudos
1,209 Views
TurboBob
Contributor IV

loaded up the Beta you asked me to try.

 

It builds.  When I try to load the version_0 using the debugger,  I get a write protect warning.  If I comment out the MY_NVPROT line,  then it "appears to load".    But the software in the CPU has not changed from what was loaded previously.

 

So its something with the debugger (HiWave),  that is not loading the software.

 

I'm using my demo board at the moment,  so the base files (12 mhz) should all work..

 

Have you ever had the debugger act this way?  All the hardware works correctly with the other software/projects.

 

Bob

0 Kudos
1,209 Views
TurboBob
Contributor IV

ok,  I forced the debugger to load the software and I can step it.  (not sure why it was being difficult)

 

With no application loaded,  should it enumerate,  or just run in an Illegal Op loop like the serial stuff.

 

(it does not seem to enumerate the USB,  but I'm just getting it going.)

 

Bob

0 Kudos
1,209 Views
TurboBob
Contributor IV

ok,

 

it seems that a missing application does not automatically kick-start the bootloader,  button required.

 

So I got the USB to trigger the found-new-hardware wizard.

 

Now I need the drivers  (win xp and vista)

 

I'm sure they are posted on here somewhere.

 

(progress!!)

 

Can you describe the advantages/limitations to the version 1 or version 0 settings?

 

Sorry for all the posts,  I'm slowly getting thru all this.

 

Bob

0 Kudos
1,209 Views
TurboBob
Contributor IV

Another update.  Not sure if others are using the CFV1 USB loader yet.  I think I have it working.

 

Version 1 puts the loader firmware at the top of flash,  which can't be protected.

 

Version 0 can be protected so I am using this version.

 

I'm using Processor Expert in my application which puts in its own initializations every time it generates code,  which need to be tweaked before you can bootload the  app.

 

To make the app compatible,  I set the memory limits to avoid the relocated interrupt vectors,  and have the flash start after the bootloaders flash segment allowing extra room for the copy of the vector table.  I then edit cpu.c and comment out the write to vbr  and the setting of the flash protect registers.

 

I am getting a warning when bootloading that there is a memory issue at 803C00 ,  but it seems to load ok.

There are some issues in the project settings,  and I am still having to force the debugger to load it.  But things are looking up.

 

I'm currently testing on the Demo board with a 12mhz crystal.  I will be trying it with the real hardware soon.

 

Bob

N8DRK

0 Kudos
1,209 Views
Nouchi
Senior Contributor II

Hello,

 

 

I found a bug in SpSubBurst CFV1 routine, in some case, the block data length couldn't be a four bytes multiple, which cause (never ending loop) a crash.

I solved this issue below :

 

/*******************************************************************************/ /*********************** FLASH BURST SUBROUTINE ********************************//*********** THIS PART OF SOURCE CODE MUST RUNNING IN RAM ***********************/ SpSubBurst:            move.l  d2,a1               /* SOURCE ADDRESS IN D2 */SpSubBurst1:                            /* LENGTH IN D4, MUST BE MULTIPLE OF 4 */            move.l  (a3),(a1)           /* POINTER TO DATA IN A3 */                   moveq   #mBurstProg,d0      /* BURST COMMAND */                                           move.b  d0,FCMD            move.l  #FSTAT,a4       move.b  #mFSTAT_FCBEF,d1    /* CLEAR FACCER AND FPVIOL */            move.b  d1,(a4)loop3:                  move.b  FSTAT,d0            /* IF COMMAND BUUFER EMPTY FLAG == 0 WAIT */            btst    #FSTAT_FCBEF,d0            beq.s   loop3             addq.l  #4,a1               /* POINTER TO DESTINATION ADDRESS PLUS FOUR BYTES */            addq.l  #4,a3               /* POINTER TO SOURCE ADDRESS PLUS FOUR BYTES */                        subi.l  #4,d4               /* CHECK LENGTH */            cmpi.b  #0,d4//            bne.s   SpSubBurst1            bgt.s   SpSubBurst1     /* loop if positive */loop4:                  move.b  FSTAT,d0                                                      btst    #FSTAT_FCCF,d0                                                      beq.s   loop4 SpSubBurstEnd:            rts

 

 

Emmanuel

 

 

0 Kudos
1,209 Views
Nouchi
Senior Contributor II

Hello,

 

I found something sounds like a datasheet error in MCF51AC family bootloader, the ERBLK_LEN constante was 1024, and needs to be 2048 to works.

The  MCF51AC256RM chapter 4.4.4.4 says 1kb, strange no?

 

0 Kudos
1,209 Views
ok2ucx
Contributor IV

BugMan wrote:

Hello,

 

I found something sounds like a datasheet error in MCF51AC family bootloader, the ERBLK_LEN constante was 1024, and needs to be 2048 to works.

The  MCF51AC256RM chapter 4.4.4.4 says 1kb, strange no?

 


That's obviously documentation bug. Bootloader corrected as well.

Thanks for pointing it out.

 

2048B is the correct Erase page size on 51AC256.

 

Pavel

0 Kudos
1,208 Views
GianniDr
Contributor I

Hello everyone, 
I'm trying to create the code for the bootloader for mc9s08sv16, 
but I have trouble compiling the code as I start "working" for the MCU QG4 
Thank you in advance 

 

Google translator

0 Kudos
1,210 Views
Stipey75
Contributor I

Hello, i'm a newbie in this bootloader section i need some help to understand vector redirection without hw support.

 

I have a bootloader project developed MC9S08QE64 which doesn't have hw vector redirection and an application project, thisi is application prm:

 

 

/* This is a linker parameter file for the mc9s08qe64 */NAMES END /* CodeWarrior will pass all the needed files to the linker by command line. But here you may add your own files too. */SEGMENTS /* Here all RAM/ROM areas of the device are listed. Used in PLACEMENT below. */    Z_RAM                    =  READ_WRITE   0x0080 TO 0x00FF;    RAM                      =  READ_WRITE   0x0100 TO 0x107F;    /* unbanked FLASH ROM */    ROM                      =  READ_ONLY    0x2080 TO 0x7FFF;    //ROM                      =  READ_ONLY    0x2090 TO 0x3FFF;    //ROM                      =  READ_ONLY    0x2080 TO 0x3FFF;  //ORIGINAL VALUE!!        ROM1                     =  READ_ONLY    0xC000 TO 0xFFAD; /* INTVECTS                 =  READ_ONLY    0xFFC0 TO 0xFFFF; Reserved for Interrupt Vectors */    /* banked FLASH ROM */    PPAGE_0                  =  READ_ONLY    0x008000 TO 0x00A08F; /* PAGE partially contained in ROM segment */    //PPAGE_0                  =  READ_ONLY    0x008000 TO 0x00A07F; //ORIGINAL VALUE!!/* PAGE partially contained in ROM segment */    PPAGE_2                  =  READ_ONLY    0x028000 TO 0x02BFFF;     //PPAGE_1                  =  READ_ONLY    0x018000 TO 0x01BFFF; //PAGE already contained in segment at 0x4000-0x7FFF */    //PPAGE_3                  =  READ_ONLY    0x038000 TO 0x03BFFF; //PAGE already contained in segment at 0xC000-0xFFFF */    //PPAGE_3                  =  READ_ONLY    0x038000 TO 0x03BFAD; /* vectors are at 0xFFAE(banked 0x3BFAE*/ //0x03BFFF;*/ /* this is the same like nonbanked 0xC000-0xFFFF */ENDPLACEMENT /* Here all predefined and user segments are placed into the SEGMENTS defined above. */    DEFAULT_RAM                         /* non-zero page variables */                                        INTO  RAM;    _PRESTART,                          /* startup code */    STARTUP,                            /* startup data structures */    ROM_VAR,                            /* constant variables */    STRINGS,                            /* string literals */    VIRTUAL_TABLE_SEGMENT,              /* C++ virtual table segment */    NON_BANKED,                         /* runtime routines which must not be banked */    COPY                                /* copy down information: how to initialize variables */                                        INTO  ROM; /* ,ROM1: To use "ROM1" as well, pass the option -OnB=b to the compiler */        DEFAULT_ROM, PAGED_ROM                           /* routines which can be banked */                                        INTO  PPAGE_0,PPAGE_2,ROM,ROM1;//PPAGE_1,PPAGE_3;    _DATA_ZEROPAGE,                     /* zero page variables */    MY_ZEROPAGE                         INTO  Z_RAM;ENDSTACKSIZE 0xC0//VECTOR 0 _Startup     /* Reset vector: this is the default entry point for an application. */

 

 

Could somebody explain with a simple example how to use vector redirection with jump table ( it seems to that i have to use this way to create a single project )?

 

This under is the bootloader prm ( i have surely to modify it...

 

// This is a linker parameter file for the mc9s08qe128NAMES ENDSEGMENTS Z_RAM   =  READ_WRITE   0x0080 TO 0x00FF; RAM    =  READ_WRITE   0x0100 TO 0x17FF; RAM1   =  READ_WRITE   0x1880 TO 0x207F;  //unbanked FLASH ROM USER_VECT  =  READ_ONLY    0xD7A0 TO 0xD7FF;  //user interrupt vectors USER_DATA  =  READ_ONLY    0xD800 TO 0xDFFF;  //user data BOOT_DATA  =  READ_ONLY    0xE000 TO 0xE01F;  //boot code BOOT_CODE  =  READ_ONLY    0xE020 TO 0xFFAD;  //boot code BOOT_VECT  =  READ_ONLY    0xFFC0 TO 0xFFFF;  //boot interrupt vectors  //banked FLASH ROM PPAGE_0   =  READ_ONLY    0x008000 TO 0x00A07F; //PAGE partially contained in ROM segment //PPAGE_1  =  READ_ONLY    0x018000 TO 0x01BFFF; //PAGE already contained in segment at 0x4000-0x7FFF PPAGE_2   =  READ_ONLY    0x028000 TO 0x02BFFF;  //PPAGE_3  =  READ_ONLY    0x038000 TO 0x03BFFF; //PAGE already contained in segment at 0xC000-0xFFFF PPAGE_4   =  READ_ONLY    0x048000 TO 0x04BFFF;  PPAGE_5   =  READ_ONLY    0x058000 TO 0x05BFFF;  PPAGE_6   =  READ_ONLY    0x068000 TO 0x06BFFF;  PPAGE_7   =  READ_ONLY    0x078000 TO 0x07BFFF; ENDPLACEMENT DEFAULT_RAM    INTO  RAM,RAM1; ISR_USER      //    INTO  USER_VECT; // ISR_BOOT      //    INTO  BOOT_VECT; // _PRESTART,      // startup code STARTUP,      // startup data structures ROM_VAR,      // constant variables DEFAULT_ROM, STRINGS,      // string literals VIRTUAL_TABLE_SEGMENT,   // C++ virtual table segment NON_BANKED,      // runtime routines which must not be banked COPY       // copy down information: how to initialize variables    INTO  BOOT_CODE;  // ,ROM1: To use "ROM1" as well, pass the option -OnB=b to the compiler           _DATA_ZEROPAGE,     // zero page variables MY_ZEROPAGE    INTO  Z_RAM;ENDSTACKSIZE 0x0200

 I know that is really a newbie question but vector redirection in this case is not so clear to me...

 

Thanks in advance to anyone!

 

0 Kudos
1,208 Views
csp
Contributor I

Hi Pavel,

 

I'm using your bootloader for JM32 device through USB, I think I'm close to make it working, but I have some problem.

 

First of all I opened your project, and I selected JM32 target instead JM60 (it seems is selected by default), I changed the Button port to enter in bootloader mode to fit in my board, then I flashed the bootloader with BDM interface successfully. It seems everything ok, when I run the board with pressed button it enters in bootloader mode.

 

I used your software to flash my .S19 file, the first time, the application threw me a warning that some memory address will overlap with the bootloader adress, the warning was this one:

 

"WARNING! S19 image will not fit into available memory (at address 0xFFBD)!"

 

I just found this address was NVPROT_INIT. I looked in my project and device initialitzation configured these registers for me:

 

const unsigned char NVPROT_INIT @0x0000FFBD = 255;
const unsigned char NVOPT_INIT @0x0000FFBF = 126;

 

So I removed these declarations. After this I flashed the .S19 again, and the surprise is that after flashing the new code starts to run successfully, but when I reset the board, it isn't able to start the user code.  It seems that bootloader starts (I can see the COM port in windows hardware admin), but is not able to jump to user code, and it restarts again, and loops forever.

 

What I'm doing wrong? Could you suggest me some advice?

 

Thank yo so much,

Jordi

 

0 Kudos
1,210 Views
Stipey75
Contributor I

Hi everybody!

 

I am new in the forum, but I've found a lot of interesting stuff for der developing a bootloader app for AC32!

 

With AN2295 and some topics here i have now a bootloader nicely working using hw vector redirection I can reflash ROM with my user at 115200 really cool!

 

Only one question...stupid maybe...:-)

 

My bootloader is placed in ROM from 0xFE00 and the app stand above this address...i use BDM to program device with bootloader and from what I can understand from AN 2295 assembly (i'm not so good with it!) is that bootloader protect FLASH from address 0xFE00 to 0xFFFF but if I try to program my user app with bdm it erases all memory and so also bootloader area! I suppose this happens because in my app i don't write nothing to NVOPT and FOPT because i have to avoid conflict with bootloader.

My question is...it's possible to generate a single s19 file to flash AC32 with bootloader and user app together? And the of course to use bootloader to reprogram device i'd like to have a single file for the first programming!

 

Thanks in advance!

0 Kudos