diff --git a/Makefile b/Makefile index f0c96e7..00c4ba5 100644 --- a/Makefile +++ b/Makefile @@ -174,8 +174,8 @@ ARM_ELF_FLAGS += -fno-common -fno-builtin -ffreestanding -nostdinc -fno-strict-a ARM_ELF_FLAGS += -mno-thumb-interwork -fno-stack-protector -fno-toplevel-reorder ARM_ELF_FLAGS += -Wstrict-prototypes -Wno-format-nonliteral -Wno-format-security -jtag-loop.elf: jtag-loop.c jtag-loop.lds - $(CROSS_CC) -g $(ARM_ELF_FLAGS) $< -nostdlib -o $@ -T $(lastword $^) -Wl,-N +jtag-loop.elf: jtag-loop.c bare-metal.c bare-metal.lds + $(CROSS_CC) -march=armv5te -g $(ARM_ELF_FLAGS) $(filter %.c,$^) -nostdlib -o $@ -T $(lastword $^) -Wl,-N fel-sdboot.elf: fel-sdboot.S fel-sdboot.lds $(CROSS_CC) -march=armv5te -g $(ARM_ELF_FLAGS) $< -nostdlib -o $@ -T $(lastword $^) -Wl,-N diff --git a/jtag-loop.c b/jtag-loop.c index 1110e48..01d52a7 100644 --- a/jtag-loop.c +++ b/jtag-loop.c @@ -18,19 +18,32 @@ * MA 02111-1307 USA */ -/* +#include "bare-metal.h" -Build instructions: - -arm-none-linux-gnueabi-gcc -g -fno-common -ffixed-r8 -msoft-float -fno-builtin -ffreestanding -nostdinc -mno-thumb-interwork -Wall -Wstrict-prototypes -fno-stack-protector -Wno-format-nonliteral -Wno-format-security -fno-toplevel-reorder -Os jtag-loop.c -c - -arm-none-linux-gnueabi-objcopy -O binary jtag-loop.o jtag-loop.bin - -mksunxiboot jtag-loop.bin jtag-loop.sunxi -*/ - -void _start(void) +int main(void) { - *(volatile unsigned long *)0x01c208b4 = 0x00444444; + const struct soc_info *soc = sunxi_detect_soc(); + + if (soc == NULL) + return 0; + + gpio_init(soc); + jtag_init(soc); + uart0_init(soc); + + uart0_puts("\nJTAG loop for Allwinner "); + uart0_puts(soc->name); + uart0_puts("!\n"); + + if (!soc->jtag.pinmux) { + uart0_puts("No JTAG pins defined for this SoC!\n"); + uart0_puts("Returning back to FEL.\n"); + return 0; + } + + uart0_puts("JTAG pinmux set, entering loop.\n"); + while(1); + + return 0; } diff --git a/jtag-loop.lds b/jtag-loop.lds deleted file mode 100644 index 9ba718d..0000000 --- a/jtag-loop.lds +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2012 Henrik Nordstrom - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -SECTIONS -{ - . = 0x0030; - .text : { *(.text) } - /DISCARD/ : { *(.dynstr*) } - /DISCARD/ : { *(.dynamic*) } - /DISCARD/ : { *(.plt*) } - /DISCARD/ : { *(.interp*) } - /DISCARD/ : { *(.gnu*) } - /DISCARD/ : { *(.note*) } -}