Skip to main content
MHéna.1
Associate II
February 23, 2024
Solved

FLASH2 STM32h743

  • February 23, 2024
  • 17 replies
  • 7282 views

Hello,

 

I program STM32H743ZGT6 with STM32CUBE IDE Version: 1.12.1.

The FLASH1 is full and i want to use FLASH2 => during the compilation i have an error (of course).

How can i use FLASH2 ?

MHna1_0-1708698925226.png

 

At the start i grown up the FLASH1 as below but i think its' not adising :

/* Specify the memory areas */
MEMORY
{
FLASH (rx) : ORIGIN = 0x08020000, LENGTH = 768K
FLASH2 (rx) : ORIGIN = 0x081C0000, LENGTH = 128K
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
}

Looking forward to your reply

Best Regards

Malo

    This topic has been closed for replies.
    Best answer by NTaha.1

    Hello, you can maybe add this section to the .ld file 

    .usr_part :
     {
     KEEP(*(.usr_part))
     } > FLASH2
    

    and then this attribute: 

    __attribute__ ((section (".usr_part")))

    in the function decloration. 

    17 replies

    TDK
    February 23, 2024

    > during the compilation i have an error (of course).

    Plese provide the error. The crystal ball is hard to use.

    There's nothing wrong with the code you posted, except you renamed FLASH1 to FLASH possibly? (and if so, why?)

    "If you feel a post has answered your question, please click ""Accept as Solution""."
    mƎALLEm
    ST Technical Moderator
    February 23, 2024

    Hello,

    If I would summarize what you have used as Flash:

    SofLit_0-1708708123924.png

    In yellow what you have used as Flash. My question is:

    Are the flash regions that kept unused (in green), is intentional?

    If FLASH1 (FLASH) is full you need simply to stretch its size. There is 128K after which is free unless it is used for something else.

    Otherwise, to my knowledge, there is no method to let the tool to bond a separated and not contiguous regions (except, I think, IAR..)

     

    To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
    MHéna.1
    MHéna.1Author
    Associate II
    February 26, 2024

    Hello,

     

    The error displayed during the building is as below :

    MHna1_0-1708933497787.png

     

    Sorry, there is a mistake in my explication :

    when the error appears the FLASHs is set as below :

    FLASH (rx) : ORIGIN = 0x08020000, LENGTH = 384K
    FLASH2 (rx) : ORIGIN = 0x08100000, LENGTH = 512K
    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

     

    The lenght of the FLASH is set to 384K because 128K is reserved to the BOOTLOADER (in my application)

     

    When is set as below i have no error (in the .ld file) :

    /* Specify the memory areas */
    MEMORY
    {
    FLASH (rx) : ORIGIN = 0x08020000, LENGTH = 768K
    FLASH2 (rx) : ORIGIN = 0x081C0000, LENGTH = 128K
    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
    }

     

    But i think it's not authorize because i read these comments is the reference manual :

    MHna1_1-1708933804954.png

     

    So, i suppose it's not authorise to grow up the FLASH1 in my case. What is your opinion about his subject ?

    Best Regard

    Malo

    mƎALLEm
    ST Technical Moderator
    February 26, 2024

    This is what you have to take into account (From the datasheet Table 2). The flash size config depends on the device:

    SofLit_0-1708934859592.png

    For the config 2 x 512k the flash is not contiguous. So you are limited to 512k for each bank and you cannot bond them. For the second case: 2 x 1M: you can use all the 2M without issue. The two "1M" are contiguous.

     

    To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
    AScha.3
    Super User
    February 26, 2024

    Hi,

    Why you set the flash start not at the real start address ? (You loose first 128KB.)

    > FLASH (rx) : ORIGIN = 0x08020000, LENGTH = 384K

    + set your bootloader to bank2 ?

    or:

    If need bootloader at bank1, 

    set your program to bank2 :

    FLASH (rx) : ORIGIN = 0x08100000, LENGTH = 512K

     

    btw

    If this product is just for yourself, not for production in quantities, you could try the "2MB" setting :

    FLASH (rx) : ORIGIN = 0x08020000, LENGTH = 768K

    This uses the 2x1MB flash, which is on chip, but you have a version with only 2x512K tested and guaranteed to work. But if your lucky, all 2 MB flash work fine - just try it.

    If you feel a post has answered your question, please click on " Best Answer ".
    mƎALLEm
    ST Technical Moderator
    February 27, 2024

    Also why you don't:

    FLASH (rx) : ORIGIN = 0x08020000, LENGTH = 384K  --> stretch this region
    FLASH2 (rx) : ORIGIN = 0x08100000, LENGTH = 512K --> reserve 128K here to put your bootloader

     

     

    To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
    MHéna.1
    MHéna.1Author
    Associate II
    February 27, 2024

    Unfortunately, it's not possible to deplace the BOOTLOADER => the project has already been industrialised and sent to customers. So we can't change the position of the BOOTLOADER.

    But, the solution might be to use the FLASH2 for my application and keep the FLASH1 for BOOTLOADER.

    My application is place in the 384KB sector as explain before. If my application is place in the FLASH2, 512KB will be available.

    I will try your solution NTaha.1

     

    NTaha.1
    NTaha.1Best answer
    Associate II
    February 27, 2024

    Hello, you can maybe add this section to the .ld file 

    .usr_part :
     {
     KEEP(*(.usr_part))
     } > FLASH2
    

    and then this attribute: 

    __attribute__ ((section (".usr_part")))

    in the function decloration. 

    MHéna.1
    MHéna.1Author
    Associate II
    March 11, 2024

    Hello NTaha.1,

     

    Thank you for your response. your solution seems to work. I have tested with some function declared in FLASH2and now i have this result :

    MHna1_0-1710143876771.png

     

     

    The size used by FLASH2 grow up and the size free for FLASH1 grow up.

    Thank you again :)