title: Read/Write Struct to Flash Memory
body: <p>I want to write the contents of a struct to flash memory in my C program for STM32F4 Discovery board using HAL libraries. This is my struct:</p>
  
  <pre><code>typedef struct
  {
      RTC_TimeTypeDef time;
      RTC_DateTypeDef date;
      float Data;
  } DataLogTypeDef;
  </code></pre>
  
  <p>I have the option to write Byte, Half-Word, Word and Double-Word to each memory address at a time using the <strong>stm32f4xx_hal_flash.c</strong> library function:</p>
  
  <pre><code>HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data);
  </code></pre>
  
  <p>My struct contains various data types but I'm not sure how to write the contents using only Byte, Half-Word, Word and Double-Word commands at a time?</p>