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

Subversion Repositories s6soc

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 52 to Rev 51
    Reverse comparison

Rev 52 → Rev 51

/s6soc/trunk/sw/host/zipelf.cpp
119,17 → 119,17
}
 
if (dbg) {
fprintf(stderr," %-20s 0x%jx\n","e_type", (uintmax_t)ehdr.e_type);
fprintf(stderr," %-20s 0x%jx\n","e_machine", (uintmax_t)ehdr.e_machine);
fprintf(stderr," %-20s 0x%jx\n","e_version", (uintmax_t)ehdr.e_version);
fprintf(stderr," %-20s 0x%jx\n","e_entry",(uintmax_t)ehdr.e_entry);
fprintf(stderr," %-20s 0x%jx\n","e_phoff",(uintmax_t)ehdr.e_phoff);
fprintf(stderr," %-20s 0x%jx\n","e_shoff",(uintmax_t)ehdr.e_shoff);
fprintf(stderr," %-20s 0x%jx\n","e_flags",(uintmax_t)ehdr.e_flags);
fprintf(stderr," %-20s 0x%jx\n","e_ehsize",(uintmax_t)ehdr.e_ehsize);
fprintf(stderr," %-20s 0x%jx\n","e_phentsize", (uintmax_t)ehdr.e_phentsize);
fprintf(stderr," %-20s 0x%jx\n","e_shentsize", (uintmax_t)ehdr.e_shentsize);
fprintf(stderr,"\n");
printf(" %-20s 0x%jx\n", "e_type", (uintmax_t)ehdr.e_type);
printf(" %-20s 0x%jx\n", "e_machine", (uintmax_t)ehdr.e_machine);
printf(" %-20s 0x%jx\n", "e_version", (uintmax_t)ehdr.e_version);
printf(" %-20s 0x%jx\n", "e_entry", (uintmax_t)ehdr.e_entry);
printf(" %-20s 0x%jx\n", "e_phoff", (uintmax_t)ehdr.e_phoff);
printf(" %-20s 0x%jx\n", "e_shoff", (uintmax_t)ehdr.e_shoff);
printf(" %-20s 0x%jx\n", "e_flags", (uintmax_t)ehdr.e_flags);
printf(" %-20s 0x%jx\n", "e_ehsize", (uintmax_t)ehdr.e_ehsize);
printf(" %-20s 0x%jx\n", "e_phentsize", (uintmax_t)ehdr.e_phentsize);
printf(" %-20s 0x%jx\n", "e_shentsize", (uintmax_t)ehdr.e_shentsize);
printf("\n");
}
 
 
161,22 → 161,22
}
 
if (dbg) {
fprintf(stderr, " %-20s 0x%x\n", "p_type", phdr.p_type);
fprintf(stderr, " %-20s 0x%jx\n", "p_offset", phdr.p_offset);
fprintf(stderr, " %-20s 0x%jx\n", "p_vaddr", phdr.p_vaddr);
fprintf(stderr, " %-20s 0x%jx\n", "p_paddr", phdr.p_paddr);
fprintf(stderr, " %-20s 0x%jx\n", "p_filesz", phdr.p_filesz);
fprintf(stderr, " %-20s 0x%jx\n", "p_memsz", phdr.p_memsz);
fprintf(stderr, " %-20s 0x%x [", "p_flags", phdr.p_flags);
printf(" %-20s 0x%x\n", "p_type", phdr.p_type);
printf(" %-20s 0x%jx\n", "p_offset", phdr.p_offset);
printf(" %-20s 0x%jx\n", "p_vaddr", phdr.p_vaddr);
printf(" %-20s 0x%jx\n", "p_paddr", phdr.p_paddr);
printf(" %-20s 0x%jx\n", "p_filesz", phdr.p_filesz);
printf(" %-20s 0x%jx\n", "p_memsz", phdr.p_memsz);
printf(" %-20s 0x%x [", "p_flags", phdr.p_flags);
 
if (phdr.p_flags & PF_X) fprintf(stderr, " Execute");
if (phdr.p_flags & PF_R) fprintf(stderr, " Read");
if (phdr.p_flags & PF_W) fprintf(stderr, " Write");
fprintf(stderr, "]\n");
fprintf(stderr, " %-20s 0x%jx\n", "p_align", phdr.p_align);
if (phdr.p_flags & PF_X) printf(" Execute");
if (phdr.p_flags & PF_R) printf(" Read");
if (phdr.p_flags & PF_W) printf(" Write");
printf("]\n");
printf(" %-20s 0x%jx\n", "p_align", phdr.p_align);
}
 
