This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
manual:demos:nucleo_l152re_cubeide [2023/12/04 22:35] voorburg [Supported firmware update interfaces] |
manual:demos:nucleo_l152re_cubeide [2024/02/15 14:30] (current) voorburg [EEPROM memory device support] |
||
---|---|---|---|
Line 61: | Line 61: | ||
* [[manual:rs232_demo|Firmware updates using the RS232 communication interface]] | * [[manual:rs232_demo|Firmware updates using the RS232 communication interface]] | ||
+ | |||
+ | ===== EEPROM memory device support ===== | ||
+ | |||
+ | This demo bootloader showcases how to enable and implement support for an additional memory device. Specifically, the 16kb internal data EEPROM of the STM32L152RE. | ||
+ | |||
+ | Support for the additional memory device in the OpenBLT bootloader was enabled by setting the ''BOOT_NVM_HOOKS_ENABLE'' configuration macro to ''1'' in "blt_conf.h": | ||
+ | |||
+ | <code c> | ||
+ | /** \brief Enable/disable the NVM hook function for supporting additional memory devices. */ | ||
+ | #define BOOT_NVM_HOOKS_ENABLE (1) | ||
+ | </code> | ||
+ | |||
+ | Once enabled, this results in the following hook-functions in "hooks.c" being called during the firmware update: | ||
+ | |||
+ | * ''NvmInitHook()'' | ||
+ | * ''NvmWriteHook()'' | ||
+ | * ''NvmEraseHook()'' | ||
+ | * ''NvmDoneHook()'' | ||
+ | |||
+ | The actual low-level driver for operating on the internal data EEPROM is located in the files ''memdrv.c'' and ''memdrv.h''. The implementation of the before mentioned hook-functions is such that it glues it to the functions in this low-level driver. | ||
+ | |||
+ | For testing purposes an extra S-record file was generated that contains random data, mapped to a location in the internal data EEPROM: | ||
+ | |||
+ | * \Target\Demo\ARMCM3_STM32L1_Nucleo_L152RE_CubeIDE\Prog\Debug\eeprom_data.srec | ||
+ | | ||
+ | If you select this S-record file when starting a firmware update, its data contents will be stored in the STM32L152RE's internal data EEPROM. | ||
+ | |||
+ | Note that this S-record file with random data was generated with the ''srec_cat'' [[https://srecord.sourceforge.net/|tool]]: | ||
+ | |||
+ | <code> | ||
+ | srec_cat -generator 0x08080000 0x08080400 -repeat-data 0x00 -exclude 0x08080000 0x08080400 \ | ||
+ | -random-fill 0x08080000 0x08080400 -o eeprom_data.srec -Motorola | ||
+ | </code> | ||
+ | |||
+ | Refer to this blog article for in-depth details on how to add support for an additional memory device: | ||
+ | |||
+ | * [[https://www.feaser.com/en/blog/2024/02/additional-memory-device-in-openblt/|Additional memory device in the OpenBLT bootloader]] | ||
+ | |||
+ | |||