Skip to main content
Senior
September 2, 2024
Solved

how to load touchgfx images on fmc_nor flash where external loader is created

  • September 2, 2024
  • 3 replies
  • 5795 views

Hi Team,

After assigning NOR Flash space in the linker, I created an external loader, tested it, and debugged it in CubeProgrammer. @mƎALLEm  suggested to seek help regarding my TouchGFX-related query in a new thread.

Is there any reference or guide available for implementing FMC NOR Flash in a TouchGFX project within CubeIDE? I added my own loader in the debug configuration and debugged it, but no data is shown on the display, nor is anything visible at 0x60000000 in the memory browser.

Please guide me on how to achieve full access via Flash memory.

Regards,

jr_mbed_engr

Screenshot (1339).png

Screenshot (1337).png

Screenshot (1338).png

my linker file:

 

estack = ORIGIN(RAM_D1) + LENGTH(RAM_D1); /* end of RAM */
/* Generate a link error if heap and stack don't fit into RAM */
_Min_Heap_Size = 0x2000; /* required amount of heap */
_Min_Stack_Size = 0x4000; /* required amount of stack */

/* Specify the memory areas */
MEMORY
{
 FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 2048K
 DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
 RAM_D1 (xrw) : ORIGIN = 0x24000000, LENGTH = 512K
 RAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 288K
 RAM_D3 (xrw) : ORIGIN = 0x38000000, LENGTH = 64K
 ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K
 EXT_FLASH (r) : ORIGIN = 0x60000000, LENGTH = 128M
}

/* Define output sections */
SECTIONS
{
 /* The startup code goes first into FLASH */
 .isr_vector :
 {
 . = ALIGN(4);
 KEEP(*(.isr_vector)) /* Startup code */
 . = ALIGN(4);
 } >FLASH

 /* The program code and other data goes into FLASH */
 .text :
 {
 . = ALIGN(4);
 *(.text) /* .text sections (code) */
 *(.text*) /* .text* sections (code) */
 *(.glue_7) /* glue arm to thumb code */
 *(.glue_7t) /* glue thumb to arm code */
 *(.eh_frame)

 KEEP (*(.init))
 KEEP (*(.fini))

 . = ALIGN(4);
 _etext = .; /* define a global symbols at end of code */
 } >FLASH

 /* Constant data goes into FLASH */
 .rodata :
 {
 . = ALIGN(4);
 *(.rodata) /* .rodata sections (constants, strings, etc.) */
 *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
 . = ALIGN(4);
 } >FLASH

 .ARM.extab (READONLY) : 
 {
 *(.ARM.extab* .gnu.linkonce.armextab.*)
 } >FLASH
 .ARM (READONLY) : 
 {
 __exidx_start = .;
 *(.ARM.exidx*)
 __exidx_end = .;
 } >FLASH

 .preinit_array (READONLY) : 
 {
 PROVIDE_HIDDEN (__preinit_array_start = .);
 KEEP (*(.preinit_array*))
 PROVIDE_HIDDEN (__preinit_array_end = .);
 } >FLASH

 .init_array (READONLY) : 
 {
 PROVIDE_HIDDEN (__init_array_start = .);
 KEEP (*(SORT(.init_array.*)))
 KEEP (*(.init_array*))
 PROVIDE_HIDDEN (__init_array_end = .);
 } >FLASH

 .fini_array (READONLY) : 
 {
 PROVIDE_HIDDEN (__fini_array_start = .);
 KEEP (*(SORT(.fini_array.*)))
 KEEP (*(.fini_array*))
 PROVIDE_HIDDEN (__fini_array_end = .);
 } >FLASH

 /* used by the startup to initialize data */
 _sidata = LOADADDR(.data);

 /* Initialized data sections goes into RAM, load LMA copy after code */
 .data :
 {
 . = ALIGN(4);
 _sdata = .; /* create a global symbol at data start */
 *(.data) /* .data sections */
 *(.data*) /* .data* sections */
 *(.RamFunc) /* .RamFunc sections */
 *(.RamFunc*) /* .RamFunc* sections */

 . = ALIGN(4);
 _edata = .; /* define a global symbol at data end */
 } >RAM_D1 AT> FLASH

 /* Uninitialized data section */
 . = ALIGN(4);
 .bss :
 {
 /* This is used by the startup in order to initialize the .bss section */
 _sbss = .; /* define a global symbol at bss start */
 __bss_start__ = _sbss;
 *(.bss)
 *(.bss*)
 *(COMMON)

 . = ALIGN(4);
 _ebss = .; /* define a global symbol at bss end */
 __bss_end__ = _ebss;
 } >RAM_D1

 /* User_heap_stack section, used to check that there is enough RAM left */
 ._user_heap_stack :
 {
 . = ALIGN(8);
 PROVIDE ( end = . );
 PROVIDE ( _end = . );
 . = . + _Min_Heap_Size;
 . = . + _Min_Stack_Size;
 . = ALIGN(8);
 } >RAM_D1

 /* Place IntFlashSection in external flash */
 IntFlashSection :
 {
 . = ALIGN(4);
 *(IntFlashSection)
 . = ALIGN(4);
 } >EXT_FLASH /* Modified to use external flash */

 ExtFlashSection :
 {
 . = ALIGN(4);
 *(ExtFlashSection*) /* .ext_flash* sections */
 . = ALIGN(4);
 } >EXT_FLASH
 
 /* Remove information from the standard libraries */
 /DISCARD/ :
 {
 libc.a ( * )
 libm.a ( * )
 libgcc.a ( * )
 }

 .ARM.attributes 0 : { *(.ARM.attributes) }
}

 

 