total_octets += phdr.p_filesz;
total_octets += phdr.p_memsz;
}
 
char *d = (char *)malloc(total_octets + sizeof(ELFSECTION)+sizeof(ELFSECTION *));
187,7 → 187,6
current_section = 0;
 
for(i=0; i<(int)n; i++) {
if (dbg) fprintf(stderr, "Working with &d[%d]\n", current_offset);
r[i] = (ELFSECTION *)(&d[current_offset]);
 
if (gelf_getphdr(e, i, &phdr) != &phdr) {
196,19 → 195,19
}
 
if (dbg) {
fprintf(stderr, " %-20s 0x%jx\n", "p_offset", phdr.p_offset);
fprintf(stderr, " %-20s 0x%jx\n", "p_vaddr", phdr.p_vaddr);
fprintf(stderr, " %-20s 0x%jx\n", "p_paddr", phdr.p_paddr);
fprintf(stderr, " %-20s 0x%jx\n", "p_filesz", phdr.p_filesz);
fprintf(stderr, " %-20s 0x%jx\n", "p_memsz", phdr.p_memsz);
fprintf(stderr, " %-20s 0x%x [", "p_flags", phdr.p_flags);
printf(" %-20s 0x%jx\n", "p_offset", phdr.p_offset);
printf(" %-20s 0x%jx\n", "p_vaddr", phdr.p_vaddr);
printf(" %-20s 0x%jx\n", "p_paddr", phdr.p_paddr);
printf(" %-20s 0x%jx\n", "p_filesz", phdr.p_filesz);
printf(" %-20s 0x%jx\n", "p_memsz", phdr.p_memsz);
printf(" %-20s 0x%x [", "p_flags", phdr.p_flags);
 
if (phdr.p_flags & PF_X) fprintf(stderr, " Execute");
if (phdr.p_flags & PF_R) fprintf(stderr, " Read");
if (phdr.p_flags & PF_W) fprintf(stderr, " Write");
fprintf(stderr, "]\n");
if (phdr.p_flags & PF_X) printf(" Execute");
if (phdr.p_flags & PF_R) printf(" Read");
if (phdr.p_flags & PF_W) printf(" Write");
printf("]\n");
 
fprintf(stderr, " %-20s 0x%jx\n", "p_align", phdr.p_align);
printf(" %-20s 0x%jx\n", "p_align", phdr.p_align);
}
 
current_section++;
216,7 → 215,7
r[i]->m_start = phdr.p_paddr;
r[i]->m_len = phdr.p_filesz;
 
current_offset += phdr.p_filesz + sizeof(ELFSECTION);
current_offset += phdr.p_memsz + sizeof(ELFSECTION);
 
// Now, let's read in our section ...
if (lseek(fd, phdr.p_offset, SEEK_SET) < 0) {
/s6soc/trunk/sw/host/Makefile
70,9 → 70,6
scope: $(OBJDIR)/scope.o $(BUSOBJS)
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
 
xpflashscop: $(OBJDIR)/scopecls.o $(OBJDIR)/xpflashscop.o $(BUSOBJS)
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
 
readflash: $(OBJDIR)/readflash.o $(BUSOBJS)
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
 
/s6soc/trunk/sw/host/deppi.cpp
124,7 → 124,7
}
 
DEPPI::~DEPPI(void) {
DEPPI::close();
close();
}
 
void DEPPI::close(void) {
131,7 → 131,6
if (m_dev)
DmgrClose(m_dev);
m_dev = 0;
LLCOMMSI::close();
}
 
void DEPPI::depperr(void) {
/s6soc/trunk/sw/host/zipload.cpp
79,15 → 79,9
//
0xaa, 0x99, 0x55, 0x66 };
unsigned char buf[SEARCHLN];
size_t nr;
 
rewind(fp);
nr = fread(buf, sizeof(char), SEARCHLN, fp);
if (nr != SEARCHLN) {
fprintf(stderr, "Cannot read the Xilinx bitfile header\n");
perror("O/S Err:");
exit(EXIT_FAILURE);
}
fread(buf, sizeof(char), SEARCHLN, fp);
for(int start=0; start+MATCHLN<SEARCHLN; start++) {
int mloc;
 
97,11 → 91,8
if (buf[start+mloc] != matchstr[mloc])
break;
if (mloc < 0) {
if (fseek(fp, (long)start, SEEK_SET) != 0) {
fprintf(stderr, "Cannot seek to the end of the Xilinx header\n");
perror("O/S Err:");
exit(EXIT_FAILURE);
} return;
fseek(fp, start, SEEK_SET);
return;
}
}
 
113,7 → 104,7
int main(int argc, char **argv) {
int skp=0, argn;
bool debug_only = false, verbose = false;
bool ignore_missing_memory = true;
bool ignore_missing_memory = false;
unsigned entry = 0;
FLASHDRVR *flash = NULL;
const char *bitfile = NULL, *altbitfile = NULL, *execfile = NULL;
155,11 → 146,7
 
 
for(argn=0; argn<argc; argn++) {
if (access(argv[argn], R_OK)!=0) {
printf("ERR: Cannot open %s\n", argv[argn]);
usage();
exit(EXIT_FAILURE);
} else if (iself(argv[argn])) {
if (iself(argv[argn])) {
if (execfile) {
printf("Too many executable files given, %s and %s\n", execfile, argv[argn]);
usage();
199,8 → 186,6
if ((bitfile)&&(access(bitfile,R_OK)!=0)) {
// If there's no code file, or the code file cannot be opened
fprintf(stderr, "Cannot open bitfile, %s\n", bitfile);
if (iself(bitfile))
fprintf(stderr, "Is %s an ELF executable??\n", bitfile);
exit(EXIT_FAILURE);
}
 
213,7 → 198,7
fprintf(stderr, "Cannot open executable, %s\n\n", execfile);
usage();
exit(EXIT_FAILURE);
} else if ((execfile)&&(!iself(execfile))) {
} else if (!iself(execfile)) {
printf("%s is not an executable file\n\n", execfile);
usage();
exit(EXIT_FAILURE);
250,7 → 235,7
if (bitfile) {
 
fp = fopen(bitfile, "r");
if (strcmp(&bitfile[strlen(bitfile)-4],".bit")==0)
if (strcmp(&argv[argn][strlen(argv[argn])-4],".bit")==0)
skip_bitfile_header(fp);
bitsz = fread(&fbuf[CONFIG_ADDRESS-SPIFLASH],
sizeof(fbuf[0]),
313,14 → 298,10
<= SPIFLASH+FLASHLEN))
valid = true;
if (!valid) {
if (ignore_missing_memory)
fprintf(stderr, "WARNING: No such memory on board: 0x%08x - %08x\n",
secp->m_start, secp->m_start+secp->m_len);
else {
fprintf(stderr, "ERROR: No such memory on board: 0x%08x - %08x\n",
secp->m_start, secp->m_start+secp->m_len);
fprintf(stderr, "No such memory on board: 0x%08x - %08x\n",
secp->m_start, secp->m_start+secp->m_len);
if (!ignore_missing_memory)
exit(EXIT_FAILURE);
}
}
}
 
370,7 → 351,6
exit(-2);
}
 
if (flash) delete flash;
if (m_fpga) delete m_fpga;
 
return EXIT_SUCCESS;
/s6soc/trunk/sw/zipos/bootloader.h
2,7 → 2,7
//
// Filename: bootloader.h
//
// Project: CMod S6 System on a Chip, ZipCPU demonstration project
// Project: Zip CPU -- a small, lightweight, RISC CPU soft core
//
// Purpose:
//
12,7 → 12,7
//
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015-2017, 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
24,11 → 24,6
// 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
//
/s6soc/trunk/sw/zipos/Makefile
50,8 → 50,7
HEADERS := $(wildcard *.h) $(subst .c,.h,$(DEVSRCS))
# CFLAGS := -O3 -fdump-tree-all -Wall -Wextra -nostdlib -fno-builtin
# CFLAGS := -O3 -fdump-rtl-all -DZIPOS -Wall -Wextra -nostdlib -fno-builtin
INCS := -I. -I../dev
CFLAGS := $(INCS) -Os -DZIPOS -Wall -Wextra -nostdlib -fno-builtin -Wa,-nocis
CFLAGS := -I. -I../dev -Os -DZIPOS -Wall -Wextra -nostdlib -fno-builtin -Wa,-nocis
LDFLAGS := -T cmodram.ld -Wl,-Map,$(OBJDIR)/doorbell.map -nostdlib
 
all: doorbell
95,7 → 94,7
 
define build-depends
@echo "Building dependency file(s)"
@$(CC) $(INCS) -MM $(SOURCES) $(DEVSRCS) > $(OBJDIR)/xdepends.txt
@$(CC) $(CPPFLAGS) -MM $(SOURCES) $(DEVSRCS) > $(OBJDIR)/xdepends.txt
@sed -e 's/^.*.o: /$(OBJDIR)\/&/' < $(OBJDIR)/xdepends.txt > $(OBJDIR)/depends.txt
@rm $(OBJDIR)/xdepends.txt
endef
/s6soc/trunk/sw/zipos/board.h
109,29 → 109,17
#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 MEMLEN 0x04000
#define FLASHLEN 0x1000000
#define RAMADDR 0x004000
#define RAMSZ (RAMADDR)
#define FLASHADDR 0x1000000
#define RESET_ADDR 0x1200000
#define FLASHSZ (FLASHADDR)
 
#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
#define _ZIP_HAS_WATCHDOG
#define _watchdog _sys->io_watchdog
 
static volatile WBSCOPE *const _scope = (WBSCOPE *)SCOPEADDR;
 
#define valid_ram_region(PTR,LN) ((((char *)PTR)>=(char *)BKRAM)&&((((char *)PTR)+LN)<(char *)BKRAM+MEMLEN))
#define valid_flash_region(PTR,LN) ((((char *)PTR)>=(char *)FLASH)&&((((char *)PTR)+LN)<(char *)FLASH+FLASHLEN))
#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
/s6soc/trunk/sw/zipos/cmod.ld
47,17 → 47,15
 
SECTIONS
{
.rocode 0x1200000 : ALIGN(4) {
.rocode 0x1200000 : {
_boot_address = .;
*(.start) *(.boot*)
*(.start) *(.boot)
*(.text*)
*(.rodata*)
*(.strings*)
__rocode_alignment = (. + 3) & ~ 3;
. = __rocode_alignment;
} > flash
_kernel_image_start = . ;
.data : ALIGN_WITH_INPUT {
.data : {
*(.kernel*)
*(.fixdata*)
*(.data*)
65,7 → 63,7
_kernel_image_end = . ;
}> blkram AT> flash
_blkram_image_end = . ;
.bss : ALIGN_WITH_INPUT {
.bss : {
*(.bss*)
_bss_image_end = . ;
} > blkram
/s6soc/trunk/sw/zipos/kernel.c
48,7 → 48,6
#include "ktraps.h"
#include "errno.h"
#include "swint.h"
#include "txfns.h"
 
extern void kpanic(void);
extern void raw_put_uart(int val);
75,8 → 74,6
 
extern void txstr(const char *);
 
#define SET_WATCHDOG _watchdog = (CONTEXT_LENGTH*2)
 
void kernel_entry(void) {
int nheartbeats= 0, tickcount = 0, milliseconds=0, ticks = 0;
int audiostate = 0, buttonstate = 0;
100,13 → 97,12
// Then selectively turn some of them back on
_sys->io_pic = INT_ENABLE | enableset | 0x07fff;
 
txstr("HEAP: "); txhex((int)heap);
txstr("HEAP: "); txhex(heap);
 
do {
int need_resched = 0, context_has_been_saved, pic;
nheartbeats++;
 
SET_WATCHDOG;
zip_rtu();
 
last_context = current->context;

powered by: WebSVN 2.1.0

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