blue-pill: more draugr cleanups

This commit is contained in:
Kyle Isom 2018-03-07 15:55:54 -08:00
parent f5621c24b8
commit 75c0f46433
4 changed files with 17 additions and 14 deletions

View File

@ -31,12 +31,12 @@ all: $(BIN)
$(ELF): $(OBJS) $(ELF): $(OBJS)
$(ARMCC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS) $(ARMCC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
$(ARMSIZE) -A $@ $(ARMSIZE) $@
.PHONY: strip .PHONY: strip
strip: $(ELF) strip: $(ELF)
$(ARMTC)-strip $(ELF) $(ARMTC)-strip $(ELF)
$(ARMSIZE) -A $(ELF) $(ARMSIZE) $(ELF)
$(BIN): $(ELF) $(BIN): $(ELF)
$(OBJCOPY) -O binary $< $@ $(OBJCOPY) -O binary $< $@

View File

@ -33,7 +33,7 @@ all: $(BIN)
$(ELF): $(OBJS) $(ELF): $(OBJS)
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS) $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
$(ARMSIZE) -A $@ $(ARMSIZE) $@
$(BIN): $(ELF) $(BIN): $(ELF)
$(OBJCOPY) -O binary $< $@ $(OBJCOPY) -O binary $< $@

View File

@ -1,22 +1,24 @@
#include "bluepill.h" #include "bluepill.h"
#define LED_PIN 13 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) { // void __attribute__ ((weak, naked)) reset_handler(void) {
int int
main() { main() {
GPIO_C->enable_clock(); GPIO_C->enable_clock();
GPIO_C->pin_mode(LED_PIN, true, OUTPUT_GPP, OUTPUT_MAX_2MHZ); GPIO_C->pin_mode(LED, true, OUTPUT_GPP, OUTPUT_MAX_2MHZ);
while(1) { while(1) {
GPIO_C->pin_clear(LED_PIN); GPIO_C->pin_clear(LED);
delay(1000000); delay(LDELAY);
GPIO_C->pin_set(LED_PIN); GPIO_C->pin_set(LED);
delay(100000); delay(SDELAY);
GPIO_C->pin_clear(LED_PIN); GPIO_C->pin_clear(LED);
delay(100000); delay(SDELAY);
GPIO_C->pin_set(LED_PIN); GPIO_C->pin_set(LED);
delay(100000); delay(SDELAY);
} }
} }

View File

@ -6,6 +6,7 @@
*/ */
.globl vectors .globl vectors
vectors:
.align 2 .align 2
.long 0x100 /* best guess at stack pointer */ .long 0x100 /* best guess at stack pointer */
.long reset_handler /* reset handler */ .long reset_handler /* reset handler */
@ -20,7 +21,7 @@
.skip 4 /* reserved */ .skip 4 /* reserved */
.long 0 /* pendsv handler */ .long 0 /* pendsv handler */
.long 0 /* systick handler */ .long 0 /* systick handler */
.skip 0x110 /* remaining / IRQ vectors */ .skip 0xf4 /* remaining / IRQ vectors */
.globl reset_handler .globl reset_handler
reset_handler: reset_handler: