Add more Flash on STM32MP157?

Sysprogs forums Forums VisualGDB Add more Flash on STM32MP157?

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #29823
    Ankan
    Participant

    Hi,

    I’am getting low of FLASH on my STM32MP157.

    Used FLASH: 126KB out of 128KB (98%) [+4916]
    Used RAM1: 49KB out of 128KB (38%) [+120]
    Used RAM2: 0 bytes out of 128KB (0%)
    Used Unknown: 664 bytes

    How do I change a bit of RAM to FLASH in VisualGDB?

    #29826
    support
    Keymaster

    Hi,

    You can use the Memory Explorer window to get a detailed report on the RAM/FLASH usage by various parts of your program and then replace some of them with less memory-intense alternatives.

    #29838
    Ankan
    Participant

    Does this mean that it’s not possible to use the so called RAM1 or RAM2 as FLASH?

    What I understand it should be possible to customize the M4 memory mapping

    https://wiki.st.com/stm32mpu/wiki/STM32MP15_RAM_mapping

    #29842
    support
    Keymaster

    Hi,

    On the VisualGDB side, you can modify your project to use RAM1 or RAM2 as FLASH.However, you would need to take special care to ensure they are loaded properly in production environment.

    We would advise first getting familiar with linker scripts, sections and attributes by following the Additional Memories and Linker Script tutorials.

    Once you get a good understanding of linker scripts, you can try editing the default linker script similarly to what VisualGDB does with Additional Memories:

    1. Add a memory region for RAM1 or RAM2 if it’s not added already.
    2. Create a section that will be placed there. Make sure it’s not placed in the regular FLASH (see the Additional Memories tutorial).
    3. Use attributes to place parts of your program into the new section.

    In the debug environment, VisualGDB will automatically load both FLASH and RAM with the correct data.

    In the production environment, your Linux code would need to make sure the RAM gets initialized with the correct values before your program starts. You can dump the initial contents of the RAM section into a separate binary file by running objcopy:

    arm-none-eabi-objcopy -O binary --only-section=<your section name> <ELF file built by VisualGDB> <output file>

    Then, use the Linux-side API to manually load this file into RAM before turning on the Cortex-M4 core.

    #29847
    Ankan
    Participant

    Hi,

    I have read both tutorials but don’t really understand how to apply this to my STM32MP157 processor.

    My linker script look like this: https://github.com/STMicroelectronics/STM32CubeMP1/blob/master/Projects/STM32MP157C-DK2/Templates/SW4STM32/Templates/stm32mp15xx_m4.ld In other words it’s default linker script for stm32mp15xx processors.

    As you can read here: https://wiki.st.com/stm32mpu/wiki/STM32MP15_RAM_mapping#Zoom_in_the_Cortex-A7-2FCortex-M4_shared_memory m_text and m_data are same kind of memory and can be tuned.

    I tried to define memory like this:

    MEMORY
    {
    m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000298
    m_text (RX) : ORIGIN = 0x10000000, LENGTH = 0x00030000
    m_data (RW) : ORIGIN = 0x10030000, LENGTH = 0x00010000
    m_ipc_shm (RW) : ORIGIN = 0x10040000, LENGTH = 0x00008000
    }

    It compiled but didn’t work.

    What have I missed?

    • This reply was modified 3 years, 3 months ago by Ankan.
    #29849
    support
    Keymaster

    No problem, we can help you get it working with your specific project as a part of our consulting services. Please feel free to contact our sales to get a quote and we will be happy to delver a working example demonstrating the exact configuration you need.

    #29857
    Ankan
    Participant

    Hi again,

    1. Add a memory region for RAM1 or RAM2 if it’s not added already.
      Already added by default MCU SRAM1 (m_text) and SRAM2 (m_data) (See linked linking script above) https://sysprogs.com/w/forums/topic/add-more-flash-on-stm32mp157/#post-29847

    2. Create a section that will be placed there. Make sure it’s not placed in the regular FLASH (see the Additional Memories tutorial).
      Sections for m_text and m_data is already created as default. (See linked linking script ) https://sysprogs.com/w/forums/topic/add-more-flash-on-stm32mp157/#post-29847
    3. Use attributes to place parts of your program into the new section.
      m_text have a .text section that take all non-attribute-specified-code and put it there. Why is my solution above not working as it seams logic?

    It’s good that you can offer your consulting services to solve this for us. But I don’t think it’s that unique as it’s only about how to use STM32MP1 with VisualGDB.

    #29858
    support
    Keymaster

    Please note that VisualGDB is a productivity tool. It can simplify the workflow of a software engineer by automating various common tasks, however it cannot completely replace a software engineer with relevant experience, or automatically translate a textual problem description into a working prototype.

    Our support is limited to VisualGDB issues only (i.e. when a specific part of VisualGDB is not working). Suggesting design patterns, creating reference designs and troubleshooting of projects is not covered in our regular product support.

    As the issue you reported is a generic question about memory organization for a specific project, and is not specific to VisualGDB, we will not be able to provide further help with it. Please consider contacting ST support if you need further help.

    Another option would be to first get it working using regular Makefiles, or any other IDE, such as STM32CubeIDE, and then we can help you import that project into VisualGDB and understand the relevant VisualGDB settings.

    #29859
    Ankan
    Participant

    Never mind, I solved it.

    My change to linker script was correct. I just had a bug in my code that broke it.

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.