Solved! Go to Solution.
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
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
Hello Bob,
I assume that the bootloader does not make use of any inline assembly code? It would then be non-portable.
Regards,
Mac
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
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
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
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
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]
are there any other changes required, like vector redefinition?
I will try the new version later today.
Bob
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
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
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
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
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
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
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
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?
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
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
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!
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
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!