From ae5f878d6acadabaa671a7a30b87e16eb1d718a7 Mon Sep 17 00:00:00 2001 From: Megan Wachs Date: Wed, 30 Nov 2016 10:55:18 -0800 Subject: Bump Everything to Match new Freedom Repo (#8) * Bump tool versions * Use version of OpenOCD which can load programs into flash * Bump OpenOCD to Handle ISSI Flash Programming * Update Header files * add initial support for hifive1 * add dhrystone * add clock helper functions * add openocd cfg file * Demo_GPIO checkpoint -- compiles and runs but no blinky LEDs * Remove riscv-tests submodule * Remove FPGA files, as they are no longer relevant to this Repository * Add openocd_upload script * Add Pinmux Mappings Adding the pinmux mappings to the Platform Header * Add IOF Mappings to platform header * Re-order the IOF Mapping declarations * Add more useful things to platform headers * Get GPIO Demo working again (except interrupts aren't working) * Update README with more OS packages needed A bare ubuntu-16.04.1-server installation could not run `make tools` without these packages. * bump openocd to get SCKDIV fix * Remove duplicated help text for run_debug target * Add package to README that is needed for openocd build Without this package I was seeing two different failures like below when running `make tools`. /home/scottj/freedom-e-sdk/openocd/configure: line 4533: syntax error near unexpected token `0.23' /home/scottj/freedom-e-sdk/openocd/configure: line 4533: `PKG_PROG_PKG_CONFIG(0.23)' Makefile:70: recipe for target '/home/scottj/freedom-e-sdk/toolchain/bin/openocd' failed make: *** [/home/scottj/freedom-e-sdk/toolchain/bin/openocd] Error 2 ... or ... + autoconf configure.ac:12: error: possibly undefined macro: AC_MSG_WARN If this token and others are legitimate, please use m4_pattern_allow. See the Autoconf documentation. configure.ac:240: error: possibly undefined macro: AC_MSG_NOTICE configure.ac:342: error: possibly undefined macro: AC_DEFINE Makefile:70: recipe for target '/home/scottj/freedom-e-sdk/toolchain/bin/openocd' failed make: *** [/home/scottj/freedom-e-sdk/toolchain/bin/openocd] Error 1 * Bump OpenOCD to not overwrite SCKDIV when flashing * Roll back CoreMark --- software/shared/syscall.c | 206 ---------------------------------------------- 1 file changed, 206 deletions(-) delete mode 100644 software/shared/syscall.c (limited to 'software/shared/syscall.c') diff --git a/software/shared/syscall.c b/software/shared/syscall.c deleted file mode 100644 index 1acb88f..0000000 --- a/software/shared/syscall.c +++ /dev/null @@ -1,206 +0,0 @@ -// See LICENSE for license details. - -/* This is an incomplete version of a syscall library, - * which really only supports simple reads and writes over UART. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "encoding.h" - -#include "shared.h" - -volatile uint64_t tohost __attribute__((aligned(64))); -volatile uint64_t fromhost __attribute__((aligned(64))); - -void write_hex(int fd, uint32_t hex){ - uint8_t ii; - uint8_t jj; - char towrite; - write( fd , "0x", 2 ); - for (ii = 8 ; ii > 0; ii--){ - jj = ii-1; - uint8_t digit = ((hex & (0xF << (jj*4))) >> (jj*4)); - towrite = digit < 0xA ? ('0' + digit) : ('A' + (digit - 0xA)); - write( fd, &towrite, 1); - } - -} - - -void _exit(int code) -{ - volatile uint32_t* leds = (uint32_t*) (GPIO_BASE_ADDR + GPIO_OUT_OFFSET); - const char * message = "\nProgam has exited with code:"; - - *leds = (~(code)); - - write(STDERR_FILENO, message, strlen(message)); - write_hex(STDERR_FILENO, code); - - while (1){}; - -} - -void *sbrk(ptrdiff_t incr) -{ - // extern char _end[]; - // extern char _heap_end[]; - // static char *curbrk = _end; - - // if ((curbrk + incr < _end) || (curbrk + incr > _heap_end)) - return NULL - 1; - - // curbrk += incr; - //return curbrk - incr; -} - -static int stub(int err) -{ - errno = err; - return -1; -} - -int open(const char* name, int flags, int mode) -{ - return stub(ENOENT); -} - -int openat(int dirfd, const char* name, int flags, int mode) -{ - return stub(ENOENT); -} - -int close(int fd) -{ - return stub(EBADF); -} - -int execve(const char* name, char* const argv[], char* const env[]) -{ - return stub(ENOMEM); -} - -int fork() -{ - return stub(EAGAIN); -} - -int fstat(int fd, struct stat *st) -{ - if (isatty(fd)) { - st->st_mode = S_IFCHR; - return 0; - } - - return stub(EBADF); -} - -int getpid() -{ - return 1; -} - -int isatty(int fd) -{ - if (fd == STDOUT_FILENO || fd == STDERR_FILENO) - return 1; - - errno = EBADF; - return 0; -} - -int kill(int pid, int sig) -{ - return stub(EINVAL); -} - -int link(const char *old_name, const char *new_name) -{ - return stub(EMLINK); -} - -off_t lseek(int fd, off_t ptr, int dir) -{ - if (isatty(fd)) - return 0; - - return stub(EBADF); -} - -ssize_t read(int fd, void* ptr, size_t len) -{ - int i; - uint8_t * current = (uint8_t*) ptr; - volatile uint8_t * uart_rx = (uint8_t*) (UART_BASE_ADDR + UART_RX_OFFSET); - volatile uint32_t * uart_rx_cnt = (uint32_t*) (UART_BASE_ADDR + UART_RX_COUNT_OFFSET); - - ssize_t result = 0; - - if (isatty(fd)) { - - for (current = (uint8_t*) ptr; - (current < ((uint8_t*) ptr) + len) && (*uart_rx_cnt > 0); - current ++){ - *current = *uart_rx; - result ++; - } - return result; - - } - - return stub(EBADF); -} - -int stat(const char* file, struct stat* st) -{ - return stub(EACCES); -} - -clock_t times(struct tms* buf) -{ - return stub(EACCES); -} - -int unlink(const char* name) -{ - return stub(ENOENT); -} - -int wait(int* status) -{ - return stub(ECHILD); -} - -ssize_t write(int fd, const void* ptr, size_t len) -{ - - const uint8_t * current = (const char*) ptr; - volatile uint32_t * uart_tx_count = (uint32_t*) (UART_BASE_ADDR + UART_TX_COUNT_OFFSET); - volatile uint8_t * uart_tx = (uint8_t*) (UART_BASE_ADDR + UART_TX_OFFSET); - - size_t jj; - if (isatty(fd)) { - - for (jj = 0; jj < len; jj++){ - - while ((*uart_tx_count) < 1){}; - *uart_tx = current[jj]; - - if (current[jj] == '\n'){ - while ((*uart_tx_count) < 1){}; - *uart_tx = '\r'; - } - } - return len; - } - return stub(EBADF); -} -- cgit v1.2.3