summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile35
-rw-r--r--main.c10
-rw-r--r--openocd-due.cfg5
-rw-r--r--script.ld4
4 files changed, 4 insertions, 50 deletions
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 846d463..0000000
--- a/Makefile
+++ /dev/null
@@ -1,35 +0,0 @@
-CC = arm-none-eabi-gcc
-CPU = cortex-m3
-TARGET = due
-
-SRC = main.c
-OBJ = $(SRC:.c=.o)
-
-CFLAGS = -std=gnu99
-CFLAGS += -Os
-CFLAGS += -Wall
-CFLAGS += -mcpu=$(CPU)
-CFLAGS += -mthumb
-
-LDFLAGS = -mcpu=$(CPU)
-LDFLAGS += -Wl,--gc-sections
-
-HEX_FLAGS = -O ihex
-HEX_FLAGS += -j .text -j .data
-
-%.o: %.c
- $(CC) $(CFLAGS) -c -o $@ $<
-
-elf: $(OBJ)
- $(CC) $(LDFLAGS) $(OBJ) -o $(TARGET).elf
-
-hex: elf
- arm-none-eabi-objcopy $(HEX_FLAGS) $(TARGET).elf $(TARGET).hex
-
-#upload: hex
-# openocd -f openocd-due.cfg -c "program $(TARGET) verify reset exit"
-
-.PHONY: clean
-
-clean:
- rm *.o *.elf *.hex
diff --git a/main.c b/main.c
index 71df022..3f00881 100644
--- a/main.c
+++ b/main.c
@@ -38,7 +38,7 @@ int main(void)
return 0;
}
-__attribute__((noreturn)) void _rst_handler(void) {
+__attribute__((noreturn)) void _reset(void) {
unsigned long *dst, *src;
extern unsigned long _sbss, _ebss, _sdata, _edata, _sidata;
@@ -49,14 +49,8 @@ __attribute__((noreturn)) void _rst_handler(void) {
*dst++ = *src++;
main();
-
- for (;;)
- ;
}
extern const unsigned int _sp;
-__attribute__ ((section(".vtor"))) const void* _tab[] = {
- &_sp,
- _rst_handler
-};
+__attribute__ ((section(".vtor"))) const void* _tab[] = { &_sp, _reset };
diff --git a/openocd-due.cfg b/openocd-due.cfg
index 8fba185..121a479 100644
--- a/openocd-due.cfg
+++ b/openocd-due.cfg
@@ -1,12 +1,7 @@
source [find interface/stlink.cfg]
-#transport type SWD
transport select hla_swd
-
-#swd frequency
adapter speed 1800
-
-#sam3x8e cpuid
set CPUTAPID 0x2ba01477
source [find target/at91sam3ax_8x.cfg]
diff --git a/script.ld b/script.ld
index 7a67dcf..f2e9b5d 100644
--- a/script.ld
+++ b/script.ld
@@ -4,8 +4,6 @@ MEMORY
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 96K
}
-_sp = ORIGIN(ram) + LENGTH(ram);
-
SECTIONS
{
.text :
@@ -32,3 +30,5 @@ SECTIONS
_ebss = . ;
} > ram
}
+
+_sp = ORIGIN(ram) + LENGTH(ram);