I am trying to implement the in-circuit firmware upgrade feature on a MSP430148 based system. The firmware consists of a boot loader and application. boot loader will be able to receive new application firmware over UART and program it into the flash to replace the older application. I have a few questions related to this: 1. Can the boot loader program flash while executing in flash? Or does it have to be copied to RAM first? 2. Both of my boot loader and application need to communicate over UART, how do I change the interrupt handler at run time? I am using IAR's tool. Its "interrupt" keyword sets up interrupt vector at compile time. 3. In IAR's Embedded Workbench, I will have two projects for boot loader and application. If I use the linker script to place boot loader and application into different location, can I use C-Spy to download them into flash? 4. When build the application firmware for field upgrade, what link output format should I choose that's good for download and flash programming? 5. When the system goes to production, how do I get a complete flash image so we can program it on MSP430 chips before populate it on the board? Thanks Weiyang Zhou
MSP430 in-circuit firmware upgrade question
Started by ●November 5, 2004
Reply by ●November 5, 20042004-11-05
Weiyang Zhou schrieb in Nachricht ...>I am trying to implement the in-circuit firmware upgrade feature on a >MSP430148 based system. The firmware consists of a boot loader and >application. boot loader will be able to receive new application firmware >over UART and program it into the flash to replace the older application. > >I have a few questions related to this: >1. Can the boot loader program flash while executing in flash? Or does it >have to be copied to RAM first? >2. Both of my boot loader and application need to communicate over UART,how>do I change the interrupt handler at run time? I am using IAR's tool. Its >"interrupt" keyword sets up interrupt vector at compile time. >3. In IAR's Embedded Workbench, I will have two projects for boot loaderand>application. If I use the linker script to place boot loader andapplication>into different location, can I use C-Spy to download them into flash? >4. When build the application firmware for field upgrade, what link output >format should I choose that's good for download and flash programming? >5. When the system goes to production, how do I get a complete flash image >so we can program it on MSP430 chips before populate it on the board?I think you should work on it and not ask school questions. The people are very busy here! Sorry - Henry -- <Schau auch mal auf meine Homepage www.ehydra.dyndns.info> <u.a. Versand von Wasserflohzuchtansatz, Wasserpflanzen/-schnecken, brasilianischer Sauerklee, Natron zum Backen/Baden, u.a.> <Alternativ �ber http://people.freenet.de/algenkocher>
Reply by ●November 6, 20042004-11-06
Weiyang Zhou wrote:> I am trying to implement the in-circuit firmware upgrade feature on a > MSP430148 based system. The firmware consists of a boot loader and > application. boot loader will be able to receive new application firmware > over UART and program it into the flash to replace the older application. > > I have a few questions related to this: > 1. Can the boot loader program flash while executing in flash? Or does it > have to be copied to RAM first?While you are programming the flash, it can't execute from it, so it automatically executes marching on the spot until the write is finished. So you have two choices: copy your loader to RAM, or turn off all interrupts while actually writing.> 2. Both of my boot loader and application need to communicate over UART, how > do I change the interrupt handler at run time?Just a flag to steer to mthe appropriate routine from the interrupt. Or make the interrupt vector table point to a table of pointers (in RAM) to the approriate routine.> 4. When build the application firmware for field upgrade, what link output > format should I choose that's good for download and flash programming?Something with checking would probably be better than the Texas .txt format. OPerhaps add a CRC to each block.> 5. When the system goes to production, how do I get a complete flash image > so we can program it on MSP430 chips before populate it on the board?Don't. All the flash MSP430s have a built in serial bootloader, for the cost of 4 extra pins on the board (tx, rx, reset, gnd). Or use the JTAG if serial is too slow. Paul Burke
Reply by ●November 8, 20042004-11-08
I still don't quite understand what you mean by make the interrupt vector table point to a table of pointers (in RAM) to the appropriate routine, may I have a little more details? In our hardware design, not all pins required foe bootstrap loader are available. There is not JTAG connector either. We need to program the chip before put it on the board. How can I do this? Thanks Weiyang "Paul Burke" <paul@scazon.com> wrote in message news:2v41lbF2gfaq1U1@uni-berlin.de...> Weiyang Zhou wrote: >> I am trying to implement the in-circuit firmware upgrade feature on a >> MSP430148 based system. The firmware consists of a boot loader and >> application. boot loader will be able to receive new application firmware >> over UART and program it into the flash to replace the older application. >> >> I have a few questions related to this: >> 1. Can the boot loader program flash while executing in flash? Or does it >> have to be copied to RAM first? > > While you are programming the flash, it can't execute from it, so it > automatically executes marching on the spot until the write is finished. > So you have two choices: copy your loader to RAM, or turn off all > interrupts while actually writing. > >> 2. Both of my boot loader and application need to communicate over UART, >> how >> do I change the interrupt handler at run time? > > Just a flag to steer to mthe appropriate routine from the interrupt. Or > make the interrupt vector table point to a table of pointers (in RAM) to > the approriate routine. > >> 4. When build the application firmware for field upgrade, what link >> output >> format should I choose that's good for download and flash programming? > > Something with checking would probably be better than the Texas .txt > format. OPerhaps add a CRC to each block. > >> 5. When the system goes to production, how do I get a complete flash >> image >> so we can program it on MSP430 chips before populate it on the board? > > Don't. All the flash MSP430s have a built in serial bootloader, for the > cost of 4 extra pins on the board (tx, rx, reset, gnd). Or use the JTAG if > serial is too slow. > > Paul Burke >
Reply by ●November 8, 20042004-11-08
Weiyang Zhou wrote:> I still don't quite understand what you mean by make the interrupt vector > table > point to a table of pointers (in RAM) to the appropriate routine, may I have > a little > more details? >Declare a pointer to your interrupt function, it's just an ordinary function:: void (*CCR12ISR_hook)(); Write a routine that does your bootloader interrupt stuff: void BootloaderCCR12ISR() { WhateverPleasesYou(); } In your initialisation for the bootloader, make the hook point to the ISR (before you enable the interrupts): CCR12ISR_hook = BootloaderCCR12ISR; Then the interrupt routine calls the hook (this is in MSPGCC format): interrupt(TIMERA1_VECTOR) INTERRUPT_MODE CCR12ISR (void) { (*CCR12ISR_hook)(); } and similarly when you call the app, change the hook to point to the app's ISR.> In our hardware design, not all pins required foe bootstrap loader are > available. > There is not JTAG connector either. We need to program the chip before put > it on > the board. How can I do this?You'll have to get a socket for a TQFP. They aren't at all cheap. You should have put the pins on the PCB. Paul Burke>
Reply by ●November 8, 20042004-11-08
I plan to create to separate projects for bootloader and application. But CCR12ISR_hook needs to be variable visible to both projects, how do I do that? Should I put it into a fixed RAM location? Thanks Weiyang "Paul Burke" <paul@scazon.com> wrote in message news:2v9m93F2j264tU1@uni-berlin.de...> Weiyang Zhou wrote: > > I still don't quite understand what you mean by make the interruptvector> > table > > point to a table of pointers (in RAM) to the appropriate routine, may Ihave> > a little > > more details? > > > > Declare a pointer to your interrupt function, it's just an ordinary > function:: > > void (*CCR12ISR_hook)(); > > Write a routine that does your bootloader interrupt stuff: > > void BootloaderCCR12ISR() > { > WhateverPleasesYou(); > } > > In your initialisation for the bootloader, make the hook point to the > ISR (before you enable the interrupts): > > CCR12ISR_hook = BootloaderCCR12ISR; > > Then the interrupt routine calls the hook (this is in MSPGCC format): > > interrupt(TIMERA1_VECTOR) INTERRUPT_MODE CCR12ISR (void) > { > (*CCR12ISR_hook)(); > } > > and similarly when you call the app, change the hook to point to the > app's ISR. > > > In our hardware design, not all pins required foe bootstrap loader are > > available. > > There is not JTAG connector either. We need to program the chip beforeput> > it on > > the board. How can I do this? > > You'll have to get a socket for a TQFP. They aren't at all cheap. You > should have put the pins on the PCB. > > Paul Burke > > >
Reply by ●November 9, 20042004-11-09
Weiyang Zhou wrote:> I plan to create to separate projects for bootloader and application. But > CCR12ISR_hook needs to be variable visible to both projects, how do I do > that? Should I put it into a fixed RAM location? >You could usefully do that, say in the flash page below the vectors. You'll probably also need to create a custom startup module for the app. Paul Burke