I've got a project I'm working that is using an STM32F030K6T6. I've followed STM's example of emulated eeprom for the STM32F0xx microcontrollers, but am hitting a Hard Fault when the EEPROM_Init function calls this line:
/* Get Page0 status */ pagestatus0 = (*(__IO uint16_t*)PAGE0_BASE_ADDRESS);
Here's the PDF document for the STM32 help code: https://www.st.com/content/ccc/resource/technical/document/application_note/2e/d4/65/6b/87/dd/40/25/DM00049914.pdf/files/DM00049914.pdf/jcr:content/translations/en.DM00049914.pdf
and here is a link to the eeprom code itself: https://www.st.com/en/embedded-software/stsw-stm32117.html
I left the example as it was in the STM32 code exmaple, so I assume that the addresses should be okay for a medium density STM32.
Here are the definitions related to the emulated EEPROM
#define ADDR_FLASH_PAGE_16 ((uint32_t)0x08008000) /* Base @ of Page 16, 2 Kbytes */ #define ADDR_FLASH_PAGE_48 ((uint32_t)0x08018000) /* Base @ of Page 48, 2 Kbytes */ /* Define the size of the sectors to be used */ #define PAGE_SIZE (uint32_t)FLASH_PAGE_SIZE /* Page size */ /* EEPROM start address in Flash */ #define EEPROM_START_ADDRESS ((uint32_t)ADDR_FLASH_PAGE_16) /* EEPROM emulation start address */ /* Pages 0 and 1 base and end addresses */ #define PAGE0_BASE_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + 0x0000)) #define PAGE0_END_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + (PAGE_SIZE - 1))) #define PAGE1_BASE_ADDRESS ((uint32_t)(ADDR_FLASH_PAGE_48)) #define PAGE1_END_ADDRESS ((uint32_t)(ADDR_FLASH_PAGE_48 + PAGE_SIZE - 1))
I usually use Microchip parts, but we are switching over to STM32's for a lot of our future products. In other words, I'm a little out of my natural environment.
I am using Atollic and the STM32CubeMX plugin.