OpenCores
URL https://opencores.org/ocsvn/s6soc/s6soc/trunk

Subversion Repositories s6soc

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /s6soc/trunk/sw/dev
    from Rev 53 to Rev 47
    Reverse comparison

Rev 53 → Rev 47

/resetdump.s File deleted
/asmstartup.s File deleted
/uartecho.c File deleted
/cputest.c File deleted
/blinky.c
38,10 → 38,27
////////////////////////////////////////////////////////////////////////////////
//
//
// #include "asmstartup.h"
#include "board.h"
 
void zip_idle(void);
 
asm("\t.section\t.start\n"
"\t.global\t_start\n"
"\t.type\t_start,@function\n"
"_start:\n"
"\tMOV\tkernel_exit(PC),uPC\n"
"\tLDI 104,R0\n"
"\tSW R0,0x41c\n"
"\tLDI 0xff,R0\n"
"\tSW R0,0x414\n"
"\tLDI\t_top_of_stack,SP\n"
"\tJSR\tentry\n"
"\tNEXIT\tR0\n"
"kernel_exit:\n"
"\tBUSY\n"
"\t.section\t.text");
 
void entry(void) {
const char *msg = "Hello, World!\r\n", *ptr = msg;
int count = 0;
/Makefile
45,9 → 45,8
################################################################################
##
##
# Declare "all" to be the default target
all:
PROGRAMS := helloworld doorbell doorbell2 kptest blinky cputest uartecho
PROGRAMS := helloworld doorbell doorbell2 kptest blinky
all: $(OBJDIR)/ $(PROGRAMS)
 
 
62,16 → 61,14
# Not for build, for for building tags and dependency files, we need to know
# what the sources and headers are
DEVDRVR:= keypad.c display.c rtcsim.c txfns.c
SOURCES:= helloworld.c doorbell.c doorbell2.c kptest.c uartecho.c $(DEVDRVR)
SOURCES:= helloworld.c doorbell.c doorbell2.c kptest.c $(DEVDRVR)
HEADERS:= board.h
OBJDRVR := $(addprefix $(OBJDIR)/,$(subst .c,.o,$(DEVDRVR)))
 
CPPFLAGS := -I../zipos -I.
DUMPFLAGS := # -fdump-rtl-all
CFLAGS := $(CPPFLAGS) $(DUMPFLAGS) -O3 -Wall -Wextra -nostdlib -fno-builtin
CFLAGS := $(CPPFLAGS) $(DUMPFLAGS) -O3 -Wall -Wextra -nostdlib -fno-builtin -Wa,-nocis
LDFLAGS = -T cmod.ld -Wl,-Map,$(OBJDIR)/$@.map -Wl,--unresolved-symbols=report-all -nostdlib
STARTUP := resetdump.s
STARTOBJ:= $(addprefix $(OBJDIR)/,$(subst .s,.o,$(STARTUP)))
 
$(OBJDIR)/:
$(mk-objdir)
81,18 → 78,9
$(OBJDIR)/%.o: %.c
$(mk-objdir)
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/cputest.o: cputest.c
$(mk-objdir)
$(CC) $(CFLAGS) -Wa,-nocis -c $< -o $@
$(OBJDIR)/cputestcis.o: cputest.c
$(mk-objdir)
$(CC) $(CFLAGS) -Wa,-cis -c $< -o $@
$(OBJDIR)/%.o: ../zipos/%.c
$(mk-objdir)
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/%.o: %.s
$(mk-objdir)
$(AS) -nocis $< -o $@
 
$(OBJDIR)/%.s: %.c
$(mk-objdir)
105,38 → 93,29
$(OBJDUMP) -Dr $< > $@
 
 
helloworld: $(OBJDIR)/helloworld.o $(STARTOBJ) cmod.ld
$(CC) $(LDFLAGS) $(STARTOBJ) $(OBJDIR)/helloworld.o -o $@
helloworld: $(OBJDIR)/helloworld.o cmod.ld
$(CC) $(LDFLAGS) $(OBJDIR)/helloworld.o -o $@
$(OBJDIR)/helloworld.txt: helloworld
$(OBJDUMP) -dr $^ > $@
 
uartecho: $(OBJDIR)/uartecho.o $(STARTOBJ) cmod.ld
$(CC) $(LDFLAGS) $(STARTOBJ) $(OBJDIR)/uartecho.o -o $@
doorbell: $(OBJDIR)/doorbell.o cmod.ld
$(CC) $(LDFLAGS) $(OBJDIR)/doorbell.o -o $@
 
doorbell: $(OBJDIR)/doorbell.o $(STARTOBJ) cmod.ld
$(CC) $(LDFLAGS) $(STARTOBJ) $(OBJDIR)/doorbell.o -o $@
 
doorbell2: $(OBJDIR)/doorbell2.o $(OBJDRVR) $(STARTOBJ) $(OBJDIR)/string.o cmod.ld
$(CC) $(LDFLAGS) $(STARTOBJ) $(OBJDIR)/doorbell2.o $(OBJDRVR) $(OBJDIR)/string.o -o $@
doorbell2: $(OBJDIR)/doorbell2.o $(OBJDRVR) $(OBJDIR)/string.o cmod.ld
$(CC) $(LDFLAGS) $(OBJDIR)/doorbell2.o $(OBJDRVR) $(OBJDIR)/string.o -o $@
$(OBJDIR)/doorbell2.txt: doorbell2
$(OBJDUMP) -dr $^ > $@
 
KPSRCS := kptest.c keypad.c txfns.c
KPOBJS := $(addprefix $(OBJDIR)/,$(subst .c,.o,$(KPSRCS)))
kptest: $(KPOBJS) $(STARTOBJ) cmod.ld
$(CC) $(LDFLAGS) $(STARTOBJ) $(KPOBJS) -o $@
kptest: $(KPOBJS) cmod.ld
$(CC) $(LDFLAGS) $(KPOBJS) -o $@
$(OBJDIR)/kptest.txt: kptest
$(OBJDUMP) -dr $^ > $@
 
blinky: $(OBJDIR)/blinky.o cmod.ld
$(CC) $(LDFLAGS) $(STARTOBJ) $(OBJDIR)/blinky.o -o $@
$(CC) $(LDFLAGS) $(OBJDIR)/blinky.o -o $@
 
cputest: $(OBJDIR)/cputest.o cmod.ld
$(CC) $(LDFLAGS) $(OBJDIR)/cputest.o -o $@
 
cputestcis: $(OBJDIR)/cputestcis.o cmod.ld
$(CC) $(LDFLAGS) $(OBJDIR)/cputestcis.o -o $@
 
define mk-objdir
@bash -c "if [ ! -e $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi"
endef
/asmstartup.h
0,0 → 1,67
////////////////////////////////////////////////////////////////////////////////
//
// Filename: asmstartup.h
//
// Project: CMod S6 System on a Chip, ZipCPU demonstration project
//
// Purpose: A small assembly routine, included from C via the "asm"
// statement, to place startup code into the very beginning of
// the program space. This startup code *must* start at the RESET_ADDRESS
// of the ZipCPU. It does two things: 1) loads a valid stack pointer, and
// 2) jumps to the entry point in the program which (as a result of this
// startup code) may be anywhere in the address space.
//
// Sadly, the main program often follows this code, leading to a long jump
// to the main program entry. This isn't that efficient, but ... on a
// non-pipelined machine it shouldn't cost more than one extra flash
// access.
//
// Creator: Dan Gisselquist, Ph.D.
// Gisselquist Technology, LLC
//
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015-2016, Gisselquist Technology, LLC
//
// This program is free software (firmware): 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 3 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 MERCHANTIBILITY 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. (It's in the $(ROOT)/doc directory, run make with no
// target there if the PDF file isn't present.) If not, see
// <http://www.gnu.org/licenses/> for a copy.
//
// License: GPL, v3, as defined and found on www.gnu.org,
// http://www.gnu.org/licenses/gpl.html
//
//
////////////////////////////////////////////////////////////////////////////////
//
//
#ifndef ASMSTARTUP_H
#define ASMSTARTUP_H
 
asm("\t.section\t.start\n"
"\t.global\t_start\n"
"\t.type\t_start,@function\n"
"_start:\n"
"\tNDUMP\n"
"\tMOV\tkernel_exit(PC),uPC\n"
"\tLDI\t255,R0\n"
"\tSW\tR0,0x414\n"
"\tLDI\t_top_of_stack,SP\n"
"\tJSR\tentry\n"
"NEXIT\tR0\n"
"kernel_exit:\n"
"\tHALT\n"
"\tBRA\tkernel_exit\n"
"\t.section\t.text");
 
#endif
/board.h
109,32 → 109,13
#define IOADDR 0x000400
#define SCOPEADDR 0x000800
// #define FCTLADDR 0x000c00 // Flash control, depends upon write capability
#define BKRAM (void *)0x004000
#define FLASH (void *)0x1000000
#define SDRAM (void *)0
#define RAMADDR 0x004000
#define RAMSZ (RAMADDR)
#define FLASHADDR 0x1000000
#define RESET_ADDR 0x1200000
#define FLASHSZ (FLASHADDR)
#define MEMLEN 0x04000
#define FLASHLEN 0x1000000
#define RESET_ADDR 0x1200000
 
#define CLOCKFREQHZ 80000000
#define CLOCKFREQ_HZ CLOCKFREQHZ
 
static volatile IOSPACE *const _sys = (IOSPACE *)IOADDR;
#define _ZIP_HAS_WBUARTRX
#define _uartrx _sys->io_uart
#define _ZIP_HAS_LONELY_UART
#define LONELY_UART
#define _uart _sys->io_uart
 
static volatile WBSCOPE *const _scope = (WBSCOPE *)SCOPEADDR;
 
#define SYSTIMER _sys->io_timer
#define SYSPIC _sys->io_pic
 
#define valid_ram_region(PTR,LN) (((int)(PTR)>=RAMADDR)&&((int)(PTR+LN)<RAMADDR+RAMSZ))
#define valid_flash_region(PTR,LN) (((int)(PTR)>=FLASHADDR)&&((int)(PTR+LN)<FLASHADDR+FLASHSZ))
#define valid_mem_region(PTR,LN) ((valid_ram_region(PTR,LN))||(valid_flash_region(PTR,LN)))
 
#endif
/cmod.ld
38,36 → 38,14
flash (rx) : ORIGIN = 0x1000000, LENGTH = 0x1000000
}
 