Best answer by jr_engr_mbed

Hi @GaetanGodart @Tesla DeLorean @mƎALLEm  , Here's an update regarding FMC NOR flash: I was successfully able to run NOR flash after changing the NOR flash IC from 1 Gbit to 128 Mbit. I replaced it with the same 56-TSOP package. Now, I can load TouchGFX data into my NOR flash. Thank you for guiding me for such a long time. i found data mismatch error in 01 gbit norflash, where full data is not loaded properly, after changing 128mbits  flash, i can get full data exactly.

3 replies

Tesla DeLorean
Guru
September 2, 2024

Bring up the NOR Flash as you did with the External Loader  Init(), so clocks, pins, peripheral, ..

You should ideally do this in SystemInit(), but the Cube approach might make that more practical at the beginning of main()

You should be able to confirm / dump the expected content after you've brought the memory up.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Senior
September 3, 2024

Hi Tesla,

  1. As you suggested, I implemented the test code directly in the main() function of the TouchGFX project. I've already allocated space, and the TouchGFX-generated images are stored in the .ext_flash section. How can I redirect this data to the txbuffer at address 0x60000000? Is the external loader sufficient for displaying the images, or do I need to write a driver for non-memory mapped mode? Is the driver you're referring to the same as the external loader?
GaetanGodart
Technical Moderator
September 3, 2024

Hello @jr_engr_mbed ,

 

You can check our guide on how to setup external flash in memory mapped mode :  flash-external-addressable 
You can also check the guide on external flash in block mode : flash-external-nonaddressable 

 

Don't hesitate to send a new message if you have a specific question.

 

Regards,

Senior
September 3, 2024

Hi,

Please confirm if my approach to achieving the external loader functionality is correct so far:

  1. my main doubt is if i use to load already available loader which is given as only one FMC_norflash example in stm32-external loader .github .
  2. if this loader works with my flash, then, it is seem nearly identical and can be used the same loader., as it is 16MB and mine 128MB, but, i 'm enough to use 16MB itself. So, i don't need to worry about creating own loader. Right? or the timing parameter b/w both flash makes any large differences?this is what my assumption so far.,
    so, directly, i need to work with bring up norflash in touchgfx application by initalizing clock,pins, pheripherals.
    like previously, developed project just for norflash testing..
  3. my FMC_nor is followed as non memory mapped? coz, qspi is memory mapped mode.

 

reply for proceeding in one direction.

Thank you for your guidance.

Best regards,

jr_mbed_engr

Screenshot (1359).png

Screenshot (1360).png

 

GaetanGodart
Technical Moderator
September 9, 2024

Hello @jr_engr_mbed ,

 

1)
Yes you can use this example, just make sure it works with your project. You might have to change some things but it will be a great starting piont!

2)
Yes, the timings are different for both flash and probably different enough that it won't just work. You will have to use your own timing (c.f. you datasheet)

3)
Yes, your memory (NOR flash using FMC) is probably not memory mapped so it is in block mode.
Have a look at this article to see how to use block mode memory.

 

Regards,

 

 

Tesla DeLorean
Guru
October 1, 2024

NOR Flash should be able to directly memory map, the content should be visible to the MCU

It's NAND flash that's more complicated and blocked.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..