jtag-loop: Use common bare-metal code, adding support for most SoCs

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
This commit is contained in:
Paul Kocialkowski 2025-04-16 12:35:13 +02:00 committed by Andre Przywara
parent edcbe4f4b8
commit c507149dbf
3 changed files with 27 additions and 42 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -1,28 +0,0 @@
/*
* Copyright (C) 2012 Henrik Nordstrom <henrik@henriknordstrom.net>
*
* 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 <http://www.gnu.org/licenses/>.
*/
SECTIONS
{
. = 0x0030;
.text : { *(.text) }
/DISCARD/ : { *(.dynstr*) }
/DISCARD/ : { *(.dynamic*) }
/DISCARD/ : { *(.plt*) }
/DISCARD/ : { *(.interp*) }
/DISCARD/ : { *(.gnu*) }
/DISCARD/ : { *(.note*) }
}