_flash = ORIGIN(flash);
_blkram = ORIGIN(blkram);
_sdram = 0;
_top_of_stack = ORIGIN(blkram) + LENGTH(blkram) - 4;
_sdram_image_start = 0;
_sdram_image_end = 0;
 
SECTIONS
{
.rocode 0x1200000 : ALIGN(4) {
_boot_address = .;
*(.start) *(.boot*)
*(.text*)
*(.rodata*)
*(.strings*)
__rocode_alignment = (. + 3) & ~ 3;
. = __rocode_alignment;
} > flash
_kernel_image_start = . ;
.data : ALIGN_WITH_INPUT {
*(.kernel*)
*(.fixdata*)
*(.data*)
*(COMMON*)
_kernel_image_end = . ;
}> blkram AT> flash
_blkram_image_end = . ;
.bss : ALIGN_WITH_INPUT {
*(.bss*)
_bss_image_end = . ;
} > blkram
_top_of_heap = .;
. = 0x1200000;
.rocode 0x1200000 : { *(.start) *(.text*)
*(.rodata*)
*(.strings*) } > flash
.data : { *(.fixdata*) *(.data*) *(COMMON*) *(.bss*) } > blkram
_top_of_heap = .;
}
/doorbell.c
36,6 → 36,7
////////////////////////////////////////////////////////////////////////////////
//
//
#include "asmstartup.h"
#include "board.h"
 
