Re: Re: Booting MPC565 by CAN/RS-232?

David Wybo <[email protected]>
Newsgroups gmane.comp.hardware.motorola.microcontrollers
Organization RealTime Consultants, Inc.
Message-ID <[email protected]>
Yes, if your bootloader code is running out of internal flash, and there 
is no external flash, then you cannot be running toe bootloader out of 
the flash when you are also trying to erase it.

You RCW is fine the way it is. You obviously have RAM somewhere, I 
assume you are using the internal RAM at 0x3f800.

So, if you want your running application to reflash itself, it needs to 
copy at least some of the code over to RAM and run there. You need at 
least the RS232/CAN driver, the flash routines, and the control logic 
copied over to RAM and run there while you are reflashing.

This does mean that you have to reserve some of your RAM for the 
bootloader, and not use it for variables, etc.

And, no, I cannot send you my bootloader code, it is copyrighted. It 
probably is available for sale though.

I do not know of any freeware bootloaders, as it seems almost every one 
is a little bit different.

When you design your system with the bootloader, just keep in mind that 
you cannot be running out of the flash device you are trying to erase.

vijayanandl wrote:

>Hi David
>       Thanks for the tips. Just to make sure my understanding is 
>right, I need to transfer the boot code from ROM to RAM when I detect 
>a boot message is received over RS-232/CAN. My current implementation 
>all I have is a hard RCW which enables the code to execute from 0x0 
>in flash, and I use a standard MPC565 with no external flash, so I 
>just modified the cfg and lcf files. I simply load the program using 
>CodeWarrior on the flash location and then erase/program flash.
>Now how do I modify my existing settings and how can I possibly 
>detect message and reflash it. I am new to writing bootloaders and it 
>doesnt look so straightforward to me!! Can you please send the 
>bootloader code which you have used so that I can understand how I 
>can possibly accomplish this task?! Are there any standard bootloader 
>code available so that I can make use of that for my development. 
>Thanks again.
>Regards
>Vijay
>
>--- In [email protected], David Wybo <realtimeconsultants@c...> 
>wrote:
>  
>
>>It is fairly straightforward, but there are a couple caveats. First 
>>    
>>
>you 
>  
>
>>need a device driver for the port you want to flash from. However, 
>>    
>>
>if 
>  
>
>>you are reflashing the internal flash, and your vector table is in 
>>    
>>
>this 
>  
>
>>internal flash, then you need to be very careful about an interrupt 
>>river device driver, since at some point in time, you will be 
>>    
>>
>erasing 
>  
>
>>the vector table. So, you can either programmatically move the 
>>    
>>
>vector 
>  
>
>>table to some other memory, or run a polled device driver.
>>
>>Secondly, the code you are executing in order to do the download 
>>    
>>
>must 
>  
>
>>execute from somewhere, and it also cannot be executing out of the 
>>internal flash while you are trying to reprogram it. So, either 
>>    
>>
>this 
>  
>
>>code, I'll call it the bootloader, needs to be moved from internal 
>>    
>>
>flash 
>  
>
>>to RAM, or it needs to execute from external flash, or it needs to 
>>    
>>
>be 
>  
>
>>downloaded into RAM at the point in time when you want to reflash.
>>
>>The bootloader I wrote a while back, accepts a new application over 
>>    
>>
>CAN. 
>  
>
>>WHile the old application is running, a message is sent to the 
>>    
>>
>target 
>  
>
>>stating that a reflash is requested. The message is acknowledged, 
>>    
>>
>and 
>  
>
>>the bootloader is downloaded into RAM. WHen the bootloader is 
>>    
>>
>completely 
>  
>
>>downloaded, the application terminates and jumps to the bootloader, 
>>which then communicates to the host to download the new application 
>>    
>>
>for 
>  
>
>>flashing. I happen to use CCP for the protocol, but you can use 
>>    
>>
>anything 
>  
>
>>you want.
>>
>>Keep in mind that with only 8 byte data packets, CAN bootloading 
>>    
>>
>may 
>  
>
>>take longer than a serial download. However, the time needed to 
>>    
>>
>reflash 
>  
>
>>a 2 Mb application over CAN is not that bad. I also use an RTOS but 
>>    
>>
>that 
>  
>
>>also is not necessary.
>>
>>Hope this helps.
>>
>>vijayanandl wrote:
>>
>>    
>>
>>>Hi All,
>>>     I have a question regarding programming the internal flash. 
>>>      
>>>
>In my 
>  
>
>>>current implementation I have programmed the MPC565 internal flash 
>>>using the JTAG interface. We have a working system now and to 
>>>      
>>>
>expand 
>  
>
>>>its functions, now I am interested to program the internal flash 
>>>      
>>>
>using 
>  
>
>>>the RS-232/CAN interface if possible. The question is I am 
>>>      
>>>
>currently 
>  
>
>>>using the standard initialization, with program executing from 
>>>      
>>>
>internal 
>  
>
>>>flash and I do not use an RTOS(its a bareboard) my environment is 
>>>Codewarrior and BDI. So what are the steps I need to take to 
>>>      
>>>
>achieve 
>  
>
>>>this capability using RS-232/CAN interface? 
>>>Do I need to modify my initialization files, flash driver etc. 
>>>      
>>>
>Advice 
>  
>
>>>in this regard will be really helpful. Thanks in advance.
>>>
>>>Regards
>>>Vijay
>>>
>>>
>>>
>>>
>>>
>>>-----------------------------------------------------------
>>>To learn more about Freescale Microcontrollers, please visit
>>>http://www.freescale.com/mcu
>>>
>>>
>>>
>>>Yahoo! Groups Links
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> 
>>>
>>>      
>>>
>>-- 
>>David Wybo                    mailto:david.wybo@r...
>>RealTime Consultants, Inc.    Phone: 248.345.6160
>>www.realtimeconsultantsinc.com
>>    
>>
>
>
>
>
>
>-----------------------------------------------------------
>To learn more about Freescale Microcontrollers, please visit
>http://www.freescale.com/mcu
>
>
> 
>Yahoo! Groups Links
>
>
>
> 
>
>
>
>
>  
>

-- 
David Wybo                    mailto:[email protected]
RealTime Consultants, Inc.    Phone: 248.345.6160
www.realtimeconsultantsinc.com



[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/dN_tlB/TM
--------------------------------------------------------------------~-> 

-----------------------------------------------------------
To learn more about Freescale Microcontrollers, please visit
http://www.freescale.com/mcu


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/MPC500/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.