summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPalmer Dabbelt <palmer@dabbelt.com>2017-06-12 09:18:05 -0700
committerPalmer Dabbelt <palmer@dabbelt.com>2017-06-14 08:53:39 -0700
commitd52256b60fe0c5b4990d742ec2655fddd9d77e19 (patch)
tree9d0750c9ef7f48079c1c1e8bce8858e8f383aa58
parent9b831bc77f8a7a0046899075aa0f0016478f5bf2 (diff)
Call puts instead of printf when printing constants
printf doesn't fit in the scratchpad, but since there's really no reason to call it on constant strings it can be replaced with puts. With this change, the "hello" example fits in the scratchpad.
-rw-r--r--bsp/env/coreplexip-e31-arty/init.c8
-rw-r--r--software/hello/hello.c2
2 files changed, 7 insertions, 3 deletions
diff --git a/bsp/env/coreplexip-e31-arty/init.c b/bsp/env/coreplexip-e31-arty/init.c
index 05b2b3e..84ae09e 100644
--- a/bsp/env/coreplexip-e31-arty/init.c
+++ b/bsp/env/coreplexip-e31-arty/init.c
@@ -6,12 +6,16 @@
#include "platform.h"
#include "encoding.h"
+#define CPU_FREQ 65000000
+#define XSTR(x) #x
+#define STR(x) XSTR(x)
+
extern int main(int argc, char** argv);
extern void trap_entry();
static unsigned long get_cpu_freq()
{
- return 65000000;
+ return CPU_FREQ;
}
unsigned long get_timer_freq()
@@ -83,7 +87,7 @@ void _init()
#ifndef NO_INIT
uart_init(115200);
- printf("core freq at %d Hz\n", get_cpu_freq());
+ puts("core freq at " STR(CPU_FREQ) " Hz\n");
write_csr(mtvec, &trap_entry);
#endif
diff --git a/software/hello/hello.c b/software/hello/hello.c
index 85c5d87..befc6ee 100644
--- a/software/hello/hello.c
+++ b/software/hello/hello.c
@@ -2,7 +2,7 @@
int main()
{
- printf("hello world!\n");
+ puts("hello world!\n");
return 0;
}