User Tools

Site Tools


manual:demos:nucleo_l152re_cubeide

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
manual:demos:nucleo_l152re_cubeide [2022/07/30 14:57]
voorburg [Notes]
manual:demos:nucleo_l152re_cubeide [2024/02/15 14:30] (current)
voorburg [EEPROM memory device support]
Line 3: Line 3:
 ===== Supported firmware update interfaces ===== ===== Supported firmware update interfaces =====
  
-^ RS232          ^ CAN             ​^ USB          ^ TCP/​IP ​      ​^ SD-card ​     ^ +^ RS232         ​^ CAN            ^ USB         ​^ TCP/​IP ​     ^ SD-card ​     ​^ Modbus RTU   
-| Yes            | No              | No           ​| No           | No           |+| Yes           ​| No             ​| No          | No          ​| No           | No           |
  
 ===== Development Environment ===== ===== Development Environment =====
Line 62: Line 62:
   * [[manual:​rs232_demo|Firmware updates using the RS232 communication interface]]   * [[manual:​rs232_demo|Firmware updates using the RS232 communication interface]]
  
-===== Notes ===== +===== EEPROM memory device support ​===== 
-  * For the demo bootloader ​and user program ​to function properlymake sure to only use compiler optimization ​**-Og** or **-O0**.+ 
 +This demo bootloader ​showcases how to enable and implement support for an additional memory device. Specificallythe 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]] 
 + 
  
  
  
manual/demos/nucleo_l152re_cubeide.1659185876.txt.gz · Last modified: 2022/07/30 14:57 by voorburg