This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

MCB1700 board LPC1700 USB Bootloader

Hi

I have the boot loader install and running on the MCB1700, and would like to know how to store more than one application no more than two and have a boot loader decide which bin application to run. What is the best way to do this with out any performance loss.

A person I has told me that repeatedly flashing the device can degrade the flash memory, is this true?

He also said will be a performance penalty by running code from RAM is this true?.

what other option do I have and what would be the best way you would suggest to do this.

thanks.

Parents
  • The datasheet for your processor will tell you how much rewrite cycles the flash memory supports.

    There is normally not any performance penalty from running from RAM - it's normally the flash can't can't keep up with faster processors, requiring the introduction of wait cycles.

    On the other hand - if you have a limited amount of RAM and runs code in the RAM, you will have less RAM available for your variables. So you may need to select a slower algorithm to reduce amount of code or data space needed.

    Next thing is that many processors have multiple memory busses to supply data to the processor core and to the peripherials. So in some situations, running code in RAM will require the available memory bandwidth split between code instructions and the data accesses performed by the peripherial. This is mainly when using DMA transfers.

    If you build position-independant code, or link the two applications to specifically run in either flash memory region 1 or 2, then the boot loader can switch between applications without you moving any code around. But you need EEPROM, a flash sector or some other nonvolatile storage to store the data used by the boot loader to decide which of the two application areas to use. It could be a couple of bytes at start or end of the application region so you just use the application with highest version number if the checksum is correct. Or you may use of counters (normally together with EEPROM or F-RAM) to keep track of which application was last used, and automatically perform a fallback to the other application if the first application for some reason unexpectedly fails - maybe generating watchdog resets or showing other indications of not being trustworthy.

Reply
  • The datasheet for your processor will tell you how much rewrite cycles the flash memory supports.

    There is normally not any performance penalty from running from RAM - it's normally the flash can't can't keep up with faster processors, requiring the introduction of wait cycles.

    On the other hand - if you have a limited amount of RAM and runs code in the RAM, you will have less RAM available for your variables. So you may need to select a slower algorithm to reduce amount of code or data space needed.

    Next thing is that many processors have multiple memory busses to supply data to the processor core and to the peripherials. So in some situations, running code in RAM will require the available memory bandwidth split between code instructions and the data accesses performed by the peripherial. This is mainly when using DMA transfers.

    If you build position-independant code, or link the two applications to specifically run in either flash memory region 1 or 2, then the boot loader can switch between applications without you moving any code around. But you need EEPROM, a flash sector or some other nonvolatile storage to store the data used by the boot loader to decide which of the two application areas to use. It could be a couple of bytes at start or end of the application region so you just use the application with highest version number if the checksum is correct. Or you may use of counters (normally together with EEPROM or F-RAM) to keep track of which application was last used, and automatically perform a fallback to the other application if the first application for some reason unexpectedly fails - maybe generating watchdog resets or showing other indications of not being trustworthy.

Children
  • I seem to remember that the STM32 (another Cortex-M3), for example, does have a performance penalty from running from RAM!

    IIRC, there were two reasons:
    1. there is some clever "acceleration" (prefetch) for fetching code from flash - which is not there for RAM;
    2. As Per mentioned, the bus usage.

    See: my.st.com/.../Flat.aspx

    http://bit.ly/Hp0OCD

    So you should really check this carefully in the documentation for your particular processor - and/or ask the manufacturer's support line. (It has nothing to do with Keil).