Index: umsboot/src/app/umsboot/console.h |
— | — | @@ -1,5 +1,5 @@ |
2 | | -#ifndef __TARGET_UMSBOOT_IPODNANO2G_H__ |
3 | | -#define __TARGET_UMSBOOT_IPODNANO2G_H__ |
| 2 | +#ifndef __APP_UMSBOOT_CONSOLE_H__ |
| 3 | +#define __APP_UMSBOOT_CONSOLE_H__ |
4 | 4 | |
5 | 5 | #include "global.h" |
6 | 6 | #include "interface/console/console.h" |
Index: umsboot/src/app/umsboot/DEPS |
— | — | @@ -1,3 +1,4 @@ |
2 | 2 | ../../interface/lcd |
3 | 3 | ../../lib/simpletextrenderer |
4 | 4 | ../../lib/fbconsole |
| 5 | + |
Index: umsboot/src/app/umsboot/SOURCES |
— | — | @@ -3,3 +3,4 @@ |
4 | 4 | main.c |
5 | 5 | usbglue.c |
6 | 6 | ums.c |
| 7 | + |
Index: umsboot/src/soc/s5l87xx/startup.S |
— | — | @@ -26,22 +26,21 @@ |
27 | 27 | .extern _fiq_handler |
28 | 28 | |
29 | 29 | |
30 | | -.global _vectors |
31 | 30 | .section .vectors,"ax",%progbits |
32 | | -_vectors: |
33 | | - b _reset_handler |
34 | | - b _undef_instr_handler |
35 | | - b _syscall_handler |
36 | | - b _prefetch_abort_handler |
37 | | - b _data_abort_handler |
38 | | - b _reserved_handler |
39 | | - b _irq_handler |
40 | | - b _fiq_handler |
| 31 | + ldr pc, =_reserved_handler |
| 32 | + ldr pc, =_undef_instr_handler |
| 33 | + ldr pc, =_syscall_handler |
| 34 | + ldr pc, =_prefetch_abort_handler |
| 35 | + ldr pc, =_data_abort_handler |
| 36 | + ldr pc, =_reserved_handler |
| 37 | + ldr pc, =_irq_handler |
| 38 | + ldr pc, =_fiq_handler |
41 | 39 | |
42 | | -_reset_handler: |
| 40 | + |
| 41 | +.section .init,"ax",%progbits |
43 | 42 | @ Check if we need to relocate ourselves |
44 | | - adr r0, _vectors |
45 | | - ldr r1, =_vectors |
| 43 | + adr r0, _init_end |
| 44 | + ldr r1, =_text |
46 | 45 | cmp r0, r1 |
47 | 46 | beq _relocated |
48 | 47 | @ Move around as necessary |
— | — | @@ -53,6 +52,19 @@ |
54 | 53 | subs r2, r2, #1 |
55 | 54 | bne _copy |
56 | 55 | _relocated: |
| 56 | + @ Check if the vectors need to be copied |
| 57 | + ldr r2, =_vectors_src |
| 58 | + sub r0, r0, r1 |
| 59 | + add r0, r0, r2 |
| 60 | + ldr r2, =(_vectors_size + 31) |
| 61 | + ldr r1, =_vectors |
| 62 | + mov r2, r2,lsr#5 |
| 63 | + @ Copy vectors |
| 64 | +_vectors_copy: |
| 65 | + ldmia r0!, {r4-r11} |
| 66 | + stmia r1!, {r4-r11} |
| 67 | + subs r2, r2, #1 |
| 68 | + bne _vectors_copy |
57 | 69 | #ifdef SOC_S5L8701 |
58 | 70 | @ Detect execution base address and remap memory at 0x0 accordingly (for IRQ vectors) |
59 | 71 | tst r1, #0x20000000 |
— | — | @@ -136,7 +148,10 @@ |
137 | 149 | |
138 | 150 | @ Jump to final execution address (after relocation) |
139 | 151 | ldr pc, =_enable_irqs |
| 152 | +.ltorg |
| 153 | +_init_end: |
140 | 154 | |
| 155 | +.section .text,"ax",%progbits |
141 | 156 | _enable_irqs: |
142 | 157 | @ Mask and clear all IRQs |
143 | 158 | #ifdef SOC_S5L8701 |
— | — | @@ -228,3 +243,4 @@ |
229 | 244 | b hang |
230 | 245 | .size reset, .-reset |
231 | 246 | .size hang, .-hang |
| 247 | + |
Index: umsboot/src/soc/s5l87xx/target.h |
— | — | @@ -4,3 +4,4 @@ |
5 | 5 | |
6 | 6 | |
7 | 7 | #endif |
| 8 | + |
Index: umsboot/src/soc/s5l87xx/link.lds |
— | — | @@ -13,18 +13,36 @@ |
14 | 14 | #define SDRAM_SIZE DEFAULT_SDRAM_SIZE |
15 | 15 | #endif |
16 | 16 | |
| 17 | +#ifndef VECTORS_REGION |
| 18 | +#define VECTORS_REGION SRAM |
| 19 | +#endif |
| 20 | +#ifndef VECTORS_BASE |
| 21 | +#define VECTORS_BASE SRAM_BASE |
| 22 | +#endif |
17 | 23 | #ifndef CODE_REGION |
18 | 24 | #define CODE_REGION SDRAM |
19 | 25 | #endif |
| 26 | +#ifndef CODE_BASE |
| 27 | +#define CODE_BASE |
| 28 | +#endif |
20 | 29 | #ifndef BSS_REGION |
21 | 30 | #define BSS_REGION SDRAM |
22 | 31 | #endif |
| 32 | +#ifndef BSS_BASE |
| 33 | +#define BSS_BASE |
| 34 | +#endif |
23 | 35 | #ifndef DMABSS_REGION |
24 | 36 | #define DMABSS_REGION SRAM |
25 | 37 | #endif |
| 38 | +#ifndef DMABSS_BASE |
| 39 | +#define DMABSS_BASE |
| 40 | +#endif |
26 | 41 | #ifndef STACK_REGION |
27 | 42 | #define STACK_REGION SRAM |
28 | 43 | #endif |
| 44 | +#ifndef STACK_BASE |
| 45 | +#define STACK_BASE |
| 46 | +#endif |
29 | 47 | |
30 | 48 | #ifndef STACK_SIZE |
31 | 49 | #define STACK_SIZE 0x1000 |
— | — | @@ -44,16 +62,18 @@ |
45 | 63 | SDRAM : ORIGIN = SDRAM_BASE, LENGTH = SDRAM_SIZE |
46 | 64 | } |
47 | 65 | |
48 | | -_entry = _vectors; |
| 66 | +_entry = _init; |
49 | 67 | ENTRY(_entry) |
50 | 68 | |
51 | 69 | SECTIONS |
52 | 70 | { |
53 | 71 | |
54 | | - .text : |
| 72 | + .text CODE_BASE : |
55 | 73 | { |
| 74 | + _init = .; |
| 75 | + KEEP(*(.init)) |
| 76 | + _init_end = .; |
56 | 77 | _text = .; |
57 | | - KEEP(*(.vectors)) |
58 | 78 | *(.text) |
59 | 79 | *(.text.*) |
60 | 80 | *(.rodata) |
— | — | @@ -70,9 +90,25 @@ |
71 | 91 | |
72 | 92 | _text_size = _text_end - _text; |
73 | 93 | |
74 | | - .bss (NOLOAD) : |
| 94 | + .vectors VECTORS_BASE : |
75 | 95 | { |
| 96 | + _vectors = .; |
| 97 | + KEEP(*(.vectors)) |
| 98 | + _vectors_end = .; |
| 99 | + } >VECTORS_REGION AT>CODE_REGION |
| 100 | + |
| 101 | + _vectors_src = LOADADDR(.vectors); |
| 102 | + _vectors_size = _vectors_end - _vectors; |
| 103 | + |
| 104 | + .dummy _text_end - 4 : |
| 105 | + { |
| 106 | + . += 4; |
76 | 107 | . = ALIGN(1 << CACHEALIGN_BITS); |
| 108 | + } >CODE_REGION |
| 109 | + |
| 110 | + .bss BSS_BASE (NOLOAD) : |
| 111 | + { |
| 112 | + . = ALIGN(1 << CACHEALIGN_BITS); |
77 | 113 | _bss = .; |
78 | 114 | *(.bss) |
79 | 115 | *(.bss.*) |
— | — | @@ -83,7 +119,7 @@ |
84 | 120 | |
85 | 121 | _bss_size = _bss_end - _bss; |
86 | 122 | |
87 | | - .dmabss (NOLOAD) : |
| 123 | + .dmabss DMABSS_BASE (NOLOAD) : |
88 | 124 | { |
89 | 125 | . = ALIGN(1 << CACHEALIGN_BITS); |
90 | 126 | _dmabss = .; |
— | — | @@ -95,7 +131,7 @@ |
96 | 132 | |
97 | 133 | _dmabss_size = _dmabss_end - _dmabss; |
98 | 134 | |
99 | | - .stack (NOLOAD) : |
| 135 | + .stack STACK_BASE (NOLOAD) : |
100 | 136 | { |
101 | 137 | . = ALIGN(1 << CACHEALIGN_BITS); |
102 | 138 | _stack = .; |
Index: umsboot/src/soc/s5l87xx/init.c |
— | — | @@ -7,3 +7,4 @@ |
8 | 8 | { |
9 | 9 | main(); |
10 | 10 | } |
| 11 | + |
Index: umsboot/src/sys/util.h |
— | — | @@ -111,7 +111,7 @@ |
112 | 112 | #ifndef ASM_FILE |
113 | 113 | extern __attribute__((noreturn)) void powerdown(); |
114 | 114 | extern __attribute__((noreturn)) void hang(); |
115 | | -extern __attribute__((pure)) void idle(); |
| 115 | +extern void idle(); |
116 | 116 | extern __attribute__((noreturn)) void execfirmware(void* address); |
117 | 117 | extern void enter_critical_section(); |
118 | 118 | extern void leave_critical_section(); |
Index: umsboot/Makefile |
— | — | @@ -99,7 +99,7 @@ |
100 | 100 | SRC := $(foreach file,$(SRC),$(call relpath,$(file))) |
101 | 101 | OBJ := $(SRC:src/%.c=build/$(TARGET)/$(TYPE)/%.o) |
102 | 102 | OBJ := $(OBJ:src/%.S=build/$(TARGET)/$(TYPE)/%.o) |
103 | | -_LDSCRIPT = $(LDSCRIPT:src/%.lds=build/$(TARGET)/$(TYPE)/%.lds) |
| 103 | +_LDSCRIPT := $(LDSCRIPT:src/%.lds=build/$(TARGET)/$(TYPE)/%.lds) |
104 | 104 | |
105 | 105 | _ASMFLAGS := $(CFLAGS_GENERAL) $(CFLAGS_ASM) $(CFLAGS_$(TYPE)) $(_CFLAGS) $(_PPFLAGS) $(CFLAGS) $(ASMFLAGS) |
106 | 106 | _CFLAGS := $(CFLAGS_GENERAL) $(CFLAGS_$(TYPE)) $(_CFLAGS) $(_PPFLAGS) $(CFLAGS) |