Skip to main content
benjamin Gräf
Associate III
February 21, 2018
Question

Update STM32L073 programmcode

  • February 21, 2018
  • 2 replies
  • 613 views
Posted on February 21, 2018 at 17:27

Hey, I am facing a specific task and I could really need some help with that. 

So I have many stm32L073 µC which all run the same programm. The programm has a stored list of constants in them which are used while the programm is executed. Now it should be possible to extend/upgrade this list of constants from extern. The µC is connected with UART to a XBee wireless module. 

Is it possible ot write to values received from the UART to a specific place in the flash storage? Or is it better to reload the whole programm, which is updated with the new constants.

For example:

old programm has list of those IDs:

uint8_t ID[13] = {0,32,41,23,124,53,123,123,43,0};

new programm:

uint8_t ID[13] = {0,32,41,23,124,53,123,123,43,0,11,22,45};

these variables are fixed and should be available all the time by the programm and they do not change.

any help/advice is helpfull. 

Thanks,

Benjamin

    This topic has been closed for replies.

    2 replies

    Tesla DeLorean
    Guru
    February 21, 2018
    Posted on February 21, 2018 at 18:53

    Normally you'd place constants (calibration data, serialization, etc) in a separate area of flash that you manage, can erase, replace, or set to defaults.

    If this is a final programming stage you could modify (patch) the image you are writing to each unit. Programming code recognizes a specific signature in memory, or via symbols exported in .MAP or .ELF and substitutes values.

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    Andrew Neil
    Super User
    February 21, 2018
    Posted on February 21, 2018 at 19:12

    The STM32L0x3 line offers ... up to 6 Kbytes of embedded EEPROM

    http://www.st.com/content/st_com/en/products/microcontrollers/stm32-32-bit-arm-cortex-mcus/stm32-ultra-low-power-mcus/stm32l0-series/stm32l0x3.html?querycriteria=productId=LN1845

      

    So why not use that?

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    benjamin Gräf
    Associate III
    February 22, 2018
    Posted on February 22, 2018 at 08:54

    Well, it should also be possible to use Controllers which do not have a EEPROM. But it would be best to use EEPROM in this case, as you suggested. I was just wondering if it is possbile to update the Flash storage via the UART.