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)
$(ARMCC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
$(ARMSIZE) -A $@
$(ARMSIZE) $@
.PHONY: strip
strip: $(ELF)
$(ARMTC)-strip $(ELF)
$(ARMSIZE) -A $(ELF)
$(ARMSIZE) $(ELF)
$(BIN): $(ELF)
$(OBJCOPY) -O binary $< $@

View File

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

View File

@ -1,22 +1,24 @@
#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) {
int
main() {
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) {
GPIO_C->pin_clear(LED_PIN);
delay(1000000);
GPIO_C->pin_set(LED_PIN);
delay(100000);
GPIO_C->pin_clear(LED_PIN);
delay(100000);
GPIO_C->pin_set(LED_PIN);
delay(100000);
GPIO_C->pin_clear(LED);
delay(LDELAY);
GPIO_C->pin_set(LED);
delay(SDELAY);
GPIO_C->pin_clear(LED);
delay(SDELAY);
GPIO_C->pin_set(LED);
delay(SDELAY);
}
}

View File

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