1.1 --- a/stage2/Makefile Fri Jun 12 01:33:55 2015 +0200
1.2 +++ b/stage2/Makefile Fri Jun 12 01:38:00 2015 +0200
1.3 @@ -35,8 +35,8 @@
1.4 -I../include
1.5 LDFLAGS = -nostdlib -EL -pie
1.6
1.7 +UIMAGE = uImage
1.8 PAYLOAD = stage2.bin
1.9 -UIMAGE = uImage
1.10 TARGET = $(PAYLOAD:.bin=.elf)
1.11 DUMP = $(PAYLOAD:.bin=.dump)
1.12 MAP = $(PAYLOAD:.bin=.map)
1.13 @@ -70,13 +70,13 @@
1.14 all: $(PAYLOAD) $(UIMAGE)
1.15
1.16 clean:
1.17 - rm -f $(OBJ) $(TARGET) $(PAYLOAD) $(DUMP) *.map
1.18 + rm -f $(OBJ) $(TARGET) $(PAYLOAD) $(UIMAGE) $(DUMP) *.map
1.19
1.20 distclean: clean
1.21 echo "Nothing else to clean."
1.22
1.23 $(UIMAGE): $(PAYLOAD)
1.24 - $(MKIMAGE) -A mips -O linux -T standalone -C none -a 0x80000000 -e 0x80000000 -n NanoPayload -d $(PAYLOAD) $(UIMAGE)
1.25 + $(MKIMAGE) -A mips -O u-boot -T standalone -C none -a 0x80000000 -e 0x80000000 -n NanoPayload -d $(PAYLOAD) $(UIMAGE)
1.26
1.27 $(PAYLOAD): $(TARGET)
1.28 $(OBJCOPY) -O binary $(@:.bin=.elf) $@+
2.1 --- a/stage2/board-nanonote.c Fri Jun 12 01:33:55 2015 +0200
2.2 +++ b/stage2/board-nanonote.c Fri Jun 12 01:38:00 2015 +0200
2.3 @@ -131,3 +131,8 @@
2.4 lastdec = 0;
2.5 timestamp = 0;
2.6 }
2.7 +
2.8 +int is_started(void)
2.9 +{
2.10 + return REG_CPM_CLKGR != 0;
2.11 +}
3.1 --- a/stage2/board-nanonote.h Fri Jun 12 01:33:55 2015 +0200
3.2 +++ b/stage2/board-nanonote.h Fri Jun 12 01:38:00 2015 +0200
3.3 @@ -7,5 +7,6 @@
3.4 void cpm_init(void);
3.5 void rtc_init(void);
3.6 void timer_init(void);
3.7 +int is_started(void);
3.8
3.9 #endif /* __BOARD_NANONOTE_H__ */
4.1 --- a/stage2/stage2.c Fri Jun 12 01:33:55 2015 +0200
4.2 +++ b/stage2/stage2.c Fri Jun 12 01:38:00 2015 +0200
4.3 @@ -31,6 +31,7 @@
4.4 /* Relocate object locations. */
4.5
4.6 volatile unsigned int start_addr, got_start, got_end, addr, offset;
4.7 + volatile int started;
4.8
4.9 /* get absolute start address */
4.10 __asm__ __volatile__(
4.11 @@ -59,10 +60,13 @@
4.12
4.13 /* The actual work. */
4.14
4.15 - gpio_init2();
4.16 - cpm_init();
4.17 - rtc_init();
4.18 - timer_init();
4.19 + started = is_started();
4.20 + if (!started) {
4.21 + gpio_init2();
4.22 + cpm_init();
4.23 + rtc_init();
4.24 + timer_init();
4.25 + }
4.26 lcd_init();
4.27 while (1);
4.28 }