Skip to content

Commit

Permalink
Fix RAM address and add ITCM and DTCM sections
Browse files Browse the repository at this point in the history
Previously DTCM region was simply added to RAM region, this can cause problems with DMA as DMA does not have access to DTCM region.
See page 71 and 76 in data sheet RM0410 Rev 4.

#123

Signed-off-by: Moritz Scheuren <[email protected]>
  • Loading branch information
systec-ms committed Nov 4, 2021
1 parent 708ac86 commit e0ec1b4
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion memory_2048_368.x
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,32 @@ MEMORY
{
/* NOTE K = KiBi = 1024 bytes */
FLASH : ORIGIN = 0x08000000, LENGTH = 2M
RAM : ORIGIN = 0x20000000, LENGTH = 368K + 16K
RAM : ORIGIN = 0x20020000, LENGTH = 368K + 16K
ITCM : ORIGIN = 0x00000000, LENGTH = 16K /* Instruction Tighly Coupled Memory */
DTCM : ORIGIN = 0x20000000, LENGTH = 128K /* Data Tighly Coupled Memory */
}

SECTIONS
{
.itcm : ALIGN(4)
{
*(.itcm .itcm.*);
. = ALIGN(4);
} > ITCM

.dtcm : ALIGN(4)
{
*(.dtcm .dtcm.*);
. = ALIGN(4);
} > DTCM
}

/* You can then use something like this to place a variable into a specific section of memory:
* #[link_section = ".dtcm.BUFFER"]
* static mut BUF: [u8; 1024] = [3u8; 1024];
* Verifiable with: cargo size --release --example hello_world -- -A
*/

/* This is where the call stack will be allocated. */
/* The stack is of the full descending type. */
/* NOTE Do NOT modify `_stack_start` unless you know what you are doing */
Expand Down

0 comments on commit e0ec1b4

Please sign in to comment.