summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-05-03 13:24:21 +0100
committerDamien George <damien.p.george@gmail.com>2014-05-03 13:24:21 +0100
commit5874c1c92baac65834c4684e913ca0a7d8db8f50 (patch)
tree10e220915d654cf862ed73cefeed3366560857f6
parente88814a27492c41791bf2a10cd452340b54b66e5 (diff)
downloadmicropython-5874c1c92baac65834c4684e913ca0a7d8db8f50.tar.gz
micropython-5874c1c92baac65834c4684e913ca0a7d8db8f50.zip
stmhal: Remove #include <stdint.h> from mpconfigport.h.
Make include dependencies neater, and adheres to the coding convention that headers should not include headers.
-rw-r--r--stmhal/bufhelper.c2
-rw-r--r--stmhal/bufhelper.h2
-rw-r--r--stmhal/gccollect.c6
-rw-r--r--stmhal/input.c2
-rw-r--r--stmhal/modos.c1
-rw-r--r--stmhal/modpyb.c6
-rw-r--r--stmhal/mpconfigport.h10
-rw-r--r--stmhal/pyexec.c6
-rw-r--r--stmhal/timer.c2
9 files changed, 19 insertions, 18 deletions
diff --git a/stmhal/bufhelper.c b/stmhal/bufhelper.c
index 5612a048dc..c5dcd6c1d2 100644
--- a/stmhal/bufhelper.c
+++ b/stmhal/bufhelper.c
@@ -4,7 +4,7 @@
#include "obj.h"
#include "bufhelper.h"
-void pyb_buf_get_for_send(mp_obj_t o, mp_buffer_info_t *bufinfo, uint8_t *tmp_data) {
+void pyb_buf_get_for_send(mp_obj_t o, mp_buffer_info_t *bufinfo, byte *tmp_data) {
if (MP_OBJ_IS_INT(o)) {
tmp_data[0] = mp_obj_get_int(o);
bufinfo->buf = tmp_data;
diff --git a/stmhal/bufhelper.h b/stmhal/bufhelper.h
index 9b58e817c8..53ab7ab3e0 100644
--- a/stmhal/bufhelper.h
+++ b/stmhal/bufhelper.h
@@ -1,2 +1,2 @@
-void pyb_buf_get_for_send(mp_obj_t o, mp_buffer_info_t *bufinfo, uint8_t *tmp_data);
+void pyb_buf_get_for_send(mp_obj_t o, mp_buffer_info_t *bufinfo, byte *tmp_data);
mp_obj_t pyb_buf_get_for_recv(mp_obj_t o, mp_buffer_info_t *bufinfo);
diff --git a/stmhal/gccollect.c b/stmhal/gccollect.c
index d40460d70c..8be531416f 100644
--- a/stmhal/gccollect.c
+++ b/stmhal/gccollect.c
@@ -41,9 +41,9 @@ void gc_collect(void) {
gc_info_t info;
gc_info(&info);
printf("GC@%lu %lums\n", start, ticks);
- printf(" %lu total\n", info.total);
- printf(" %lu : %lu\n", info.used, info.free);
- printf(" 1=%lu 2=%lu m=%lu\n", info.num_1block, info.num_2block, info.max_block);
+ printf(" " UINT_FMT " total\n", info.total);
+ printf(" " UINT_FMT " : " UINT_FMT "\n", info.used, info.free);
+ printf(" 1=" UINT_FMT " 2=" UINT_FMT " m=" UINT_FMT "\n", info.num_1block, info.num_2block, info.max_block);
}
}
diff --git a/stmhal/input.c b/stmhal/input.c
index a45a36198c..6e98ea960c 100644
--- a/stmhal/input.c
+++ b/stmhal/input.c
@@ -1,3 +1,5 @@
+#include <stdint.h>
+
#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
diff --git a/stmhal/modos.c b/stmhal/modos.c
index 076a28782e..3594cbc3a6 100644
--- a/stmhal/modos.c
+++ b/stmhal/modos.c
@@ -1,3 +1,4 @@
+#include <stdint.h>
#include <string.h>
#include "mpconfig.h"
diff --git a/stmhal/modpyb.c b/stmhal/modpyb.c
index 2f53bb5234..6ffc92553a 100644
--- a/stmhal/modpyb.c
+++ b/stmhal/modpyb.c
@@ -82,9 +82,9 @@ STATIC mp_obj_t pyb_info(uint n_args, const mp_obj_t *args) {
gc_info_t info;
gc_info(&info);
printf("GC:\n");
- printf(" %lu total\n", info.total);
- printf(" %lu : %lu\n", info.used, info.free);
- printf(" 1=%lu 2=%lu m=%lu\n", info.num_1block, info.num_2block, info.max_block);
+ printf(" " UINT_FMT " total\n", info.total);
+ printf(" " UINT_FMT " : " UINT_FMT "\n", info.used, info.free);
+ printf(" 1=" UINT_FMT " 2=" UINT_FMT " m=" UINT_FMT "\n", info.num_1block, info.num_2block, info.max_block);
}
// free space on flash
diff --git a/stmhal/mpconfigport.h b/stmhal/mpconfigport.h
index 24ab20b16b..ad55ed6324 100644
--- a/stmhal/mpconfigport.h
+++ b/stmhal/mpconfigport.h
@@ -1,5 +1,3 @@
-#include <stdint.h>
-
// options to control how Micro Python is built
#define MICROPY_EMIT_THUMB (1)
@@ -51,11 +49,11 @@ extern const struct _mp_obj_module_t time_module;
#define BYTES_PER_WORD (4)
-#define UINT_FMT "%lu"
-#define INT_FMT "%ld"
+#define UINT_FMT "%u"
+#define INT_FMT "%d"
-typedef int32_t machine_int_t; // must be pointer size
-typedef uint32_t machine_uint_t; // must be pointer size
+typedef int machine_int_t; // must be pointer size
+typedef unsigned int machine_uint_t; // must be pointer size
typedef void *machine_ptr_t; // must be of pointer size
typedef const void *machine_const_ptr_t; // must be of pointer size
diff --git a/stmhal/pyexec.c b/stmhal/pyexec.c
index 6a8929cb4e..294020cec5 100644
--- a/stmhal/pyexec.c
+++ b/stmhal/pyexec.c
@@ -84,9 +84,9 @@ bool parse_compile_execute(mp_lexer_t *lex, mp_parse_input_kind_t input_kind, bo
gc_info_t info;
gc_info(&info);
printf("GC:\n");
- printf(" %lu total\n", info.total);
- printf(" %lu : %lu\n", info.used, info.free);
- printf(" 1=%lu 2=%lu m=%lu\n", info.num_1block, info.num_2block, info.max_block);
+ printf(" " UINT_FMT " total\n", info.total);
+ printf(" " UINT_FMT " : " UINT_FMT "\n", info.used, info.free);
+ printf(" 1=" UINT_FMT " 2=" UINT_FMT " m=" UINT_FMT "\n", info.num_1block, info.num_2block, info.max_block);
}
}
diff --git a/stmhal/timer.c b/stmhal/timer.c
index e1d55e14a0..e92a9988f7 100644
--- a/stmhal/timer.c
+++ b/stmhal/timer.c
@@ -467,7 +467,7 @@ void timer_irq_handler(uint tim_id) {
// Uncaught exception; disable the callback so it doesn't run again.
tim->callback = mp_const_none;
__HAL_TIM_DISABLE_IT(&tim->tim, TIM_IT_UPDATE);
- printf("Uncaught exception in Timer(%lu) interrupt handler\n", tim->tim_id);
+ printf("Uncaught exception in Timer(" UINT_FMT ") interrupt handler\n", tim->tim_id);
mp_obj_print_exception((mp_obj_t)nlr.ret_val);
}
gc_unlock();