#include "samples.c"
/doorbell2.c
50,6 → 50,7
////////////////////////////////////////////////////////////////////////////////
//
//
#include "asmstartup.h"
#include "board.h"
#include "rtcsim.h"
#include "display.h"
58,6 → 59,8
 
#include "samples.c"
 
void zip_halt(void);
 
void build_dpymsg(char *msg, unsigned clkval);
void build_uartmsg(char *msg, unsigned clkval);
void showval(int val);
/helloworld.c
46,6 → 46,7
////////////////////////////////////////////////////////////////////////////////
//
//
#include "asmstartup.h"
#include "board.h"
 
const char msg[] = "Hello, world!\r\n";
54,13 → 55,8
volatile IOSPACE *const sys = (IOSPACE *)IOADDR;
int ledset = 0;
 
sys->io_pic = 0x07fffffff; // Acknowledge and turn off all ints
sys->io_spio = 0x0f0;
 
// sys->io_watchdog = TM_ONE_SECOND * 2;
_scope->s_ctrl = 2 | WBSCOPE_NO_RESET;
 
sys->io_spio = 0x0fc;
 
/// Turn off timer B
sys->io_watchdog = 0;
 
68,7 → 64,6
const char *ptr;
sys->io_timer = TM_ONE_SECOND; // Ticks per second, 80M
sys->io_pic = 0x07fffffff; // Acknowledge and turn off all ints
sys->io_pic = INT_ENABLEV(INT_BUTTON);
 
ptr = msg;
while(*ptr) {
77,7 → 72,6
// Wait while our transmitter is busy
while((sys->io_pic & INT_UARTTX)==0)
;
 
sys->io_uart = iv; // Transmit our character
sys->io_pic = INT_UARTTX; // Clear the int flag
}
99,7 → 93,6
sys->io_spio = ledset&0x0f5;
else
sys->io_spio = ledset;
sys->io_watchdog = 0;
}
}
 
/kptest.c
35,6 → 35,7
////////////////////////////////////////////////////////////////////////////////
//
//
#include "asmstartup.h"
#include "board.h"
#include "keypad.h"
#include "txfns.h"

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.