1.1 --- a/Makefile Fri Jun 05 19:07:33 2015 +0200
1.2 +++ b/Makefile Fri Jun 05 19:34:16 2015 +0200
1.3 @@ -32,35 +32,42 @@
1.4 -ffreestanding -fno-hosted -fno-builtin \
1.5 -march=mips32 -mno-abicalls \
1.6 -Iinclude -I$(ASM_INC) -I$(ASM_INC)/asm/mach-generic
1.7 -LDFLAGS = -nostdlib -EL -T target.ld
1.8 +LDFLAGS = -nostdlib -EL
1.9
1.10 -PAYLOAD = stage1.bin
1.11 +PAYLOAD = stage1.bin stage2.bin
1.12 TARGET = $(PAYLOAD:.bin=.elf)
1.13 DUMP = $(PAYLOAD:.bin=.dump)
1.14 MAP = $(PAYLOAD:.bin=.map)
1.15 -SRC = head.S stage1.c board-nanonote.c
1.16 -OBJ = $(filter %.o,$(SRC:.c=.o) $(SRC:.S=.o))
1.17 +
1.18 +SRC1 = head1.S stage1.c board-nanonote.c
1.19 +SRC2 = head2.S stage2.c board-nanonote.c
1.20 +OBJ1 = $(filter %.o,$(SRC1:.c=.o) $(SRC1:.S=.o))
1.21 +OBJ2 = $(filter %.o,$(SRC2:.c=.o) $(SRC2:.S=.o))
1.22 +OBJ = $(OBJ1) $(OBJ2)
1.23
1.24 .PHONY: all clean distclean
1.25
1.26 all: $(PAYLOAD)
1.27
1.28 clean:
1.29 - rm -f $(OBJ) $(TARGET) $(PAYLOAD) $(DUMP) $(MAP) System.map
1.30 + rm -f $(OBJ) $(TARGET) $(PAYLOAD) $(DUMP) $(MAP) #System.map
1.31
1.32 distclean: clean
1.33 echo "Nothing else to clean."
1.34
1.35 $(PAYLOAD): $(TARGET)
1.36 - $(OBJCOPY) -O binary $< $@+
1.37 - $(OBJDUMP) -D $< > $(DUMP)
1.38 - $(OBJDUMP) -h $< > $(MAP)
1.39 - $(NM) -n $< > System.map
1.40 + $(OBJCOPY) -O binary $(@:.bin=.elf) $@+
1.41 + $(OBJDUMP) -D $(@:.bin=.elf) > $(@:.bin=.dump)
1.42 + $(OBJDUMP) -h $(@:.bin=.elf) > $(@:.bin=.map)
1.43 + #$(NM) -n $< > System.map
1.44 chmod -x $@+
1.45 mv -f $@+ $@
1.46
1.47 -$(TARGET): $(OBJ)
1.48 - $(LD) $(LDFLAGS) $(OBJ) -o $@
1.49 +stage1.elf: $(OBJ1)
1.50 + $(LD) $(LDFLAGS) -T $(@:.elf=.ld) $(OBJ1) -o $@
1.51 +
1.52 +stage2.elf: $(OBJ2)
1.53 + $(LD) $(LDFLAGS) -T $(@:.elf=.ld) $(OBJ2) -o $@
1.54
1.55 .c.o:
1.56 $(CC) -c $(CFLAGS) $< -o $@
2.1 --- a/board-nanonote.c Fri Jun 05 19:07:33 2015 +0200
2.2 +++ b/board-nanonote.c Fri Jun 05 19:34:16 2015 +0200
2.3 @@ -34,7 +34,10 @@
2.4 * Initialize SDRAM pins
2.5 */
2.6 __gpio_as_sdram_32bit();
2.7 +}
2.8
2.9 +void gpio_init2(void)
2.10 +{
2.11 /*
2.12 * Initialize LCD pins
2.13 */
3.1 --- a/head.S Fri Jun 05 19:07:33 2015 +0200
3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
3.3 @@ -1,53 +0,0 @@
3.4 -/*
3.5 - * head.S
3.6 - *
3.7 - * Entry point of the firmware.
3.8 - * The firmware code are executed in the ICache.
3.9 - *
3.10 - * Copyright 2009 (C) Qi Hardware Inc.,
3.11 - * Author: Xiangfu Liu <xiangfu@sharism.cc>
3.12 - *
3.13 - * This program is free software; you can redistribute it and/or
3.14 - * modify it under the terms of the GNU General Public License
3.15 - * version 3 as published by the Free Software Foundation.
3.16 - *
3.17 - * This program is distributed in the hope that it will be useful,
3.18 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
3.19 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.20 - * GNU General Public License for more details.
3.21 - *
3.22 - * You should have received a copy of the GNU General Public License
3.23 - * along with this program; if not, write to the Free Software
3.24 - * Foundation, Inc., 51 Franklin Street, Fifth Floor,
3.25 - * Boston, MA 02110-1301, USA
3.26 - */
3.27 -
3.28 - .text
3.29 -
3.30 - .extern c_main
3.31 -
3.32 - .globl _start
3.33 - .set noreorder
3.34 -_start:
3.35 - b real_start
3.36 - nop
3.37 - .word 0x0 /* address: 0x80002008 */
3.38 - .word 0x0
3.39 - .word 0x0
3.40 - .word 0x0
3.41 - .word 0x0
3.42 - .word 0x0
3.43 - .word 0x0
3.44 - .word 0x0
3.45 - /* reserve 8 words for args
3.46 - * this is must big then sizeof(sturct fw_args)
3.47 - */
3.48 -real_start:
3.49 - /*
3.50 - * setup stack, jump to C code
3.51 - */
3.52 - la $29, 0x80004000 /* sp */
3.53 - j c_main
3.54 - nop
3.55 -
3.56 - .set reorder
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/head1.S Fri Jun 05 19:34:16 2015 +0200
4.3 @@ -0,0 +1,53 @@
4.4 +/*
4.5 + * head.S
4.6 + *
4.7 + * Entry point of the firmware.
4.8 + * The firmware code are executed in the ICache.
4.9 + *
4.10 + * Copyright 2009 (C) Qi Hardware Inc.,
4.11 + * Author: Xiangfu Liu <xiangfu@sharism.cc>
4.12 + *
4.13 + * This program is free software; you can redistribute it and/or
4.14 + * modify it under the terms of the GNU General Public License
4.15 + * version 3 as published by the Free Software Foundation.
4.16 + *
4.17 + * This program is distributed in the hope that it will be useful,
4.18 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4.19 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4.20 + * GNU General Public License for more details.
4.21 + *
4.22 + * You should have received a copy of the GNU General Public License
4.23 + * along with this program; if not, write to the Free Software
4.24 + * Foundation, Inc., 51 Franklin Street, Fifth Floor,
4.25 + * Boston, MA 02110-1301, USA
4.26 + */
4.27 +
4.28 + .text
4.29 +
4.30 + .extern c_main
4.31 +
4.32 + .globl _start
4.33 + .set noreorder
4.34 +_start:
4.35 + b real_start
4.36 + nop
4.37 + .word 0x0 /* address: 0x80002008 */
4.38 + .word 0x0
4.39 + .word 0x0
4.40 + .word 0x0
4.41 + .word 0x0
4.42 + .word 0x0
4.43 + .word 0x0
4.44 + .word 0x0
4.45 + /* reserve 8 words for args
4.46 + * this is must big then sizeof(sturct fw_args)
4.47 + */
4.48 +real_start:
4.49 + /*
4.50 + * setup stack, jump to C code
4.51 + */
4.52 + la $29, 0x80004000 /* sp */
4.53 + j c_main
4.54 + nop
4.55 +
4.56 + .set reorder
5.1 --- a/include/nanonote.h Fri Jun 05 19:07:33 2015 +0200
5.2 +++ b/include/nanonote.h Fri Jun 05 19:34:16 2015 +0200
5.3 @@ -36,6 +36,8 @@
5.4 #define GPIO_SD_CD_N GPIO_SD_DETECT /* SD Card insert detect */
5.5 #define GPIO_SD_VCC_EN_N GPIO_SDPW_EN /* SD Card Power Enable */
5.6
5.7 +#define GPIO_SD_CMD (3 * 32 + 8)
5.8 +
5.9 #define SPEN GPIO_LCD_CS /* LCDCS :Serial command enable */
5.10 #define SPDA (2 * 32 + 22) /* LCDSCL:Serial command clock input */
5.11 #define SPCK (2 * 32 + 23) /* LCDSDA:Serial command data input */
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/stage1.ld Fri Jun 05 19:34:16 2015 +0200
6.3 @@ -0,0 +1,31 @@
6.4 +OUTPUT_ARCH(mips)
6.5 +ENTRY(_start)
6.6 +MEMORY
6.7 +{
6.8 + ram : ORIGIN = 0x80002000 , LENGTH = 0x100000
6.9 +}
6.10 +
6.11 +SECTIONS
6.12 +{
6.13 + . = ALIGN(4);
6.14 + .text : { *(.text*) } > ram
6.15 +
6.16 + . = ALIGN(4);
6.17 + .rodata : { *(.rodata*) } > ram
6.18 +
6.19 + . = ALIGN(4);
6.20 + .sdata : { *(.sdata*) } > ram
6.21 +
6.22 + . = ALIGN(4);
6.23 + .data : { *(.data*) *(.scommon*) *(.reginfo*) } > ram
6.24 +
6.25 + _gp = ABSOLUTE(.); /* Base of small data */
6.26 +
6.27 + .got : { *(.got*) } > ram
6.28 +
6.29 + . = ALIGN(4);
6.30 + .sbss : { *(.sbss*) } > ram
6.31 + .bss : { *(.bss*) } > ram
6.32 + . = ALIGN (4);
6.33 +}
6.34 +
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/stage2.c Fri Jun 05 19:34:16 2015 +0200
7.3 @@ -0,0 +1,46 @@
7.4 +/*
7.5 + * Ben NanoNote stage 2 payload test.
7.6 + *
7.7 + * Copyright (C) 2015 Paul Boddie <paul@boddie.org.uk>
7.8 + * Copyright (C) Wolfgang Spraul <wolfgang@sharism.cc>
7.9 + *
7.10 + * This program is free software; you can redistribute it and/or modify it under
7.11 + * the terms of the GNU General Public License as published by the Free Software
7.12 + * Foundation; either version 3 of the License, or (at your option) any later
7.13 + * version.
7.14 + *
7.15 + * This program is distributed in the hope that it will be useful, but WITHOUT
7.16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
7.17 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
7.18 + * details.
7.19 + *
7.20 + * You should have received a copy of the GNU General Public License along with
7.21 + * this program. If not, see <http://www.gnu.org/licenses/>.
7.22 + */
7.23 +
7.24 +#include "jz4740.h"
7.25 +#include "board-nanonote.h"
7.26 +#include "nanonote.h"
7.27 +
7.28 +/* These arguments are initialised by usbboot and are defined in...
7.29 + /etc/xburst-tools/usbboot.cfg. */
7.30 +
7.31 +struct fw_args *fw_args;
7.32 +volatile u32 CPU_ID;
7.33 +volatile u32 UART_BASE;
7.34 +volatile u32 CONFIG_BAUDRATE;
7.35 +volatile u8 SDRAM_BW16;
7.36 +volatile u8 SDRAM_BANK4;
7.37 +volatile u8 SDRAM_ROW;
7.38 +volatile u8 SDRAM_COL;
7.39 +volatile u8 CONFIG_MOBILE_SDRAM;
7.40 +volatile u32 CFG_CPU_SPEED;
7.41 +volatile u32 CFG_EXTAL;
7.42 +volatile u8 PHM_DIV;
7.43 +volatile u8 IS_SHARE;
7.44 +
7.45 +void c_main(void)
7.46 +{
7.47 + __gpio_as_output(GPIO_SD_CMD);
7.48 + __gpio_set_pin(GPIO_SD_CMD);
7.49 +}
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/stage2.ld Fri Jun 05 19:34:16 2015 +0200
8.3 @@ -0,0 +1,32 @@
8.4 +OUTPUT_ARCH(mips)
8.5 +ENTRY(_start)
8.6 +MEMORY
8.7 +{
8.8 + ram : ORIGIN = 0x80000000 , LENGTH = 3M
8.9 +}
8.10 +
8.11 +SECTIONS
8.12 +{
8.13 + . = ALIGN(4);
8.14 + .text : { *(.text*) } > ram
8.15 +
8.16 + . = ALIGN(4);
8.17 + .rodata : { *(.rodata*) } > ram
8.18 +
8.19 + . = ALIGN(4);
8.20 + .sdata : { *(.sdata*) } > ram
8.21 +
8.22 + . = ALIGN(4);
8.23 + .data : { *(.data*) *(.scommon*) *(.reginfo*) } > ram
8.24 +
8.25 + _gp = ALIGN(16);
8.26 +
8.27 + .got : { *(.got*) } > ram
8.28 + _got_end = ABSOLUTE(.);
8.29 +
8.30 + . = ALIGN(4);
8.31 + .sbss : { *(.sbss*) } > ram
8.32 + .bss : { *(.bss*) } > ram
8.33 + . = ALIGN (4);
8.34 +}
8.35 +
9.1 --- a/target.ld Fri Jun 05 19:07:33 2015 +0200
9.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
9.3 @@ -1,31 +0,0 @@
9.4 -OUTPUT_ARCH(mips)
9.5 -ENTRY(_start)
9.6 -MEMORY
9.7 -{
9.8 - ram : ORIGIN = 0x80002000 , LENGTH = 0x100000
9.9 -}
9.10 -
9.11 -SECTIONS
9.12 -{
9.13 - . = ALIGN(4);
9.14 - .text : { *(.text*) } > ram
9.15 -
9.16 - . = ALIGN(4);
9.17 - .rodata : { *(.rodata*) } > ram
9.18 -
9.19 - . = ALIGN(4);
9.20 - .sdata : { *(.sdata*) } > ram
9.21 -
9.22 - . = ALIGN(4);
9.23 - .data : { *(.data*) *(.scommon*) *(.reginfo*) } > ram
9.24 -
9.25 - _gp = ABSOLUTE(.); /* Base of small data */
9.26 -
9.27 - .got : { *(.got*) } > ram
9.28 -
9.29 - . = ALIGN(4);
9.30 - .sbss : { *(.sbss*) } > ram
9.31 - .bss : { *(.bss*) } > ram
9.32 - . = ALIGN (4);
9.33 -}
9.34 -