summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/stm32/app.lds
blob: 4e5e393d28cdf2f2bd81cc450a6c9ab381dcda99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#include "cpu.h"

/*
 * TODO: this is temporary and has not been tested
 */

ENTRY(main)
OUTPUT_FORMAT(elf32-littlearm)
OUTPUT_ARCH(arm)
STARTUP(target/arm/stm32/crt0-stm32h7.o)

MEMORY
{
    SRAM_AXI (rwx) : ORIGIN = STM32_SRAM_AXI_BASE,    LENGTH = STM32_SRAM_AXI_SIZE
    DTCM     (rwx) : ORIGIN = STM32_DTCM_BASE,        LENGTH = STM32_DTCM_SIZE
    ITCM     (rwx) : ORIGIN = STM32_ITCM_BASE,        LENGTH = STM32_ITCM_SIZE
    SDRAM    (rwx) : ORIGIN = STM32_SDRAM1_BASE,      LENGTH = MEMORYSIZE * 1024 * 1024
}

/*
 * to control section alignment (only affects on-disk alignment):
 * -Wl,-z,max-page-size=0x1
 */

PHDRS
{
    sram_rx PT_LOAD ;
    sram_ro PT_LOAD ;
    sram_rw PT_LOAD ;
    itcm PT_LOAD ;
    dtcm PT_LOAD ;
    sdram_rx PT_LOAD ;
    sdram_rw PT_LOAD ;
}

SECTIONS
{
    .text :
    {
        loadaddress = .; /* only needed to keep ROLO happy */

        KEEP(*(.bootdata))
        *(.init.text*)
        *(.text*)
    } > SRAM_AXI :sram_rx

    .rodata :
    {
        *(.rodata*)
    } > SRAM_AXI :sram_ro

    .data :
    {
        _databegin = .;
        *(.data*)
        _dataend = .;
    } > SRAM_AXI :sram_rw
    _datacopy = LOADADDR(.data);

    .itext :
    {
        KEEP(*(.vectors.arm))
        KEEP(*(.vectors.platform))
        *(.icode*);
    } > ITCM :itcm

    .stack (NOLOAD) :
    {
        irqstackbegin = .;
        . += 0x400;
        irqstackend = .;

        stackbegin = .;
        . += 0x2000;
        stackend = .;

        *(.stack);
    } > DTCM :dtcm

    .bss (NOLOAD) :
    {
        _bssbegin = .;
        *(.bss*);
        *(COMMON);
        _bssend = .;
    } > SDRAM :sdram_rw

    audiobuffer = ALIGN(32);
    audiobufend = ORIGIN(SDRAM) + LENGTH(SDRAM) - CODEC_SIZE - PLUGIN_BUFFER_SIZE;
    codecbuf = audiobufend;
    pluginbuf = codecbuf + CODEC_SIZE;
}

EXTERN(__vectors_arm);
EXTERN(__vectors_platform);
ASSERT(DEFINED(__vectors_arm), "ARM exception vectors are not defined.");
ASSERT(DEFINED(__vectors_platform), "Platform exception vectors are not defined.");