-
Notifications
You must be signed in to change notification settings - Fork 1
/
chipKIT-application-32MX440F256-pinguino.ld
153 lines (140 loc) · 7.57 KB
/
chipKIT-application-32MX440F256-pinguino.ld
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/* Default linker script, for normal executables */
OUTPUT_FORMAT("elf32-tradlittlemips")
OUTPUT_ARCH(pic32mx)
ENTRY(_reset)
/*
* Provide for a minimum stack and heap size
* - _min_stack_size - represents the minimum space that must be made
* available for the stack. Can be overridden from
* the command line using the linker's --defsym option.
* - _min_heap_size - represents the minimum space that must be made
* available for the heap. Can be overridden from
* the command line using the linker's --defsym option.
*/
EXTERN (_min_stack_size _min_heap_size)
PROVIDE(_min_stack_size = 0x800) ;
PROVIDE(_min_heap_size = 0x800) ;
/*************************************************************************
* Processor-specific object file. Contains SFR definitions.
*************************************************************************/
INPUT("processor.o")
/*************************************************************************
* Memory Regions
*
* Memory regions without attributes cannot be used for orphaned sections.
* Only sections specifically assigned to these regions can be allocated
* into these regions.
*************************************************************************/
MEMORY
{
kseg0_program_mem (rx) : ORIGIN = 0x9D006A00, LENGTH = 0x3C300
kseg0_boot_mem : ORIGIN = 0x9D006490, LENGTH = 0x970
exception_mem : ORIGIN = 0x9D005000, LENGTH = 0x1000
kseg1_boot_mem : ORIGIN = 0x9D006000, LENGTH = 0x490
kseg0_eeprom_mem : ORIGIN = 0x9D03F000, LENGTH = 0x1000
debug_exec_mem : ORIGIN = 0xBFC02000, LENGTH = 0
config3 : ORIGIN = 0xBFC02FF0, LENGTH = 4
config2 : ORIGIN = 0xBFC02FF4, LENGTH = 4
config1 : ORIGIN = 0xBFC02FF8, LENGTH = 4
config0 : ORIGIN = 0xBFC02FFC, LENGTH = 4
boot_software_key : ORIGIN = 0xA0000000, LENGTH = 0x4
kseg1_data_mem (w!x) : ORIGIN = 0xA0000004, LENGTH = 0x7FFC
sfrs : ORIGIN = 0xBF800000, LENGTH = 0x100000
configsfrs : ORIGIN = 0xBFC02FF0, LENGTH = 0x10
}
/*************************************************************************
* Memory Address Equates
*************************************************************************/
_ebase_address = ORIGIN(exception_mem);
_IMAGE_PTR_TABLE = _ebase_address + 0x0F8;
_IMAGE_HEADER_ADDR = _ebase_address + 0x0FC;
_GEN_EXCPT_ADDR = _ebase_address + 0x180;
_RESET_ADDR = 0x9D006000;
_EEPROM_ADDR = ORIGIN(kseg0_eeprom_mem);
_BEV_EXCPT_ADDR = 0x9D006380;
_DBG_EXCPT_ADDR = 0x9D006480;
_DBG_CODE_ADDR = 0xBFC02000;
/*************************************************************************
* Bootloader program directives.
*
* _IMAGE_TYPE
*
* image type:
*/
_imageReserved = 0x00000000 ;
_imageMPIDE = 0x00000001 ; /* This is a normal MPIDE sketch */
_imageBootFlashBootloader = 0x00000002 ; /* This is a boot flash bootloader */
_imageProgramFlashBootloader = 0x00000004 ; /* This is a program flash bootloader */
_imageSplitFlashBootloader = 0x00000008 ; /* This has bootloader code in both boot and program flash */
/*
* Instructions for the bootloader
*/
_imageFullFlashEraseLess4KEEProm = 0x00010000 ; /* The original bootloader method of erasing all of program flash except the last 4K reserved for eeprom */
_imageJustInTimeFlashErase = 0x00020000 ; /* Only flash pages written too needed by the sketch is erased */
_imageLinkerSpecifiedFlashErase = 0x00040000 ; /* The linker defines the flash range to erase */
_imageFullFlashErase = 0x00080000 ; /* All of flash is erased */
_imageExecutionJumpAddress = 0x01000000 ; /* the bootloader will jump to the execution jump address immediately after programming */
_imageExecutionJumpToFirstInFlash = 0x02000000 ; /* the bootloader will jump to the first sketch loaded in flash ignoring the execution jump address immediately after programming */
/*
* _IMAGE_FLASH_SIZE
*
* Typically _imageJustInTimeFlashErase is selected to just erase the pages
* of flash that code is written too; thus leaving all other flash pages untouched.
*
* If _imageLinkerSpecifiedFlashErase set, then the range
* starting from _ebase_address for _IMAGE_FLASH_SIZE bytes are erased.
*
* If _imageFullFlashErase is specified, than the whole flash
* as known by the bootloader will be erased. This will erase eeprom as well
*
* if _imageFullFlashEraseLess4KEEProm is set, all of flash less the last 4K is
* erased, this is the old default. This bit could be set to make a program flash bootloader
* erasing everything but the old flash. If NOTHING is set, this will be the default as this is the old behavior.
*
* _JUMP_ADDR
*
* This is the address that the bootloader will jump to start execution
* of the sketch. This is almost always _RESET_ADDR.
*
* However, you can specify an alternate entry execution point for example
* if you have alternate starup code that, say, shared
* the runtime with other sketches or needed some kind of specific handling
*
* Immediately after programming (avrdude upload) the bootloader will typically
* jump to the just loaded sketch, no matter where it was loaded in flash.
* _imageExecutionJumpToFirstInFlash will tell the bootloader to jump to the first
* sketch in flash even if the just loaded one is not at the beginning of flash.
* This is useful when programming sketches in slots of flash and then always
* jumping to the program-flash loader (vector sketch) as if the board was just reset.
* This bit does not effect jumping to a sketch already in flash after reset.
* As of today, after reset, the first program in flash will always be jumped to.
*
*************************************************************************/
_IMAGE_TYPE = _imageMPIDE | _imageJustInTimeFlashErase | _imageExecutionJumpAddress;
_IMAGE_FLASH_SIZE = LENGTH(exception_mem) + LENGTH(kseg0_program_mem);
_JUMP_ADDR = _RESET_ADDR;
SECTIONS
{
.boot_software_key_sec : {
*(.boot_software_key_sec)
} > boot_software_key
.config_BFC02FF0 : {
KEEP(*(.config_BFC02FF0))
} > config3
.config_BFC02FF4 : {
KEEP(*(.config_BFC02FF4))
} > config2
.config_BFC02FF8 : {
KEEP(*(.config_BFC02FF8))
} > config1
.config_BFC02FFC : {
KEEP(*(.config_BFC02FFC))
} > config0
/* Boot Sections */
.reset _RESET_ADDR :
{
KEEP(*(.reset))
} > kseg1_boot_mem
}
/* From here out every linker script is the same, so just include it */
/*INCLUDE "chipKIT-application-COMMON.ld"*/