-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #200 from sifive/picolibc
Picolibc
- Loading branch information
Showing
8 changed files
with
164 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#include <errno.h> | ||
#include <stddef.h> | ||
|
||
char *_getcwd(char *buf, size_t size) { | ||
errno = -ENOSYS; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright © 2019 Keith Packard | ||
* | ||
* Permission to use, copy, modify, distribute, and sell this software and its | ||
* documentation for any purpose is hereby granted without fee, provided that | ||
* the above copyright notice appear in all copies and that both that copyright | ||
* notice and this permission notice appear in supporting documentation, and | ||
* that the name of the copyright holders not be used in advertising or | ||
* publicity pertaining to distribution of the software without specific, | ||
* written prior permission. The copyright holders make no representations | ||
* about the suitability of this software for any purpose. It is provided "as | ||
* is" without express or implied warranty. | ||
* | ||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, | ||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO | ||
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR | ||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, | ||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | ||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | ||
* OF THIS SOFTWARE. | ||
*/ | ||
|
||
#include <metal/tty.h> | ||
#include <stdio.h> | ||
|
||
static int metal_putc(char c, FILE *file) { | ||
(void)file; | ||
metal_tty_putc(c); | ||
return c; | ||
} | ||
|
||
static int metal_getc(FILE *file) { | ||
int c; | ||
(void)file; | ||
metal_tty_getc(&c); | ||
return c; | ||
} | ||
|
||
static int metal_flush(FILE *file) { return 0; } | ||
|
||
static FILE __stdio = | ||
FDEV_SETUP_STREAM(metal_putc, metal_getc, metal_flush, _FDEV_SETUP_RW); | ||
|
||
FILE *const __iob[3] = {&__stdio, &__stdio, &__stdio}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include <time.h> | ||
#include <unistd.h> | ||
|
||
/* Get configurable system variables. */ | ||
|
||
long sysconf(int name) { | ||
unsigned long long timebase; | ||
|
||
switch (name) { | ||
case _SC_CLK_TCK: | ||
metal_timer_get_timebase_frequency(0, &timebase); | ||
return (long)timebase; | ||
} | ||
|
||
return -1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <metal/timer.h> | ||
#include <sys/time.h> | ||
#include <sys/times.h> | ||
|
||
/* | ||
* Simple enough to return the tick count by | ||
* just getting it from the hardware. | ||
*/ | ||
|
||
clock_t times(struct tms *buf) { | ||
unsigned long long mcc; | ||
metal_timer_get_cyclecount(0, &mcc); | ||
buf->tms_stime = 0; | ||
buf->tms_cutime = 0; | ||
buf->tms_cstime = 0; | ||
return buf->tms_utime = mcc; | ||
} |