1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
diff --git a/apps/plugins/doom/z_zone.c b/apps/plugins/doom/z_zone.c
index 1d0ac5b..adf17a7 100644
--- a/apps/plugins/doom/z_zone.c
+++ b/apps/plugins/doom/z_zone.c
@@ -248,7 +248,7 @@ void Z_Init(void)

    zonebase_size=size;

-   printf("Z_Init: Allocated %dKb zone memory\n", (long unsigned)size >> 10);
+   printf("Z_Init: Allocated %uldKb zone memory\n", (long unsigned)(size >> 10));

    // Align on cache boundary

diff --git a/apps/plugins/mp3_encoder.c b/apps/plugins/mp3_encoder.c
index c0b0252..bdfb4d8 100644
--- a/apps/plugins/mp3_encoder.c
+++ b/apps/plugins/mp3_encoder.c
@@ -903,7 +903,7 @@ int read_samples(uint32_t *buffer, int num_samples)
   return samples;
 }

-inline uint32_t myswap32(uint32_t val)
+static inline uint32_t myswap32(uint32_t val)
 {
   const uint8_t* v = (const uint8_t*)&val;

diff --git a/apps/plugins/test_disk.c b/apps/plugins/test_disk.c
index afb25da..dd0758a 100644
--- a/apps/plugins/test_disk.c
+++ b/apps/plugins/test_disk.c
@@ -434,7 +434,7 @@ enum plugin_status plugin_start(const void* parameter)

     audiobuf = rb->plugin_get_audio_buffer(&audiobuflen);
     /* align start and length to 32 bit */
-    align = (-(int)audiobuf) & 3;
+    align = (-(intptr_t)audiobuf) & 3;
     audiobuf += align;
     audiobuflen = (audiobuflen - align) & ~3;

diff --git a/apps/plugins/test_mem.c b/apps/plugins/test_mem.c
index 0d9729f..2530982 100644
--- a/apps/plugins/test_mem.c
+++ b/apps/plugins/test_mem.c
@@ -188,7 +188,9 @@ enum plugin_status plugin_start(const void* parameter)
 {
     (void)parameter;
     bool done = false;
+#ifdef HAVE_ADJUSTABLE_CPU_FREQ
     bool boost = false;
+#endif
     int count = 0;

 #ifdef HAVE_LCD_BITMAP
@@ -204,7 +206,7 @@ enum plugin_status plugin_start(const void* parameter)
         line = 0;
         int ret;
         rb->screens[0]->clear_display();
-#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
+#ifdef HAVE_ADJUSTABLE_CPU_FREQ
         TEST_MEM_PRINTF("%s", boost?"boosted":"unboosted");
         TEST_MEM_PRINTF("clock: %d Hz", *rb->cpu_frequency);
 #endif
diff --git a/firmware/libc/sscanf.c b/firmware/libc/sscanf.c
index 5fbe81f..5bb08d8 100644
--- a/firmware/libc/sscanf.c
+++ b/firmware/libc/sscanf.c
@@ -1,22 +1,7 @@
 #include <stdarg.h>
 #include <string.h>
 #include <stdbool.h>
-
-static inline bool isspace(char c)
-{
-    return (c == ' ') || (c == '\t') || (c == '\n');
-}
-
-static inline bool isdigit(char c)
-{
-    return (c >= '0') && (c <= '9');
-}
-
-static inline bool isxdigit(char c)
-{
-    return ((c >= '0') && (c <= '9'))
-        || ((c >= 'a') && (c <= 'f')) || ((c >= 'A') && (c <= 'F'));
-}
+#include <ctype.h>

 static int parse_dec(int (*peek)(void *userp),
                      void (*pop)(void *userp),
diff --git a/firmware/target/hosted/sdl/thread-sdl.c b/firmware/target/hosted/sdl/thread-sdl.c
index 1a68391..83f1d19 100644
--- a/firmware/target/hosted/sdl/thread-sdl.c
+++ b/firmware/target/hosted/sdl/thread-sdl.c
@@ -632,8 +632,8 @@ void thread_exit(void)
     remove_thread(THREAD_ID_CURRENT);
     /* This should never and must never be reached - if it is, the
      * state is corrupted */
-    THREAD_PANICF("thread_exit->K:*R",
-                  thread_id_entry(THREAD_ID_CURRENT));
+    THREAD_PANICF("thread_exit->K:*R (ID: %d)",
+                  thread_id_entry(THREAD_ID_CURRENT)->id);
     while (1);
 }

diff --git a/tools/configure b/tools/configure
index ca0e97d..89f8d17 100755
--- a/tools/configure
+++ b/tools/configure
@@ -202,7 +202,8 @@ simcc () {

  app_type=$1
  winbuild=""
- GCCOPTS='-W -Wall -g -fno-builtin'
+ GCCOPTS=`echo $CCOPTS | sed -e s/-ffreestanding// -e s/-nostdlib// -e s/-Wundef// -e s/-O//`
+ GCCOPTS="$GCCOPTS -fno-builtin -g"
  GCCOPTIMIZE=''
  LDOPTS='-lm' # button-sdl.c uses sqrt()