Hi,
i had issues with writing and DMA-access to a large array, 150KB
The reason is the SRAM_L/SRAM_U boundary, where no unaligned access is allowed. Here, unaligned means 16BIT accesses to 0x1FFFFFFE (crash...).
This is a big problem , because it is essential that the code can access this address. Any other access, or an "if" inside the inner loop would make the code much slower, so : no way.
I found a solution, with a new linker-file ( added "SCREEN" (.dmascreen))
and using __attribute__ ((section(".dmascreen"), used)) for the array.
Ok.... but i really really don't like this solution: It is a arduino-project, and some day i want to publish it. I really don't want that the user has to install a new linkerfile that influences all his other projects.
In addition, the size-tool reports wrong values after compiling.
My Question:
Is there a better way to make sure that the array is above the ram-boundary ?
i had issues with writing and DMA-access to a large array, 150KB
The reason is the SRAM_L/SRAM_U boundary, where no unaligned access is allowed. Here, unaligned means 16BIT accesses to 0x1FFFFFFE (crash...).
This is a big problem , because it is essential that the code can access this address. Any other access, or an "if" inside the inner loop would make the code much slower, so : no way.
I found a solution, with a new linker-file ( added "SCREEN" (.dmascreen))
Code:
MEMORY
{
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 1024K
RAM (rwx) : ORIGIN = 0x1FFF0000, LENGTH = 106K
SCREEN (rw) : ORIGIN = 0x2000A800, LENGTH = 150K
}
SECTIONS
{
.text : {
. = 0;
KEEP(*(.vectors))
/* TODO: does linker detect startup overflow onto flashconfig? */
. = 0x400;
KEEP(*(.flashconfig*))
*(.startup*)
*(.text*)
*(.rodata*)
. = ALIGN(4);
KEEP(*(.init))
. = ALIGN(4);
__preinit_array_start = .;
KEEP (*(.preinit_array))
__preinit_array_end = .;
__init_array_start = .;
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
__init_array_end = .;
} > FLASH = 0xFF
.ARM.exidx : {
__exidx_start = .;
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
__exidx_end = .;
} > FLASH
_etext = .;
.usbdescriptortable (NOLOAD) : {
/* . = ORIGIN(RAM); */
. = ALIGN(512);
*(.usbdescriptortable*)
} > RAM
.dmabuffers (NOLOAD) : {
. = ALIGN(4);
*(.dmabuffers*)
} > RAM
.usbbuffers (NOLOAD) : {
. = ALIGN(4);
*(.usbbuffers*)
} > RAM
.data : AT (_etext) {
. = ALIGN(4);
_sdata = .;
*(.fastrun*)
. = ALIGN(4);
*(.data*)
. = ALIGN(4);
_edata = .;
} > RAM
.noinit (NOLOAD) : {
*(.noinit*)
} > RAM
.bss : {
. = ALIGN(4);
_sbss = .;
__bss_start__ = .;
*(.bss*)
*(COMMON)
. = ALIGN(4);
_ebss = .;
__bss_end = .;
__bss_end__ = .;
} > RAM
.dmascreen (NOLOAD) : {
*(.dmascreen*)
} > SCREEN
_estack = ORIGIN(RAM) + LENGTH(RAM);
}
Ok.... but i really really don't like this solution: It is a arduino-project, and some day i want to publish it. I really don't want that the user has to install a new linkerfile that influences all his other projects.
In addition, the size-tool reports wrong values after compiling.
My Question:
Is there a better way to make sure that the array is above the ram-boundary ?
Last edited: