H7: few more Kb of RAM found (#1605)

* init

* remove discard
This commit is contained in:
Igor Biletskyy 2023-08-24 16:56:31 -07:00 committed by GitHub
parent 0587f22bf3
commit 0a32b17513
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 51 additions and 24 deletions

View File

@ -53,9 +53,9 @@ void process_can(uint8_t can_number);
can_ring can_##x = { .w_ptr = 0, .r_ptr = 0, .fifo_size = (size), .elems = (CANPacket_t *)&(elems_##x) };
#ifdef STM32H7
__attribute__((section(".ram_d1"))) can_buffer(rx_q, 0x1000)
__attribute__((section(".ram_d1"))) can_buffer(tx2_q, 0x1A0)
__attribute__((section(".ram_d2"))) can_buffer(txgmlan_q, 0x1A0)
__attribute__((section(".axisram"))) can_buffer(rx_q, 0x1000)
__attribute__((section(".axisram"))) can_buffer(tx2_q, 0x1A0)
__attribute__((section(".sram12"))) can_buffer(txgmlan_q, 0x1A0)
#else
can_buffer(rx_q, 0x1000)
can_buffer(tx2_q, 0x1A0)

View File

@ -10,8 +10,8 @@
#ifdef STM32H7
#define SPI_BUF_SIZE 2048U
__attribute__((section(".ram_d1"))) uint8_t spi_buf_rx[SPI_BUF_SIZE];
__attribute__((section(".ram_d2"))) uint8_t spi_buf_tx[SPI_BUF_SIZE];
__attribute__((section(".axisram"))) uint8_t spi_buf_rx[SPI_BUF_SIZE];
__attribute__((section(".sram12"))) uint8_t spi_buf_tx[SPI_BUF_SIZE];
#else
#define SPI_BUF_SIZE 1024U
uint8_t spi_buf_rx[SPI_BUF_SIZE];

View File

@ -64,12 +64,17 @@ _Min_Stack_Size = 0x400; /* required amount of stack */
/* Specify the memory areas */
MEMORY
{
/* RAM */
BACKUP_SRAM (xrw) : ORIGIN = 0x38800000, LENGTH = 4K /* Backup SRAM(4kb) */
SRAM4 (xrw) : ORIGIN = 0x38000000, LENGTH = 16K /* SRAM4(16kb) best for BDMA and SDMMC1*/
SRAM12 (xrw) : ORIGIN = 0x30000000, LENGTH = 32K /* SRAM1(16kb) + SRAM2(16kb), not for BDMA or SDMMC1 */
AXISRAM (xrw) : ORIGIN = 0x24000000, LENGTH = 320K /* AXI SRAM */
DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K /* DTCM */
RAM_D1 (xrw) : ORIGIN = 0x24000000, LENGTH = 320K /* AXI SRAM */
RAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 32K /* SRAM1(16kb) + SRAM2(16kb) */
RAM_D3 (xrw) : ORIGIN = 0x38000000, LENGTH = 16K /* SRAM4 */
/* Code */
SYSTEM (rx) : ORIGIN = 0x1FF00000, LENGTH = 128K /* System memory */
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 1024K
}
/* Define output sections */
@ -141,7 +146,7 @@ SECTIONS
_sidata = LOADADDR(.data);
/* Initialized data sections goes into RAM, load LMA copy after code */
.data :
.data :
{
. = ALIGN(4);
_sdata = .; /* create a global symbol at data start */
@ -180,17 +185,35 @@ SECTIONS
. = ALIGN(8);
} >DTCMRAM
.ram_d1 (NOLOAD) :
.itcmram (NOLOAD) :
{
. = ALIGN(4);
*(.ram_d1*)
} >RAM_D1
*(.itcmram*)
} >ITCMRAM
.ram_d2 (NOLOAD) :
.axisram (NOLOAD) :
{
. = ALIGN(4);
*(.ram_d2*)
} >RAM_D2
*(.axisram*)
} >AXISRAM
.sram12 (NOLOAD) :
{
. = ALIGN(4);
*(.sram12*)
} >SRAM12
.sram4 (NOLOAD) :
{
. = ALIGN(4);
*(.sram4*)
} >SRAM4
.backup_sram (NOLOAD) :
{
. = ALIGN(4);
*(.backup_sram*)
} >BACKUP_SRAM
.ARM.attributes 0 : { *(.ARM.attributes) }
}

View File

@ -7,15 +7,16 @@ def check_space(file, mcu):
MCUS = {
"H7": {
".flash": 1024*1024, # FLASH
".ram_dtcm": 128*1024, # DTCMRAM
".ram_d1": 320*1024, # AXI SRAM
".ram_d2": 32*1024, # SRAM1(16kb) + SRAM2(16kb)
".ram_d3": 16*1024, # SRAM4
".ram_itcm": 64*1024, # ITCMRAM
".dtcmram": 128*1024, # DTCMRAM
".itcmram": 64*1024, # ITCMRAM
".axisram": 320*1024, # AXI SRAM
".sram12": 32*1024, # SRAM1(16kb) + SRAM2(16kb)
".sram4": 16*1024, # SRAM4
".backup_sram": 4*1024, # SRAM4
},
"F4": {
".flash": 1024*1024, # FLASH
".ram_dtcm": 256*1024, # RAM
".dtcmram": 256*1024, # RAM
".ram_d1": 64*1024, # RAM2
},
}
@ -29,7 +30,10 @@ def check_space(file, mcu):
".debug_str",
".debug_ranges",
".debug_loc",
".debug_frame"
".debug_frame",
".debug_line_str",
".debug_rnglists",
".debug_loclists",
]
FLASH = [
".isr_vector",
@ -59,7 +63,7 @@ def check_space(file, mcu):
calcs[".flash"] += int(line[1], 16)
pop = True
if line[0] in RAM:
calcs[".ram_dtcm"] += int(line[1], 16)
calcs[".dtcmram"] += int(line[1], 16)
pop = True
if pop:
result.pop(line[0])