blue-pill: copying linker script over

This commit is contained in:
Kyle Isom 2018-03-12 22:48:05 -07:00
parent 943e2bfa93
commit 5f5c4ac7ae
5 changed files with 36 additions and 28 deletions

View File

@ -1,11 +1,18 @@
MEMORY
{
flash (rx) : ORIGIN = 0x00000000, LENGTH = 128K
flash (rx) : ORIGIN = 0x08000000, LENGTH = 64K
sram (rwx) : ORIGIN = 0x20000000, LENGTH = 20K
}
EXTERN(vectors);
ENTRY(reset_handler);
SECTIONS
{
.text : { *(.text*) } > flash
.text : {
*(.vectors*)
*(.text*)
. = ALIGN(4);
} > flash
.bss : { *(.bss*) } > sram
}

View File

@ -8,29 +8,26 @@
.cpu cortex-m3
.thumb
.globl vectors
.section .text
.global vectors
vectors:
.align 2
.long 0x20002000 /* best guess at stack pointer */
.long 0x100 /* best guess at stack pointer */
.long reset_handler /* reset handler */
.long hang /* NMI handler */
.long hang /* hard_fault_handler */
.long hang /* memory management handler */
.long hang /* bus fault handler */
.long hang /* usage fault handler */
.long 0 /* NMI handler */
.long 0 /* hard_fault_handler */
.long 0 /* memory management handler */
.long 0 /* bus fault handler */
.long 0 /* usage fault handler */
.skip 0x20 /* reserved */
.long hang /* svcall handler */
.long hang /* debug handler */
.long 0 /* svcall handler */
.long 0 /* debug handler */
.skip 4 /* reserved */
.long hang /* pendsv handler */
.long hang /* systick handler */
.skip 0x100 /* remaining / IRQ vectors */
.thumb_func
hang: b .
.long 0 /* pendsv handler */
.long 0 /* systick handler */
.skip 0xf4 /* remaining / IRQ vectors */
.thumb_func
.global reset_handler
reset_handler:
bl main

View File

@ -4,7 +4,6 @@ constexpr uint32_t LED = 13;
constexpr unsigned long SDELAY = 100000;
constexpr unsigned long LDELAY = (SDELAY * 10) - (3 * SDELAY);
// void __attribute__ ((weak, naked)) reset_handler(void) {
int
main() {
GPIO_C->enable_clock();
@ -21,4 +20,3 @@ main() {
delay(SDELAY);
}
}

View File

@ -1,6 +1,6 @@
MEMORY
{
flash (rx) : ORIGIN = 0x08000000, LENGTH = 64K
flash (rx) : ORIGIN = 0x08000000, LENGTH = 128K
sram (rwx) : ORIGIN = 0x20000000, LENGTH = 20K
}
@ -10,9 +10,8 @@ ENTRY(reset_handler);
SECTIONS
{
.text : {
*(.vectors*)
*(.vectors)
*(.text*)
. = ALIGN(4);
} > flash
.bss : { *(.bss*) } > sram
}

View File

@ -1,11 +1,18 @@
MEMORY
{
flash (rx) : ORIGIN = 0x00000000, LENGTH = 128K
flash (rx) : ORIGIN = 0x08000000, LENGTH = 64K
sram (rwx) : ORIGIN = 0x20000000, LENGTH = 20K
}
EXTERN(vectors);
ENTRY(reset_handler);
SECTIONS
{
.text : { *(.text*) } > flash
.text : {
*(.vectors*)
*(.text*)
. = ALIGN(4);
} > flash
.bss : { *(.bss*) } > sram
}