cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F7 DISCO - Storing data in NOR

ahmed2
Associate
Posted on November 12, 2015 at 19:10

Hello everyone,

I just started using the STM32F7-DISCO board and i wanted to start with writing a small UI app with a single image, with the image data being stored in the NOR flash. but the application doesn't seems to load the image on the screen. To write the image data to NOR i used __attribute__((section(''.ExtQSPIFlashSection''))). I checked the MAP file and checked the memory using ST-LINK and i can confirm that the data is written to NOR, but for some reason my application cannot read it.

Load Region LR_QSPI (Base: 0x90000000, Size: 0x0000459c, Max: 0x00ffffff, ABSOLUTE)
Execution Region ER_QSPI (Base: 0x90000000, Size: 0x0000459c, Max: 0x00ffffff, ABSOLUTE)
Base Addr Size Type Attr Idx E Section Name Object
0x90000000 0x0000459a Data RO 331 .ExtQSPIFlashSection wndmaindlg.o

Image data (trimmed for display here.

static const U8 _acImage_0[17818] __attribute__((section(''.ExtQSPIFlashSection''))) = { huge array here}

#nor-read-only-qspi-rom #stm32f7
2 REPLIES 2
ahmed2
Associate
Posted on November 12, 2015 at 19:13

I want to add that if i remove __attribute__((section(''.ExtQSPIFlashSection''))) , things work as expected.and i am initializing the NOR

int main(void)
{
/* This project template calls firstly two functions in order to configure MPU feature 
and to enable the CPU Cache, respectively MPU_Config() and CPU_CACHE_Enable().
These functions are provided as template implementation that User may integrate 
in his application, to enhance the performance in case of use of AXI interface 
with several masters. */ 
/* Configure the MPU attributes as Write Through */
MPU_Config();
/* Enable the CPU Cache */
CPU_CACHE_Enable();
#ifdef RTE_CMSIS_RTOS // when using CMSIS RTOS
osKernelInitialize(); // initialize CMSIS-RTOS
#endif
/* STM32F7xx HAL library initialization:
- Configure the Flash ART accelerator on ITCM interface
- Configure the Systick to generate an interrupt each 1 msec
- Set NVIC Group Priority to 4
- Low Level Initialization
*/
HAL_Init();
/* Configure the System clock to have a frequency of 200 MHz */
SystemClock_Config();
BSP_QSPI_Init();
BSP_QSPI_MemoryMappedMode();
BSP_SDRAM_Init();
LED_Initialize();
/* Enable CRC to Unlock GUI */
__HAL_RCC_CRC_CLK_ENABLE();
/* Enable Back up SRAM */
__HAL_RCC_BKPSRAM_CLK_ENABLE();
/* Add your application code here
*/
#ifdef RTE_CMSIS_RTOS // when using CMSIS RTOS
// create 'thread' functions that start executing,
// example: tid_name = osThreadCreate (osThread(name), NULL);
Init_GUIThread();
osKernelStart(); // start thread execution 
#endif
/* Infinite loop */
while (1)
{
osDelay(10);
}
}

Posted on February 19, 2016 at 00:49

I use QSPI as NOR to have background BMPs for LCD there.

But, please bear in mind:

even mapped on NOR region - it is still Read Only (RO) due to QSPI chip there.

You cannot write through NOR region into a flash device.

Updating content in flash devices, the QSPI - needs special procedure, a protocol, for instance: before you can write often you have to do a ''page erase'' in flash chip.

The NOR as normal memory region does not know how to write into flash (and just updating one single byte in NOR would need a page erase + reprogramming page again, not so ''easy'').

Use QSPI on NOR just as a RO device.

Bring the content into, or update the content in QSPI, via ST-Link utility (works fine for me), not via your own firmware (you could, if you use the direct QUAD-SPI channel to QSPI chip and implement the flash protocol).

Never write C code which would write to NOR region (silently ignored). NOR is usually Read-Only (like a ROM).