Multiple RAM sections in Memory Map

Sysprogs forums Forums VisualGDB Multiple RAM sections in Memory Map

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #35242
    Ancaritha
    Participant

    I am trying to update the STM32L486 files so that I can utilize the RAM2 section of RAM, and I’m real close, but I can’t quite figure out what I’m missing for the memory map.  It’s showing the same data in two separate sections and I can’t figure out why.

    1. I have updated the linker file and added a section that writes to RAM2 instead of RAM.
    2. I have updated the code to apply the necessary attribute to the appropriate variables
    3. I modified the startup assembly code to wipe RAM2 section like it does for the .bss section
    4. I updated the stm32.xml file to display RAM2 properties.
    5. The .map file confirms things are located at the correct addresses
    6. The code runs and works correctly.
    7. Using the debugger I have confirmed that the variables are located in the correction memory location
    8. The VisualGDB Embedded Memory Explorer shows the new RAM sector and allocates the appropriate items to it

    The only thing not working:

    The RAM2 section information ALSO shows up in the RAM1 information when using VisualGDBs Memory Explorer.

    I have attached an image showing the memory explorer.
    I have attached my modified stm32.xml file to manually add a RAM2 section.

    ——————————————————————————————–

    Here is the relevant section of my .map file that shows the address of .rm2data is where I think it is

     *(COMMON)
                    0x20012aac                . = ALIGN (0x4)
                    0x20012aac                _ebss = .
                    0x20012aac                __bss_end__ = _ebss
    
    ._user_heap_stack
                    0x20012aac      0x604 load address 0x0805f960
                    0x20012ab0                . = ALIGN (0x8)
     *fill*         0x20012aac        0x4 
                    0x20012ab0                PROVIDE (end = .)
                    [!provide]                PROVIDE (_end = .)
                    0x20012cb0                . = (. + _Min_Heap_Size)
     *fill*         0x20012ab0      0x200 
                    0x200130b0                . = (. + _Min_Stack_Size)
     *fill*         0x20012cb0      0x400 
                    0x200130b0                . = ALIGN (0x8)
                    0x200130b0                _sirm2data = LOADADDR (.rm2data)
    
    .rm2data        0x10000000     0x3d30 load address 0x200130b0
                    0x10000000                . = ALIGN (0x8)
                    0x10000000                _srm2data = .
     *(.rm2data)
     .rm2data       0x10000000     0x145c Debug/usbd_composite.o
                    0x10000000                USBD_CDC_CfgHSDesc
                    0x10000114                USBD_CDC_CfgFSDesc
                    0x10000228                USBD_CDC_OtherSpeedCfgDesc
     .rm2data       0x1000145c      0x200 Debug/usbd_composite_desc.o
                    0x1000145c                USBD_StrDesc
     .rm2data       0x1000165c     0x22d0 Debug/usbUtils.o
     .rm2data       0x1000392c      0x400 Debug/svcShellStorageMgr.o
     *(.rm2data*)
                    0x10003d30                . = ALIGN (0x8)
     *fill*         0x10003d2c        0x4 
                    0x10003d30                _erm2data = .
    
    
    --------------------------------------------------------------------------------------------
    Here is the relevant section of my linker in case I'm missing something
    /* 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
    
      /* used by the startup to initialize ram2 data */
      _sirm2data = LOADADDR(.rm2data);
    
      .rm2data : 
      {
        . = ALIGN(8);
        _srm2data = .;        /* create a global symbol at data start */
        *(.rm2data)           /* .data sections */
        *(.rm2data*)          /* .data* sections */
    
        . = ALIGN(8);
        _erm2data = .;        /* define a global symbol at data end */
      } >RAM2 AT> RAM
    
    

    Any ideas of why the Embedded Memory Explorer is duplicating the information?

    Thanks!

    Attachments:
    You must be logged in to view attached files.
    #35244
    Ancaritha
    Participant

    Well, I apparently can’t upload .xml files, so here it is

    <?xml version="1.0"?>
    <EmbeddedProfile xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <ToolchainID>com.visualgdb.arm-eabi</ToolchainID>
      <ToolchainVersion>
        <GCC>10.3.1</GCC>
        <GDB>10.2.90</GDB>
        <Revision>1</Revision>
      </ToolchainVersion>
      <BspID>com.visualgdb.bsp.in-place</BspID>
      <BspVersion>1.0</BspVersion>
      <McuID>STM32L486QC</McuID>
      <MCUDefinitionFile>stm32l486xx.xml</MCUDefinitionFile>
      <MCUProperties>
        <Entries />
      </MCUProperties>
      <BSPSourceFolderName>Device-specific files</BSPSourceFolderName>
      <InPlaceMCU>
        <ID>STM32L486QC</ID>
        <UserFriendlyName>STM32L486QC</UserFriendlyName>
        <CompilationFlags>
          <PreprocessorMacros>
            <string>SYS_NAME=$(SYS_NAME)</string>
            <string>RUNNING_FREE_RTOS</string>
            <string>USE_CUBEMX_USB</string>
            <string>STM32L486QC</string>
            <string>STM32L486xx</string>
            <string>ARM_MATH_CM4</string>
            <string>__CORTEX_M4__</string>
            <string>REV3</string>
          </PreprocessorMacros>
          <IncludeDirectories>
            <string>../../../STM32_FrameworksL4/Drivers/CMSIS/Device/ST/STM32L4xx/Include</string>
            <string>../../../STM32_FrameworksL4/Drivers/STM32L4xx_HAL_Driver/Inc</string>
            <string>../../../STM32_FrameworksL4/Drivers/STM32L4xx_HAL_Driver/Inc/Legacy</string>
            <string>../../../STM32_FrameworksL4/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2</string>
            <string>../../../STM32_FrameworksL4/Middlewares/Third_Party/FreeRTOS/Source/include</string>
            <string>../../../STM32_FrameworksL4/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM7/r0p1</string>
            <string>../../../STM32_FrameworksL4/Middlewares/ST/STM32_USB_Device_Library/Core/Inc</string>
            <string>../../../STM32_FrameworksL4/Drivers/CMSIS/Include</string>
            <string>../../../CryptoV3.1.3/AccHw_Crypto/STM32L4/Middlewares/ST/STM32_Crypto/Inc</string>
            <string>../../../PtxComps</string>
            <string>../../../PtxComps/Services</string>
            <string>../../../PtxComps/ControlComps</string>
            <string>../../../PtxComps/Utils</string>
            <string>../../../PtxComps/HwComps</string>
            <string>../../../PtxComps/HwDrivers</string>
            <string>../../../PtxComps/Tasks</string>
            <string>../../../PtxComps/Init</string>
            <string>../../../PtxComps/ThirdParty/include</string>
            <string>../../../PtxComps/ThirdParty/littlefs-2.4.2</string>
            <string>../../../PtxComps/Utils</string>
            <string>../../../PtxComps/USB</string>
            <string>../../../PtxComps/USB/Composite</string>
            <string>../../../PtxComps/USB/RNDIS</string>
            <string>../../../PtxComps/Utils/Crypto</string>
            <string>../../CubeMXRev3/Inc</string>
            <string>../../Code</string>
          </IncludeDirectories>
          <CFLAGS>-Wall -Wextra -Wno-unknown-pragmas -Wno-unused-parameter  -ffunction-sections -fdata-sections</CFLAGS>
          <CXXFLAGS>-Wall -Wextra -Wno-unknown-pragmas -Wno-unused-parameter  -ffunction-sections -fdata-sections</CXXFLAGS>
          <LDFLAGS>--specs=nano.specs --specs=nosys.specs</LDFLAGS>
          <ASFLAGS>-Wall -Wextra -Wno-unknown-pragmas -Wno-unused-parameter  -ffunction-sections -fdata-sections</ASFLAGS>
          <LinkerScript>../../CubeMXRev3/STM32L486QGIx_FLASH_APP.ld</LinkerScript>
          <COMMONFLAGS>-mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard</COMMONFLAGS>
          <EnableLinkerGroups>true</EnableLinkerGroups>
        </CompilationFlags>
        <AdditionalSourceFiles />
        <AdditionalHeaderFiles />
        <MemoryMap>
          <Memories>
            <MCUMemory>
              <Name>FLASH</Name>
              <Address>134217728</Address>
              <Size>1048576</Size>
              <AddressSpaceSize>0</AddressSpaceSize>
              <Flags>IsDefaultFLASH</Flags>
            </MCUMemory>
            <MCUMemory>
              <Name>RAM</Name>
              <Address>536870912</Address>
              <Size>98304</Size>
              <AddressSpaceSize>0</AddressSpaceSize>
              <Flags>None</Flags>
            </MCUMemory>
    		<MCUMemory>
              <Name>RAM2</Name>
              <Address>268435456</Address>
              <Size>32768</Size>
              <AddressSpaceSize>0</AddressSpaceSize>
              <Flags>None</Flags>
            </MCUMemory>
          </Memories>
        </MemoryMap>
        <AdditionalSystemVars>
          <SysVarEntry>
            <Key>com.sysprogs.bspoptions.arm.core</Key>
            <Value>M4</Value>
          </SysVarEntry>
          <SysVarEntry>
            <Key>com.sysprogs.stm32.hal_header_prefix</Key>
            <Value>stm32l4xx</Value>
          </SysVarEntry>
          <SysVarEntry>
            <Key>com.sysprogs.bspoptions.stm32.hal_system_file</Key>
            <Value>STM32L4xxxx/CMSIS_HAL/Device/ST/STM32L4xx/Source/Templates/system_stm32l4xx.c</Value>
          </SysVarEntry>
          <SysVarEntry>
            <Key>com.sysprogs.bspoptions.stm32.hal_config_template_file</Key>
            <Value>STM32L4xxxx/STM32L4xx_HAL_Driver/Inc/STM32L4xx_hal_conf_template.h</Value>
          </SysVarEntry>
          <SysVarEntry>
            <Key>com.sysprogs.stm32.hal_device_family</Key>
            <Value>STM32L486xx</Value>
          </SysVarEntry>
        </AdditionalSystemVars>
        <ConfigurableProperties>
          <PropertyGroups>
            <PropertyGroup>
              <Properties>
                <PropertyEntry xsi:type="Enumerated">
                  <Name>Execute from</Name>
                  <UniqueID>com.sysprogs.bspoptions.primary_memory</UniqueID>
                  <OmitPrefixIfEmpty>false</OmitPrefixIfEmpty>
                  <SuggestionList>
                    <Suggestion>
                      <UserFriendlyName>FLASH</UserFriendlyName>
                      <InternalValue>flash</InternalValue>
                    </Suggestion>
                    <Suggestion>
                      <UserFriendlyName>SRAM</UserFriendlyName>
                      <InternalValue>sram</InternalValue>
                    </Suggestion>
                  </SuggestionList>
                  <DefaultEntryIndex>0</DefaultEntryIndex>
                  <AllowFreeEntry>false</AllowFreeEntry>
                </PropertyEntry>
                <PropertyEntry xsi:type="Enumerated">
                  <Name>Floating point support</Name>
                  <UniqueID>com.sysprogs.bspoptions.arm.floatmode</UniqueID>
                  <OmitPrefixIfEmpty>false</OmitPrefixIfEmpty>
                  <SuggestionList>
                    <Suggestion>
                      <UserFriendlyName>Software</UserFriendlyName>
                      <InternalValue>-mfloat-abi=soft</InternalValue>
                    </Suggestion>
                    <Suggestion>
                      <UserFriendlyName>Hardware</UserFriendlyName>
                      <InternalValue>-mfloat-abi=hard</InternalValue>
                    </Suggestion>
                    <Suggestion>
                      <UserFriendlyName>Unspecified</UserFriendlyName>
                      <InternalValue />
                    </Suggestion>
                  </SuggestionList>
                  <DefaultEntryIndex>0</DefaultEntryIndex>
                  <AllowFreeEntry>false</AllowFreeEntry>
                </PropertyEntry>
                <PropertyEntry xsi:type="Boolean">
                  <Name>Exclude the startup file from project</Name>
                  <UniqueID>com.sysprogs.mcuoptions.ignore_startup_file</UniqueID>
                  <OmitPrefixIfEmpty>false</OmitPrefixIfEmpty>
                  <DefaultValue>false</DefaultValue>
                  <ValueForTrue>1</ValueForTrue>
                </PropertyEntry>
                <PropertyEntry xsi:type="Enumerated">
                  <Name>C Library Type</Name>
                  <UniqueID>com.sysprogs.toolchainoptions.arm.libctype</UniqueID>
                  <OmitPrefixIfEmpty>false</OmitPrefixIfEmpty>
                  <SuggestionList>
                    <Suggestion>
                      <UserFriendlyName>Default</UserFriendlyName>
                      <InternalValue />
                    </Suggestion>
                    <Suggestion>
                      <UserFriendlyName>Newlib-nano</UserFriendlyName>
                      <InternalValue>--specs=nano.specs</InternalValue>
                    </Suggestion>
                    <Suggestion>
                      <UserFriendlyName>Newlib-nano with floating point support in printf()</UserFriendlyName>
                      <InternalValue>--specs=nano.specs -u _printf_float</InternalValue>
                    </Suggestion>
                    <Suggestion>
                      <UserFriendlyName>Newlib-nano with floating point support in printf() and scanf()</UserFriendlyName>
                      <InternalValue>--specs=nano.specs -u _printf_float -u _scanf_float</InternalValue>
                    </Suggestion>
                  </SuggestionList>
                  <DefaultEntryIndex>1</DefaultEntryIndex>
                  <AllowFreeEntry>false</AllowFreeEntry>
                </PropertyEntry>
                <PropertyEntry xsi:type="Enumerated">
                  <Name>Implementations for _sbrk(), etc.</Name>
                  <UniqueID>com.sysprogs.toolchainoptions.arm.libnosys</UniqueID>
                  <OmitPrefixIfEmpty>false</OmitPrefixIfEmpty>
                  <SuggestionList>
                    <Suggestion>
                      <UserFriendlyName>None</UserFriendlyName>
                      <InternalValue />
                    </Suggestion>
                    <Suggestion>
                      <UserFriendlyName>Minimal (no semihosting)</UserFriendlyName>
                      <InternalValue>--specs=nosys.specs</InternalValue>
                    </Suggestion>
                    <Suggestion>
                      <UserFriendlyName>Support semihosting</UserFriendlyName>
                      <InternalValue>--specs=rdimon.specs</InternalValue>
                    </Suggestion>
                  </SuggestionList>
                  <DefaultEntryIndex>1</DefaultEntryIndex>
                  <AllowFreeEntry>false</AllowFreeEntry>
                </PropertyEntry>
              </Properties>
              <CollapsedByDefault>false</CollapsedByDefault>
            </PropertyGroup>
          </PropertyGroups>
        </ConfigurableProperties>
        <HierarchicalPath>STM32\STM32L4</HierarchicalPath>
        <FamilyID>STM32L4</FamilyID>
        <FLASHSize>1048576</FLASHSize>
    	<FLASHBase>134217728</FLASHBase>
    	<RAMBase>536870912</RAMBase>
        <RAMSize>98304</RAMSize>
    	<RAM2Base>268435456</RAM2Base>
        <RAM2Size>32768</RAM2Size>
        <MCUDefinitionFile>stm32l486xx.xml</MCUDefinitionFile>
        <AdditionalSourcesRequiredForTesting>false</AdditionalSourcesRequiredForTesting>
      </InPlaceMCU>
      <MCUMakFile>stm32.mak</MCUMakFile>
      <ReferencedFrameworks />
      <FrameworkProperties>
        <Entries>
          <KeyValue>
            <Key>com.sysprogs.bspoptions.stm32.ll_driver</Key>
            <Value />
          </KeyValue>
        </Entries>
      </FrameworkProperties>
      <TestFrameworkProperties>
        <Entries />
      </TestFrameworkProperties>
    </EmbeddedProfile>

     

    #35246
    support
    Keymaster

    Hi,

    This looks like the behavior of the old VisualGDB version that could not reliably distinguish the load/placement addresses of some sections, and had to guess it. Please try updating to the latest VisualGDB 6.0 Beta 3 – it should handle it out-of-the-box.

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